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

Commit 1845e6f9 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by Android Build Coastguard Worker
Browse files

Add ALLOW_SLIPPERY_TOUCHES to make StatusBarTouchController slippery

LauncherActivity uses FLAG_SLIPPERY for certain interactions. For
example, when home screen is shown, and the user pulls down from not the
top of the screen, and notification shade is getting displayed, then the
touch should be getting transferred to the NotificationShade using
FLAG_SLIPPERY.

The newly introduced permission is added to launcher in order for this
flag to be applied to the window.

Bug: 206188649
Bug: 157929241
Test: reviewed logs, ensure that NexusLauncherActivity has FLAG_SLIPPERY
Test: re-ran the performance regression test
Merged-In: I8d05fa3663687b5382a59b0d47cdac404844c3b7
Change-Id: I8d05fa3663687b5382a59b0d47cdac404844c3b7
(cherry picked from commit 918776ee)
Merged-In:I8d05fa3663687b5382a59b0d47cdac404844c3b7
parent af648c78
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@
    <uses-permission android:name="android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS" />
    <uses-permission android:name="android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
    <uses-permission android:name="android.permission.ALLOW_SLIPPERY_TOUCHES"/>
    <uses-permission android:name="${packageName}.permission.HOTSEAT_EDU" />
    <uses-permission android:name="${packageName}.permission.HOTSEAT_EDU" />


    <application
    <application
+10 −11
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;
import static android.view.MotionEvent.ACTION_MOVE;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;


import android.graphics.PointF;
import android.graphics.PointF;
import android.util.SparseArray;
import android.util.SparseArray;
@@ -48,17 +49,6 @@ public class StatusBarTouchController implements TouchController {


    private static final String TAG = "StatusBarController";
    private static final String TAG = "StatusBarController";


    /**
     * Window flag: Enable touches to slide out of a window into neighboring
     * windows in mid-gesture instead of being captured for the duration of
     * the gesture.
     *
     * This flag changes the behavior of touch focus for this window only.
     * Touches can slide out of the window but they cannot necessarily slide
     * back in (unless the other window with touch focus permits it).
     */
    private static final int FLAG_SLIPPERY = 0x20000000;

    private final Launcher mLauncher;
    private final Launcher mLauncher;
    private final SystemUiProxy mSystemUiProxy;
    private final SystemUiProxy mSystemUiProxy;
    private final float mTouchSlop;
    private final float mTouchSlop;
@@ -142,6 +132,15 @@ public class StatusBarTouchController implements TouchController {
        return true;
        return true;
    }
    }


    /**
     * FLAG_SLIPPERY enables touches to slide out of a window into neighboring
     * windows in mid-gesture instead of being captured for the duration of
     * the gesture.
     *
     * This flag changes the behavior of touch focus for this window only.
     * Touches can slide out of the window but they cannot necessarily slide
     * back in (unless the other window with touch focus permits it).
     */
    private void setWindowSlippery(boolean enable) {
    private void setWindowSlippery(boolean enable) {
        Window w = mLauncher.getWindow();
        Window w = mLauncher.getWindow();
        WindowManager.LayoutParams wlp = w.getAttributes();
        WindowManager.LayoutParams wlp = w.getAttributes();