summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Victor Hsieh <victorhsieh@google.com> 2024-05-01 12:07:19 -0700
committer Victor Hsieh <victorhsieh@google.com> 2024-05-01 12:07:19 -0700
commitfecc98e239c6074c5a5b0105f8a26fe5f26b97a3 (patch)
tree88f8cc2e9adff97fe86bac2754c7033972d81b29
parentdc336859b54116afdfa6fed5ce7ae174848e3466 (diff)
Fix FRP setting write failure due to calling identity
Test: Verify with GMS Core Bug: 338214895 Change-Id: Ie51cd809ce0ff2e3da612975c4e68c41274a7e20
-rw-r--r--services/core/java/com/android/server/pdb/PersistentDataBlockService.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/pdb/PersistentDataBlockService.java b/services/core/java/com/android/server/pdb/PersistentDataBlockService.java
index 2c1453261808..c5e2bb87afd3 100644
--- a/services/core/java/com/android/server/pdb/PersistentDataBlockService.java
+++ b/services/core/java/com/android/server/pdb/PersistentDataBlockService.java
@@ -291,9 +291,15 @@ public class PersistentDataBlockService extends SystemService {
private void setOldSettingForBackworkCompatibility(boolean isActive) {
// Set the SECURE_FRP_MODE flag, for backward compatibility with clients who use it.
- // They should switch to calling #isFrpActive().
- Settings.Global.putInt(mContext.getContentResolver(),
- Settings.Global.SECURE_FRP_MODE, isActive ? 1 : 0);
+ // They should switch to calling #isFrpActive(). Clear calling ID since this can happen
+ // during an app call.
+ final long callingId = Binder.clearCallingIdentity();
+ try {
+ Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Global.SECURE_FRP_MODE, isActive ? 1 : 0);
+ } finally {
+ Binder.restoreCallingIdentity(callingId);
+ }
}
private void setOemUnlockEnabledProperty(boolean oemUnlockEnabled) {