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

Commit d4334fa7 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5778831 from fc3678b2 to rvc-release

Change-Id: I7fb44885232f494eef610bb1805684185129c0cf
parents c043905e fc3678b2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -188,9 +188,9 @@ public class RecentsAnimationWrapper {
        return true;
    }

    public void setCancelWithDeferredScreenshot(boolean deferredWithScreenshot) {
    public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) {
        if (targetSet != null) {
            targetSet.controller.setCancelWithDeferredScreenshot(deferredWithScreenshot);
            targetSet.controller.setDeferCancelUntilNextTransition(defer, screenshot);
        }
    }

+30 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_H
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_ASSISTANT;
@@ -68,6 +69,7 @@ import android.view.WindowManager;

import androidx.annotation.BinderThread;
import androidx.annotation.UiThread;
import androidx.annotation.WorkerThread;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.MainThreadExecutor;
@@ -145,6 +147,11 @@ public class TouchInteractionService extends Service implements

    private static final String TAG = "TouchInteractionService";

    private static final String KEY_BACK_NOTIFICATION_COUNT = "backNotificationCount";
    private static final String NOTIFY_ACTION_BACK = "com.android.quickstep.action.BACK_GESTURE";
    private static final int MAX_BACK_NOTIFICATION_COUNT = 3;
    private int mBackGestureNotificationCounter = -1;

    private final IBinder mMyBinder = new IOverviewProxy.Stub() {

        public void onActiveNavBarRegionChanges(Region region) {
@@ -205,6 +212,10 @@ public class TouchInteractionService extends Service implements
                    mOverviewComponentObserver.getActivityControlHelper();
            UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY,
                    isButton, gestureSwipeLeft, activityControl.getContainerType());

            if (completed && !isButton && shouldNotifyBackGesture()) {
                BACKGROUND_EXECUTOR.execute(TouchInteractionService.this::tryNotifyBackGesture);
            }
        }

        public void onSystemUiStateChanged(int stateFlags) {
@@ -479,6 +490,8 @@ public class TouchInteractionService extends Service implements

        // Temporarily disable model preload
        // new ModelPreload().start(this);
        mBackGestureNotificationCounter = Math.max(0, Utilities.getDevicePrefs(this)
                .getInt(KEY_BACK_NOTIFICATION_COUNT, MAX_BACK_NOTIFICATION_COUNT));

        Utilities.unregisterReceiverSafely(this, mUserUnlockedReceiver);
    }
@@ -569,6 +582,7 @@ public class TouchInteractionService extends Service implements
    private boolean validSystemUiFlags() {
        return (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0
                && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0
                && (mSystemUiStateFlags & SYSUI_STATE_QUICK_SETTINGS_EXPANDED) == 0
                && ((mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0
                        || (mSystemUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0);
    }
@@ -864,6 +878,22 @@ public class TouchInteractionService extends Service implements
                mRecentsModel, mInputConsumer, isLikelyToStartNewTask, continuingLastGesture);
    }

    protected boolean shouldNotifyBackGesture() {
        return mBackGestureNotificationCounter > 0 &&
                mGestureBlockingActivity != null;
    }

    @WorkerThread
    protected void tryNotifyBackGesture() {
        if (shouldNotifyBackGesture()) {
            mBackGestureNotificationCounter--;
            Utilities.getDevicePrefs(this).edit()
                    .putInt(KEY_BACK_NOTIFICATION_COUNT, mBackGestureNotificationCounter).apply();
            sendBroadcast(new Intent(NOTIFY_ACTION_BACK).setPackage(
                    mGestureBlockingActivity.getPackageName()));
        }
    }

    public static void startRecentsActivityAsync(Intent intent, RecentsAnimationListener listener) {
        BACKGROUND_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
                .startRecentsActivity(intent, null, listener, null, null));
+2 −1
Original line number Diff line number Diff line
@@ -1186,7 +1186,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
    private void setupLauncherUiAfterSwipeUpToRecentsAnimation() {
        endLauncherTransitionController();
        mActivityControlHelper.onSwipeUpToRecentsComplete(mActivity);
        mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true);
        mRecentsAnimationWrapper.setDeferCancelUntilNextTransition(true /* defer */,
                true /* screenshot */);
        mRecentsView.onSwipeUpAnimationSuccess();

        RecentsModel.INSTANCE.get(mContext).onOverviewShown(false, TAG);
+3 −1
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.util.ObjectWrapper;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.SwipeAnimationTargetSet;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -335,7 +336,8 @@ public class FallbackNoButtonInputConsumer extends

                ThumbnailData thumbnail =
                        mRecentsAnimationWrapper.targetSet.controller.screenshotTask(mRunningTaskId);
                mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true);
                mRecentsAnimationWrapper.setDeferCancelUntilNextTransition(true /* defer */,
                        false /* screenshot */);

                ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0);
                ActivityOptionsCompat.setFreezeRecentTasksList(options);
+5 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.util.ArraySet;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.Preconditions;
import com.android.quickstep.util.SwipeAnimationTargetSet.SwipeAnimationListener;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
import com.android.systemui.shared.system.RecentsAnimationListener;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -39,7 +40,7 @@ import androidx.annotation.UiThread;
public class RecentsAnimationListenerSet implements RecentsAnimationListener {

    // The actual app surface is replaced by a screenshot upon recents animation cancelation when
    // deferredWithScreenshot is true. Launcher takes the responsibility to clean up this screenshot
    // the thumbnailData exists. Launcher takes the responsibility to clean up this screenshot
    // after app transition is finished. This delay is introduced to cover the app transition
    // period of time.
    private final int TRANSITION_DELAY = 100;
@@ -90,14 +91,14 @@ public class RecentsAnimationListenerSet implements RecentsAnimationListener {
    }

    @Override
    public final void onAnimationCanceled(boolean deferredWithScreenshot) {
    public final void onAnimationCanceled(ThumbnailData thumbnailData) {
        Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), () -> {
            for (SwipeAnimationListener listener : getListeners()) {
                listener.onRecentsAnimationCanceled();
            }
        });
        // TODO: handle the transition better instead of simply using a transition delay.
        if (deferredWithScreenshot) {
        if (thumbnailData != null) {
            MAIN_THREAD_EXECUTOR.getHandler().postDelayed(() -> mController.cleanupScreenshot(),
                    TRANSITION_DELAY);
        }
@@ -109,6 +110,6 @@ public class RecentsAnimationListenerSet implements RecentsAnimationListener {

    public void cancelListener() {
        mCancelled = true;
        onAnimationCanceled(false);
        onAnimationCanceled(null);
    }
}
Loading