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

Commit e9f31c10 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Using correct window bounds in multi-window for fallback activity" into ub-launcher3-master

parents 2cb5bddd 3477804c
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.views.LauncherLayoutListener;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;

import java.util.function.BiPredicate;

@@ -92,6 +93,10 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
    @UiThread
    boolean switchToRecentsIfVisible();

    Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target);

    boolean shouldMinimizeSplitScreen();

    /**
     * @return {@code true} if recents activity should be started immediately on touchDown,
     *         {@code false} if it should deferred until some threshold is crossed.
@@ -260,6 +265,16 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
        public boolean deferStartingActivity(int downHitTarget) {
            return downHitTarget == HIT_TARGET_BACK;
        }

        @Override
        public Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target) {
            return homeBounds;
        }

        @Override
        public boolean shouldMinimizeSplitScreen() {
            return true;
        }
    }

    class FallbackActivityControllerHelper implements ActivityControlHelper<RecentsActivity> {
@@ -377,6 +392,18 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
            // Always defer starting the activity when using fallback
            return true;
        }

        @Override
        public Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target) {
            // TODO: Remove this once b/77875376 is fixed
            return target.sourceContainerBounds;
        }

        @Override
        public boolean shouldMinimizeSplitScreen() {
            // TODO: Remove this once b/77875376 is fixed
            return false;
        }
    }

    interface LayoutListener {
+2 −2
Original line number Diff line number Diff line
@@ -98,7 +98,6 @@ public class RecentsActivity extends BaseDraggingActivity {

    @Override
    public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
        mOldConfig.setTo(newConfig);
        onHandleConfigChanged();
        super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
    }
@@ -129,7 +128,8 @@ public class RecentsActivity extends BaseDraggingActivity {
            InvariantDeviceProfile idp = appState == null
                    ? new InvariantDeviceProfile(this) : appState.getInvariantDeviceProfile();
            DeviceProfile dp = idp.getDeviceProfile(this);
            mDeviceProfile = dp.getMultiWindowProfile(this, mRecentsRootView.getLastKnownSize());
            mDeviceProfile = mRecentsRootView == null ? dp.copy(this)
                    : dp.getMultiWindowProfile(this, mRecentsRootView.getLastKnownSize());
        } else {
            // If we are reusing the Invariant device profile, make a copy.
            mDeviceProfile = appState == null
+9 −5
Original line number Diff line number Diff line
@@ -459,7 +459,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
                    // TODO: This logic is spartanic!
                    boolean passedThreshold = shift > 0.12f;
                    mRecentsAnimationWrapper.setAnimationTargetsBehindSystemBars(!passedThreshold);
                    mRecentsAnimationWrapper.setSplitScreenMinimizedForTransaction(passedThreshold);
                    if (mActivityControlHelper.shouldMinimizeSplitScreen()) {
                        mRecentsAnimationWrapper
                                .setSplitScreenMinimizedForTransaction(passedThreshold);
                    }
                }
            };
            if (Looper.getMainLooper() == Looper.myLooper()) {
@@ -478,15 +481,16 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
            for (RemoteAnimationTargetCompat target : apps) {
                if (target.mode == MODE_CLOSING) {
                    DeviceProfile dp = LauncherAppState.getIDP(mContext).getDeviceProfile(mContext);
                    final Rect homeStackBounds;
                    final Rect overviewStackBounds;

                    if (minimizedHomeBounds != null) {
                        homeStackBounds = minimizedHomeBounds;
                        overviewStackBounds = mActivityControlHelper
                                .getOverviewWindowBounds(minimizedHomeBounds, target);
                        dp = dp.getMultiWindowProfile(mContext,
                                new Point(minimizedHomeBounds.width(), minimizedHomeBounds.height()));
                        dp.updateInsets(homeContentInsets);
                    } else {
                        homeStackBounds = new Rect(0, 0, dp.widthPx, dp.heightPx);
                        overviewStackBounds = new Rect(0, 0, dp.widthPx, dp.heightPx);
                        // TODO: Workaround for an existing issue where the home content insets are
                        // not valid immediately after rotation, just use the stable insets for now
                        Rect insets = new Rect();
@@ -495,7 +499,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
                        dp.updateInsets(insets);
                    }

                    mClipAnimationHelper.updateSource(homeStackBounds, target);
                    mClipAnimationHelper.updateSource(overviewStackBounds, target);
                    initTransitionEndpoints(dp);
                }
            }
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ public class RecentsRootView extends BaseDragLayer<RecentsActivity> {
    }

    public void dispatchInsets() {
        mActivity.getDeviceProfile().updateInsets(mInsets);
        super.setInsets(mInsets);
    }
}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ public class LauncherRootView extends InsettableFrameLayout {
    }

    public void dispatchInsets() {
        mLauncher.getDeviceProfile().updateInsets(mInsets);
        super.setInsets(mInsets);
    }