Allow Bluetooth to use privapp_allowlist

Apparently there's some special case-code in package manager that
scans apps as privileged regardless of their location. BT is one
such app -- so allow it to specify a privapp allowlist even though
it isn't in priv-app.

Bug: 284500052
Test: use privapp_allowlist in Bluetooth and its overriddes
Change-Id: Ib9ac86ebc45087a176100fe8df07db7bf81a85a7
This commit is contained in:
Anton Hansson
2023-06-02 09:30:08 +00:00
parent 022adb0b8c
commit a91268a690

View File

@@ -288,7 +288,13 @@ func (a *AndroidApp) OverridablePropertiesDepsMutator(ctx android.BottomUpMutato
}
if a.appProperties.Privapp_allowlist != nil && !Bool(a.appProperties.Privileged) {
ctx.PropertyErrorf("privapp_allowlist", "privileged must be set in order to use privapp_allowlist")
// There are a few uids that are explicitly considered privileged regardless of their
// app's location. Bluetooth is one such app. It should arguably be moved to priv-app,
// but for now, allow it not to be in priv-app.
privilegedBecauseOfUid := ctx.ModuleName() == "Bluetooth"
if !privilegedBecauseOfUid {
ctx.PropertyErrorf("privapp_allowlist", "privileged must be set in order to use privapp_allowlist (with a few exceptions)")
}
}
for _, cert := range a.appProperties.Additional_certificates {