Android Q适配(非SDK接口管控)

作者: 翱翔黑涩天空 | 来源:发表于2019-04-19 07:46 被阅读27次

介绍

https://developer.android.google.cn/distribute/best-practices/develop/restrictions-non-sdk-interfaces

  • Android P

    • Blacklist 无论targetVersion如何,使用这些api,系统将会抛出错误
    • Greylist 如果targetVersion == 28 将会跟Blacklist一样,如果不是则可以正常使用
    • Whitelist 可以正常使用
  • Android Q

    • greylist 本系统标记为不支持调用。但是无限制,可以正常使用
    • Blacklist 无论targetVersion如何,使用这些api,系统将会抛出错误
    • greylist-max-o 受限制的灰名单。targetVersion <= 27 可以正常访问
    • greylist-max-p 受限制的灰名单。targetVersion <= 28 可以正常访问

变更

Android Q 更新了黑名单、黑灰名单的接口,增加了一些新的名字。 如在 Android P 中被限制的黑灰色名单:darkgrey list 现在叫做 greylist-max-o, 在 Android Q 中被限制的非SDK接口应该称为 greylist-max-p

  • blacklist 无论targetVersion如何,使用这些api,系统将会抛出错误

  • greylist 本系统标记为不支持调用。但是无限制,可以正常使用

  • greylist-max-o 受限制的灰名单,targetVersion <= 27 可以正常访问,targetVersion > 27(Android P,9,Q)不能使用

  • greylist-max-p 受限制的灰名单,targetVersion <= 28 可以正常访问,targetVersion > 28(Android Q)不能使用

check工具

把veridex-mac.zip下载下来进行下面操作进行check检查

https://developer.android.google.cn/distribute/best-practices/develop/restrictions-non-sdk-interfaces#test-veridex-tool
https://android.googlesource.com/platform/prebuilts/runtime/+/master/appcompat

Linux x64

Download veridex-linux.zip, unzip the file and run with:

./appcompat.sh --dex-file=test.apk

macOS

Download veridex-mac.zip, unzip the file and run with:

./appcompat.sh --dex-file=test.apk

相关文章

网友评论

    本文标题:Android Q适配(非SDK接口管控)

    本文链接:https://www.haomeiwen.com/subject/gaefgqtx.html