Skip to content

Commit 11941fd

Browse files
author
Dianne Hackborn
committed
Fix crash when setting wallpaper from non-primary user.
When accessing a content provider, there is a check for whether the provider can run in the caller's process; if so, even if the provider is currently published, we return to the caller that it can run locally. This check was broken -- it had an old condition that allowed content providers owned by the system UID to run in any other UID's process. This is wrong, since by definition the other UIDs would not be able to access the data under the original UID. We ran into this because the activity picker is part of the android platform manifest, so runs as the system process. However it needs to run as the user who invoked it, so when coming from the non-primary user we spin up a "system" process running as a uid of that user. Now when that process tries to access the settings provider, the broken check would think that a new instance of the settings provider should be created in the caller's process. Change-Id: I7bf495ed8370cb271bdaec073d5b7dda9e38c546
1 parent 649d0d7 commit 11941fd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

services/java/com/android/server/am/ContentProviderRecord.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public ContentProviderHolder newHolder(ContentProviderConnection conn) {
8585

8686
public boolean canRunHere(ProcessRecord app) {
8787
return (info.multiprocess || info.processName.equals(app.processName))
88-
&& (uid == Process.SYSTEM_UID || uid == app.info.uid);
88+
&& uid == app.info.uid;
8989
}
9090

9191
public void addExternalProcessHandleLocked(IBinder token) {

services/java/com/android/server/pm/Settings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ void writeLPr() {
12591259
final ArrayList<PackageCleanItem> pkgs = mPackagesToBeCleaned.valueAt(i);
12601260
for (int j=0; j<pkgs.size(); j++) {
12611261
serializer.startTag(null, "cleaning-package");
1262-
PackageCleanItem item = pkgs.get(i);
1262+
PackageCleanItem item = pkgs.get(j);
12631263
serializer.attribute(null, ATTR_NAME, item.packageName);
12641264
serializer.attribute(null, ATTR_CODE, item.andCode ? "true" : "false");
12651265
serializer.attribute(null, ATTR_USER, userStr);

0 commit comments

Comments
 (0)