Android M新特性之Behavior Changes

1、Runtime Permissions

  On your apps that target the M Preview release or higher, make sure to check for and request permissions at runtime. To determine if your app has been granted a permission, call the new Context.checkSelfPermission() method. To request a permission, call the new Activity.requestPermission() method. Even if your app is not targeting the M Preview release, you should test your app under the new permissions model.

2、Power-Saving Optimizations

  If a device is unplugged and left stationary with the screen off for a period of time, it goes into Doze mode where it attempts to keep the system in a sleep state.

  The following restrictions apply to your apps while in Doze:

  • Network access is disabled, unless your app receives a high priority Google Cloud Messaging tickle.
  • Wake locks are ignored.
  • Alarms scheduled with the AlarmManager class are disabled, except for alarms that you‘ve set with thesetAlarmClock() method and AlarmManager.setAndAllowWhileIdle().
  • WiFi scans are not performed.
  • Syncs and jobs for your sync adapters and JobScheduler are not permitted to run.

3、App standby

  With this preview, the system may determine that apps are idle when they are not in active use.

4、Adoptable Storage Devices

  With this preview, users can adopt external storage devices such as SD cards. Adopting an external storage device encrypts and formats the device to behave like internal storage. This feature allows users to move both apps and private data of those apps between storage devices. When moving apps, the system respects theandroid:installLocation preference in the manifest.

5、Apache HTTP Client Removal

  This preview removes support for the Apache HTTP client. If your app is using this client and targets Android 2.3 (API level 9) or higher, use the HttpURLConnection class instead. This API is more efficient because it reduces network use through transparent compression and response caching, and minimizes power consumption. To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in yourbuild.gradle file:

android {    useLibrary ‘org.apache.http.legacy‘}

6、AudioManager Changes



  Setting the volume directly or muting specific streams via the AudioManager class is no longer supported. ThesetStreamSolo() method is deprecated, and you should call the AudioManager.requestAudioFocus() method instead. Similarly, the setStreamMute() method is deprecated; instead, call theAudioManager.adjustStreamVolume() method and pass in the direction value ADJUST_MUTE orADJUST_UNMUTE.

7、Text Selection

  When users select text in your app, you can now display text selection actions such as CutCopy, and Paste in a floating toolbar

8、Android Keystore Changes

  With this preview, the Android Keystore provider no longer supports DSA. ECDSA is still supported.

9、Wi-Fi and Networking Changes

  This preview introduces the following behavior changes to the Wi-Fi and networking APIs.

  • Your apps can now change the state of WifiConfiguration objects only if you created these objects. You are not permitted to modify or delete WifiConfiguration objects created by the user or by other apps.
  • Previously, if an app forced the device to connect to a specific Wi-Fi network by using enableNetwork() with the disableAllOthers=true setting, the device disconnected from other networks such as cellular data. In this preview, the device no longer disconnects from such other networks. If your app’s targetSdkVersion is “20”or lower, it is pinned to the selected Wi-Fi network. If your app’s targetSdkVersion is “21” or higher, use the multinetwork APIs (such as openConnection()bindSocket(), and the newConnectivityManager.bindProcessToNetwork() method) to ensure that its network traffic is sent on the selected network.

10、Camera Service Changes

  In this preview, the model for accessing shared resources in the camera service has been changed from the previous “first come, first serve” access model to an access model where high-priority processes are favored.

11、Runtime

  The ART runtime now properly implements access rules for the newInstance() method. This change fixes a problem where Dalvik was checking access rules incorrectly in previous versions. If your app uses thenewInstance() method and you want to override access checks, call the setAccessible() method with the input parameter set to true. If your app uses the v7 appcompat library or the v7 recyclerview library, you must update your app to use to the latest versions of these libraries. Otherwise, make sure that any custom classes referenced from XML are updated so that their class constructors are accessible.

This preview updates the behavior of the dynamic linker. The dynamic linker now understands the difference between a library’s soname and its path (public bug 6670), and search by soname is now implemented. Apps which previously worked that have bad DT_NEEDED entries (usually absolute paths on the build machine’s file system) may fail when loaded.

