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

Commit 41c1ded7 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Allow phone UID to export singleton providers

Also add a user variant of replacePreferredActivity for use
by SmsApplication.

Map user restrictions for SMS/MMS to AppOps perms.

Bug: 16681533
Change-Id: I3dfed5fc754e33bb51c6f571851653a7c2770e46
parent ad3aa32f
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -459,15 +459,15 @@ public class AppOpsManager {
            null, //POST_NOTIFICATION
            null, //NEIGHBORING_CELLS
            null, //CALL_PHONE
            null, //READ_SMS
            null, //WRITE_SMS
            null, //RECEIVE_SMS
            null, //RECEIVE_EMERGECY_SMS
            null, //RECEIVE_MMS
            UserManager.DISALLOW_SMS, //READ_SMS
            UserManager.DISALLOW_SMS, //WRITE_SMS
            UserManager.DISALLOW_SMS, //RECEIVE_SMS
            null, //RECEIVE_EMERGENCY_SMS
            UserManager.DISALLOW_SMS, //RECEIVE_MMS
            null, //RECEIVE_WAP_PUSH
            null, //SEND_SMS
            null, //READ_ICC_SMS
            null, //WRITE_ICC_SMS
            UserManager.DISALLOW_SMS, //SEND_SMS
            UserManager.DISALLOW_SMS, //READ_ICC_SMS
            UserManager.DISALLOW_SMS, //WRITE_ICC_SMS
            null, //WRITE_SETTINGS
            UserManager.DISALLOW_CREATE_WINDOWS, //SYSTEM_ALERT_WINDOW
            null, //ACCESS_NOTIFICATIONS
+12 −1
Original line number Diff line number Diff line
@@ -1384,7 +1384,18 @@ final class ApplicationPackageManager extends PackageManager {
    public void replacePreferredActivity(IntentFilter filter,
                                         int match, ComponentName[] set, ComponentName activity) {
        try {
            mPM.replacePreferredActivity(filter, match, set, activity);
            mPM.replacePreferredActivity(filter, match, set, activity, UserHandle.myUserId());
        } catch (RemoteException e) {
            // Should never happen!
        }
    }

    @Override
    public void replacePreferredActivityAsUser(IntentFilter filter,
                                         int match, ComponentName[] set, ComponentName activity,
                                         int userId) {
        try {
            mPM.replacePreferredActivity(filter, match, set, activity, userId);
        } catch (RemoteException e) {
            // Should never happen!
        }
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ interface IPackageManager {
            in ComponentName[] set, in ComponentName activity, int userId);

    void replacePreferredActivity(in IntentFilter filter, int match,
            in ComponentName[] set, in ComponentName activity);
            in ComponentName[] set, in ComponentName activity, int userId);

    void clearPackagePreferredActivities(String packageName);

+9 −0
Original line number Diff line number Diff line
@@ -3522,6 +3522,15 @@ public abstract class PackageManager {
    public abstract void replacePreferredActivity(IntentFilter filter, int match,
            ComponentName[] set, ComponentName activity);

    /**
     * @hide
     */
    @Deprecated
    public void replacePreferredActivityAsUser(IntentFilter filter, int match,
           ComponentName[] set, ComponentName activity, int userId) {
        throw new RuntimeException("Not implemented. Must override in a subclass.");
    }

    /**
     * Remove all preferred activity mappings, previously added with
     * {@link #addPreferredActivity}, from the
+4 −0
Original line number Diff line number Diff line
@@ -13765,6 +13765,10 @@ public final class ActivityManagerService extends ActivityManagerNative
            }
        } else if ("system".equals(componentProcessName)) {
            result = true;
        } else if (UserHandle.isSameApp(aInfo.uid, Process.PHONE_UID)
                && (flags & ServiceInfo.FLAG_SINGLE_USER) != 0) {
            // Phone app is allowed to export singleuser providers.
            result = true;
        } else {
            // App with pre-defined UID, check if it's a persistent app
            result = (aInfo.flags & ApplicationInfo.FLAG_PERSISTENT) != 0;
Loading