Android 6.0 Changes

Source: Internet
Author: User
Tags openssl library

In addition to providing many new features and functionality, Android 6.0 (API level 23) has made various changes to system and API behavior. This article highlights some of the major changes you should be aware of and consider when developing your application.

If you've previously published an Android app, be aware that your app may be affected by these platform changes.

Run-time permissions

This release introduces a new permission pattern that now allows users to manage app permissions directly at run time. This mode allows users to better understand and control permissions, while streamlining the installation and automatic update process for application developers. Users can grant or revoke permissions individually for each app that they install.

For apps that target platforms with Android 6.0 (API level 23) or later, be sure to check and request permissions at run time. To determine whether your app has been granted permission, call the new checkSelfPermission() method. To request permission, call the new requestPermissions() method. Even if your app doesn't target Android 6.0 (API level 23), you should test your app in new permission mode.

For more information on supporting new permission modes in your app, see Using System permissions. For tips on how to assess the impact of new patterns on your app, see Permissions best practices.

Low power consumption mode and application Standby mode

This release introduces the latest energy-saving optimization techniques for idle devices and applications. These features affect all apps, so be sure to test your app in these new modes.

    • Low power consumption mode : If the user unplug the device and leave it inactive for a period of time after the screen is turned off, the device enters a low-consumption mode in which the device attempts to keep the system in hibernation. In this mode, the device resumes its normal operation for a short period of time for application synchronization and allows the system to perform any pending operations.
    • Apply Standby mode : Apply Standby mode allows the system to determine that the app is idle when the user is not actively using it. This decision is made when the user has not touched the app for some time. If you unplug the device, the system disables network access and pauses synchronization and jobs for apps that it considers to be idle.

To learn more about these energy-saving changes, see targeted optimizations for low power consumption mode and application Standby mode.

Cancel support for Apache HTTP client

Android version 6.0 removes support for Apache HTTP clients. If your app uses the client and is targeting the platform with Android 2.3 (API Level 9) or later, use HttpURLConnection classes instead. This API is more efficient because it reduces network usage through transparent compression and response caching, and minimizes power consumption. To continue using the Apache HTTP API, you must first build.gradle declare the following compile-time dependencies in the file:

{
' Org.apache.http.legacy '
}
Boringssl

Android is moving from using the OpenSSL library to using the BORINGSSL library. If you want to use the Android NDK in your app, do not link to an encryption library that is not part of the NDK API, such as libcrypto.so and libssl.so . These libraries are not public APIs and may change or fail with no symptoms on different versions and devices. In addition, you may expose yourself to the risk of a security breach. Instead, modify the native code to invoke the Java encryption API via JNI, or statically link to the encryption library of your choice.

Hardware identifier access rights

To provide more stringent data protection for users, Android removes programmatic access to the device's local hardware identifiers for applications that use the WLAN API and Bluetooth APIs, starting from this release. WifiInfo.getMacAddress()methods and BluetoothAdapter.getAddress() methods now return constant values 02:00:00:00:00:00 .

Now, to access the hardware identifiers of nearby external devices via Bluetooth and WLAN scanning, your app must have ACCESS_FINE_LOCATION or have ACCESS_COARSE_LOCATION permissions.

    • WifiManager.getScanResults()
    • BluetoothDevice.ACTION_FOUND
    • BluetoothLeScanner.startScan()

Note : When a device running Android 6.0 (API level 23) initiates a background WLAN or Bluetooth scan, it appears to the external device that the originating source of the operation is a randomized MAC address.

Notice

This version removes the Notification.setLatestEventInfo() method. Use Notification.Builder classes instead to build notifications. To repeat the update notification, use the Notification.Builder instance again. Call build() the method to get the updated Notification instance.

adb shell dumpsys notificationThe command no longer prints out your notification text. Use adb shell dumpsys notification --noredact the command to print out the text in the notification object instead.

Audio Manager changes

AudioManagersetting the volume directly through the class or muting a specific audio stream is no longer supported. setStreamSolo()method is deprecated, you should call the requestAudioFocus() method instead. Similarly, the setStreamMute() method is deprecated, instead calling the adjustStreamVolume() method and passing in the direction value ADJUST_MUTE or ADJUST_UNMUTE .

Text selection

Now, when users select text in your app, you can display text selection actions such as cut,copy , and paste in a floating toolbar. It is similar to the context Action bar described in enabling context operation mode for a single view on user interaction implementations.

