Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87c1f6b5 authored by Jeff Chang's avatar Jeff Chang Committed by Automerger Merge Worker
Browse files

Merge "Enable flagging shortcut with no_user_action flag" into tm-qpr-dev am: eb47deb3

parents 274c0066 eb47deb3
Loading
Loading
Loading
Loading
+23 −0
Original line number Original line Diff line number Diff line
@@ -333,6 +333,13 @@ public class ActivityOptions extends ComponentOptions {
    private static final String KEY_APPLY_MULTIPLE_TASK_FLAG_FOR_SHORTCUT =
    private static final String KEY_APPLY_MULTIPLE_TASK_FLAG_FOR_SHORTCUT =
            "android:activity.applyMultipleTaskFlagForShortcut";
            "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
     * For Activity transitions, the calling Activity's TransitionListener used to
     * notify the called Activity when the shared element and the exit transitions
     * notify the called Activity when the shared element and the exit transitions
@@ -467,6 +474,7 @@ public class ActivityOptions extends ComponentOptions {
    private boolean mDisallowEnterPictureInPictureWhileLaunching;
    private boolean mDisallowEnterPictureInPictureWhileLaunching;
    private boolean mApplyActivityFlagsForBubbles;
    private boolean mApplyActivityFlagsForBubbles;
    private boolean mApplyMultipleTaskFlagForShortcut;
    private boolean mApplyMultipleTaskFlagForShortcut;
    private boolean mApplyNoUserActionFlagForShortcut;
    private boolean mTaskAlwaysOnTop;
    private boolean mTaskAlwaysOnTop;
    private boolean mTaskOverlay;
    private boolean mTaskOverlay;
    private boolean mTaskOverlayCanResume;
    private boolean mTaskOverlayCanResume;
@@ -1268,6 +1276,8 @@ public class ActivityOptions extends ComponentOptions {
                KEY_APPLY_ACTIVITY_FLAGS_FOR_BUBBLES, false);
                KEY_APPLY_ACTIVITY_FLAGS_FOR_BUBBLES, false);
        mApplyMultipleTaskFlagForShortcut = opts.getBoolean(
        mApplyMultipleTaskFlagForShortcut = opts.getBoolean(
                KEY_APPLY_MULTIPLE_TASK_FLAG_FOR_SHORTCUT, false);
                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)) {
        if (opts.containsKey(KEY_ANIM_SPECS)) {
            Parcelable[] specs = opts.getParcelableArray(KEY_ANIM_SPECS);
            Parcelable[] specs = opts.getParcelableArray(KEY_ANIM_SPECS);
            mAnimSpecs = new AppTransitionAnimationSpec[specs.length];
            mAnimSpecs = new AppTransitionAnimationSpec[specs.length];
@@ -1864,6 +1874,16 @@ public class ActivityOptions extends ComponentOptions {
        return mApplyMultipleTaskFlagForShortcut;
        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
     * 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
     * result of this option. If the launched activity is a trampoline that starts another activity
@@ -2199,6 +2219,9 @@ public class ActivityOptions extends ComponentOptions {
            b.putBoolean(KEY_APPLY_MULTIPLE_TASK_FLAG_FOR_SHORTCUT,
            b.putBoolean(KEY_APPLY_MULTIPLE_TASK_FLAG_FOR_SHORTCUT,
                    mApplyMultipleTaskFlagForShortcut);
                    mApplyMultipleTaskFlagForShortcut);
        }
        }
        if (mApplyNoUserActionFlagForShortcut) {
            b.putBoolean(KEY_APPLY_NO_USER_ACTION_FLAG_FOR_SHORTCUT, true);
        }
        if (mAnimSpecs != null) {
        if (mAnimSpecs != null) {
            b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs);
            b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs);
        }
        }
+4 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.app.PendingIntent.FLAG_MUTABLE;
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
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_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_BUBBLE_SHORTCUTS;
import static android.content.pm.LauncherApps.FLAG_CACHE_NOTIFICATION_SHORTCUTS;
import static android.content.pm.LauncherApps.FLAG_CACHE_NOTIFICATION_SHORTCUTS;
import static android.content.pm.LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS;
import static android.content.pm.LauncherApps.FLAG_CACHE_PEOPLE_TILE_SHORTCUTS;
@@ -1123,6 +1124,9 @@ public class LauncherAppsService extends SystemService {
                if (options.isApplyMultipleTaskFlagForShortcut()) {
                if (options.isApplyMultipleTaskFlagForShortcut()) {
                    intents[0].addFlags(FLAG_ACTIVITY_MULTIPLE_TASK);
                    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].addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intents[0].setSourceBounds(sourceBounds);
            intents[0].setSourceBounds(sourceBounds);