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

Commit a6a58127 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Using input monitor for edge swipe handling for back

Bug: 112934365
Bug: 124299674
Bug: 124298541
Test: Verified build on device
Change-Id: Ic4cc4339b22aee63b0d96587f05dae3d8c01563f
parent 89df2a72
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@
    <uses-permission android:name="android.permission.REGISTER_WINDOW_MANAGER_LISTENERS" />
    <uses-permission android:name="android.permission.SET_ORIENTATION" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name="android.permission.MONITOR_INPUT" />

    <!-- DreamManager -->
    <uses-permission android:name="android.permission.READ_DREAM_STATE" />
+8 −0
Original line number Diff line number Diff line
@@ -38,6 +38,14 @@
    <dimen name="navigation_handle_sample_horizontal_margin">10dp</dimen>
    <dimen name="navigation_home_handle_width">72dp</dimen>


    <!-- Size of the nav bar edge panels, should be greater to the
         edge sensitivity + the drag threshold -->
    <dimen name="navigation_edge_panel_width">52dp</dimen>
    <dimen name="navigation_edge_panel_height">52dp</dimen>
    <!-- The threshold to drag to trigger the edge action -->
    <dimen name="navigation_edge_action_drag_threshold">16dp</dimen>

    <!-- Luminance threshold to determine black/white contrast for the navigation affordances -->
    <item name="navigation_luminance_threshold" type="dimen" format="float">0.5</item>
    <!-- Luminance change threshold that allows applying new value if difference was exceeded -->
+5 −0
Original line number Diff line number Diff line
@@ -92,4 +92,9 @@ interface ISystemUiProxy {
     * Start the assistant.
     */
    void startAssistant(in Bundle bundle) = 13;

    /**
     * Creates a new gesture monitor
     */
    Bundle monitorGestureInput(String name, int displayId) = 14;
}
+66 −0
Original line number Diff line number Diff line
/*
/**
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,42 +13,54 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.systemui.shared.system;

package com.android.systemui.statusbar.phone;

import android.annotation.NonNull;
import android.os.Bundle;
import android.view.MotionEvent;
import android.os.Looper;
import android.view.Choreographer;
import android.view.InputMonitor;

import com.android.systemui.assist.AssistManager;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.shared.system.InputChannelCompat.InputEventListener;
import com.android.systemui.shared.system.InputChannelCompat.InputEventReceiver;

/**
 * Assistant is triggered with this action
 * @see android.view.InputMonitor
 */
public class NavigationAssistantAction extends NavigationGestureAction {
    private static final String TAG = "NavigationAssistantActions";
public class InputMonitorCompat {

    private final InputMonitor mInputMonitor;

    private final AssistManager mAssistManager;
    private InputMonitorCompat(InputMonitor monitor) {
        mInputMonitor = monitor;
    }

    public NavigationAssistantAction(@NonNull NavigationBarView navigationBarView,
            @NonNull OverviewProxyService service, AssistManager assistManager) {
        super(navigationBarView, service);
        mAssistManager = assistManager;
    /**
     * @see InputMonitor#pilferPointers()
     */
    public void pilferPointers() {
        mInputMonitor.pilferPointers();
    }

    @Override
    public boolean isEnabled() {
        return true;
    /**
     * @see InputMonitor#dispose()
     */
    public void dispose() {
        mInputMonitor.dispose();
    }

    @Override
    public boolean disableProxyEvents() {
        return true;
    /**
     * @see InputMonitor#getInputChannel()
     */
    public InputEventReceiver getInputReceiver(Looper looper, Choreographer choreographer,
            InputEventListener listener) {
        return new InputEventReceiver(mInputMonitor.getInputChannel(), looper, choreographer,
                listener);
    }

    @Override
    public void onGestureStart(MotionEvent event) {
        mAssistManager.startAssist(new Bundle());
    /**
     * Gets the input monitor stored in a bundle
     */
    public static InputMonitorCompat fromBundle(Bundle bundle, String key) {
        return new InputMonitorCompat((InputMonitor) bundle.getParcelable(key));
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ public class QuickStepContract {

    public static final String KEY_EXTRA_SYSUI_PROXY = "extra_sysui_proxy";
    public static final String KEY_EXTRA_INPUT_CHANNEL = "extra_input_channel";
    public static final String KEY_EXTRA_INPUT_MONITOR = "extra_input_monitor";
    public static final String KEY_EXTRA_WINDOW_CORNER_RADIUS = "extra_window_corner_radius";
    public static final String KEY_EXTRA_SUPPORTS_WINDOW_CORNERS = "extra_supports_window_corners";

Loading