Remove the foreground service manager tile
Test: `atest SystemUITests`
Play around with tiles
Bug: 201579707
Change-Id: Ia6941648849e1d2ef9409be459aa00d023155530
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2021 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- Remove when Fgs manager tile is removed -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M2,4h4v4h-4z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M8,4h14v4h-14z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M2,10h4v4h-4z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M8,10h14v4h-14z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M2,16h4v4h-4z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M8,16h14v4h-14z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
|
||||
<string name="quick_settings_tiles_stock" translatable="false">
|
||||
internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,fgsmanager,color_correction
|
||||
internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction
|
||||
</string>
|
||||
|
||||
<!-- The tiles to display in QuickSettings -->
|
||||
|
||||
@@ -308,14 +308,4 @@
|
||||
<item>Off</item>
|
||||
<item>On</item>
|
||||
</string-array>
|
||||
|
||||
<!-- State names for fgsmanager tile: unavailable, off, on.
|
||||
This subtitle is shown when the tile is in that particular state but does not set its own
|
||||
subtitle, so some of these may never appear on screen. They should still be translated as
|
||||
if they could appear.[CHAR LIMIT=32] -->
|
||||
<string-array name="tile_states_fgsmanager">
|
||||
<item>Unavailable</item>
|
||||
<item>Off</item>
|
||||
<item>On</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -39,7 +39,6 @@ import com.android.systemui.qs.tiles.ColorInversionTile;
|
||||
import com.android.systemui.qs.tiles.DataSaverTile;
|
||||
import com.android.systemui.qs.tiles.DeviceControlsTile;
|
||||
import com.android.systemui.qs.tiles.DndTile;
|
||||
import com.android.systemui.qs.tiles.FgsManagerTile;
|
||||
import com.android.systemui.qs.tiles.FlashlightTile;
|
||||
import com.android.systemui.qs.tiles.HotspotTile;
|
||||
import com.android.systemui.qs.tiles.InternetTile;
|
||||
@@ -99,7 +98,6 @@ public class QSFactoryImpl implements QSFactory {
|
||||
private final Provider<QuickAccessWalletTile> mQuickAccessWalletTileProvider;
|
||||
private final Provider<QRCodeScannerTile> mQRCodeScannerTileProvider;
|
||||
private final Provider<OneHandedModeTile> mOneHandedModeTileProvider;
|
||||
private final Provider<FgsManagerTile> mFgsManagerTileProvider;
|
||||
|
||||
private final Lazy<QSHost> mQsHostLazy;
|
||||
private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
|
||||
@@ -137,7 +135,6 @@ public class QSFactoryImpl implements QSFactory {
|
||||
Provider<QuickAccessWalletTile> quickAccessWalletTileProvider,
|
||||
Provider<QRCodeScannerTile> qrCodeScannerTileProvider,
|
||||
Provider<OneHandedModeTile> oneHandedModeTileProvider,
|
||||
Provider<FgsManagerTile> fgsManagerTileProvider,
|
||||
Provider<ColorCorrectionTile> colorCorrectionTileProvider) {
|
||||
mQsHostLazy = qsHostLazy;
|
||||
mCustomTileBuilderProvider = customTileBuilderProvider;
|
||||
@@ -171,7 +168,6 @@ public class QSFactoryImpl implements QSFactory {
|
||||
mQuickAccessWalletTileProvider = quickAccessWalletTileProvider;
|
||||
mQRCodeScannerTileProvider = qrCodeScannerTileProvider;
|
||||
mOneHandedModeTileProvider = oneHandedModeTileProvider;
|
||||
mFgsManagerTileProvider = fgsManagerTileProvider;
|
||||
mColorCorrectionTileProvider = colorCorrectionTileProvider;
|
||||
}
|
||||
|
||||
@@ -246,8 +242,6 @@ public class QSFactoryImpl implements QSFactory {
|
||||
return mQRCodeScannerTileProvider.get();
|
||||
case "onehanded":
|
||||
return mOneHandedModeTileProvider.get();
|
||||
case "fgsmanager":
|
||||
return mFgsManagerTileProvider.get();
|
||||
case "color_correction":
|
||||
return mColorCorrectionTileProvider.get();
|
||||
}
|
||||
|
||||
@@ -653,7 +653,6 @@ internal object SubtitleArrayMapping {
|
||||
"qr_code_scanner" to R.array.tile_states_qr_code_scanner,
|
||||
"alarm" to R.array.tile_states_alarm,
|
||||
"onehanded" to R.array.tile_states_onehanded,
|
||||
"fgsmanager" to R.array.tile_states_fgsmanager,
|
||||
"color_correction" to R.array.tile_states_color_correction
|
||||
)
|
||||
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.systemui.qs.tiles
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.provider.DeviceConfig
|
||||
import android.view.View
|
||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags
|
||||
import com.android.internal.logging.MetricsLogger
|
||||
import com.android.systemui.DejankUtils
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.dagger.qualifiers.Background
|
||||
import com.android.systemui.dagger.qualifiers.Main
|
||||
import com.android.systemui.fgsmanager.FgsManagerDialogFactory
|
||||
import com.android.systemui.plugins.ActivityStarter
|
||||
import com.android.systemui.plugins.FalsingManager
|
||||
import com.android.systemui.plugins.qs.QSTile
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController
|
||||
import com.android.systemui.qs.QSHost
|
||||
import com.android.systemui.qs.logging.QSLogger
|
||||
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||
import com.android.systemui.statusbar.policy.RunningFgsController
|
||||
import com.android.systemui.statusbar.policy.RunningFgsController.UserPackageTime
|
||||
import java.util.concurrent.Executor
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* Quicksettings tile for the foreground services manager (task manager)
|
||||
*/
|
||||
class FgsManagerTile @Inject constructor(
|
||||
host: QSHost?,
|
||||
@Background backgroundLooper: Looper?,
|
||||
@Background private val backgroundExecutor: Executor?,
|
||||
@Main mainHandler: Handler?,
|
||||
falsingManager: FalsingManager?,
|
||||
metricsLogger: MetricsLogger?,
|
||||
statusBarStateController: StatusBarStateController?,
|
||||
activityStarter: ActivityStarter?,
|
||||
qsLogger: QSLogger?,
|
||||
private val fgsManagerDialogFactory: FgsManagerDialogFactory,
|
||||
private val runningFgsController: RunningFgsController
|
||||
) : QSTileImpl<QSTile.State>(host, backgroundLooper, mainHandler, falsingManager, metricsLogger,
|
||||
statusBarStateController, activityStarter, qsLogger), RunningFgsController.Callback {
|
||||
|
||||
override fun handleInitialize() {
|
||||
super.handleInitialize()
|
||||
mUiHandler.post { runningFgsController.observe(lifecycle, this) }
|
||||
}
|
||||
|
||||
override fun isAvailable(): Boolean {
|
||||
return DejankUtils.whitelistIpcs<Boolean> {
|
||||
DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
SystemUiDeviceConfigFlags.TASK_MANAGER_ENABLED, false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun newTileState(): QSTile.State {
|
||||
return QSTile.State()
|
||||
}
|
||||
|
||||
override fun handleClick(view: View?) {
|
||||
mUiHandler.post { fgsManagerDialogFactory.create(view) }
|
||||
}
|
||||
|
||||
override fun handleUpdateState(state: QSTile.State?, arg: Any?) {
|
||||
state?.label = tileLabel
|
||||
state?.secondaryLabel = runningFgsController.getPackagesWithFgs().size.toString()
|
||||
state?.handlesLongClick = false
|
||||
state?.icon = ResourceIcon.get(R.drawable.ic_list)
|
||||
}
|
||||
|
||||
override fun getMetricsCategory(): Int = 0
|
||||
|
||||
override fun getLongClickIntent(): Intent? = null
|
||||
|
||||
// Inline the string so we don't waste translator time since this isn't used in the mocks.
|
||||
// TODO If mocks change need to remember to move this to strings.xml
|
||||
override fun getTileLabel(): CharSequence = "Active apps"
|
||||
|
||||
override fun onFgsPackagesChanged(packages: List<UserPackageTime>) = refreshState()
|
||||
}
|
||||
@@ -34,7 +34,6 @@ import com.android.systemui.qs.tiles.ColorInversionTile
|
||||
import com.android.systemui.qs.tiles.DataSaverTile
|
||||
import com.android.systemui.qs.tiles.DeviceControlsTile
|
||||
import com.android.systemui.qs.tiles.DndTile
|
||||
import com.android.systemui.qs.tiles.FgsManagerTile
|
||||
import com.android.systemui.qs.tiles.FlashlightTile
|
||||
import com.android.systemui.qs.tiles.HotspotTile
|
||||
import com.android.systemui.qs.tiles.InternetTile
|
||||
@@ -92,7 +91,6 @@ private val specMap = mapOf(
|
||||
"wallet" to QuickAccessWalletTile::class.java,
|
||||
"qr_code_scanner" to QRCodeScannerTile::class.java,
|
||||
"onehanded" to OneHandedModeTile::class.java,
|
||||
"fgsmanager" to FgsManagerTile::class.java,
|
||||
"color_correction" to ColorCorrectionTile::class.java
|
||||
)
|
||||
|
||||
@@ -133,7 +131,6 @@ class QSFactoryImplTest : SysuiTestCase() {
|
||||
@Mock private lateinit var quickAccessWalletTile: QuickAccessWalletTile
|
||||
@Mock private lateinit var qrCodeScannerTile: QRCodeScannerTile
|
||||
@Mock private lateinit var oneHandedModeTile: OneHandedModeTile
|
||||
@Mock private lateinit var fgsManagerTile: FgsManagerTile
|
||||
@Mock private lateinit var colorCorrectionTile: ColorCorrectionTile
|
||||
|
||||
private lateinit var factory: QSFactoryImpl
|
||||
@@ -178,7 +175,6 @@ class QSFactoryImplTest : SysuiTestCase() {
|
||||
{ quickAccessWalletTile },
|
||||
{ qrCodeScannerTile },
|
||||
{ oneHandedModeTile },
|
||||
{ fgsManagerTile },
|
||||
{ colorCorrectionTile }
|
||||
)
|
||||
// When adding/removing tiles, fix also [specMap]
|
||||
|
||||
Reference in New Issue
Block a user