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

Commit 06a108c2 authored by Adam Cohen's avatar Adam Cohen Committed by android-build-merger
Browse files

Merge "Revert "Fixing occasional jump when launching certain apps from Recents."" into oc-dr1-dev

am: 0151c395

Change-Id: I027d106b11eb23bc056451c65cb89266cfea12e1
parents 29b1a86a 0151c395
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -31,5 +31,4 @@ oneway interface IRecentsSystemUserCallbacks {
    void sendRecentsDrawnEvent();
    void sendRecentsDrawnEvent();
    void sendDockingTopTaskEvent(int dragMode, in Rect initialRect);
    void sendDockingTopTaskEvent(int dragMode, in Rect initialRect);
    void sendLaunchRecentsEvent();
    void sendLaunchRecentsEvent();
    void setWaitingForTransitionStartEvent(boolean waitingForTransitionStart);
}
}
+0 −20
Original line number Original line Diff line number Diff line
@@ -57,7 +57,6 @@ import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent;
import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
import com.android.systemui.recents.events.component.ScreenPinningRequestEvent;
import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent;
import com.android.systemui.recents.events.component.ShowUserToastEvent;
import com.android.systemui.recents.events.component.ShowUserToastEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.misc.SystemServicesProxy;
@@ -712,25 +711,6 @@ public class Recents extends SystemUI
        }
        }
    }
    }


    public final void onBusEvent(SetWaitingForTransitionStartEvent event) {
        int processUser = sSystemServicesProxy.getProcessUser();
        if (sSystemServicesProxy.isSystemUser(processUser)) {
            mImpl.setWaitingForTransitionStart(event.waitingForTransitionStart);
        } else {
            postToSystemUser(new Runnable() {
                @Override
                public void run() {
                    try {
                        mUserToSystemCallbacks.setWaitingForTransitionStartEvent(
                                event.waitingForTransitionStart);
                    } catch (RemoteException e) {
                        Log.e(TAG, "Callback failed", e);
                    }
                }
            });
        }
    }

    /**
    /**
     * Attempts to register with the system user.
     * Attempts to register with the system user.
     */
     */
+4 −41
Original line number Original line Diff line number Diff line
@@ -24,11 +24,12 @@ import static android.view.View.MeasureSpec;
import android.app.ActivityManager;
import android.app.ActivityManager;
import android.app.ActivityManager.TaskSnapshot;
import android.app.ActivityManager.TaskSnapshot;
import android.app.ActivityOptions;
import android.app.ActivityOptions;
import android.app.ActivityOptions.OnAnimationStartedListener;
import android.content.ActivityNotFoundException;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.res.Resources;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.GraphicBuffer;
import android.graphics.GraphicBuffer;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.RectF;
@@ -207,20 +208,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
    protected static RecentsTaskLoadPlan sInstanceLoadPlan;
    protected static RecentsTaskLoadPlan sInstanceLoadPlan;
    // Stores the last pinned task time
    // Stores the last pinned task time
    protected static long sLastPipTime = -1;
    protected static long sLastPipTime = -1;
    // Stores whether we are waiting for a transition to/from recents to start. During this time,
    // we disallow the user from manually toggling recents until the transition has started.
    private static boolean mWaitingForTransitionStart = false;
    // Stores whether or not the user toggled while we were waiting for a transition to/from
    // recents. In this case, we defer the toggle state until then and apply it immediately after.
    private static boolean mToggleFollowingTransitionStart = true;

    private ActivityOptions.OnAnimationStartedListener mResetToggleFlagListener =
            new OnAnimationStartedListener() {
                @Override
                public void onAnimationStarted() {
                    setWaitingForTransitionStart(false);
                }
            };


    protected Context mContext;
    protected Context mContext;
    protected Handler mHandler;
    protected Handler mHandler;
@@ -378,11 +365,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
            return;
            return;
        }
        }


        if (mWaitingForTransitionStart) {
            mToggleFollowingTransitionStart = true;
            return;
        }

        mDraggingInRecents = false;
        mDraggingInRecents = false;
        mLaunchedWhileDocking = false;
        mLaunchedWhileDocking = false;
        mTriggeredFromAltTab = false;
        mTriggeredFromAltTab = false;
