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

Commit 409297da authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Allow INTERACT_ACROSS_USERS for service access.

But only if the two users are in the same profile.  Also
apply the same rule for the recently allowed interaction
across content providers.

The activity manager now keeps track of which users are in
the same profile group, and the handleIncomingUser function has
an option to allow a non-full caller to do the interaction
if the two users are in the same profile group.

Spread this joy all over the place.

Also turn off multi-user on Svelte devices.

Change-Id: I231484ea2a6bfccbb3cd51357d7a387bd75039ea
parent 8ecc8e19
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package android.os;

import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.pm.UserInfo;
@@ -900,6 +901,8 @@ public class UserManager {
    public static int getMaxSupportedUsers() {
        // Don't allow multiple users on certain builds
        if (android.os.Build.ID.startsWith("JVP")) return 1;
        // Svelte devices don't get multi-user.
        if (ActivityManager.isLowRamDeviceStatic()) return 1;
        return SystemProperties.getInt("fw.max_users",
                Resources.getSystem().getInteger(R.integer.config_multiuserMaximumUsers));
    }
+1 −1
Original line number Diff line number Diff line
@@ -961,7 +961,7 @@ public final class ActiveServices {
                + " type=" + resolvedType + " callingUid=" + callingUid);

        userId = mAm.handleIncomingUser(callingPid, callingUid, userId,
                false, true, "service", null);
                false, ActivityManagerService.ALLOW_NON_FULL_IN_PROFILE, "service", null);

        ServiceMap smap = getServiceMap(userId);
        final ComponentName comp = service.getComponent();
+178 −84

File changed.

Preview size limit exceeded, changes collapsed.

+4 −2
Original line number Diff line number Diff line
@@ -3407,7 +3407,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
        public final int startActivity(Intent intent) {
            mService.enforceNotIsolatedCaller("ActivityContainer.startActivity");
            int userId = mService.handleIncomingUser(Binder.getCallingPid(),
                    Binder.getCallingUid(), mCurrentUser, false, true, "ActivityContainer", null);
                    Binder.getCallingUid(), mCurrentUser, false,
                    ActivityManagerService.ALLOW_FULL_ONLY, "ActivityContainer", null);
            // TODO: Switch to user app stacks here.
            intent.addFlags(FORCE_NEW_TASK_FLAGS);
            String mimeType = intent.getType();
@@ -3433,7 +3434,8 @@ public final class ActivityStackSupervisor implements DisplayListener {

        private void checkEmbeddedAllowedInner(Intent intent, String resolvedType) {
            int userId = mService.handleIncomingUser(Binder.getCallingPid(),
                    Binder.getCallingUid(), mCurrentUser, false, true, "ActivityContainer", null);
                    Binder.getCallingUid(), mCurrentUser, false,
                    ActivityManagerService.ALLOW_FULL_ONLY, "ActivityContainer", null);
            if (resolvedType == null) {
                resolvedType = intent.getType();
                if (resolvedType == null && intent.getData() != null