To implement a floating toolbar that you can use for text selection, make the following changes in your existing app:

    1. In the View object or Activity object, ActionMode change the call from to startActionMode(Callback) startActionMode(Callback, ActionMode.TYPE_FLOATING) .
    2. Use ActionMode.Callback the existing implementation extension instead ActionMode.Callback2 .
    3. An alternative onGetContentRect() method that provides the coordinates of a Rect content object, such as a text selection rectangle, in a view.
    4. If the rectangle's positioning is no longer valid, and this is the only element that needs to be declared as invalid, call the invalidateContentRect() method.

Note that if you use the Android Support Library 22.2 Revision, the floating toolbar is not backwards compatible, and by default AppCompat will gain control over the ActionMode object. This disables the display of the floating toolbar. To ActionMode enable support in AppCompatActivity , call getDelegate() , and then call on the returned setHandleNativeActionModesEnabled() object AppCompatDelegate , and set the input parameter to false . This call will ActionMode return control of the object to the framework. On devices running Android 6.0 (API level 23), the framework can support mode ActionBar or floating toolbar mode, while on devices running Android 5.1 (API level 22) or previous versions, the framework supports only ActionBar mode.

Browser Bookmark Changes

This release removes support for global bookmarks. android.provider.Browser.getAllBookmarks()and android.provider.Browser.saveBookmark() methods have now been removed. Similarly, READ_HISTORY_BOOKMARKS permissions and WRITE_HISTORY_BOOKMARKS permissions have been removed. If your app is targeted at Android 6.0 (API level 23) or later, do not access bookmarks or use bookmark permissions from the global provider. Your app should store the bookmark data internally instead.

Android KeyStore Changes

Starting with this release, the Android keystore provider no longer supports DSA. But it still supports ECDSA.

When you deactivate or reset the security lock screen (for example, when the user or device administrator performs such actions), the key that requires idle encryption is no longer deleted, but the key that requires idle encryption is removed during the above event.

WLAN and network connectivity changes

This release introduces the following behavioral changes to the WLAN API and Networking APIs.

    • Your app can now only change the state of the WifiConfiguration objects that you created. The system does not allow you to modify or delete objects created by users or other apps WifiConfiguration .
    • In previous releases, if an app was using disableAllOthers=true a mandatory device with settings to enableNetwork() Connect to a specific WLAN network, the device would disconnect from other networks, such as the mobile data network. In this release, the device no longer disconnects from the other networks described above. If your app targetSdkVersion is or is “20” lower, the selected Wi-Fi network is docked. If your app targetSdkVersion is or is higher “21” , use a multi-network API (such as openConnection() , bindSocket() and new bindProcessToNetwork() methods) to ensure that network traffic is delivered over the selected network.
Camera Service Changes

In this release, the access mode for shared resources in the camera service has changed from a previous "first come first served" access mode to a high-priority process-first access mode. Changes to the service behavior include:

    • Grant access to the camera subsystem resource based on the priority of the client application process, including opening and configuring the camera device. Application processes with activity or foreground activity that are visible to the user are generally given higher priority, which makes the acquisition and use of the camera resources more reliable;
    • When high-priority applications try to use the camera, the system may "evict" the low-priority app that is using the camera client. In deprecated Camera APIs, this causes the system to be called by the evicted client onError() . In the Camera2 API, this causes the system to be invoked for the evicted client onDisconnected() ;
    • On devices equipped with the appropriate camera hardware, different application processes can simultaneously open and use different camera devices independently. But now, if the camera is accessed concurrently in a multi-process use case, the performance or ability of any open camera device is severely degraded, and the camera service detects this condition and prohibits simultaneous access. Even if no other app attempts to access the same camera device directly, this change can also cause the low-priority client to be "evicted."
    • Changing the current user causes an in-app active camera client that was owned by the previous user account to be evicted. Access to the camera is limited to accessing user profiles owned by the current device user. This means, for example, that when a user switches to another account, the Guest account does not actually keep the process running using the camera subsystem.
Run-time

The ART runtime environment now correctly implements newInstance() access rules for methods. This change fixes an issue in which Dalvik did not properly check access rules in previous versions. If your app uses newInstance() methods, and you want to override the access check, call the setAccessible() method (set the input parameter to true ). If your app uses the V7 AppCompat library or the V7 Recyclerview library, you must update the app to use the latest version of these libraries. Otherwise, be sure to update any custom classes referenced from XML so that they have access to their class constructors.