The dlopen(3) RTLD_LOCAL flag is now correctly implemented. Note that RTLD_LOCAL is the default, so calls todlopen(3) that didn’t explicitly use RTLD_LOCAL will be affected (unless your app explicitly used RTLD_GLOBAL). With RTLD_LOCAL, symbols will not be made available to libraries loaded by later calls to dlopen(3) (as opposed to being referenced by DT_NEEDED entries).

12、APK Validation

  The platform now performs stricter validation of APKs. An APK is considered corrupt if a file is declared in the manifest but not present in the APK itself. An APK must be re-signed if any of the contents are removed.

13、USB Connection

  Device connections through the USB port are now set to charge-only mode by default. To access the device and its content over a USB connection, users must explicitly grant permission for such interactions. If your app supports user interactions with the device over a USB port, take into consideration that the interaction must be explicitly enabled.

14、Android for Work Changes

  This preview includes the following behavior changes for Android for Work:

  • Work contacts in personal contexts. The Google Dialer Call Log now displays work contacts when the user views past calls. Setting setCrossProfileCallerIdDisabled() to true hides the work profile contacts in the Google Dialer Call Log. Work contacts can be displayed along with personal contacts to devices over Bluetooth only if you set DevicePolicyManager.setBluetoothContactSharingDisabled() to false. By default, it is set to true.
  • WiFi configuration removal: WiFi configurations added by a Profile Owner (for example, through calls to theaddNetwork() method) are now removed if that work profile is deleted.
  • WiFi configuration lockdown: Any WiFi configuration created by an active Device Owner can no longer be modified or deleted by the user if Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN is non-zero. The user can still create and modify their own WiFi configurations. Active Device Owners have the privilege of editing/removing any WiFi configurations, including those not created by them.
  • Download Work Policy Controller via Google account addition: When a Google account that requires management via a Work Policy Controller (WPC) app is added to a device outside of a managed context, the add account flow now prompts the user to install the appropriate WPC. This behavior also applies to accounts added via Settings > Accounts and in the initial device setup wizard.
  • Changes to specific DevicePolicyManager API behaviors:
    • Calling the setCameraDisabled() method affects the camera for the calling user only; calling it from the managed profile doesn’t affect camera apps running on the primary user.
    • In addition, the setKeyguardDisabledFeatures() method is now available for Profile Owners, as well as to Device Owners.
    • A Profile Owner can set these keyguard restrictions:
    • The createAndInitializeUser() and createUser() methods have been deprecated.
    • The setScreenCaptureDisabled() method now also blocks the assist structure when an app of the given user is in the foreground.
    • EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM now defaults to SHA-256. SHA-1 is still supported for backwards compatibility but will be removed in future.EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM now only accepts SHA-256.
    • Device initializer APIs which existed in the MNC preview are now removed. They will not appear in the final M release.
    • EXTRA_PROVISIONING_RESET_PROTECTION_PARAMETERS is removed so NFC bump provisioning cannot programmatically unlock a factory reset protected device.
    • Android for Work APIs are optimized for M runtime permissions, including Work profiles, assist layer, and others. New DevicePolicyManager permission APIs don‘t affect pre-M apps.
  • Changes to other APIs:
    • Data Usage: The android.app.usage.NetworkUsageStats class has been renamedandroid.app.usage.NetworkStats.
  • Changes to global settings:
    • These settings can no longer be set via setGlobalSettings():

      • BLUETOOTH_ON
      • DEVELOPMENT_SETTINGS_ENABLED
      • MODE_RINGER
      • NETWORK_PREFERENCE
      • WIFI_ON
    • These global settings can now be set via setGlobalSettings():
      • WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN
时间: 2024-11-02 00:15:50

Android M新特性之Behavior Changes的相关文章

Android N 新特性

