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
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a91268a690e2aa98a0fa7b376a948a48f41b1265)
Merged-In: Ib9ac86ebc45087a176100fe8df07db7bf81a85a7
Change-Id: Ib9ac86ebc45087a176100fe8df07db7bf81a85a7
This commit is contained in:
Anton Hansson
2023-06-03 08:53:47 +00:00
committed by Android Build Cherrypicker Worker
parent 48fa309aa3
commit e3f31cfd1e

View File

@@ -289,7 +289,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 {