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

Commit be193c0b authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Launch user switcher as SYSTEM" into tm-dev

parents 00b19cde 9fbefebb
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.systemui.plugins;
import android.annotation.Nullable;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.UserHandle;
import android.view.View;

import com.android.systemui.animation.ActivityLaunchAnimator;
@@ -70,6 +71,9 @@ public interface ActivityStarter {
    void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked);
    void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked, UserHandle userHandle);
    void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade);
    void startActivity(Intent intent, boolean dismissShade, Callback callback);
    void postStartActivityDismissingKeyguard(Intent intent, int delay);
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ package com.android.systemui;

import android.app.PendingIntent;
import android.content.Intent;
import android.os.UserHandle;
import android.view.View;

import androidx.annotation.Nullable;
@@ -99,6 +100,15 @@ public class ActivityStarterDelegate implements ActivityStarter {
                    showOverLockscreenWhenLocked));
    }

    @Override
    public void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked, UserHandle userHandle) {
        mActualStarterOptionalLazy.get().ifPresent(
                starter -> starter.startActivity(intent, dismissShade, animationController,
                    showOverLockscreenWhenLocked, userHandle));
    }

    @Override
    public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade) {
        mActualStarterOptionalLazy.get().ifPresent(
+18 −8
Original line number Diff line number Diff line
@@ -1695,12 +1695,20 @@ public class CentralSurfaces extends CoreStartable implements
    public void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked) {
        startActivity(intent, dismissShade, animationController, showOverLockscreenWhenLocked,
                UserHandle.CURRENT);
    }

    @Override
    public void startActivity(Intent intent, boolean dismissShade,
            @Nullable ActivityLaunchAnimator.Controller animationController,
            boolean showOverLockscreenWhenLocked, UserHandle userHandle) {
        // Make sure that we dismiss the keyguard if it is directly dismissable or when we don't
        // want to show the activity above it.
        if (mKeyguardStateController.isUnlocked() || !showOverLockscreenWhenLocked) {
            startActivityDismissingKeyguard(intent, false, dismissShade,
                    false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */,
                0 /* flags */, animationController);
                    0 /* flags */, animationController, userHandle);
            return;
        }

@@ -1755,7 +1763,7 @@ public class CentralSurfaces extends CoreStartable implements
                        .create(mContext)
                        .addNextIntent(intent)
                        .startActivities(getActivityOptions(getDisplayId(), adapter),
                                UserHandle.CURRENT));
                                userHandle));
    }

    /**
@@ -1775,7 +1783,7 @@ public class CentralSurfaces extends CoreStartable implements
    public void startActivity(Intent intent, boolean dismissShade, Callback callback) {
        startActivityDismissingKeyguard(intent, false, dismissShade,
                false /* disallowEnterPictureInPictureWhileLaunching */, callback, 0,
                null /* animationController */);
                null /* animationController */, UserHandle.CURRENT);
    }

    public void setQsExpanded(boolean expanded) {
@@ -2417,7 +2425,7 @@ public class CentralSurfaces extends CoreStartable implements
            boolean dismissShade, int flags) {
        startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade,
                false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */,
                flags, null /* animationController */);
                flags, null /* animationController */, UserHandle.CURRENT);
    }

    public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
@@ -2428,7 +2436,8 @@ public class CentralSurfaces extends CoreStartable implements
    void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
            final boolean dismissShade, final boolean disallowEnterPictureInPictureWhileLaunching,
            final Callback callback, int flags,
            @Nullable ActivityLaunchAnimator.Controller animationController) {
            @Nullable ActivityLaunchAnimator.Controller animationController,
            final UserHandle userHandle) {
        if (onlyProvisioned && !mDeviceProvisionedController.isDeviceProvisioned()) return;

        final boolean willLaunchResolverActivity =
@@ -2487,7 +2496,7 @@ public class CentralSurfaces extends CoreStartable implements
                                    intent,
                                    intent.resolveTypeIfNeeded(mContext.getContentResolver()),
                                    null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null,
                                    options.toBundle(), UserHandle.CURRENT.getIdentifier());
                                    options.toBundle(), userHandle.getIdentifier());
                        } catch (RemoteException e) {
                            Log.w(TAG, "Unable to start activity", e);
                        }
@@ -2860,7 +2869,8 @@ public class CentralSurfaces extends CoreStartable implements
                                false /* disallowEnterPictureInPictureWhileLaunching */,
                                null /* callback */,
                                0 /* flags */,
                                animationController),
                                animationController,
                                UserHandle.CURRENT),
                delay);
    }

+2 −2
Original line number Diff line number Diff line
@@ -371,7 +371,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
            mCentralSurfaces.startActivityDismissingKeyguard(cameraIntent,
                    false /* onlyProvisioned */, true /* dismissShade */,
                    true /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, 0,
                    null /* animationController */);
                    null /* animationController */, UserHandle.CURRENT);
        } else {
            if (!mCentralSurfaces.isDeviceInteractive()) {
                // Avoid flickering of the scrim when we instant launch the camera and the bouncer
@@ -428,7 +428,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
            mCentralSurfaces.startActivityDismissingKeyguard(emergencyIntent,
                    false /* onlyProvisioned */, true /* dismissShade */,
                    true /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, 0,
                    null /* animationController */);
                    null /* animationController */, UserHandle.CURRENT);
            return;
        }

+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone;
import static com.android.systemui.DejankUtils.whitelistIpcs;

import android.content.Intent;
import android.os.UserHandle;
import android.os.UserManager;
import android.view.View;
import android.view.ViewGroup;
@@ -62,7 +63,7 @@ public class MultiUserSwitchController extends ViewController<MultiUserSwitch> {

                mActivityStarter.startActivity(intent, true /* dismissShade */,
                        ActivityLaunchAnimator.Controller.fromView(v, null),
                        true /* showOverlockscreenwhenlocked */);
                        true /* showOverlockscreenwhenlocked */, UserHandle.SYSTEM);
            } else {
                mUserSwitchDialogController.showDialog(v);
            }
Loading