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

Commit 70147b09 authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Fix Accessibility Menu Window breaking gesture exclusion API

The gesture exclusion region set by the Accessibility Menu Window counts towards the global exclusion limit. With a few menu items, there is no gesture exclusion margin left to be used by apps.

To fix this, the PRIVATE_FLAG_UNRESTRICTED_GESTURE_EXCLUSION flag is set on the Accessibility Menu Window. This ensures that the exclusion region is not counted towards the global limit.

Additionally, this fixes the problem that the Accessibility Menu Window itself runs out of exclusion margin when it has many menu items. In that case, it's easy to trigger the back gesture when the intention is to drag the window.

Bug: 378425927
Test: Manual, i.e. verified that app's exclusion regions are unaffected by the presence of the Accessibility Menu. Also verified that dragging the Accessibility Menu never triggers the back gesture.
Flag: EXEMPT bugfix
Change-Id: I8f4171b92acfdeffd0e1bc383587320e15c9ef71
parent ee77c61a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -95,5 +95,6 @@
        <permission name="android.permission.START_FOREGROUND_SERVICES_FROM_BACKGROUND" />
        <permission name="android.permission.OVERRIDE_SYSTEM_KEY_BEHAVIOR_IN_FOCUSED_WINDOW"/>
        <permission name="android.permission.SUBSCRIBE_TO_KEYGUARD_LOCKED_STATE" />
        <permission name="android.permission.SET_UNRESTRICTED_GESTURE_EXCLUSION" />
    </privapp-permissions>
</permissions>
+3 −0
Original line number Diff line number Diff line
@@ -392,6 +392,9 @@
    <!-- To be able to decipher default applications for certain roles in shortcut helper -->
    <uses-permission android:name="android.permission.MANAGE_DEFAULT_APPLICATIONS" />

    <!-- To be able to set unrestricted system gesture exclusion rects -->
    <uses-permission android:name="android.permission.SET_UNRESTRICTED_GESTURE_EXCLUSION"/>

    <protected-broadcast android:name="com.android.settingslib.action.REGISTER_SLICE_RECEIVER" />
    <protected-broadcast android:name="com.android.settingslib.action.UNREGISTER_SLICE_RECEIVER" />
    <protected-broadcast android:name="com.android.settings.flashlight.action.FLASHLIGHT_CHANGED" />
+4 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.accessibility.floatingmenu;

import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_UNRESTRICTED_GESTURE_EXCLUSION;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;

import android.content.Context;
@@ -90,9 +91,11 @@ class MenuViewLayerController implements IAccessibilityFloatingMenu {
                WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
                PixelFormat.TRANSLUCENT);
        params.setTitle("FloatingMenu");
        params.receiveInsetsIgnoringZOrder = true;
        params.privateFlags |=
                PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION | SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
                PRIVATE_FLAG_EXCLUDE_FROM_SCREEN_MAGNIFICATION | SYSTEM_FLAG_SHOW_FOR_ALL_USERS
                        | PRIVATE_FLAG_UNRESTRICTED_GESTURE_EXCLUSION;
        params.windowAnimations = android.R.style.Animation_Translucent;
        // Insets are configured to allow the menu to display over navigation and system bars.
        params.setFitInsetsTypes(0);