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

Commit 33cffe37 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by android-build-merger
Browse files

Merge "Fixed bugs with starting windows when displayng forcedResized activity" into nyc-dev

am: b406dd20

* commit 'b406dd20':
  Fixed bugs with starting windows when displayng forcedResized activity

Change-Id: I9e3bc8825d837abe61d31dea27249f7bce6e7f9d
parents 52ccdf05 b406dd20
Loading
Loading
Loading
Loading
+12 −12
Original line number Original line Diff line number Diff line
@@ -161,10 +161,10 @@ public class ActivityOptions {
    private static final String KEY_LAUNCH_TASK_ID = "android.activity.launchTaskId";
    private static final String KEY_LAUNCH_TASK_ID = "android.activity.launchTaskId";


    /**
    /**
     * See {@link #setAvoidMoveToFront}.
     * See {@link #setTaskOverlay}.
     * @hide
     * @hide
     */
     */
    private static final String KEY_DONT_MOVE_TO_FRONT = "android.activity.dontMoveToFront";
    private static final String KEY_TASK_OVERLAY = "android.activity.taskOverlay";


    /**
    /**
     * Where the docked stack should be positioned.
     * Where the docked stack should be positioned.
@@ -239,7 +239,7 @@ public class ActivityOptions {
    private int mLaunchStackId = INVALID_STACK_ID;
    private int mLaunchStackId = INVALID_STACK_ID;
    private int mLaunchTaskId = -1;
    private int mLaunchTaskId = -1;
    private int mDockCreateMode = DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
    private int mDockCreateMode = DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
    private boolean mAvoidMoveToFront;
    private boolean mTaskOverlay;
    private AppTransitionAnimationSpec mAnimSpecs[];
    private AppTransitionAnimationSpec mAnimSpecs[];


    /**
    /**
@@ -782,7 +782,7 @@ public class ActivityOptions {
        }
        }
        mLaunchStackId = opts.getInt(KEY_LAUNCH_STACK_ID, INVALID_STACK_ID);
        mLaunchStackId = opts.getInt(KEY_LAUNCH_STACK_ID, INVALID_STACK_ID);
        mLaunchTaskId = opts.getInt(KEY_LAUNCH_TASK_ID, -1);
        mLaunchTaskId = opts.getInt(KEY_LAUNCH_TASK_ID, -1);
        mAvoidMoveToFront = opts.getBoolean(KEY_DONT_MOVE_TO_FRONT, false);
        mTaskOverlay = opts.getBoolean(KEY_TASK_OVERLAY, false);
        mDockCreateMode = opts.getInt(KEY_DOCK_CREATE_MODE, DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT);
        mDockCreateMode = opts.getInt(KEY_DOCK_CREATE_MODE, DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT);
        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);
@@ -961,20 +961,20 @@ public class ActivityOptions {
    }
    }


    /**
    /**
     * Set's whether the task should be moved to the front. This is different from
     * Set's whether the activity launched with this option should be a task overlay. That is the
     * {@link #getLaunchTaskBehind()} as we don't want to have an animation at all when launching
     * activity will always be the top activity of the task and doesn't cause the task to be moved
     * an activity that shouldn't be moved to the front.
     * to the front when it is added.
     * @hide
     * @hide
     */
     */
    public void setAvoidMoveToFront(boolean avoidMoveToFront) {
    public void setTaskOverlay(boolean taskOverlay) {
        mAvoidMoveToFront = avoidMoveToFront;
        mTaskOverlay = taskOverlay;
    }
    }


    /**
    /**
     * @hide
     * @hide
     */
     */
    public boolean getAvoidMoveToFront() {
    public boolean getTaskOverlay() {
        return mAvoidMoveToFront;
        return mTaskOverlay;
    }
    }


    /** @hide */
    /** @hide */
@@ -1130,7 +1130,7 @@ public class ActivityOptions {
        }
        }
        b.putInt(KEY_LAUNCH_STACK_ID, mLaunchStackId);
        b.putInt(KEY_LAUNCH_STACK_ID, mLaunchStackId);
        b.putInt(KEY_LAUNCH_TASK_ID, mLaunchTaskId);
        b.putInt(KEY_LAUNCH_TASK_ID, mLaunchTaskId);
        b.putBoolean(KEY_DONT_MOVE_TO_FRONT, mAvoidMoveToFront);
        b.putBoolean(KEY_TASK_OVERLAY, mTaskOverlay);
        b.putInt(KEY_DOCK_CREATE_MODE, mDockCreateMode);
        b.putInt(KEY_DOCK_CREATE_MODE, mDockCreateMode);
        if (mAnimSpecs != null) {
        if (mAnimSpecs != null) {
            b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs);
            b.putParcelableArray(KEY_ANIM_SPECS, mAnimSpecs);
+6 −1
Original line number Original line Diff line number Diff line
@@ -163,7 +163,12 @@ interface IWindowManager
            IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
            IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
            boolean scaleUp);
            boolean scaleUp);
    void executeAppTransition();
    void executeAppTransition();
    void setAppStartingWindow(IBinder token, String pkg, int theme,

    /**
     * Called to set the starting window for the input token and returns true if the starting
     * window was set for the token.
     */
    boolean setAppStartingWindow(IBinder token, String pkg, int theme,
            in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
            in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
            int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
            int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
    void setAppVisibility(IBinder token, boolean visible);
    void setAppVisibility(IBinder token, boolean visible);
+1 −1
Original line number Original line Diff line number Diff line
@@ -111,7 +111,7 @@ public class ForcedResizableInfoActivityController {
            Intent intent = new Intent(mContext, ForcedResizableInfoActivity.class);
            Intent intent = new Intent(mContext, ForcedResizableInfoActivity.class);
            ActivityOptions options = ActivityOptions.makeBasic();
            ActivityOptions options = ActivityOptions.makeBasic();
            options.setLaunchTaskId(mPendingTaskIds.valueAt(i));
            options.setLaunchTaskId(mPendingTaskIds.valueAt(i));
            options.setAvoidMoveToFront(true);
            options.setTaskOverlay(true);
            mContext.startActivity(intent, options.toBundle());
            mContext.startActivity(intent, options.toBundle());
        }
        }
        mPendingTaskIds.clear();
        mPendingTaskIds.clear();
+12 −0
Original line number Original line Diff line number Diff line
@@ -202,6 +202,7 @@ final class ActivityRecord {
    static final int STARTING_WINDOW_SHOWN = 1;
    static final int STARTING_WINDOW_SHOWN = 1;
    static final int STARTING_WINDOW_REMOVED = 2;
    static final int STARTING_WINDOW_REMOVED = 2;
    int mStartingWindowState = STARTING_WINDOW_NOT_SHOWN;
    int mStartingWindowState = STARTING_WINDOW_NOT_SHOWN;
    boolean mTaskOverlay = false; // Task is always on-top of other activities in the task.


    boolean mUpdateTaskThumbnailWhenHidden;
    boolean mUpdateTaskThumbnailWhenHidden;
    ActivityContainer mInitialActivityContainer;
    ActivityContainer mInitialActivityContainer;
@@ -1390,6 +1391,17 @@ final class ActivityRecord {
        pendingVoiceInteractionStart = false;
        pendingVoiceInteractionStart = false;
    }
    }


    void showStartingWindow(ActivityRecord prev, boolean createIfNeeded) {
        final CompatibilityInfo compatInfo =
                service.compatibilityInfoForPackageLocked(info.applicationInfo);
        final boolean shown = service.mWindowManager.setAppStartingWindow(
                appToken, packageName, theme, compatInfo, nonLocalizedLabel, labelRes, icon,
                logo, windowFlags, prev != null ? prev.appToken : null, createIfNeeded);
        if (shown) {
            mStartingWindowState = STARTING_WINDOW_SHOWN;
        }
    }

    void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
    void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
        out.attribute(null, ATTR_ID, String.valueOf(createTime));
        out.attribute(null, ATTR_ID, String.valueOf(createTime));
        out.attribute(null, ATTR_LAUNCHEDFROMUID, String.valueOf(launchedFromUid));
        out.attribute(null, ATTR_LAUNCHEDFROMUID, String.valueOf(launchedFromUid));
+4 −22
Original line number Original line Diff line number Diff line
@@ -2459,12 +2459,7 @@ final class ActivityStack {
                    next.hasBeenLaunched = true;
                    next.hasBeenLaunched = true;
                } else  if (SHOW_APP_STARTING_PREVIEW && lastStack != null &&
                } else  if (SHOW_APP_STARTING_PREVIEW && lastStack != null &&
                        mStackSupervisor.isFrontStack(lastStack)) {
                        mStackSupervisor.isFrontStack(lastStack)) {
                    mWindowManager.setAppStartingWindow(
                    next.showStartingWindow(null, true);
                            next.appToken, next.packageName, next.theme,
                            mService.compatibilityInfoForPackageLocked(next.info.applicationInfo),
                            next.nonLocalizedLabel, next.labelRes, next.icon, next.logo,
                            next.windowFlags, null, true);
                    next.mStartingWindowState = STARTING_WINDOW_SHOWN;
                }
                }
                mStackSupervisor.startSpecificActivityLocked(next, true, false);
                mStackSupervisor.startSpecificActivityLocked(next, true, false);
                if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
                if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
