平台簽署的應用程式是指與平台套件 (android
) 共用相同 (或相容) 簽署憑證的應用程式。平台簽署的應用程式可以是系統應用程式 (位於系統映像檔分割區),也可以是非系統應用程式。平台簽署的共用 UID 是指包含平台簽署應用程式的共用 UID (android:sharedUserId
)。可偵錯的建構版本是指 android.os.Build.isDebuggable()
會傳回 true
的建構版本,例如 userdebug
或 eng
建構版本。
過去,裝置製造商幾乎無法控管哪些平台簽署的非系統應用程式可以加入平台簽署的共用 UID。從 Android 15 開始,製造商可以在 /etc/sysconfig
目錄的系統設定 XML 檔案中,明確允許平台簽署的非系統應用程式加入平台簽署的共用 UID。如果平台簽署的非系統應用程式未加入平台簽署共用 UID 的許可清單,且該應用程式仍嘗試加入平台簽署共用 UID (資訊清單中含有 android:sharedUserId
),則無法在不可偵錯的建構版本中安裝。
新增許可清單
您可以在單一或多個 XML 檔案中列出應用程式的允許清單,
類似於
frameworks/base/data/etc/package-shareduid-allowlist.xml
:
<!--
This XML defines an allowlist for packages that want to join a particular shared-uid.
If a non-system package that is signed with platform signature, is trying to join a particular
shared-uid, and not in this list, the installation will fail.
- The "package" XML attribute refers to the app's package name.
- The "shareduid" XML attribute refers to the shared uid name.
-->
<config>
<allow-package-shareduid package="android.test.settings" shareduid="android.uid.system" />
</config>
尋找遺失的許可清單
如要找出缺少的許可清單項目,請嘗試在無法偵錯的建構版本上安裝平台簽署的非系統應用程式,並檢查是否仍可安裝。如果沒有,您可以檢查裝置記錄,查看以下格式的警告訊息:
Non-preload app {PACKAGE_NAME} signed with platform signature and joining shared uid: {SHARED_UID_NAME}