Loading packages/SystemUI/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" --> <string name="quick_settings_tiles_stock" translatable="false"> wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,controls,screenrecord wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord </string> <!-- The tiles to display in QuickSettings --> Loading packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java +1 −1 Original line number Diff line number Diff line Loading @@ -274,8 +274,8 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D try { tile = createTile(tileSpec); if (tile != null) { if (tile.isAvailable()) { tile.setTileSpec(tileSpec); if (tile.isAvailable()) { newTiles.put(tileSpec, tile); mQSLogger.logTileAdded(tileSpec); } else { Loading packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import static junit.framework.Assert.assertTrue; import static junit.framework.TestCase.assertFalse; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading Loading @@ -137,6 +139,8 @@ public class QSTileHostTest extends SysuiTestCase { return new TestTile1(mQSTileHost); } else if ("spec2".equals(spec)) { return new TestTile2(mQSTileHost); } else if ("na".equals(spec)) { return new NotAvailableTile(mQSTileHost); } else if (CUSTOM_TILE_SPEC.equals(spec)) { return mCustomTile; } else { Loading Loading @@ -283,6 +287,12 @@ public class QSTileHostTest extends SysuiTestCase { assertEquals(1, specs.size()); } @Test public void testNotAvailableTile_specNotNull() { mQSTileHost.onTuningChanged(QSTileHost.TILES_SETTING, "na"); verify(mQSLogger, never()).logTileDestroyed(isNull(), anyString()); } private static class TestQSTileHost extends QSTileHost { TestQSTileHost(Context context, StatusBarIconController iconController, QSFactoryImpl defaultFactory, Handler mainHandler, Looper bgLooper, Loading Loading @@ -369,4 +379,16 @@ public class QSTileHostTest extends SysuiTestCase { super(host); } } private class NotAvailableTile extends TestTile { protected NotAvailableTile(QSHost host) { super(host); } @Override public boolean isAvailable() { return false; } } } Loading
packages/SystemUI/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" --> <string name="quick_settings_tiles_stock" translatable="false"> wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,controls,screenrecord wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord </string> <!-- The tiles to display in QuickSettings --> Loading
packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java +1 −1 Original line number Diff line number Diff line Loading @@ -274,8 +274,8 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D try { tile = createTile(tileSpec); if (tile != null) { if (tile.isAvailable()) { tile.setTileSpec(tileSpec); if (tile.isAvailable()) { newTiles.put(tileSpec, tile); mQSLogger.logTileAdded(tileSpec); } else { Loading
packages/SystemUI/tests/src/com/android/systemui/qs/QSTileHostTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import static junit.framework.Assert.assertTrue; import static junit.framework.TestCase.assertFalse; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading Loading @@ -137,6 +139,8 @@ public class QSTileHostTest extends SysuiTestCase { return new TestTile1(mQSTileHost); } else if ("spec2".equals(spec)) { return new TestTile2(mQSTileHost); } else if ("na".equals(spec)) { return new NotAvailableTile(mQSTileHost); } else if (CUSTOM_TILE_SPEC.equals(spec)) { return mCustomTile; } else { Loading Loading @@ -283,6 +287,12 @@ public class QSTileHostTest extends SysuiTestCase { assertEquals(1, specs.size()); } @Test public void testNotAvailableTile_specNotNull() { mQSTileHost.onTuningChanged(QSTileHost.TILES_SETTING, "na"); verify(mQSLogger, never()).logTileDestroyed(isNull(), anyString()); } private static class TestQSTileHost extends QSTileHost { TestQSTileHost(Context context, StatusBarIconController iconController, QSFactoryImpl defaultFactory, Handler mainHandler, Looper bgLooper, Loading Loading @@ -369,4 +379,16 @@ public class QSTileHostTest extends SysuiTestCase { super(host); } } private class NotAvailableTile extends TestTile { protected NotAvailableTile(QSHost host) { super(host); } @Override public boolean isAvailable() { return false; } } }