Merge "Launch activity intents on the StatusBar's display" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3abe96871f
@@ -2692,6 +2692,10 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
return mDisplay.getRotation();
|
return mDisplay.getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getDisplayId() {
|
||||||
|
return mDisplayId;
|
||||||
|
}
|
||||||
|
|
||||||
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
|
public void startActivityDismissingKeyguard(final Intent intent, boolean onlyProvisioned,
|
||||||
boolean dismissShade, int flags) {
|
boolean dismissShade, int flags) {
|
||||||
startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade,
|
startActivityDismissingKeyguard(intent, onlyProvisioned, dismissShade,
|
||||||
@@ -2717,7 +2721,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
intent.addFlags(flags);
|
intent.addFlags(flags);
|
||||||
int result = ActivityManager.START_CANCELED;
|
int result = ActivityManager.START_CANCELED;
|
||||||
ActivityOptions options = new ActivityOptions(getActivityOptions(
|
ActivityOptions options = new ActivityOptions(getActivityOptions(mDisplayId,
|
||||||
null /* remoteAnimation */));
|
null /* remoteAnimation */));
|
||||||
options.setDisallowEnterPictureInPictureWhileLaunching(
|
options.setDisallowEnterPictureInPictureWhileLaunching(
|
||||||
disallowEnterPictureInPictureWhileLaunching);
|
disallowEnterPictureInPictureWhileLaunching);
|
||||||
@@ -4362,6 +4366,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
executeActionDismissingKeyguard(() -> {
|
executeActionDismissingKeyguard(() -> {
|
||||||
try {
|
try {
|
||||||
intent.send(null, 0, null, null, null, null, getActivityOptions(
|
intent.send(null, 0, null, null, null, null, getActivityOptions(
|
||||||
|
mDisplayId,
|
||||||
mActivityLaunchAnimator.getLaunchAnimation(associatedView, isOccluded())));
|
mActivityLaunchAnimator.getLaunchAnimation(associatedView, isOccluded())));
|
||||||
} catch (PendingIntent.CanceledException e) {
|
} catch (PendingIntent.CanceledException e) {
|
||||||
// the stack trace isn't very helpful here.
|
// the stack trace isn't very helpful here.
|
||||||
@@ -4383,15 +4388,38 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
mMainThreadHandler.post(runnable);
|
mMainThreadHandler.post(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Bundle getActivityOptions(@Nullable RemoteAnimationAdapter animationAdapter) {
|
/**
|
||||||
|
* Returns an ActivityOptions bundle created using the given parameters.
|
||||||
|
*
|
||||||
|
* @param displayId The ID of the display to launch the activity in. Typically this would be the
|
||||||
|
* display the status bar is on.
|
||||||
|
* @param animationAdapter The animation adapter used to start this activity, or {@code null}
|
||||||
|
* for the default animation.
|
||||||
|
*/
|
||||||
|
public static Bundle getActivityOptions(int displayId,
|
||||||
|
@Nullable RemoteAnimationAdapter animationAdapter) {
|
||||||
return getDefaultActivityOptions(animationAdapter).toBundle();
|
return getDefaultActivityOptions(animationAdapter).toBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Bundle getActivityOptions(@Nullable RemoteAnimationAdapter animationAdapter,
|
/**
|
||||||
boolean isKeyguardShowing, long eventTime) {
|
* Returns an ActivityOptions bundle created using the given parameters.
|
||||||
|
*
|
||||||
|
* @param displayId The ID of the display to launch the activity in. Typically this would be the
|
||||||
|
* display the status bar is on.
|
||||||
|
* @param animationAdapter The animation adapter used to start this activity, or {@code null}
|
||||||
|
* for the default animation.
|
||||||
|
* @param isKeyguardShowing Whether keyguard is currently showing.
|
||||||
|
* @param eventTime The event time in milliseconds since boot, not including sleep. See
|
||||||
|
* {@link ActivityOptions#setSourceInfo}.
|
||||||
|
*/
|
||||||
|
public static Bundle getActivityOptions(int displayId,
|
||||||
|
@Nullable RemoteAnimationAdapter animationAdapter, boolean isKeyguardShowing,
|
||||||
|
long eventTime) {
|
||||||
ActivityOptions options = getDefaultActivityOptions(animationAdapter);
|
ActivityOptions options = getDefaultActivityOptions(animationAdapter);
|
||||||
options.setSourceInfo(isKeyguardShowing ? ActivityOptions.SourceInfo.TYPE_LOCKSCREEN
|
options.setSourceInfo(isKeyguardShowing ? ActivityOptions.SourceInfo.TYPE_LOCKSCREEN
|
||||||
: ActivityOptions.SourceInfo.TYPE_NOTIFICATION, eventTime);
|
: ActivityOptions.SourceInfo.TYPE_NOTIFICATION, eventTime);
|
||||||
|
options.setLaunchDisplayId(displayId);
|
||||||
|
options.setCallerDisplayId(displayId);
|
||||||
return options.toBundle();
|
return options.toBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -427,8 +427,13 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
|
|||||||
intent.getCreatorPackage(), adapter);
|
intent.getCreatorPackage(), adapter);
|
||||||
}
|
}
|
||||||
long eventTime = row.getAndResetLastActionUpTime();
|
long eventTime = row.getAndResetLastActionUpTime();
|
||||||
Bundle options = eventTime > 0 ? getActivityOptions(adapter,
|
Bundle options = eventTime > 0
|
||||||
mKeyguardStateController.isShowing(), eventTime) : getActivityOptions(adapter);
|
? getActivityOptions(
|
||||||
|
mStatusBar.getDisplayId(),
|
||||||
|
adapter,
|
||||||
|
mKeyguardStateController.isShowing(),
|
||||||
|
eventTime)
|
||||||
|
: getActivityOptions(mStatusBar.getDisplayId(), adapter);
|
||||||
int launchResult = intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
|
int launchResult = intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
|
||||||
null, null, options);
|
null, null, options);
|
||||||
mMainThreadHandler.post(() -> {
|
mMainThreadHandler.post(() -> {
|
||||||
@@ -450,6 +455,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
|
|||||||
int launchResult = TaskStackBuilder.create(mContext)
|
int launchResult = TaskStackBuilder.create(mContext)
|
||||||
.addNextIntentWithParentStack(intent)
|
.addNextIntentWithParentStack(intent)
|
||||||
.startActivities(getActivityOptions(
|
.startActivities(getActivityOptions(
|
||||||
|
mStatusBar.getDisplayId(),
|
||||||
mActivityLaunchAnimator.getLaunchAnimation(
|
mActivityLaunchAnimator.getLaunchAnimation(
|
||||||
row, mStatusBar.isOccluded())),
|
row, mStatusBar.isOccluded())),
|
||||||
new UserHandle(UserHandle.getUserId(appUid)));
|
new UserHandle(UserHandle.getUserId(appUid)));
|
||||||
|
|||||||
Reference in New Issue
Block a user