summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff Chang <chengjeff@google.com> 2023-02-07 16:02:43 +0800
committer Jeff Chang <chengjeff@google.com> 2023-02-07 16:02:43 +0800
commit3b50c7347c291eac9431f82d22bce924e78f52ed (patch)
treeba35ba0f3851b6745b1492b742299f28d8b29040
parentef6ec0860dbed86ce4d99aef7c03857719d73f31 (diff)
Enable flagging shortcut with no_user_action flag
Enable indicating to apply no_user_action flag while starting a shortcut to split. Bug: 267723349 Test: check the applied flags with activity start logs Change-Id: I51c2152138cc80187ff649bea0bb415ac6ab043e
-rw-r--r--core/java/android/app/ActivityOptions.java23
-rw-r--r--services/core/java/com/android/server/pm/LauncherAppsService.java4
2 files changed, 27 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index 22a1a47d3d0a..d6f44e60eb0c 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -325,6 +325,13 @@ public class ActivityOptions extends ComponentOptions {
"android:activity.applyMultipleTaskFlagForShortcut";
/**
+ * Indicates to apply {@link Intent#FLAG_ACTIVITY_NO_USER_ACTION} to the launching shortcut.
+ * @hide
+ */
+ private static final String KEY_APPLY_NO_USER_ACTION_FLAG_FOR_SHORTCUT =
+ "android:activity.applyNoUserActionFlagForShortcut";
+
+ /**
* For Activity transitions, the calling Activity's TransitionListener used to
* notify the called Activity when the shared element and the exit transitions
* complete.
@@ -457,6 +464,7 @@ public class ActivityOptions extends ComponentOptions {
private boolean mDisallowEnterPictureInPictureWhileLaunching;
private boolean mApplyActivityFlagsForBubbles;
private boolean mApplyMultipleTaskFlagForShortcut;
+ private boolean mApplyNoUserActionFlagForShortcut;
private boolean mTaskAlwaysOnTop;
private boolean mTaskOverlay;
private boolean mTaskOverlayCanResume;
@@ -1256,6 +1264,8 @@ public class ActivityOptions extends ComponentOptions {
KEY_APPLY_ACTIVITY_FLAGS_FOR_BUBBLES, false);
mApplyMultipleTaskFlagForShortcut = opts.getBoolean(
KEY_APPLY_MULTIPLE_TASK_FLAG_FOR_SHORTCUT, false);
+ mApplyNoUserActionFlagForShortcut = opts.getBoolean(
+ KEY_APPLY_NO_USER_ACTION_FLAG_FOR_SHORTCUT, false);
if (opts.containsKey(KEY_ANIM_SPECS)) {
Parcelable[] specs = opts.getParcelableArray(KEY_ANIM_SPECS);
mAnimSpecs = new AppTransitionAnimationSpec[specs.length];
@@ -1835,6 +1845,16 @@ public class ActivityOptions extends ComponentOptions {
return mApplyMultipleTaskFlagForShortcut;
}
+ /** @hide */
+ public void setApplyNoUserActionFlagForShortcut(boolean apply) {
+ mApplyNoUserActionFlagForShortcut = apply;
+ }
+
+ /** @hide */
+ public boolean isApplyNoUserActionFlagForShortcut() {
+ return mApplyNoUserActionFlagForShortcut;
+ }
+
/**
* Sets a launch cookie that can be used to track the activity and task that are launch as a
* result of this option. If the launched activity is a trampoline that starts another activity
@@ -2167,6 +2187,9 @@ public class ActivityOptions extends ComponentOptions {
b.putBoolean(KEY_APPLY_MULTIPLE_TASK_FLAG_FOR_SHORTCUT,
mApplyMultipleTaskFlagForShortcut);
}
+ if (mApplyNoUserActionFlagForShortcut) {
+ b.putBoolean(KEY_APPLY_NO_USER_ACTION_FLAG_FOR_SHORTCUT, true);
+ }
if (mAnimSpecs != null) {
b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs);
}
diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java
index e37222f406a9..8b04c3adf34b 100644
--- a/services/core/java/com/android/server/pm/LauncherAppsService.java
+++ b/services/core/java/com/android/server/pm/LauncherAppsService.java
@@ -22,6 +22,7 @@ import static android.app.PendingIntent.FLAG_MUTABLE;
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
+import static android.content.Intent.FLAG_ACTIVITY_NO_USER_ACTION;
import static android.content.pm.LauncherApps.FLAG_CACHE_BUBBLE_SHORTCUTS;
import static android.content.pm.LauncherApps.FLAG_CACHE_NOTIFICATION_SHORTCUTS;
import static android.content.pm.LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS;
@@ -1123,6 +1124,9 @@ public class LauncherAppsService extends SystemService {
if (options.isApplyMultipleTaskFlagForShortcut()) {
intents[0].addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
}
+ if (options.isApplyNoUserActionFlagForShortcut()) {
+ intents[0].addFlags(FLAG_ACTIVITY_NO_USER_ACTION);
+ }
}
intents[0].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intents[0].setSourceBounds(sourceBounds);