由于我是Android的新手,我想问一些我不太清楚的问题。我读了API guide考虑到这个主题,关于权限的问题还有很多问答,不过,我不确定我是否理解正确。所以,签名保护级别是:
A permission that the system grants only if the requesting application
is signed with the same certificate as the application that declared
the permission. If the certificates match, the system automatically
grants the permission without notifying the user or asking for the
user's explicit approval.
这是否意味着我无法使用任何具有“签名”保护级别的权限,因此除了开发它的团队之外,任何人都无法使用 Android API 中定义的所有权限并具有此类保护级别?
Does this mean that I am not able to use any permission with 'signature' protection level, so all permissions defined in the Android's API and having such protection level are unavailable to anyone, apart the team which is developing it?
一般来说,是的。
更具体地说,一个 signature
-level 权限意味着应用程序使用该权限(例如,通过 android:permission
属性)保护自己,并且应用程序试图与第一个需要权限的应用程序(<uses-permission>
元素)通信必须由相同的签名 key 签名。
如果保护自身的应用程序是设备固件的一部分,或者是操作系统本身,则只有使用与该固件相同的签名 key 签名的应用程序才能通过持有权限与防御应用程序通信。
但是,如果您编写的应用程序 A 使用 signature
来保护自己-级权限(例如,自定义权限),并且你编写的应用程序 B 想要与应用程序 A 的 protected 部分对话,你可以这样做,如果你正在签署应用程序 A 和应用程序 B相同的签名 key 。