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

Commit 22120b08 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Sending NavbarSurfaceControl to Recents

Also removing some unused methods from the aidl interface

Bug: 193244407
Test: Presubmit
Change-Id: Ia13c09be93b45cd47fa3350630a2a4dc37e8756b
parent eaf2dc07
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.graphics.Rect;
import android.graphics.Region;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.SurfaceControl;
import com.android.systemui.shared.recents.ISystemUiProxy;

oneway interface IOverviewProxy {
@@ -43,12 +44,6 @@ oneway interface IOverviewProxy {
     */
    void onOverviewHidden(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) = 8;

    /**
     * Sent when there was an action on one of the onboarding tips view.
     * TODO: Move this implementation to SystemUI completely
     */
    void onTip(int actionType, int viewType) = 10;

    /**
     * Sent when device assistant changes its default assistant whether it is available or not.
     */
@@ -59,13 +54,6 @@ oneway interface IOverviewProxy {
     */
    void onAssistantVisibilityChanged(float visibility) = 14;

    /**
     * Sent when back is triggered.
     * TODO: Move this implementation to SystemUI completely
     */
    void onBackAction(boolean completed, int downX, int downY, boolean isButton,
            boolean gestureSwipeLeft) = 15;

    /**
     * Sent when some system ui state changes.
     */
@@ -115,4 +103,9 @@ oneway interface IOverviewProxy {
      * Sent when split keyboard shortcut is triggered to enter stage split.
      */
     void enterStageSplitFromRunningApp(boolean leftOrTop) = 25;

     /**
      * Sent when the surface for navigation bar is created or changed
      */
     void onNavigationBarSurface(in SurfaceControl surface) = 26;
}
+0 −3
Original line number Diff line number Diff line
@@ -106,9 +106,6 @@ interface ISystemUiProxy {
    /** Sets home rotation enabled. */
    void setHomeRotationEnabled(boolean enabled) = 45;

    /** Notifies that a swipe-up gesture has started */
    oneway void notifySwipeUpGestureStarted() = 46;

    /** Notifies when taskbar status updated */
    oneway void notifyTaskbarStatus(boolean visible, boolean stashed) = 47;

+34 −9
Original line number Diff line number Diff line
@@ -85,7 +85,11 @@ import android.view.InsetsVisibilities;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.view.View;
import android.view.ViewRootImpl;
import android.view.ViewRootImpl.SurfaceChangedCallback;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.InternalInsetsInfo;
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
@@ -353,15 +357,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            updateScreenPinningGestures();
        }

        @Override
        public void onQuickStepStarted() {
            // Use navbar dragging as a signal to hide the rotate button
            mView.getRotationButtonController().setRotateSuggestionButtonState(false);

            // Hide the notifications panel when quick step starts
            mShadeController.collapsePanel(true /* animate */);
        }

        @Override
        public void onPrioritizedRotation(@Surface.Rotation int rotation) {
            mStartingQuickSwitchRotation = rotation;
@@ -475,6 +470,24 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
                }
            };

    private final ViewRootImpl.SurfaceChangedCallback mSurfaceChangedCallback =
            new SurfaceChangedCallback() {
            @Override
            public void surfaceCreated(Transaction t) {
                notifyNavigationBarSurface();
            }

            @Override
            public void surfaceDestroyed() {
                notifyNavigationBarSurface();
            }

            @Override
            public void surfaceReplaced(Transaction t) {
                notifyNavigationBarSurface();
            }
    };

    @Inject
    NavigationBar(
            NavigationBarView navigationBarView,
@@ -701,6 +714,8 @@ public class NavigationBar extends ViewController<NavigationBarView> implements

        mView.getViewTreeObserver().addOnComputeInternalInsetsListener(
                mOnComputeInternalInsetsListener);
        mView.getViewRootImpl().addSurfaceChangedCallback(mSurfaceChangedCallback);
        notifyNavigationBarSurface();

        mNavBarHelper.registerNavTaskStateUpdater(mNavbarTaskbarStateUpdater);

@@ -779,6 +794,10 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        mHandler.removeCallbacks(mEnableLayoutTransitions);
        mNavBarHelper.removeNavTaskStateUpdater(mNavbarTaskbarStateUpdater);
        mPipOptional.ifPresent(mView::removePipExclusionBoundsChangeListener);
        ViewRootImpl viewRoot = mView.getViewRootImpl();
        if (viewRoot != null) {
            viewRoot.removeSurfaceChangedCallback(mSurfaceChangedCallback);
        }
        mFrame = null;
        mOrientationHandle = null;
    }
@@ -932,6 +951,12 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        }
    }

    private void notifyNavigationBarSurface() {
        ViewRootImpl viewRoot = mView.getViewRootImpl();
        SurfaceControl surface = viewRoot != null ? viewRoot.getSurfaceControl() : null;
        mOverviewProxyService.onNavigationBarSurfaceChanged(surface);
    }

    private int deltaRotation(int oldRotation, int newRotation) {
        int delta = newRotation - oldRotation;
        if (delta < 0) delta += 4;
+0 −4
Original line number Diff line number Diff line
@@ -412,10 +412,6 @@ public class KeyButtonView extends ImageView implements ButtonInterface {
        logSomePresses(action, flags);
        if (mCode == KeyEvent.KEYCODE_BACK && flags != KeyEvent.FLAG_LONG_PRESS) {
            Log.i(TAG, "Back button event: " + KeyEvent.actionToString(action));
            if (action == MotionEvent.ACTION_UP) {
                mOverviewProxyService.notifyBackAction((flags & KeyEvent.FLAG_CANCELED) == 0,
                        -1, -1, true /* isButton */, false /* gestureSwipeLeft */);
            }
        }
        final int repeatCount = (flags & KeyEvent.FLAG_LONG_PRESS) != 0 ? 1 : 0;
        final KeyEvent ev = new KeyEvent(mDownTime, when, action, mCode, repeatCount,
+0 −7
Original line number Diff line number Diff line
@@ -287,8 +287,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
                        mBackAnimation.setTriggerBack(true);
                    }

                    mOverviewProxyService.notifyBackAction(true, (int) mDownPoint.x,
                            (int) mDownPoint.y, false /* isButton */, !mIsOnLeftEdge);
                    logGesture(mInRejectedExclusion
                            ? SysUiStatsLog.BACK_GESTURE__TYPE__COMPLETED_REJECTED
                            : SysUiStatsLog.BACK_GESTURE__TYPE__COMPLETED);
@@ -300,8 +298,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
                        mBackAnimation.setTriggerBack(false);
                    }
                    logGesture(SysUiStatsLog.BACK_GESTURE__TYPE__INCOMPLETE);
                    mOverviewProxyService.notifyBackAction(false, (int) mDownPoint.x,
                            (int) mDownPoint.y, false /* isButton */, !mIsOnLeftEdge);
                }

                @Override
@@ -785,9 +781,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker

        if (mExcludeRegion.contains(x, y)) {
            if (withinRange) {
                // Log as exclusion only if it is in acceptable range in the first place.
                mOverviewProxyService.notifyBackAction(
                        false /* completed */, -1, -1, false /* isButton */, !mIsOnLeftEdge);
                // We don't have the end point for logging purposes.
                mEndPoint.x = -1;
                mEndPoint.y = -1;
Loading