[SettingsProvider] workaround for DevicePolicyResourcesManager
DevicePolicyResourcesManager.getString() was added in T and called in many places inside system server. However, it uses DeviceConfig.getBoolean to determine if a feature is enabled or not. In the places where it is called from inside system server, `clearCallingIdentity` was not always called, which can result in DeviceConfig.getBoolean throwing SecurityException due to mismatched AttributionSource (calling uid is the caller from the binder client, while the context is "android" which should have calling uid 0). Context is "android" because it is inside the system server where the DevicePolicyManager instance is created. This bug might lead to unexpected behavior such as packages failing to be uninstalled by admin. The easiest fix is to place a bypass in SettingsProvider and manually clear the calling uid there. This fix also allows for the cleanest backporting as it can be cherry-picked into T without touching all the places where DevicePolicyResourcesManager.getString() is called in the system server. BUG: 252663068 Test: manual Change-Id: I37a6ceb29575593018b93093562c85d49770a43c
Loading
Please register or sign in to comment