2016年5月19日,谷歌在美国加州的山景城举办了 Google I/O 开发者大会中发布.2016年6月,Android N正式命名为"牛轧糖" 本届I/O开发者大会上,Google重点介绍了Android系统三个维度:分别是性能.安全和生产力.其中性能主要新增了Vulkan API与JIT编译器(前者优化图形性能.或者加快软件安装速度):安全性包括新的数据加密方式.恶意网站识别.系统的实时更新:生产力方面加入了分屏多任务功能.程序的快速切换,所有应用都可以支持"多窗口模式

Android Lollipop 新特性 - Palette;获取图片颜色

Android Lollipop 新特性 - Palette 在Android 5.0 之后推出的palette,通过这个方法,我们就可以从一张 bitmap 中提取我们需要的颜色,可以使UI风格更加美观融洽.比如,我们可以从图片中提取颜色设置给ActionBar做背景颜色,这样ActionBar的颜色就会随着显示图片的变化而变化. Palette可以提取的颜色如下: Vibrant (有活力的) Vibrant dark(有活力的 暗色) Vibrant light(有活力的 亮色) Mute

Android M新特性Doze and App Standby模式详解

参考: Optimizing for Doze and App Standby Android M新特性Doze and App Standby模式详解 深入android6.0 设备 idle状态 Android M 的 Doze 模式下第三方推送服务还能用吗? 一.Optimizing for Doze and App Standby 从Android6.0开始,Android提供了两种省电延长电池寿命的功能:Doze和App Standby: 表现形式:当设备没有连接到电源,设备进入Doz

10大Android N新特性,不知道你就out啦!

谷歌正式发布了Android N,据悉这最新一代的安卓系统拥有过250的功能.对安卓迷来说,可谓好消息一件.通过对Android N新功能的体验,我们切身感受了系统的便捷和高效.下面是大家最为期待的10大特性: 10可调节显示尺寸 Android N将带来一系列新的辅助功能,现在你不只可以调整字体大小,还可以调整显示的尺寸.此前的调整字体大小弱爆了,新的可调节显示设置,可以改变整个用户界面的比例,实时改变包括诸如按钮,图标和搜索栏的大小 09流量保护 在如今三大运营商垄断的情况下,知道哪些应用程

Android 开发新特性

技术日新月异,稍不留神,被别人甩了几条大街. 开发工具 Android Studio: Google 官方放弃 Eclipse 和 Android Studio 普及.AS 虽然不算新,但是对 Android Studio 这个软件的更新速度快的惊人,有大量的新功能发布.例如支持很多注解代码提示注解.Live code template.支持自动生成 Parcelable 实现等等,作为开发者,持续关注这个更新列表 Recent Changes,一定会让你的写代码的生活更加美好. 编程“语言”

Android M新特性之Permissions

User does not have to grant any permissions when they install or upgrade the app. Instead, the app requests permissions as it needs them, and the system shows a dialog to the user asking for the permission. Overview With the M Developer Preview, the

Android M 新特性——应用数据自动备份功能

一.功能介绍 Android m 的自动备份数据功能运用的是Android Backup Service,将数据备份到了google drive中.Android Backup Service其实在安卓2.2就已经有了.但一开始谷歌的备份服务并不是用来同步备份应用数据,而是为了方便用户可以在不同设备上获取到备份的数据.而现在,只要你的app数据发生变化,或者系统升级时,Android M的应用数据备份功能便会启动.所以应用可以随时恢复之前存储过的数据,即使是设备恢复过出厂设置或者更换了新的设备.

Android Lollipop 新特性 - Palette

Palette 可以从一张图片中提取颜色,我们可以把提取的颜色融入到App UI中,可以使UI风格更加美观融洽.比如,我们可以从图片中提取颜色设置给ActionBar做背景颜色,这样ActionBar的颜色就会随着显示图片的变化而变化. Palette可以提取的颜色如下: Vibrant (有活力的) Vibrant dark(有活力的 暗色) Vibrant light(有活力的 亮色) Muted (柔和的) Muted dark(柔和的 暗色) Muted light(柔和的 亮色) 使用

Android M新特性之APP Link

The Android M Developer Preview introduces support for App Links, which improves upon existing link handling by allowing app developers to associate an app with a web domain they own. Declare a Website Association This JSON file indicates the Android