Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6f4d58b authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Allow singleton providers to accept connections from other users

This is required for singleton providers like sms log.

Change-Id: Icb18a764c27dc1b43f8b8bcc24c21c91274995fd
parent 9985aaf2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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();