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
AlarmManagerclass are disabled, except for alarms that you've set with thesetAlarmClock()method andAlarmManager.setAndAllowWhileIdle(). - WiFi scans are not performed.
- Syncs and jobs for your sync adapters and
JobSchedulerare 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.
Contextmethods:ApplicationInfofields:
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 Cut, Copy, 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
WifiConfigurationobjects only if you created these objects. You are not permitted to modify or deleteWifiConfigurationobjects 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 thedisableAllOthers=truesetting, 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’stargetSdkVersionis“20”or lower, it is pinned to the selected Wi-Fi network. If your app’stargetSdkVersionis“21”or higher, use the multinetwork APIs (such asopenConnection(),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()totruehides 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 setDevicePolicyManager.setBluetoothContactSharingDisabled()tofalse. By default, it is set totrue. - WiFi configuration removal: WiFi configurations added by a Profile Owner (for example, through calls to the
addNetwork()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_LOCKDOWNis 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:
KEYGUARD_DISABLE_TRUST_AGENTSandKEYGUARD_DISABLE_FINGERPRINT, which affect the keyguard settings for the profile’s parent user.KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS, which only affects notifications generated by applications in the managed profile.
- The
createAndInitializeUser()andcreateUser()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_CHECKSUMnow defaults to SHA-256. SHA-1 is still supported for backwards compatibility but will be removed in future.EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUMnow 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_PARAMETERSis 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
DevicePolicyManagerpermission APIs don't affect pre-M apps.
- Calling the
- Changes to other APIs:
- Data Usage: The
android.app.usage.NetworkUsageStatsclass has been renamedandroid.app.usage.NetworkStats.
- Data Usage: The
- Changes to global settings:
- These settings can no longer be set via
setGlobalSettings():BLUETOOTH_ONDEVELOPMENT_SETTINGS_ENABLEDMODE_RINGERNETWORK_PREFERENCEWIFI_ON
- These global settings can now be set via
setGlobalSettings():WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN
- These settings can no longer be set via
Android M新特性之Behavior Changes的更多相关文章
- 可能是最早的学习Android N新特性的文章
可能是最早的学习Android N新特性的文章 Google在今天放出了Android N开发者预览版.Android N支持Nexus6及以上的设备.5太子Nexus5不再得到更新. Android ...
- Android O新特性和行为变更总结zz
https://mp.weixin.qq.com/s/Ezfm-Xaz3fzsaSm0TU5LMw Android O 行为变更https://developer.android.google.cn/ ...
- Android N 新特性
2016年5月19日,谷歌在美国加州的山景城举办了 Google I/O 开发者大会中发布.2016年6月,Android N正式命名为“牛轧糖” 本届I/O开发者大会上,Google重点介绍了And ...
- 从开发者角度解析 Android N 新特性!
大清早看到 Google 官方博客发布 Android N 的开发者预览版,立马从床上跳起来开始仔仔细细的读起来. 从开发者角度来看,Android N 的更新并不算大.网上之前流传的一些 Andro ...
- Android R 新特性分析及适配指南
Android R(Android 11 API 30)于2020年9月9日正式发布,随国内各终端厂商在售Android设备的版本更新升级,应用软件对Android R 版本的兼容适配已迫在眉睫. 对 ...
- Android 13 新特性及适配指南
Android 13(API 33)于 2022年8月15日 正式发布(发布时间较往年早了一些),正式版Release源代码也于当日被推送到AOSP Android开源项目. 截止到笔者撰写这篇文章时 ...
- Android N 新特性 + APP开发注意事项
1. 多窗口MultiWindow 多窗口MultiWindow,这是Android N里对开发者影响比较大的特性,也是大家疑问比较多的地方.站在开发者的角度其实不必太担心这个特性会导致我们需要修改很 ...
- Android开发学习之路-Android N新特性-多窗口模式
我们都知道,在最新的Android N系统中,加入了一个新的功能,就是多窗口模式.多窗口模式允许我们在屏幕上显示两个窗口,每个窗口显示的内容不同,也就是说,我们可以一遍看电视剧,一边聊微信. 这里我们 ...
- Android M新特性之Permissions
User does not have to grant any permissions when they install or upgrade the app. Instead, the app r ...
随机推荐
- 很不错的jQuery学习资料和实例
这些都是学习Jquery很不错的资料,整理了一下,分享给大家. 希望能对大家的学习有帮助. 帕兰 Noupe带来的51个最佳jQuery教程和实例, 向大家介绍了jQuery的一些基本概念和使用的相关 ...
- HTML5之FileReader的使用
HTML5定义了FileReader作为文件API的重要成员用于读取文件,根据W3C的定义,FileReader接口提供了读取文件的方法和包含读取结果的事件模型. FileReader的使用方式非常简 ...
- Dynamics AX 2012 R2 AIF 错误 '/MicrosoftDynamicsAXAif60' 应用程序中的服务器错误
Reinhard在使用AIF的时候,服务端收到如下错误提示之一,并触发InsufficientMemoryException 和ServiceActivationException异常,那么代表你服务 ...
- jquery 新闻滚动效果
$(function () { var scrollTimer = null; var delay = 2000; //1.鼠标对新闻触发mouseout事件后每2s调用scr ...
- Sublime Text怎么在切分两行视口内显示同一个文件
原文链接:http://devlog.en.alt-area.org/?p=1098 How to split one file into two views in Sublime Text2 You ...
- filebeat 多行日志的处理
配置文件位于/etc/filebeat/filebeat.yml,就是filebeat的主配置文件 打开文件,搜索multiline:,默认是注释的,常用的有如下三个配置: multiline: pa ...
- Determining Current Block and Current Item in Oracle Forms
SYSTEM.CURSOR_BLOCK Determining current block in Oracle Forms Using SYSTEM.CURSOR_BLOCK system varia ...
- HDU 5832 A water problem(某水题)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- python成长之路【第二篇】:列表和元组
1.数据结构数据结构是通过某种方式(例如对元素进行编号)组织在一起的数据元素的集合,这些数据元素可以是数字或者字符,甚至可以是其他数据结构.在Python中,最基本的数据结构是序列(sequence) ...
- SQL语言增加、修改、删除数据的语法
增加 insert into 表名(字段1,字段2) values ('字段1的值','字段2的值'); 修改 update 表名 set 字段1='赋予字段1的新值',字段2='赋予字段2的新值' ...