Launch user switcher as SYSTEM
This switching activity should always be run as the system user. Support specifying a UserHandle on activity transitions. Fixes: 219638055 Test: manual, check user switching from multiple profiles Change-Id: I4098481daeed2423ffac5023d101171e0b4cc84a
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.statusbar.phone.userswitcher
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.UserHandle
|
||||
import android.view.View
|
||||
import com.android.systemui.animation.ActivityLaunchAnimator
|
||||
import com.android.systemui.flags.FeatureFlags
|
||||
@@ -67,7 +68,7 @@ class StatusBarUserSwitcherControllerImpl @Inject constructor(
|
||||
|
||||
activityStarter.startActivity(intent, true /* dismissShade */,
|
||||
ActivityLaunchAnimator.Controller.fromView(view, null),
|
||||
true /* showOverlockscreenwhenlocked */)
|
||||
true /* showOverlockscreenwhenlocked */, UserHandle.SYSTEM)
|
||||
} else {
|
||||
userSwitcherDialogController.showDialog(view)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user