【译】Android 6.0接口变化(三)(Android 6.0 Changes)

原文:https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-runtime-permissions

一、关键点

13、运行时:Runtime
14、APK校验:APK Validation
15、USB连接:USB Connection
16、Android企业版变化:Android for Work Changes

二、详述:

13、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 the newInstance() 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.
ART运行时现在已经完全实现了newInstance()方法的访问规则。这个改变修复了之前版本Dalvik检查访问规则不正确的问题。如果你的APP使用了newInstance() 方法,想要重写访问检查,调用setAccessible()方法并将参数设置成true。如果你的APP使用 v7 appcompat库or the v7 recyclerview库,你必须更新你的APP使用最新版本的库。也就是说,确保设计XML的客户类必须更新以便构造方法可访问。
This release 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.
此版本更新了动态链接器的行为,动态链接器现在可以理解库的soname和路径直接的区别,根据soname搜索也实现了。APP之前因为DT_NEEDED错误(通常是绝对路径在构建的虚拟机文件系统中)无法运行的现在也会加载失败。
The dlopen(3) RTLD_LOCAL flag is now correctly implemented. Note that RTLD_LOCAL is the default, so calls to dlopen(3)
that didn’t explicitly useRTLD_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).
dlopen(3) RTLD_LOCAL标识现在已经正确实现了。注意RTLD_LOCAL是默认的,因此调用dlopen(3)没有确定使用RTLD_LOCAL也会被影响(至少你的APP确定使用了RTLD_GLOBAL)。
On previous versions of Android, if your app requested the system to load a shared library with text relocations, the system displayed a warning but still allowed the library to be loaded. Beginning in this release, the system rejects this library if your app's target SDK version is 23 or higher. To help you detect if a library failed to load, your app should log the dlopen(3) failure, and include the problem description text that the dlerror(3) call returns. To learn more about handling text relocations, see this guide
在之前的Android版本中,如果你通过text relocations的方式请求一个共享库,系统会显示一个警告但会允许库被加载。从这个发布版开始,如果你APP的SDK版本是23或更高系统会拒绝。为了帮助你检测库的加载被拒绝,你的APP应该记录dlopen(3)的失败日志,包括dlerror(3)返回的问题描述。想了解更多text relocations,查看:guide

14、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.
平台现在执行严格的APK校验,如果一个文件在manifest中定义了但没有在APK中出现会被认为是一个坏APK。如果有内容改变APK必须重新签名。

15、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.
设备通过USB端口连接现在会默认设置为“仅充电”模式。想通过USB访问设备内容必须明确通过用户交互完成授权。如果你的应用支持通过USB端口的交互,要考虑到这种交互必须被明确的启用。

16、Android for Work Changes

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 14,599评论 5 6
  • Correctness AdapterViewChildren Summary: AdapterViews can...
    MarcusMa阅读 12,872评论 0 6
  • 花费时间生命金钱。注意力要有产出。 20170412(我的七年里有记录) 凌晨01:00-03:30被谈话两个小时...
    陈东Growth阅读 1,643评论 0 0
  • 这周阅读了李笑来老师的专栏文章,进一步了解了写作的重要性。现将看过专栏后的一些想法记录如下。 写作的过程就是思考的...
    22QQQQ阅读 4,791评论 0 1
  • 活到老,学到老!当今知识更新之快让我们目不暇接,不找准方向,在变换中人生就匆匆过半! 然而在这个纷繁复杂的大千世界...
    小小星火阅读 1,409评论 0 0

友情链接更多精彩内容