diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 5086cd706f485..3e7b0f146b392 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1321,6 +1321,9 @@ QR code scanner + + Updating + Work profile 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 1a24af10ab088..6d50b562cd02a 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 { state.icon = ResourceIcon.get(R.drawable.ic_qr_code_scanner); state.state = mQRCodeScannerController.isAbleToOpenCameraApp() ? 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 6a3f785e1d52d..a1be2f3ac8def 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); } }