diff options
3 files changed, 31 insertions, 7 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 8bd63dfc2075..6d2cea6b5c3c 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -17,6 +17,7 @@ package android.widget; import android.annotation.ColorInt; +import android.app.ActivityManager.StackId; import android.app.ActivityOptions; import android.app.ActivityThread; import android.app.Application; @@ -228,6 +229,11 @@ public class RemoteViews implements Parcelable, Filter { public boolean onClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) { + return onClickHandler(view, pendingIntent, fillInIntent, StackId.INVALID_STACK_ID); + } + + public boolean onClickHandler(View view, PendingIntent pendingIntent, + Intent fillInIntent, int launchStackId) { try { // TODO: Unregister this handler if PendingIntent.FLAG_ONE_SHOT? Context context = view.getContext(); @@ -239,6 +245,10 @@ public class RemoteViews implements Parcelable, Filter { 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); } + + if (launchStackId != StackId.INVALID_STACK_ID) { + opts.setLaunchStackId(launchStackId); + } context.startIntentSender( pendingIntent.getIntentSender(), fillInIntent, Intent.FLAG_ACTIVITY_NEW_TASK, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 0e21517c3a60..4ed64260dc7f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -19,7 +19,9 @@ package com.android.systemui.statusbar; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.app.ActivityManager; +import android.app.ActivityManager.StackId; import android.app.ActivityManagerNative; +import android.app.ActivityOptions; import android.app.KeyguardManager; import android.app.Notification; import android.app.NotificationManager; @@ -347,7 +349,7 @@ public abstract class BaseStatusBar extends SystemUI implements }, afterKeyguardGone); return true; } else { - return super.onClickHandler(view, pendingIntent, fillInIntent); + return superOnClickHandler(view, pendingIntent, fillInIntent); } } @@ -384,7 +386,8 @@ public abstract class BaseStatusBar extends SystemUI implements private boolean superOnClickHandler(View view, PendingIntent pendingIntent, Intent fillInIntent) { - return super.onClickHandler(view, pendingIntent, fillInIntent); + return super.onClickHandler(view, pendingIntent, fillInIntent, + StackId.FULLSCREEN_WORKSPACE_STACK_ID); } private boolean handleRemoteInput(View view, PendingIntent pendingIntent, Intent fillInIntent) { @@ -990,7 +993,7 @@ public abstract class BaseStatusBar extends SystemUI implements } TaskStackBuilder.create(mContext) .addNextIntentWithParentStack(intent) - .startActivities(null, + .startActivities(getActivityOptions(), new UserHandle(UserHandle.getUserId(appUid))); overrideActivityPendingAppTransition(keyguardShowing); } catch (RemoteException e) { @@ -1740,7 +1743,7 @@ public abstract class BaseStatusBar extends SystemUI implements } catch (RemoteException e) { } try { - intent.send(); + intent.send(null, 0, null, null, null, null, getActivityOptions()); } catch (PendingIntent.CanceledException e) { // the stack trace isn't very helpful here. // Just log the exception message. @@ -1848,7 +1851,8 @@ public abstract class BaseStatusBar extends SystemUI implements } } try { - intent.send(); + intent.send(null, 0, null, null, null, null, + getActivityOptions()); } catch (PendingIntent.CanceledException e) { // the stack trace isn't very helpful here. // Just log the exception message. @@ -1924,6 +1928,14 @@ public abstract class BaseStatusBar extends SystemUI implements } } + protected Bundle getActivityOptions() { + // Anything launched from the notification shade should always go into the + // fullscreen stack. + ActivityOptions options = ActivityOptions.makeBasic(); + options.setLaunchStackId(StackId.FULLSCREEN_WORKSPACE_STACK_ID); + return options.toBundle(); + } + protected void visibilityChanged(boolean visible) { if (mVisible != visible) { mVisible = visible; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 4c5c84321f51..c563eb606663 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -21,7 +21,9 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.annotation.NonNull; import android.app.ActivityManager; +import android.app.ActivityManager.StackId; import android.app.ActivityManagerNative; +import android.app.ActivityOptions; import android.app.IActivityManager; import android.app.Notification; import android.app.PendingIntent; @@ -3091,8 +3093,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, null, mContext.getBasePackageName(), intent, intent.resolveTypeIfNeeded(mContext.getContentResolver()), - null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, null, - UserHandle.CURRENT.getIdentifier()); + null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, + getActivityOptions(), UserHandle.CURRENT.getIdentifier()); } catch (RemoteException e) { Log.w(TAG, "Unable to start activity", e); } |