This version updates the behavior of the dynamic-link program. The dynamic linker now recognizes the difference between the library and soname its path (exposing error 6670) and is now implemented by soname search. An application that previously contained an erroneous DT_NEEDED entry (usually an absolute path on the development computer's file system) still works, and may now fail to load.

The tag is now implemented correctly dlopen(3) RTLD_LOCAL . Note that RTLD_LOCAL this is the default value, so calls that are not explicitly used RTLD_LOCAL will be dlopen(3) affected (unless your app explicitly uses it RTLD_GLOBAL ). RTLD_LOCALwhen used, dlopen(3) these symbols cannot be used in libraries that are subsequently loaded by a call (which differs from DT_NEEDED the case referenced by the entry).

On previous versions of Android, if your app requested the system to load a shared library containing text relocation information, a warning would be displayed, but the shared library would still be allowed to load. Starting with this version, if your app has a target SDK version of 23 or higher, the system will refuse to load the library. To help you detect if the library failed to load, your app should record the dlopen(3) failure log and include the dlerror(3) problem description text returned by the call in the log. To learn more about handling text relocation, see this guide.

APK Authentication

The platform now performs a more rigorous APK validation. If the file declared in the manifest does not exist in the APK, the APK will be considered corrupted. You must re-sign the APK after removing any content.

USB Connection

By default, device connections via USB ports are now set to charge-only mode. To access the device and its contents over a USB connection, the user must explicitly grant permissions for such interaction. If your app enables users to interact with the device over a USB port, you must explicitly enable the interaction to take into account.

Android for work change

This release contains the following behavior changes for Android for work:

  • work contacts in the personal context. Google Dialer Call history now displays the work contact when the user views the call history. will be setCrossProfileCallerIdDisabled() set to true hide the managed profile contact in the Google dialer call history. The setBluetoothContactSharingDisabled() false work contact can be displayed to the device with a personal contact by Bluetooth only when you set it to. By default, it is set to true .
  • WLAN Configuration Removal : When a managed profile is deleted, the WLAN configuration added by the profile owner (for example, addNetwork() the configuration added by calling the method) is removed.
  • WLAN Configuration Lock : If WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN nonzero, the user can no longer modify or delete any WLAN configuration created by the active device owner. Users can still create and modify their own WLAN configuration. The active device owner has permission to edit or delete any WLAN configuration, including configurations that are not created by it.
  • To download a device spec controller by adding a Google account: Adding a Google account that needs to be managed by a Device specification controller (DPC) app to a device other than the managed environment will now prompt the user to install the appropriate WPC. This behavior also occurs when you add an account through Settings > Accounts in the Device Initial Setup wizard.
  • to specific DevicePolicyManager Changes to API behavior:
    • Calling a setCameraDisabled() method only affects the camera of the user calling the method, and calling it from a managed profile does not affect the camera app that the primary user is running.
    • In addition, the method is now available to setKeyguardDisabledFeatures() the profile owner, in addition to being available to the device owner.
    • The configuration file owner can set the following keyboard lock limits:
      • KEYGUARD_DISABLE_TRUST_AGENTSand KEYGUARD_DISABLE_FINGERPRINT , they affect the keyboard lock settings of the profile ancestor user.
      • KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS, it affects only the notifications that are generated by the app in the managed configuration file.
    • DevicePolicyManager.createAndInitializeUser()Methods and DevicePolicyManager.createUser() methods have been deprecated.
    • When a given user's app is running in the foreground, the setScreenCaptureDisabled() method now also masks the secondary structure.
    • EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUMNow defaults to SHA-256. For backward compatibility reasons, SHA-1 is still supported, but it will be canceled in the future. EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUMnow only accept SHA-256.
    • The Device initializer API that once existed in Android 6.0 (API level 23) is now removed
    • EXTRA_PROVISIONING_RESET_PROTECTION_PARAMETERSdeleted, so NFC placeholder configuration cannot be programmed to unlock a device protected by a factory reset
    • You can now use EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE extra to apply delivery data to the device owner during the NFC configuration of the managed device.
    • The Android for working API is optimized for M runtime permissions, including work profiles, secondary layers, and other content. The new DevicePolicyManager permissions API does not affect apps prior to M versions.
    • The system now returns a result code when the user exits the ACTION_PROVISION_MANAGED_PROFILE ACTION_PROVISION_MANAGED_DEVICE synchronization portion of the setup process initiated through or intent RESULT_CANCELED .
  • changes to other APIs :
    • Traffic consumption: android.app.usage.NetworkUsageStats The class has been renamed to NetworkStats .
  • changes to the global settings :
    • These settings are no longer setGlobalSettings() set by:
      • BLUETOOTH_ON
      • DEVELOPMENT_SETTINGS_ENABLED
      • MODE_RINGER
      • NETWORK_PREFERENCE
      • WIFI_ON
    • These global settings can now be setGlobalSettings() set by:
      • WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN

Android 6.0 Changes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.