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

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

Merge "Add more controls for launcher to control sysui"

parents 107ca33d 8f25fb96
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -44,4 +44,9 @@ interface ISystemUiProxy {
     * Specifies the text to be shown for onboarding the new swipe-up gesture to access recents.
     */
    void setRecentsOnboardingText(CharSequence text);

    /**
     * Enables/disables launcher/overview interaction features {@link InteractionType}.
     */
    void setInteractionState(int flags);
}
+29 −0
Original line number Diff line number Diff line
@@ -28,4 +28,33 @@ public class NavigationBarCompat {
    public static final int HIT_TARGET_NONE = 0;
    public static final int HIT_TARGET_BACK = 1;
    public static final int HIT_TARGET_HOME = 2;

    @Retention(RetentionPolicy.SOURCE)
    @IntDef({FLAG_DISABLE_SWIPE_UP,
            FLAG_DISABLE_QUICK_SCRUB,
            FLAG_SHOW_OVERVIEW_BUTTON,
            FLAG_HIDE_BACK_BUTTON
    })
    public @interface InteractionType {}

    /**
     * Interaction type: whether the gesture to swipe up from the navigation bar will trigger
     * launcher to show overview
     */

    public static final int FLAG_DISABLE_SWIPE_UP = 0x1;
    /**
     * Interaction type: enable quick scrub and switch interaction on the home button
     */
    public static final int FLAG_DISABLE_QUICK_SCRUB = 0x2;

    /**
     * Interaction type: show/hide the overview button while this service is connected to launcher
     */
    public static final int FLAG_SHOW_OVERVIEW_BUTTON = 0x4;

    /**
     * Interaction type: show/hide the back button while this service is connected to launcher
     */
    public static final int FLAG_HIDE_BACK_BUTTON = 0x8;
}
+24 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;

/**
 * Class to send information from overview to launcher with a binder.
 */
@@ -67,6 +69,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    private IOverviewProxy mOverviewProxy;
    private int mConnectionBackoffAttempts;
    private CharSequence mOnboardingText;
    private @InteractionType int mInteractionFlags;

    private ISystemUiProxy mSysUiProxy = new ISystemUiProxy.Stub() {

@@ -108,6 +111,22 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        public void setRecentsOnboardingText(CharSequence text) {
            mOnboardingText = text;
        }

        public void setInteractionState(@InteractionType int flags) {
            long token = Binder.clearCallingIdentity();
            try {
                if (mInteractionFlags != flags) {
                    mInteractionFlags = flags;
                    mHandler.post(() -> {
                        for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
                            mConnectionCallbacks.get(i).onInteractionFlagsChanged(flags);
                        }
                    });
                }
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }
    };

    private final BroadcastReceiver mLauncherAddedReceiver = new BroadcastReceiver() {
@@ -230,6 +249,10 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
        return mOnboardingText;
    }

    public int getInteractionFlags() {
        return mInteractionFlags;
    }

    private void disconnectFromLauncherService() {
        if (mOverviewProxy != null) {
            mOverviewProxy.asBinder().unlinkToDeath(mOverviewServiceDeathRcpt, 0);
@@ -263,5 +286,6 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
    public interface OverviewProxyListener {
        default void onConnectionChanged(boolean isConnected) {}
        default void onRecentsAnimationStarted() {}
        default void onInteractionFlagsChanged(@InteractionType int flags) {}
    }
}
+6 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SHOWN;
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.windowStateToString;

import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType;
import static com.android.systemui.statusbar.phone.BarTransitions.MODE_SEMI_TRANSPARENT;
import static com.android.systemui.statusbar.phone.StatusBar.DEBUG_WINDOW_STATE;
import static com.android.systemui.statusbar.phone.StatusBar.dumpBarTransitions;
@@ -71,7 +72,6 @@ import android.view.WindowManagerGlobal;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener;
import android.widget.Button;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -165,6 +165,11 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
        public void onRecentsAnimationStarted() {
            mNavigationBarView.setRecentsAnimationStarted(true);
        }

        @Override
        public void onInteractionFlagsChanged(@InteractionType int flags) {
            mNavigationBarView.updateStates();
        }
    };

    // ----- Fragment Lifecycle Callbacks -----
+2 −2
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture

    private boolean proxyMotionEvents(MotionEvent event) {
        final IOverviewProxy overviewProxy = mOverviewProxyService.getProxy();
        if (overviewProxy != null) {
        if (overviewProxy != null && mNavigationBarView.isQuickStepSwipeUpEnabled()) {
            mNavigationBarView.requestUnbufferedDispatch(event);
            event.transform(mTransformGlobalMatrix);
            try {
@@ -192,7 +192,7 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture
    }

    public void onDraw(Canvas canvas) {
        if (mOverviewProxyService.getProxy() != null) {
        if (mNavigationBarView.isQuickScrubEnabled()) {
            mQuickScrubController.onDraw(canvas);
        }
    }
Loading