Android
Lollipop
Introduction
Android 5.0 Lollipop, This release provides users with a wealth of new features and adds thousands of APIs to developers, further extending the range of Android applications, from mobile phones, tablets and wearable devices, Extended to TVs and cars.
1. Android
5.0 new features and properties
Material Design
:
Introduction: Some of the important features of the Material design language include the upgraded version of the system font Roboto, with more vivid colors and more animated effects. Dolat also briefly talked about some of the changes in the new framework-a new framework that was released today in Google.com/design. Google's idea is to allow developers on Google's platform to master the new framework, so that all applications have a unified look, like Apple's design principles for developers. Google has also redesigned the company's flagship application based on this new design language, including Gmail and calendar on Android and the Web. You may also remember that you've seen articles about these changes, and some blogs have mastered the leaked screenshots, showing that the redesigned Gmail has a cleaner, more minimalist interface. On the Android platform, this new interface is called material, supports a variety of new animation effects, has built-in real-time UI shading, and hero elements that can be toggled between different screens.
Android 5.0 introduces Material design to Androidand provides you with an expanded UI toolkit that makes it easier for you to integrate new design patterns into your application.
the new three-dimensional view allows you to set Z-Dimension to raise the view element to deviate from the view level and to cast real-time shadows , even for dynamic elements.
built -in The Activity transformation allows the user to seamlessly complete the state transitions in pleasing animations. the Material Design theme adds transformations to your activity, providing the ability to use shared visual elements in all activity .
Provides ripple animations for buttons, check boxes, and other touch controls in your app.
you can also The XML defines a vector that can be drawn and animates it in a variety of ways. Drawing vectors can be scaled without loss of clarity, making them ideal for monochrome in-app icons.
added a new name for the Render Thread management process threads, even in the primary If the UI thread is delayed, you can still keep the animation flowing.
document-centric applications
:
Android 5.0 introduces a redesigned "overview" Space (formerly known as "Recently used apps"), and versatility and multitasking are more practical.
the new The API allows you to display different Activity in your app as a single document, along with other recently used app screens.
You can take advantage of concurrent documents to give users instant access to more of your content or services. For example, you can use concurrent documents to represent a file in a productivity application, to represent a player in a game, or to represent a chat in a messaging app.
Figure 1: document-centric, recently-used apps
High-performance graphics
:
support for Khronos OpenGL ES 3.1 now offers the highest performance 2D and 3D graphics capabilities on supported devices for gaming and other applications.
OpenGL ES 3.1 Adds compute shaders, stencil textures, accelerated visuals, high quality ETC2/EAC texture compression, advanced texture rendering, standardized texture size and render-buffer format, and other features.
Android 5.0 also introduces the Android expansion pack (AEP), a set of OpenGL ES extensions that give you access to mosaic shaders, geometry shaders, ASTC texture compression, features such as interpolation and shading, and other advanced rendering features. With AEP, you can achieve high-performance graphics on a variety of GPUs.
OpenGL ES Introduction : OpenGL ES (OpenGL for Embedded Systems) is a subset of the OpenGL three-dimensional graphics API, designed for embedded devices such as mobile phones, PDAs, and game consoles . The API is defined by Khronos Group, Khronos is a graphic hardware and software industry Association, which focuses on the open standards of graphics and multimedia.
OpenGL ES is a custom-cut from OpenGL, removing many of the glbegin/glend, such as complex primitives such as Gl_quads, polygons (gl_polygons), and so on. After years of development, there are now two versions, OpenGL ES 1.x for fixed pipeline hardware, OpenGL ES 2.x for programmable pipeline hardware. OpenGL ES 1.0 is based on the OpenGL 1.3 specification, OpenGL ES 1.1 is based on the OpenGL 1.5 specification, and they support common and common Lite respectively two Type profile. Lite profile supports only fixed-point real numbers, while common profile supports both fixed-point and floating-point numbers. OpenGL ES 2.0 is defined by reference to the OpenGL 2.0 specification, and common profile is released in 2005-8, which introduces support for programmable pipelines .
screen capture and sharing
:
Android 5.0 allows you to add screen capture and screen sharing to your app.
If you prefer, you can collect non-secure video from the display and provide the captured video over the network, if you wish.
New sensor Type
:
in Android 5.0, the new Tilt detector sensor helps improve Activity recognition on supported devices, and the heart rate sensor can report the heart rate of the person touching the device.
the new interactive composite sensor now detects special interactions such as wake gestures, pick up gestures, and peek gestures.
Chromium WebView
:
The initial version of Android 5.0 provides a version of the Chromium M37 version of Chromium for WebView, adding support for WebRTC, Webaudio, and WebGL.
Chromium M37 also provides native support for all of the following WEB component specifications: Custom elements, Shadow DOM, HTML import, and templates. This means that you can use polymer and its Material Design elements in WebView without Polyfill .
despite WebView has been based on Chromium since Android 4.4, but the Chromium layer can now be updated from Google Play
2.
Android
5.0 Behavioral changes (API level: +)
In addition to providing many new features and functionality, Android 5.0 also makes a variety of changes to system and API behavior. This section highlights some of the major changes that you should be aware of and consider when developing your application.
Android Runtime (ART)
:
Art and Dalvik : Android Runtime (ART) is a managed runtime used by apps on Android and part of system services. ART and its predecessor, Dalvik, were originally built for Android projects. As the runtime, ART executes the Dalvik executable file and follows the Dex bytecode specification.
Art and Dalvik are compatible runtimes running Dex bytecode, so apps developed for Dalvik can also work in the ART environment. However, some of the techniques used by Dalvik do not apply to ART.
some of the major new features of Android 5.0 include:1. Pre - (AOT) Compilation 2. Improved garbage collection (GC) 3. Improved debugging support .
most Android apps can work under ART without any changes. However, some techniques suitable for Dalvik are not applicable to ART. Special attention should be paid to the following situations:
- your app uses The Java Native Interface (JNI) runs C + + code.
- You use development tools that generate non-standard code (for example, some code obfuscation tools).
- You use a technology that is incompatible with compressed garbage collection.
Notice
:
(Notification Design Guide:https://material.io/guidelines/patterns/notifications.html)
Material Design Style :
use dark Text to draw notifications on a white (or very light) background to match the new Material Design widget matches. Make sure that all of your notifications are aligned with the new color scheme. If your notifications appear to be uncoordinated, please fix them:
1. use setcolor () to set the accent color in the circle behind your icon image.
2 . Update or remove resources that use color. The system ignores all non-alpha channels in the action icon and the main notification icon. You should assume that these icons only support alpha channels. The system draws the notification icon in white and draws the action icon in dark gray.
Sound and Vibration :
If you are currently using Ringtone,MediaPlayer, or vibrator classes add sound and vibration to the notification, remove the code so that the system can display the notification correctly in priority mode. Instead, use the Notification.builder method to add sound and vibration.
set the device to The ringer_mode_silent allows the device to enter a new priority mode. If you set the device to Ringer_mode_normal or ringer_mode_vibrate, the device exits the priority mode.
Previously, Android uses Stream_music as a mainstream transmission to control the volume on your tablet device. In Android 5.0, the master volume streaming of mobile phones and tablet devices is now merged and controlled by Stream_ring or stream_notification.
Lock Screen Visibility :
by default, the In Android 5.0, notifications are now displayed on the user's lock screen. Users can choose to protect sensitive information from being exposed, in which case the text displayed by the notification is automatically truncated. To customize the notification of this limitation, use Setpublicversion ().
If the notification does not contain personal information, or if you want to allow the media playback control to appear on the notification, call the Setvisibility () method and set the visibility level of the notification to Visibility_public.
Media playback :
if you want to implement notifications that display media playback status or transport controls, consider using the new Notification.mediastyle the template instead of customizing the Remoteviews.remoteview object. Regardless of which method you choose to use, be sure to set the visibility of the notification to visibility_public so that your control can be accessed through the lock screen. Note that starting with Android 5.0, the system no longer displays the Remotecontrolclient object on the lock screen.
Floating Notifications :
now, when the device is active (that is, the device is unlocked and its screen is turned on), the notification can be displayed in a small floating window (also known as a "floating notification"). These notifications look similar to the Lite version of the notification, but the floating notifications also show the action buttons. Users can process or clear floating notifications without leaving the current app.
Examples of conditions that may trigger floating notifications include:
1, the user's Activity is in full-screen mode (app uses fullscreenintent)
2 . Notifications have a higher priority and use ringtones or vibrations
If your app implements notifications in any of these scenarios, make sure the system displays floating notifications correctly
Media controls and Remotecontrolclient
:
The Remotecontrolclient class is now deprecated. Please switch to the new mediasession API as soon as possible .
The lock screen in Android 5.0 does not display transport controls for mediasession or remotecontrolclient . However, your app can provide a media playback control from the lock screen via a notification. This allows your app to have more control over the display of media buttons, while providing a consistent experience for users who use locked devices and unlocked devices.
to achieve this , Android 5.0 introduces a new Notification.mediastyle template. Notification.mediastyle converts the notification action you added with Notification.Builder.addAction () to a thin button, embedded in the app's media playback notification. Pass your session token to the Setsession () method to tell the system that the notification controls the media session in progress.
Make sure that you set the visibility of the notification to Visibility_public tomark notifications as safe for display on any lock screen (in a safe way or otherwise)
getrecenttasks ()
:
With the introduction of the new concurrent documents and Activity tasks feature in Android 5.0, the Activitymanager.getrecenttasks () method is now deprecated to improve the security of user privacy . For backward compatibility, this method still returns a small portion of its data, including invoking the application's own tasks and possibly some other non-sensitive tasks such as the home page. If your app uses this method to retrieve its own tasks, use getapptasks () instead to retrieve the information.
64-bit support in the Android NDK
:
Android 5.0 introduces support for 64-bit systems. 64-bit enhancements increase address space and improve performance while still fully supporting existing 32-bit applications. 64-bit support can also improve the performance of OpenSSL for encryption. In addition, this release introduces the new native media NDK API, as well as native OpenGL ES (GLES) 3.1 support.
binding to a service
:
The Context.bindservice () method now requires an explicit Intent, which throws an exceptionif an implicit Intent is provided. To ensure the security of your app, use an explicit intent to start or bind the service, and do not declare Intent filters for the services .
WebView
:
Android 5.0 changed the default behavior of the app.
1 . If your app is oriented to API level 21 or higher:
by default, the system will block Mixed Content and third Square Cookies. To allow mixed content and third-party cookies, use the Setmixedcontentmode () and setacceptthirdpartycookies () methods, respectively.
the system can now intelligently select what to draw The HTML document section. This new default behavior helps to reduce memory consumption and improve performance. If you want to render the entire document at once, you can deactivate the optimization by calling Enableslowwholedocumentdraw () .
2. If your app is targeted at an API level below 21: The system allows mixed content and third-party cookies, and always renders the entire document at once.
Custom Permission Uniqueness Requirements
:
according to Permissions as described in the overview, Android apps can define custom permissions to manage component access in a proprietary way without using platform-predefined system permissions. The app defines the custom permissions in the <permission> element declared in its manifest file .
In rare cases, defining custom permissions is a compliant and secure approach. However, creating custom permissions is sometimes not necessary, and may even pose a potential risk to your app, depending on the level of protection assigned to the permission.
Android 5.0 One of the behavioral changes ensures that only one app can define a given custom permission, unless it is signed with the same key as other apps that define permissions.
things to keep in mind for your application :
in Android 5.0 and later versions, apps can continue to define their own custom permissions as before, and request custom permissions from other apps through the <uses-permission> mechanism. However, for the new requirements introduced in Android 5.0, you should carefully evaluate the impact that may be on your application.
Here are a few things to consider:
Does your app declare any <permission> elements in its manifest file ? If so, are these permissions really necessary for your app or service to work? Or, can you replace them with system default permissions?
If you have <permission> elements in your app , do you know where they come from?
are you actually going to let other apps request your custom permissions through <uses-permission>?
Do you use boilerplate files or sample code in apps where you include <permission> elements? Are those permission elements really necessary?
Does your custom permission use a simple name or a generic term that may be shared by other apps?
New Installation and updates :
as described above, in running New installations and updates to your app on Android 4.4 or earlier devices will not be affected, and no change in behavior. When new installations and updates are made on a device running Android 5.0 or later, if the app defines a custom permission that has been defined by an existing resident app, your app will be blocked from being installed.
Use Existing installation of Android 5.0 System update
If your app uses custom updates and has been widely distributed and installed, when a user receives a device upgrade to When you update Android 5.0, your app may be affected. After the system update is installed, the system re-verifies the installed apps, including checking their custom permissions. If your app defines a custom permission that has been defined by another verified app, and your app does not sign with the same key as the app, your app will not be reinstalled.
Recommended : in the Run On Android 5.0 or later devices, we recommend that you check your app immediately, make any adjustments you need, and post an updated version to your users as soon as possible.
If you use custom permissions in your app, consider their origins and whether you really need them. Remove all <permission> elements from your app unless you determine that they are necessary for the app to function properly.
Consider overriding your custom permissions with system default permissions whenever possible.
-
- If your app requires custom permissions, rename your custom permissions to make them unique to your app, such as appending them to the app's full package name.
- If you have a set of signing with different keys apps, and these apps access shared components through custom permissions, make sure that this custom permission is defined only once in the shared component. Apps that use shared components should not define custom permissions themselves, but should request access through the <uses-permission> mechanism.
- If you have a set of with the same key signature app, each app can define the same custom permissions as needed, and the system allows these apps to be installed in a regular manner.
tls/ssl Default configuration changes
:
Android 5.0 introduces changes to the default Tls/ssl configuration used by the app for HTTPS and other TLS/SSL traffic:
The 1.tlsv1.2 and TLSv1.1 protocols are now enabled,
2.AES-GCM (Aead) encryption suite is now enabled,
3.MD5, 3DES, export, and static key ECDH Encryption Suite is now deactivated,
4. preferred to use Forward Secrecy Encryption Kit (ECDHE and DHE).
in the few cases listed below, these changes may cause The HTTPS or TLS/SSL connection is disconnected. Please note that the security Providerinstaller from the Google Play service has been available on the Android platform version since Android 2.3.
1. the server does not support any encryption suites that are enabled
2. apply an error hypothesis to the cryptographic suite used to connect to the server
3. The server does not support TLSv1.1, TLSv1.2, or new TLS extensions
support for managed configuration files
:
A device administrator can add a managed profile to a device. This profile is owned by the administrator and allows the administrator to control the managed profile while allowing users to control their own personal profiles and their storage space. This change affects the behavior of your existing app in the following ways.
3.
Android
5.1 Behavioral changes (API level: $)
Android 5.1 (LOLLIPOP_MR1) is an update to the LOLLIPOP version, providing a number of new features for users and app developers. This section is intended to introduce the most interesting new APIs.
multiple SIM card support
:
Android 5.1 adds support for simultaneous use of multiple cellular operator SIM cards. With this feature, users can activate and use additional Sims on devices that have two or more SIM slots.
You can use The SubscriptionManager class gets information about the currently activated SIM, including whether the device is considered to roam on the current network. This information is useful for developers who want to reduce or turn off application data access for device users who are sensitive to data access charges. You can request Read_phone_state permissions and set the SubscriptionManager object Subscriptionmanager.onsubscriptionschangedlistener, remind your application to note the status change of the device's current network connection.
deprecated HTTP classes
:
Org.apache.http classes and android.net.http have been deprecated in Android 5.1. Androidhttpclient class. These classes will no longer be retained and you should migrate any application code using these APIs to the URLConnection class as soon as possible .
Carrier Services
:
Android 5.1 supports communication service providers to create apps that can perform carrier configuration tasks on Android devices. Using these APIs, carrier-developed applications can perform these tasks securely and flexibly and publish via Google Play. Apps that use these features must obtain a certificate signature that matches the certificate in the device's universal Integrated circuit card (UICC).
Carrier Services The API has been added to the Telephonymanager class,the Smsmanager class, and the new Carriermessagingservice class. The app can check whether these APIs can be accessed by calling the Hascarrierprivileges () method. Apps that can call but can't access these APIs will receive SecurityException.
Android 5.0 Lollipop Introduction