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
This commit is contained in:
Fabian Kozynski
2022-10-10 14:34:39 -04:00
parent 3348d7197b
commit 68f0db18e4
3 changed files with 28 additions and 0 deletions

View File

@@ -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 =

View File

@@ -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() {

View File

@@ -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 {