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

Commit a5fa5796 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB] Don't do any custom touch handling in StatusBarWindowView.

StatusBarWindowView#dispatchTouchEvent was originally added for visual
immersive mode so that you could swipe down from the top of the screen
once to open the shade. However:

1) That user interaction still works even without the custom
dispatchTouchEvent logic.

2) That behavior is causing a problem with one-handed mode, where touching
a chip in the status bar doesn't do anything because StatusBarWindowView
is changing the `y` value of the MotionEvent to be `0`, which is outside
the region of the chip.

This CL just removes the custom StatusBarWindowView#dispatchTouchEvent
if a flag is on.

Bug: 391894499
Flag: com.android.systemui.status_bar_window_no_custom_touch
Test: In one-handed mode, have a status bar chip and touch it -> verify
the chip tap behavior occurs
Test: In visual immersive mode (e.g. viewing a photo), swipe down once
from the top of the screen -> verify the shade opens

Change-Id: I4d272aaad2f0c746b13491fa38fe603ef1d678f4
parent fcf9d086
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -541,6 +541,16 @@ flag {
  is_fixed_read_only: true
}

flag {
    name: "status_bar_window_no_custom_touch"
    namespace: "systemui"
    description: "Don't have any custom touch handling in StatusBarWindowView"
    bug: "391894499"
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "icon_refresh_2025"
    namespace: "systemui"
+7 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.android.systemui.Flags;
import com.android.systemui.compose.ComposeInitializer;
import com.android.systemui.statusbar.core.StatusBarRootModernization;
import com.android.systemui.statusbar.data.repository.StatusBarConfigurationController;
@@ -117,9 +118,15 @@ public class StatusBarWindowView extends FrameLayout {
     * bound of the status bar view, in order for the touch event to be correctly dispatched down,
     * we jot down the position Y of the initial touch down event, offset it to 0 in the y-axis,
     * and calculate the movement based on first touch down position.
     *
     * TODO(b/391894499): Remove this doc once Flags.statusBarWindowNoCustomTouch() is rolled out.
     */
    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        if (Flags.statusBarWindowNoCustomTouch()) {
            return super.dispatchTouchEvent(ev);
        }

        if (ev.getAction() == ACTION_DOWN && ev.getRawY() > getHeight()) {
            mTouchDownY = ev.getRawY();
            ev.setLocation(ev.getRawX(), mTopInset);