@@ -2490,14 +2485,7 @@ final class ActivityStack {
                next.hasBeenLaunched = true;
                next.hasBeenLaunched = true;
            } else {
            } else {
                if (SHOW_APP_STARTING_PREVIEW) {
                if (SHOW_APP_STARTING_PREVIEW) {
                    mWindowManager.setAppStartingWindow(
                    next.showStartingWindow(null, true);
                            next.appToken, next.packageName, next.theme,
                            mService.compatibilityInfoForPackageLocked(
                                    next.info.applicationInfo),
                            next.nonLocalizedLabel,
                            next.labelRes, next.icon, next.logo, next.windowFlags,
                            null, true);
                    next.mStartingWindowState = STARTING_WINDOW_SHOWN;
                }
                }
                if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Restarting: " + next);
                if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Restarting: " + next);
            }
            }
@@ -2712,7 +2700,7 @@ final class ActivityStack {
                // "has the same starting icon" as the next one.  This allows the
                // "has the same starting icon" as the next one.  This allows the
                // window manager to keep the previous window it had previously
                // window manager to keep the previous window it had previously
                // created, if it still had one.
                // created, if it still had one.
                ActivityRecord prev = mResumedActivity;
                ActivityRecord prev = r.task.topRunningActivityWithStartingWindowLocked();
                if (prev != null) {
                if (prev != null) {
                    // We don't want to reuse the previous starting preview if:
                    // We don't want to reuse the previous starting preview if:
                    // (1) The current activity is in a different task.
                    // (1) The current activity is in a different task.
@@ -2724,13 +2712,7 @@ final class ActivityStack {
                        prev = null;
                        prev = null;
                    }
                    }
                }
                }
                mWindowManager.setAppStartingWindow(
                r.showStartingWindow(prev, showStartingIcon);
                        r.appToken, r.packageName, r.theme,
                        mService.compatibilityInfoForPackageLocked(
                                r.info.applicationInfo), r.nonLocalizedLabel,
                        r.labelRes, r.icon, r.logo, r.windowFlags,
                        prev != null ? prev.appToken : null, showStartingIcon);
                r.mStartingWindowState = STARTING_WINDOW_SHOWN;
            }
            }
        } else {
        } else {
            // If this is the first activity, don't do any fancy animations,
            // If this is the first activity, don't do any fancy animations,
Loading