@@ -656,18 +638,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        }
        }
    }
    }


    public void setWaitingForTransitionStart(boolean waitingForTransitionStart) {
        if (mWaitingForTransitionStart == waitingForTransitionStart) {
            return;
        }

        mWaitingForTransitionStart = waitingForTransitionStart;
        if (!waitingForTransitionStart && mToggleFollowingTransitionStart) {
            toggleRecents(DividerView.INVALID_RECENTS_GROW_TARGET);
        }
        mToggleFollowingTransitionStart = false;
    }

    /**
    /**
     * Returns the preloaded load plan and invalidates it.
     * Returns the preloaded load plan and invalidates it.
     */
     */
@@ -895,9 +865,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
            }
            }
            AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()];
            AppTransitionAnimationSpec[] specsArray = new AppTransitionAnimationSpec[specs.size()];
            specs.toArray(specsArray);
            specs.toArray(specsArray);

            return new Pair<>(ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,
            return new Pair<>(ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView,
                    specsArray, mHandler, mResetToggleFlagListener, this), null);
                    specsArray, mHandler, null, this), null);
        } else {
        } else {
            // Update the destination rect
            // Update the destination rect
            Task toTask = new Task();
            Task toTask = new Task();
@@ -915,10 +884,8 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
                        return Lists.newArrayList(new AppTransitionAnimationSpec(
                        return Lists.newArrayList(new AppTransitionAnimationSpec(
                                toTask.key.id, thumbnail, rect));
                                toTask.key.id, thumbnail, rect));
                    });
                    });

            return new Pair<>(ActivityOptions.makeMultiThumbFutureAspectScaleAnimation(mContext,
            return new Pair<>(ActivityOptions.makeMultiThumbFutureAspectScaleAnimation(mContext,
                    mHandler, future.getFuture(), mResetToggleFlagListener, false /* scaleUp */),
                    mHandler, future.getFuture(), null, false /* scaleUp */), future);
                    future);
        }
        }
    }
    }


@@ -1024,10 +991,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        launchState.launchedToTaskId = runningTaskId;
        launchState.launchedToTaskId = runningTaskId;
        launchState.launchedWithAltTab = mTriggeredFromAltTab;
        launchState.launchedWithAltTab = mTriggeredFromAltTab;


        // Disable toggling of recents between starting the activity and it is visible and the app
        // has started its transition into recents.
        setWaitingForTransitionStart(useThumbnailTransition);

        // Preload the icon (this will be a null-op if we have preloaded the icon already in
        // Preload the icon (this will be a null-op if we have preloaded the icon already in
        // preloadRecents())
        // preloadRecents())
        preloadIcon(runningTaskId);
        preloadIcon(runningTaskId);
+0 −7
Original line number Original line Diff line number Diff line
@@ -29,7 +29,6 @@ import com.android.systemui.EventLogTags;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
import com.android.systemui.recents.events.activity.DockedTopTaskEvent;
import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent;
import com.android.systemui.recents.events.component.SetWaitingForTransitionStartEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.recents.events.ui.RecentsDrawnEvent;
import com.android.systemui.recents.misc.ForegroundThread;
import com.android.systemui.recents.misc.ForegroundThread;


@@ -106,10 +105,4 @@ public class RecentsSystemUser extends IRecentsSystemUserCallbacks.Stub {
    public void sendLaunchRecentsEvent() throws RemoteException {
    public void sendLaunchRecentsEvent() throws RemoteException {
        EventBus.getDefault().post(new RecentsActivityStartingEvent());
        EventBus.getDefault().post(new RecentsActivityStartingEvent());
    }
    }

    @Override
    public void setWaitingForTransitionStartEvent(boolean waitingForTransitionStart) {
        EventBus.getDefault().post(new SetWaitingForTransitionStartEvent(
                waitingForTransitionStart));
    }
}
}
+0 −31
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.recents.events.component;

import com.android.systemui.recents.events.EventBus;

/**
 * This is sent when we are setting/resetting the flag to wait for the transition to start.
 */
public class SetWaitingForTransitionStartEvent extends EventBus.Event {

    public final boolean waitingForTransitionStart;

    public SetWaitingForTransitionStartEvent(boolean waitingForTransitionStart) {
        this.waitingForTransitionStart = waitingForTransitionStart;
    }
}
Loading