Skip to content

Commit a37d000

Browse files
author
Kenny Guy
committed
SettingsProvider should use correct cache when redirecting to user 0.
SettingsProvider reads secure and system settings for managed profiles from user 0 instead. However it still checks the cache for the managed profile not user 0. Bug: 17736586 Change-Id: I15d44b8a5779b01e6b9032e528dc34f5c5602449
1 parent 7dc7f67 commit a37d000

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -691,12 +691,11 @@ public Bundle call(String method, String request, Bundle args) {
691691
if (Settings.CALL_METHOD_GET_SYSTEM.equals(method)) {
692692
if (LOCAL_LOGV) Slog.v(TAG, "call(system:" + request + ") for " + callingUser);
693693
// Check if this request should be (re)directed to the primary user's db
694-
if (callingUser == UserHandle.USER_OWNER
695-
|| shouldShadowParentProfile(callingUser, sSystemCloneToManagedKeys, request)) {
696-
dbHelper = getOrEstablishDatabase(UserHandle.USER_OWNER);
697-
} else {
698-
dbHelper = getOrEstablishDatabase(callingUser);
694+
if (callingUser != UserHandle.USER_OWNER
695+
&& shouldShadowParentProfile(callingUser, sSystemCloneToManagedKeys, request)) {
696+
callingUser = UserHandle.USER_OWNER;
699697
}
698+
dbHelper = getOrEstablishDatabase(callingUser);
700699
cache = sSystemCaches.get(callingUser);
701700
return lookupValue(dbHelper, TABLE_SYSTEM, cache, request);
702701
}
@@ -710,10 +709,9 @@ public Bundle call(String method, String request, Bundle args) {
710709
UserManager.DISALLOW_SHARE_LOCATION, new UserHandle(callingUser))) {
711710
return sSecureCaches.get(callingUser).putIfAbsent(request, "");
712711
}
713-
dbHelper = getOrEstablishDatabase(UserHandle.USER_OWNER);
714-
} else {
715-
dbHelper = getOrEstablishDatabase(callingUser);
712+
callingUser = UserHandle.USER_OWNER;
716713
}
714+
dbHelper = getOrEstablishDatabase(callingUser);
717715
cache = sSecureCaches.get(callingUser);
718716
return lookupValue(dbHelper, TABLE_SECURE, cache, request);
719717
}

0 commit comments

Comments
 (0)