summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author archichomal <archichomal@google.com> 2022-11-15 07:22:50 +0000
committer Archi Chomal <archichomal@google.com> 2022-11-18 05:31:07 +0000
commitccf777740711f8df8437e6ffbb2a2b5bd17c0632 (patch)
treec6b7cf90cdd2eb2efe69acd3edae7b70b0abf716
parente842874d979002a64f39f1778fb98109479cbb56 (diff)
QR Code Scanner tile says "Updating" when GMSCORE is updating
Bug: 257230676 It included changing the QR scanner Tile text to say updating when the GMS core is being updated and the tile is unavailable for the time being. Change-Id: Ifb6b3d5dae884de8d93ec8f21f323cef168c1937
-rw-r--r--packages/SystemUI/res/values/strings.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java4
3 files changed, 11 insertions, 0 deletions
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index db42543b3e82..bfc215a3a004 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1313,6 +1313,9 @@
<!-- QR Code Scanner label, title [CHAR LIMIT=32] -->
<string name="qr_code_scanner_title">QR code scanner</string>
+ <!-- QR Code Scanner Secondary label when GMS Core is Updating -->
+ <string name="qr_code_scanner_updating_secondary_label">Updating</string>
+
<!-- Name of the work status bar icon. -->
<string name="status_bar_work">Work profile</string>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java
index 376d3d8da8e7..8da7b0af060c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/QRCodeScannerTile.java
@@ -117,6 +117,10 @@ public class QRCodeScannerTile extends QSTileImpl<QSTile.State> {
state.icon = ResourceIcon.get(R.drawable.ic_qr_code_scanner);
state.state = mQRCodeScannerController.isEnabledForQuickSettings() ? Tile.STATE_INACTIVE
: Tile.STATE_UNAVAILABLE;
+ // The assumption is that if the OEM has the QR code scanner module enabled then the scanner
+ // would go to "Unavailable" state only when GMS core is updating.
+ state.secondaryLabel = state.state == Tile.STATE_UNAVAILABLE
+ ? mContext.getString(R.string.qr_code_scanner_updating_secondary_label) : null;
}
@Override
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java
index cac90a14096e..e6add216177a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QRCodeScannerTileTest.java
@@ -18,6 +18,7 @@ package com.android.systemui.qs.tiles;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNull;
import static org.mockito.Mockito.when;
@@ -112,6 +113,8 @@ public class QRCodeScannerTileTest extends SysuiTestCase {
QSTile.State state = new QSTile.State();
mTile.handleUpdateState(state, null);
assertEquals(state.state, Tile.STATE_UNAVAILABLE);
+ assertEquals(state.secondaryLabel.toString(),
+ mContext.getString(R.string.qr_code_scanner_updating_secondary_label));
}
@Test
@@ -120,5 +123,6 @@ public class QRCodeScannerTileTest extends SysuiTestCase {
QSTile.State state = new QSTile.State();
mTile.handleUpdateState(state, null);
assertEquals(state.state, Tile.STATE_INACTIVE);
+ assertNull(state.secondaryLabel);
}
}