diff options
| author | 2022-10-28 22:21:13 +0000 | |
|---|---|---|
| committer | 2022-10-28 22:21:13 +0000 | |
| commit | 49e2be67fee2ced1fabac8d71bc511c137a0c8e1 (patch) | |
| tree | 3a32c51ad515ba33d93f68f1aadba9cc29eb2dd6 | |
| parent | 200d029332d7b9649804156926112198fba28299 (diff) | |
| parent | bda18f27990706eb9081657282b58ebd66750bb3 (diff) | |
Merge "[SettingsProvider] workaround for DevicePolicyResourcesManager" into tm-dev am: bda18f2799
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20306468
Change-Id: I935d8f957e45f489d665fa465f50b03229b48e5a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | core/java/android/provider/Settings.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 805fdc44b256..96cc1f892551 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -3344,9 +3344,26 @@ public final class Settings { } } - // Fetch all flags for the namespace at once for caching purposes - Bundle b = cp.call(cr.getAttributionSource(), - mProviderHolder.mUri.getAuthority(), mCallListCommand, null, args); + Bundle b; + // b/252663068: if we're in system server and the caller did not call + // clearCallingIdentity, the read would fail due to mismatched AttributionSources. + // TODO(b/256013480): remove this bypass after fixing the callers in system server. + if (namespace.equals(DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER) + && Settings.isInSystemServer() + && Binder.getCallingUid() != Process.myUid()) { + final long token = Binder.clearCallingIdentity(); + try { + // Fetch all flags for the namespace at once for caching purposes + b = cp.call(cr.getAttributionSource(), + mProviderHolder.mUri.getAuthority(), mCallListCommand, null, args); + } finally { + Binder.restoreCallingIdentity(token); + } + } else { + // Fetch all flags for the namespace at once for caching purposes + b = cp.call(cr.getAttributionSource(), + mProviderHolder.mUri.getAuthority(), mCallListCommand, null, args); + } if (b == null) { // Invalid response, return an empty map return keyValues; |