am 3cb15637: Allow singleton providers to accept connections from other users
* commit '3cb156372b0b18030196e17f1d503e2a62531594': Allow singleton providers to accept connections from other users
This commit is contained in:
@@ -107,6 +107,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
|
||||
private PathPermission[] mPathPermissions;
|
||||
private boolean mExported;
|
||||
private boolean mNoPerms;
|
||||
private boolean mSingleUser;
|
||||
|
||||
private final ThreadLocal<String> mCallingPackage = new ThreadLocal<String>();
|
||||
|
||||
@@ -460,6 +461,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
|
||||
|
||||
boolean checkUser(int pid, int uid, Context context) {
|
||||
return UserHandle.getUserId(uid) == context.getUserId()
|
||||
|| mSingleUser
|
||||
|| context.checkPermission(INTERACT_ACROSS_USERS, pid, uid)
|
||||
== PERMISSION_GRANTED;
|
||||
}
|
||||
@@ -1674,6 +1676,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
|
||||
setWritePermission(info.writePermission);
|
||||
setPathPermissions(info.pathPermissions);
|
||||
mExported = info.exported;
|
||||
mSingleUser = (info.flags & ProviderInfo.FLAG_SINGLE_USER) != 0;
|
||||
setAuthorities(info.authority);
|
||||
}
|
||||
ContentProvider.this.onCreate();
|
||||
|
||||
Reference in New Issue
Block a user