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

This commit is contained in:
Matt Pietal
2022-03-21 14:02:55 +00:00
committed by Android (Google) Code Review
6 changed files with 38 additions and 12 deletions

View File

@@ -17,6 +17,7 @@ package com.android.systemui.plugins;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Intent; import android.content.Intent;
import android.os.UserHandle;
import android.view.View; import android.view.View;
import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.animation.ActivityLaunchAnimator;
@@ -70,6 +71,9 @@ public interface ActivityStarter {
void startActivity(Intent intent, boolean dismissShade, void startActivity(Intent intent, boolean dismissShade,
@Nullable ActivityLaunchAnimator.Controller animationController, @Nullable ActivityLaunchAnimator.Controller animationController,
boolean showOverLockscreenWhenLocked); 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 onlyProvisioned, boolean dismissShade);
void startActivity(Intent intent, boolean dismissShade, Callback callback); void startActivity(Intent intent, boolean dismissShade, Callback callback);
void postStartActivityDismissingKeyguard(Intent intent, int delay); void postStartActivityDismissingKeyguard(Intent intent, int delay);

View File

@@ -16,6 +16,7 @@ package com.android.systemui;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Intent; import android.content.Intent;
import android.os.UserHandle;
import android.view.View; import android.view.View;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@@ -99,6 +100,15 @@ public class ActivityStarterDelegate implements ActivityStarter {
showOverLockscreenWhenLocked)); 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 @Override
public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade) { public void startActivity(Intent intent, boolean onlyProvisioned, boolean dismissShade) {
mActualStarterOptionalLazy.get().ifPresent( mActualStarterOptionalLazy.get().ifPresent(

View File

@@ -1695,12 +1695,20 @@ public class CentralSurfaces extends CoreStartable implements
public void startActivity(Intent intent, boolean dismissShade, public void startActivity(Intent intent, boolean dismissShade,
@Nullable ActivityLaunchAnimator.Controller animationController, @Nullable ActivityLaunchAnimator.Controller animationController,
boolean showOverLockscreenWhenLocked) { 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 // Make sure that we dismiss the keyguard if it is directly dismissable or when we don't
// want to show the activity above it. // want to show the activity above it.
if (mKeyguardStateController.isUnlocked() || !showOverLockscreenWhenLocked) { if (mKeyguardStateController.isUnlocked() || !showOverLockscreenWhenLocked) {
startActivityDismissingKeyguard(intent, false, dismissShade, startActivityDismissingKeyguard(intent, false, dismissShade,
false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */,
0 /* flags */, animationController); 0 /* flags */, animationController, userHandle);
return; return;
} }
@@ -1755,7 +1763,7 @@ public class CentralSurfaces extends CoreStartable implements
.create(mContext) .create(mContext)
.addNextIntent(intent) .addNextIntent(intent)
.startActivities(getActivityOptions(getDisplayId(), adapter), .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) { public void startActivity(Intent intent, boolean dismissShade, Callback callback) {
startActivityDismissingKeyguard(intent, false, dismissShade, startActivityDismissingKeyguard(intent, false, dismissShade,
false /* disallowEnterPictureInPictureWhileLaunching */, callback, 0, false /* disallowEnterPictureInPictureWhileLaunching */, callback, 0,
null /* animationController */); null /* animationController */, UserHandle.CURRENT);
} }
public void setQsExpanded(boolean expanded) { public void setQsExpanded(boolean expanded) {
@@ -2417,7 +2425,7 @@ public class CentralSurfaces extends CoreStartable implements
boolean dismissShade, int flags) { boolean dismissShade, int flags) {
startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade, startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade,
false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, false /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */,
flags, null /* animationController */); flags, null /* animationController */, UserHandle.CURRENT);
} }
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned, 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, void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
final boolean dismissShade, final boolean disallowEnterPictureInPictureWhileLaunching, final boolean dismissShade, final boolean disallowEnterPictureInPictureWhileLaunching,
final Callback callback, int flags, final Callback callback, int flags,
@Nullable ActivityLaunchAnimator.Controller animationController) { @Nullable ActivityLaunchAnimator.Controller animationController,
final UserHandle userHandle) {
if (onlyProvisioned && !mDeviceProvisionedController.isDeviceProvisioned()) return; if (onlyProvisioned && !mDeviceProvisionedController.isDeviceProvisioned()) return;
final boolean willLaunchResolverActivity = final boolean willLaunchResolverActivity =
@@ -2487,7 +2496,7 @@ public class CentralSurfaces extends CoreStartable implements
intent, intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()), intent.resolveTypeIfNeeded(mContext.getContentResolver()),
null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null,
options.toBundle(), UserHandle.CURRENT.getIdentifier()); options.toBundle(), userHandle.getIdentifier());
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, "Unable to start activity", e); Log.w(TAG, "Unable to start activity", e);
} }
@@ -2860,7 +2869,8 @@ public class CentralSurfaces extends CoreStartable implements
false /* disallowEnterPictureInPictureWhileLaunching */, false /* disallowEnterPictureInPictureWhileLaunching */,
null /* callback */, null /* callback */,
0 /* flags */, 0 /* flags */,
animationController), animationController,
UserHandle.CURRENT),
delay); delay);
} }

View File

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

View File

@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone;
import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.DejankUtils.whitelistIpcs;
import android.content.Intent; import android.content.Intent;
import android.os.UserHandle;
import android.os.UserManager; import android.os.UserManager;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -62,7 +63,7 @@ public class MultiUserSwitchController extends ViewController<MultiUserSwitch> {
mActivityStarter.startActivity(intent, true /* dismissShade */, mActivityStarter.startActivity(intent, true /* dismissShade */,
ActivityLaunchAnimator.Controller.fromView(v, null), ActivityLaunchAnimator.Controller.fromView(v, null),
true /* showOverlockscreenwhenlocked */); true /* showOverlockscreenwhenlocked */, UserHandle.SYSTEM);
} else { } else {
mUserSwitchDialogController.showDialog(v); mUserSwitchDialogController.showDialog(v);
} }

View File

@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.phone.userswitcher package com.android.systemui.statusbar.phone.userswitcher
import android.content.Intent import android.content.Intent
import android.os.UserHandle
import android.view.View import android.view.View
import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.FeatureFlags
@@ -67,7 +68,7 @@ class StatusBarUserSwitcherControllerImpl @Inject constructor(
activityStarter.startActivity(intent, true /* dismissShade */, activityStarter.startActivity(intent, true /* dismissShade */,
ActivityLaunchAnimator.Controller.fromView(view, null), ActivityLaunchAnimator.Controller.fromView(view, null),
true /* showOverlockscreenwhenlocked */) true /* showOverlockscreenwhenlocked */, UserHandle.SYSTEM)
} else { } else {
userSwitcherDialogController.showDialog(view) userSwitcherDialogController.showDialog(view)
} }