From beb1f177ef15a3a22414144bb9d06ad421746d3c Mon Sep 17 00:00:00 2001 From: Will Harmon Date: Mon, 6 Jun 2016 14:52:40 -0700 Subject: [PATCH] Bug: 28875393 Bug: 28879732 Fixes a bug where setting an app as a default quicksettings tile will show it twice. Change-Id: Ie71746d85c6782810966c62be416a62545329859 --- packages/SystemUI/res/values/config.xml | 6 +++++- .../android/systemui/qs/customize/TileQueryHelper.java | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index e98309ebffb9a..a55a8fded1266 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -103,6 +103,11 @@ wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location + + + wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,work,cast,night + + default @@ -265,4 +270,3 @@ false - diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java index 8ec6a2f66e1ae..b38dd17c4c1aa 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java +++ b/packages/SystemUI/src/com/android/systemui/qs/customize/TileQueryHelper.java @@ -55,8 +55,7 @@ public TileQueryHelper(Context context, QSTileHost host) { } private void addSystemTiles(final QSTileHost host) { - String possible = mContext.getString(R.string.quick_settings_tiles_default) - + ",hotspot,inversion,saver,work,cast,night"; + String possible = mContext.getString(R.string.quick_settings_tiles_stock); String[] possibleTiles = possible.split(","); final Handler qsHandler = new Handler(host.getLooper()); final Handler mainHandler = new Handler(Looper.getMainLooper()); @@ -141,9 +140,16 @@ protected Collection doInBackground(Collection>... params) { PackageManager pm = mContext.getPackageManager(); List services = pm.queryIntentServicesAsUser( new Intent(TileService.ACTION_QS_TILE), 0, ActivityManager.getCurrentUser()); + String stockTiles = mContext.getString(R.string.quick_settings_tiles_stock); for (ResolveInfo info : services) { String packageName = info.serviceInfo.packageName; ComponentName componentName = new ComponentName(packageName, info.serviceInfo.name); + + // Don't include apps that are a part of the default tile set. + if (stockTiles.contains(componentName.flattenToString())) { + continue; + } + final CharSequence appLabel = info.serviceInfo.applicationInfo.loadLabel(pm); String spec = CustomTile.toSpec(componentName); State state = getState(params[0], spec);