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

Commit 68f0db18 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Fix privacy indicators in QQS with new headers

With the new headers, when in QQS the privacy indicators were not
clickable. This was due to two things:

* We were not indicating to the controller that the parent was visible,
  which is what attaches the click listener. This was only happening
  after the first time the device went to a large screen config. This CL
  makes sure that with combined headers, it's always marked as visible.
* With combined, we touches in the header were being intercepted by
  QSBH, but there's nothing there (margin for QQS). That's because
  QSFragment is preferred to other NPV views. Instead, do not handle the
  touch if the combined headers flag is on enabled and the touch is not
  in QQS.

Test: atest LargeScreenShadeHeaderControllerCombinedTest
Test: Cts tests that check for privacy indicators and dialog
Test: manual
Fixes: 252791648
Change-Id: I836bdfb01284ca38ca6963996d36589005a4d416
parent 3348d719
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.DisplayCutout;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
@@ -231,6 +232,16 @@ public class QuickStatusBarHeader extends FrameLayout {
        }
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        // If using combined headers, only react to touches inside QuickQSPanel
        if (!mUseCombinedQSHeader || event.getY() > mHeaderQsPanel.getTop()) {
            return super.onTouchEvent(event);
        } else {
            return false;
        }
    }

    void updateResources() {
        Resources resources = mContext.getResources();
        boolean largeScreenHeaderActive =
+3 −0
Original line number Diff line number Diff line
@@ -280,6 +280,9 @@ class LargeScreenShadeHeaderController @Inject constructor(
                    context.getString(com.android.internal.R.string.status_bar_alarm_clock)
            )
        }
        if (combinedHeaders) {
            privacyIconsController.onParentVisible()
        }
    }

    override fun onViewAttached() {
+14 −0
Original line number Diff line number Diff line
@@ -645,6 +645,20 @@ class LargeScreenShadeHeaderControllerCombinedTest : SysuiTestCase() {
        verify(animator).start()
    }

    @Test
    fun privacyChipParentVisibleFromStart() {
        verify(privacyIconsController).onParentVisible()
    }

    @Test
    fun privacyChipParentVisibleAlways() {
        controller.largeScreenActive = true
        controller.largeScreenActive = false
        controller.largeScreenActive = true

        verify(privacyIconsController, never()).onParentInvisible()
    }

    private fun createWindowInsets(
        topCutout: Rect? = Rect()
    ): WindowInsets {