Merge "Minor QS fixes" into rvc-dev am: 7004577d95
Change-Id: I7340711c0d95fcded3fdeb9479f8c6521f708786
This commit is contained in:
@@ -117,7 +117,7 @@
|
|||||||
|
|
||||||
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
|
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
|
||||||
<string name="quick_settings_tiles_stock" translatable="false">
|
<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>
|
</string>
|
||||||
|
|
||||||
<!-- The tiles to display in QuickSettings -->
|
<!-- The tiles to display in QuickSettings -->
|
||||||
|
|||||||
@@ -274,8 +274,8 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
|
|||||||
try {
|
try {
|
||||||
tile = createTile(tileSpec);
|
tile = createTile(tileSpec);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
|
tile.setTileSpec(tileSpec);
|
||||||
if (tile.isAvailable()) {
|
if (tile.isAvailable()) {
|
||||||
tile.setTileSpec(tileSpec);
|
|
||||||
newTiles.put(tileSpec, tile);
|
newTiles.put(tileSpec, tile);
|
||||||
mQSLogger.logTileAdded(tileSpec);
|
mQSLogger.logTileAdded(tileSpec);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ import static junit.framework.Assert.assertTrue;
|
|||||||
import static junit.framework.TestCase.assertFalse;
|
import static junit.framework.TestCase.assertFalse;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
|
import static org.mockito.ArgumentMatchers.isNull;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@@ -137,6 +139,8 @@ public class QSTileHostTest extends SysuiTestCase {
|
|||||||
return new TestTile1(mQSTileHost);
|
return new TestTile1(mQSTileHost);
|
||||||
} else if ("spec2".equals(spec)) {
|
} else if ("spec2".equals(spec)) {
|
||||||
return new TestTile2(mQSTileHost);
|
return new TestTile2(mQSTileHost);
|
||||||
|
} else if ("na".equals(spec)) {
|
||||||
|
return new NotAvailableTile(mQSTileHost);
|
||||||
} else if (CUSTOM_TILE_SPEC.equals(spec)) {
|
} else if (CUSTOM_TILE_SPEC.equals(spec)) {
|
||||||
return mCustomTile;
|
return mCustomTile;
|
||||||
} else {
|
} else {
|
||||||
@@ -283,6 +287,12 @@ public class QSTileHostTest extends SysuiTestCase {
|
|||||||
assertEquals(1, specs.size());
|
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 {
|
private static class TestQSTileHost extends QSTileHost {
|
||||||
TestQSTileHost(Context context, StatusBarIconController iconController,
|
TestQSTileHost(Context context, StatusBarIconController iconController,
|
||||||
QSFactoryImpl defaultFactory, Handler mainHandler, Looper bgLooper,
|
QSFactoryImpl defaultFactory, Handler mainHandler, Looper bgLooper,
|
||||||
@@ -369,4 +379,16 @@ public class QSTileHostTest extends SysuiTestCase {
|
|||||||
super(host);
|
super(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class NotAvailableTile extends TestTile {
|
||||||
|
|
||||||
|
protected NotAvailableTile(QSHost host) {
|
||||||
|
super(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user