Merge "[DO NOT MERGE] Convert QSFactoryImpl to use @Multibinds" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1b674edf6e
@@ -301,9 +301,13 @@ This section describes necessary and recommended steps when implementing a Quick
|
|||||||
* Use only `handleUpdateState` to modify the values of the state to the new ones. This can be done by polling controllers or through the `arg` parameter.
|
* Use only `handleUpdateState` to modify the values of the state to the new ones. This can be done by polling controllers or through the `arg` parameter.
|
||||||
* If the controller is not a `CallbackController`, respond to `handleSetListening` by attaching/dettaching from controllers.
|
* If the controller is not a `CallbackController`, respond to `handleSetListening` by attaching/dettaching from controllers.
|
||||||
* Implement `isAvailable` so the tile will not be created when it's not necessary.
|
* Implement `isAvailable` so the tile will not be created when it's not necessary.
|
||||||
4. In `QSFactoryImpl`:
|
4. Either create a new feature module or find an existing related feature module and add the following binding method:
|
||||||
* Inject a `Provider` for the tile created before.
|
* ```kotlin
|
||||||
* Add a case to the `switch` with a unique String spec for the chosen tile.
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(YourNewTile.TILE_SPEC) // A unique word that will map to YourNewTile
|
||||||
|
fun bindYourNewTile(yourNewTile: YourNewTile): QSTileImpl<*>
|
||||||
|
```
|
||||||
5. In [SystemUI/res/values/config.xml](/packages/SystemUI/res/values/config.xml), modify `quick_settings_tiles_stock` and add the spec defined in the previous step. If necessary, add it also to `quick_settings_tiles_default`. The first one contains a list of all the tiles that SystemUI knows how to create (to show to the user in the customization screen). The second one contains only the default tiles that the user will experience on a fresh boot or after they reset their tiles.
|
5. In [SystemUI/res/values/config.xml](/packages/SystemUI/res/values/config.xml), modify `quick_settings_tiles_stock` and add the spec defined in the previous step. If necessary, add it also to `quick_settings_tiles_default`. The first one contains a list of all the tiles that SystemUI knows how to create (to show to the user in the customization screen). The second one contains only the default tiles that the user will experience on a fresh boot or after they reset their tiles.
|
||||||
6. In [SystemUI/res/values/tiles_states_strings.xml](/packages/SystemUI/res/values/tiles_states_strings.xml), add a new array for your tile. The name has to be `tile_states_<spec>`. Use a good description to help the translators.
|
6. In [SystemUI/res/values/tiles_states_strings.xml](/packages/SystemUI/res/values/tiles_states_strings.xml), add a new array for your tile. The name has to be `tile_states_<spec>`. Use a good description to help the translators.
|
||||||
7. In [`SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt`](/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt), add a new element to the map in `SubtitleArrayMapping` corresponding to the resource created in the previous step.
|
7. In [`SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt`](/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt), add a new element to the map in `SubtitleArrayMapping` corresponding to the resource created in the previous step.
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.accessibility
|
||||||
|
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import com.android.systemui.qs.tiles.ColorCorrectionTile
|
||||||
|
import com.android.systemui.qs.tiles.ColorInversionTile
|
||||||
|
import com.android.systemui.qs.tiles.DreamTile
|
||||||
|
import com.android.systemui.qs.tiles.FontScalingTile
|
||||||
|
import com.android.systemui.qs.tiles.NightDisplayTile
|
||||||
|
import com.android.systemui.qs.tiles.OneHandedModeTile
|
||||||
|
import com.android.systemui.qs.tiles.ReduceBrightColorsTile
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface AccessibilityModule {
|
||||||
|
|
||||||
|
/** Inject ColorInversionTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(ColorInversionTile.TILE_SPEC)
|
||||||
|
fun bindColorInversionTile(colorInversionTile: ColorInversionTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject NightDisplayTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(NightDisplayTile.TILE_SPEC)
|
||||||
|
fun bindNightDisplayTile(nightDisplayTile: NightDisplayTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject ReduceBrightColorsTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(ReduceBrightColorsTile.TILE_SPEC)
|
||||||
|
fun bindReduceBrightColorsTile(reduceBrightColorsTile: ReduceBrightColorsTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject OneHandedModeTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(OneHandedModeTile.TILE_SPEC)
|
||||||
|
fun bindOneHandedModeTile(oneHandedModeTile: OneHandedModeTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject ColorCorrectionTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(ColorCorrectionTile.TILE_SPEC)
|
||||||
|
fun bindColorCorrectionTile(colorCorrectionTile: ColorCorrectionTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject DreamTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(DreamTile.TILE_SPEC)
|
||||||
|
fun bindDreamTile(dreamTile: DreamTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject FontScalingTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(FontScalingTile.TILE_SPEC)
|
||||||
|
fun bindFontScalingTile(fontScalingTile: FontScalingTile): QSTileImpl<*>
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.battery
|
||||||
|
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import com.android.systemui.qs.tiles.BatterySaverTile
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface BatterySaverModule {
|
||||||
|
|
||||||
|
/** Inject BatterySaverTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(BatterySaverTile.TILE_SPEC)
|
||||||
|
fun bindBatterySaverTile(batterySaverTile: BatterySaverTile): QSTileImpl<*>
|
||||||
|
}
|
||||||
@@ -44,12 +44,15 @@ import com.android.systemui.controls.ui.ControlsActivity
|
|||||||
import com.android.systemui.controls.ui.ControlsUiController
|
import com.android.systemui.controls.ui.ControlsUiController
|
||||||
import com.android.systemui.controls.ui.ControlsUiControllerImpl
|
import com.android.systemui.controls.ui.ControlsUiControllerImpl
|
||||||
import com.android.systemui.dagger.SysUISingleton
|
import com.android.systemui.dagger.SysUISingleton
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import com.android.systemui.qs.tiles.DeviceControlsTile
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.BindsOptionalOf
|
import dagger.BindsOptionalOf
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import dagger.multibindings.ClassKey
|
import dagger.multibindings.ClassKey
|
||||||
import dagger.multibindings.IntoMap
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module for injecting classes in `com.android.systemui.controls`-
|
* Module for injecting classes in `com.android.systemui.controls`-
|
||||||
@@ -149,4 +152,9 @@ abstract class ControlsModule {
|
|||||||
@IntoMap
|
@IntoMap
|
||||||
@ClassKey(ControlsActivity::class)
|
@ClassKey(ControlsActivity::class)
|
||||||
abstract fun provideControlsActivity(activity: ControlsActivity): Activity
|
abstract fun provideControlsActivity(activity: ControlsActivity): Activity
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(DeviceControlsTile.TILE_SPEC)
|
||||||
|
abstract fun bindDeviceControlsTile(controlsTile: DeviceControlsTile): QSTileImpl<*>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import androidx.annotation.Nullable;
|
|||||||
|
|
||||||
import com.android.internal.logging.UiEventLogger;
|
import com.android.internal.logging.UiEventLogger;
|
||||||
import com.android.keyguard.KeyguardViewController;
|
import com.android.keyguard.KeyguardViewController;
|
||||||
|
import com.android.systemui.battery.BatterySaverModule;
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
import com.android.systemui.dagger.qualifiers.Main;
|
||||||
import com.android.systemui.dock.DockManager;
|
import com.android.systemui.dock.DockManager;
|
||||||
import com.android.systemui.dock.DockManagerImpl;
|
import com.android.systemui.dock.DockManagerImpl;
|
||||||
@@ -40,6 +41,7 @@ import com.android.systemui.qs.dagger.QSModule;
|
|||||||
import com.android.systemui.qs.tileimpl.QSFactoryImpl;
|
import com.android.systemui.qs.tileimpl.QSFactoryImpl;
|
||||||
import com.android.systemui.recents.Recents;
|
import com.android.systemui.recents.Recents;
|
||||||
import com.android.systemui.recents.RecentsImplementation;
|
import com.android.systemui.recents.RecentsImplementation;
|
||||||
|
import com.android.systemui.rotationlock.RotationLockModule;
|
||||||
import com.android.systemui.screenshot.ReferenceScreenshotModule;
|
import com.android.systemui.screenshot.ReferenceScreenshotModule;
|
||||||
import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
|
import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
|
||||||
import com.android.systemui.shade.ShadeController;
|
import com.android.systemui.shade.ShadeController;
|
||||||
@@ -92,11 +94,13 @@ import dagger.Provides;
|
|||||||
*/
|
*/
|
||||||
@Module(includes = {
|
@Module(includes = {
|
||||||
AospPolicyModule.class,
|
AospPolicyModule.class,
|
||||||
|
BatterySaverModule.class,
|
||||||
GestureModule.class,
|
GestureModule.class,
|
||||||
MediaModule.class,
|
MediaModule.class,
|
||||||
PowerModule.class,
|
PowerModule.class,
|
||||||
QSModule.class,
|
QSModule.class,
|
||||||
ReferenceScreenshotModule.class,
|
ReferenceScreenshotModule.class,
|
||||||
|
RotationLockModule.class,
|
||||||
StartCentralSurfacesModule.class,
|
StartCentralSurfacesModule.class,
|
||||||
VolumeModule.class
|
VolumeModule.class
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ import com.android.systemui.theme.ThemeOverlayController
|
|||||||
import com.android.systemui.toast.ToastUI
|
import com.android.systemui.toast.ToastUI
|
||||||
import com.android.systemui.usb.StorageNotification
|
import com.android.systemui.usb.StorageNotification
|
||||||
import com.android.systemui.util.NotificationChannels
|
import com.android.systemui.util.NotificationChannels
|
||||||
import com.android.systemui.util.leak.GarbageMonitor
|
|
||||||
import com.android.systemui.volume.VolumeUI
|
import com.android.systemui.volume.VolumeUI
|
||||||
import com.android.systemui.wmshell.WMShell
|
import com.android.systemui.wmshell.WMShell
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
@@ -107,12 +106,6 @@ abstract class SystemUICoreStartableModule {
|
|||||||
@ClassKey(FsiChromeViewBinder::class)
|
@ClassKey(FsiChromeViewBinder::class)
|
||||||
abstract fun bindFsiChromeWindowBinder(sysui: FsiChromeViewBinder): CoreStartable
|
abstract fun bindFsiChromeWindowBinder(sysui: FsiChromeViewBinder): CoreStartable
|
||||||
|
|
||||||
/** Inject into GarbageMonitor.Service. */
|
|
||||||
@Binds
|
|
||||||
@IntoMap
|
|
||||||
@ClassKey(GarbageMonitor::class)
|
|
||||||
abstract fun bindGarbageMonitorService(sysui: GarbageMonitor.Service): CoreStartable
|
|
||||||
|
|
||||||
/** Inject into GlobalActionsComponent. */
|
/** Inject into GlobalActionsComponent. */
|
||||||
@Binds
|
@Binds
|
||||||
@IntoMap
|
@IntoMap
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.android.keyguard.dagger.ClockRegistryModule;
|
|||||||
import com.android.keyguard.dagger.KeyguardBouncerComponent;
|
import com.android.keyguard.dagger.KeyguardBouncerComponent;
|
||||||
import com.android.systemui.BootCompleteCache;
|
import com.android.systemui.BootCompleteCache;
|
||||||
import com.android.systemui.BootCompleteCacheImpl;
|
import com.android.systemui.BootCompleteCacheImpl;
|
||||||
|
import com.android.systemui.accessibility.AccessibilityModule;
|
||||||
import com.android.systemui.appops.dagger.AppOpsModule;
|
import com.android.systemui.appops.dagger.AppOpsModule;
|
||||||
import com.android.systemui.assist.AssistModule;
|
import com.android.systemui.assist.AssistModule;
|
||||||
import com.android.systemui.biometrics.AlternateUdfpsTouchProvider;
|
import com.android.systemui.biometrics.AlternateUdfpsTouchProvider;
|
||||||
@@ -57,10 +58,12 @@ import com.android.systemui.people.PeopleModule;
|
|||||||
import com.android.systemui.plugins.BcSmartspaceConfigPlugin;
|
import com.android.systemui.plugins.BcSmartspaceConfigPlugin;
|
||||||
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
|
import com.android.systemui.plugins.BcSmartspaceDataPlugin;
|
||||||
import com.android.systemui.privacy.PrivacyModule;
|
import com.android.systemui.privacy.PrivacyModule;
|
||||||
|
import com.android.systemui.qrcodescanner.dagger.QRCodeScannerModule;
|
||||||
import com.android.systemui.qs.FgsManagerController;
|
import com.android.systemui.qs.FgsManagerController;
|
||||||
import com.android.systemui.qs.FgsManagerControllerImpl;
|
import com.android.systemui.qs.FgsManagerControllerImpl;
|
||||||
import com.android.systemui.qs.footer.dagger.FooterActionsModule;
|
import com.android.systemui.qs.footer.dagger.FooterActionsModule;
|
||||||
import com.android.systemui.recents.Recents;
|
import com.android.systemui.recents.Recents;
|
||||||
|
import com.android.systemui.screenrecord.ScreenRecordModule;
|
||||||
import com.android.systemui.screenshot.dagger.ScreenshotModule;
|
import com.android.systemui.screenshot.dagger.ScreenshotModule;
|
||||||
import com.android.systemui.security.data.repository.SecurityRepositoryModule;
|
import com.android.systemui.security.data.repository.SecurityRepositoryModule;
|
||||||
import com.android.systemui.settings.DisplayTracker;
|
import com.android.systemui.settings.DisplayTracker;
|
||||||
@@ -70,6 +73,7 @@ import com.android.systemui.smartspace.dagger.SmartspaceModule;
|
|||||||
import com.android.systemui.statusbar.CommandQueue;
|
import com.android.systemui.statusbar.CommandQueue;
|
||||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||||
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
||||||
|
import com.android.systemui.statusbar.connectivity.ConnectivityModule;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
import com.android.systemui.statusbar.notification.collection.NotifPipeline;
|
||||||
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder;
|
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinder;
|
||||||
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
|
import com.android.systemui.statusbar.notification.collection.inflation.NotificationRowBinderImpl;
|
||||||
@@ -85,6 +89,7 @@ import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent;
|
|||||||
import com.android.systemui.statusbar.pipeline.dagger.StatusBarPipelineModule;
|
import com.android.systemui.statusbar.pipeline.dagger.StatusBarPipelineModule;
|
||||||
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
|
import com.android.systemui.statusbar.policy.PolicyModule;
|
||||||
import com.android.systemui.statusbar.policy.ZenModeController;
|
import com.android.systemui.statusbar.policy.ZenModeController;
|
||||||
import com.android.systemui.statusbar.policy.dagger.SmartRepliesInflationModule;
|
import com.android.systemui.statusbar.policy.dagger.SmartRepliesInflationModule;
|
||||||
import com.android.systemui.statusbar.policy.dagger.StatusBarPolicyModule;
|
import com.android.systemui.statusbar.policy.dagger.StatusBarPolicyModule;
|
||||||
@@ -97,6 +102,7 @@ import com.android.systemui.user.UserModule;
|
|||||||
import com.android.systemui.util.concurrency.SysUIConcurrencyModule;
|
import com.android.systemui.util.concurrency.SysUIConcurrencyModule;
|
||||||
import com.android.systemui.util.dagger.UtilModule;
|
import com.android.systemui.util.dagger.UtilModule;
|
||||||
import com.android.systemui.util.kotlin.CoroutinesModule;
|
import com.android.systemui.util.kotlin.CoroutinesModule;
|
||||||
|
import com.android.systemui.util.leak.GarbageMonitorModule;
|
||||||
import com.android.systemui.util.sensors.SensorModule;
|
import com.android.systemui.util.sensors.SensorModule;
|
||||||
import com.android.systemui.util.settings.SettingsUtilModule;
|
import com.android.systemui.util.settings.SettingsUtilModule;
|
||||||
import com.android.systemui.util.time.SystemClock;
|
import com.android.systemui.util.time.SystemClock;
|
||||||
@@ -126,6 +132,7 @@ import dagger.Provides;
|
|||||||
* may not appreciate that.
|
* may not appreciate that.
|
||||||
*/
|
*/
|
||||||
@Module(includes = {
|
@Module(includes = {
|
||||||
|
AccessibilityModule.class,
|
||||||
AppOpsModule.class,
|
AppOpsModule.class,
|
||||||
AssistModule.class,
|
AssistModule.class,
|
||||||
BiometricsModule.class,
|
BiometricsModule.class,
|
||||||
@@ -133,6 +140,7 @@ import dagger.Provides;
|
|||||||
ClipboardOverlayModule.class,
|
ClipboardOverlayModule.class,
|
||||||
ClockInfoModule.class,
|
ClockInfoModule.class,
|
||||||
ClockRegistryModule.class,
|
ClockRegistryModule.class,
|
||||||
|
ConnectivityModule.class,
|
||||||
CoroutinesModule.class,
|
CoroutinesModule.class,
|
||||||
DreamModule.class,
|
DreamModule.class,
|
||||||
ControlsModule.class,
|
ControlsModule.class,
|
||||||
@@ -141,17 +149,21 @@ import dagger.Provides;
|
|||||||
FlagsModule.class,
|
FlagsModule.class,
|
||||||
SystemPropertiesFlagsModule.class,
|
SystemPropertiesFlagsModule.class,
|
||||||
FooterActionsModule.class,
|
FooterActionsModule.class,
|
||||||
|
GarbageMonitorModule.class,
|
||||||
LogModule.class,
|
LogModule.class,
|
||||||
MediaProjectionModule.class,
|
MediaProjectionModule.class,
|
||||||
MotionToolModule.class,
|
MotionToolModule.class,
|
||||||
PeopleHubModule.class,
|
PeopleHubModule.class,
|
||||||
PeopleModule.class,
|
PeopleModule.class,
|
||||||
PluginModule.class,
|
PluginModule.class,
|
||||||
|
PolicyModule.class,
|
||||||
PrivacyModule.class,
|
PrivacyModule.class,
|
||||||
|
QRCodeScannerModule.class,
|
||||||
ScreenshotModule.class,
|
ScreenshotModule.class,
|
||||||
SensorModule.class,
|
SensorModule.class,
|
||||||
MultiUserUtilsModule.class,
|
MultiUserUtilsModule.class,
|
||||||
SecurityRepositoryModule.class,
|
SecurityRepositoryModule.class,
|
||||||
|
ScreenRecordModule.class,
|
||||||
SettingsUtilModule.class,
|
SettingsUtilModule.class,
|
||||||
SmartRepliesInflationModule.class,
|
SmartRepliesInflationModule.class,
|
||||||
SmartspaceModule.class,
|
SmartspaceModule.class,
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.qrcodescanner.dagger
|
||||||
|
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import com.android.systemui.qs.tiles.QRCodeScannerTile
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface QRCodeScannerModule {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(QRCodeScannerTile.TILE_SPEC)
|
||||||
|
fun bindQRCodeScannerTile(qrCodeScannerTile: QRCodeScannerTile): QSTileImpl<*>
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ import com.android.systemui.qs.QSHost;
|
|||||||
import com.android.systemui.qs.QSTileHost;
|
import com.android.systemui.qs.QSTileHost;
|
||||||
import com.android.systemui.qs.ReduceBrightColorsController;
|
import com.android.systemui.qs.ReduceBrightColorsController;
|
||||||
import com.android.systemui.qs.external.QSExternalModule;
|
import com.android.systemui.qs.external.QSExternalModule;
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl;
|
||||||
import com.android.systemui.statusbar.phone.AutoTileManager;
|
import com.android.systemui.statusbar.phone.AutoTileManager;
|
||||||
import com.android.systemui.statusbar.phone.ManagedProfileController;
|
import com.android.systemui.statusbar.phone.ManagedProfileController;
|
||||||
import com.android.systemui.statusbar.policy.CastController;
|
import com.android.systemui.statusbar.policy.CastController;
|
||||||
@@ -40,11 +41,14 @@ import com.android.systemui.statusbar.policy.SafetyController;
|
|||||||
import com.android.systemui.statusbar.policy.WalletController;
|
import com.android.systemui.statusbar.policy.WalletController;
|
||||||
import com.android.systemui.util.settings.SecureSettings;
|
import com.android.systemui.util.settings.SecureSettings;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
import dagger.Binds;
|
import dagger.Binds;
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
import dagger.multibindings.Multibinds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module for QS dependencies
|
* Module for QS dependencies
|
||||||
@@ -53,6 +57,11 @@ import dagger.Provides;
|
|||||||
includes = {MediaModule.class, QSExternalModule.class, QSFlagsModule.class})
|
includes = {MediaModule.class, QSExternalModule.class, QSFlagsModule.class})
|
||||||
public interface QSModule {
|
public interface QSModule {
|
||||||
|
|
||||||
|
/** A map of internal QS tiles. Ensures that this can be injected even if
|
||||||
|
* it is empty */
|
||||||
|
@Multibinds
|
||||||
|
Map<String, QSTileImpl<?>> tileMap();
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
static AutoTileManager provideAutoTileManager(
|
static AutoTileManager provideAutoTileManager(
|
||||||
|
|||||||
@@ -27,76 +27,32 @@ import com.android.systemui.plugins.qs.QSTile;
|
|||||||
import com.android.systemui.plugins.qs.QSTileView;
|
import com.android.systemui.plugins.qs.QSTileView;
|
||||||
import com.android.systemui.qs.QSHost;
|
import com.android.systemui.qs.QSHost;
|
||||||
import com.android.systemui.qs.external.CustomTile;
|
import com.android.systemui.qs.external.CustomTile;
|
||||||
import com.android.systemui.qs.tiles.AirplaneModeTile;
|
|
||||||
import com.android.systemui.qs.tiles.AlarmTile;
|
|
||||||
import com.android.systemui.qs.tiles.BatterySaverTile;
|
|
||||||
import com.android.systemui.qs.tiles.BluetoothTile;
|
|
||||||
import com.android.systemui.qs.tiles.CameraToggleTile;
|
|
||||||
import com.android.systemui.qs.tiles.CastTile;
|
|
||||||
import com.android.systemui.qs.tiles.ColorCorrectionTile;
|
|
||||||
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.DreamTile;
|
|
||||||
import com.android.systemui.qs.tiles.FlashlightTile;
|
|
||||||
import com.android.systemui.qs.tiles.FontScalingTile;
|
|
||||||
import com.android.systemui.qs.tiles.HotspotTile;
|
|
||||||
import com.android.systemui.qs.tiles.InternetTile;
|
|
||||||
import com.android.systemui.qs.tiles.LocationTile;
|
|
||||||
import com.android.systemui.qs.tiles.MicrophoneToggleTile;
|
|
||||||
import com.android.systemui.qs.tiles.NfcTile;
|
|
||||||
import com.android.systemui.qs.tiles.NightDisplayTile;
|
|
||||||
import com.android.systemui.qs.tiles.OneHandedModeTile;
|
|
||||||
import com.android.systemui.qs.tiles.QRCodeScannerTile;
|
|
||||||
import com.android.systemui.qs.tiles.QuickAccessWalletTile;
|
|
||||||
import com.android.systemui.qs.tiles.ReduceBrightColorsTile;
|
|
||||||
import com.android.systemui.qs.tiles.RotationLockTile;
|
|
||||||
import com.android.systemui.qs.tiles.ScreenRecordTile;
|
|
||||||
import com.android.systemui.qs.tiles.UiModeNightTile;
|
|
||||||
import com.android.systemui.qs.tiles.WorkModeTile;
|
|
||||||
import com.android.systemui.util.leak.GarbageMonitor;
|
import com.android.systemui.util.leak.GarbageMonitor;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
|
|
||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A factory that creates Quick Settings tiles based on a tileSpec
|
||||||
|
*
|
||||||
|
* To create a new tile within SystemUI, the tile class should extend {@link QSTileImpl} and have
|
||||||
|
* a public static final TILE_SPEC field which serves as a unique key for this tile. (e.g. {@link
|
||||||
|
* com.android.systemui.qs.tiles.DreamTile#TILE_SPEC})
|
||||||
|
*
|
||||||
|
* After, create or find an existing Module class to house the tile's binding method (e.g. {@link
|
||||||
|
* com.android.systemui.accessibility.AccessibilityModule}). If creating a new module, add your
|
||||||
|
* module to the SystemUI dagger graph by including it in an appropriate module.
|
||||||
|
*/
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
public class QSFactoryImpl implements QSFactory {
|
public class QSFactoryImpl implements QSFactory {
|
||||||
|
|
||||||
private static final String TAG = "QSFactory";
|
private static final String TAG = "QSFactory";
|
||||||
|
|
||||||
private final Provider<InternetTile> mInternetTileProvider;
|
protected final Map<String, Provider<QSTileImpl<?>>> mTileMap;
|
||||||
private final Provider<BluetoothTile> mBluetoothTileProvider;
|
|
||||||
private final Provider<DndTile> mDndTileProvider;
|
|
||||||
private final Provider<ColorCorrectionTile> mColorCorrectionTileProvider;
|
|
||||||
private final Provider<ColorInversionTile> mColorInversionTileProvider;
|
|
||||||
private final Provider<AirplaneModeTile> mAirplaneModeTileProvider;
|
|
||||||
private final Provider<WorkModeTile> mWorkModeTileProvider;
|
|
||||||
private final Provider<RotationLockTile> mRotationLockTileProvider;
|
|
||||||
private final Provider<FlashlightTile> mFlashlightTileProvider;
|
|
||||||
private final Provider<LocationTile> mLocationTileProvider;
|
|
||||||
private final Provider<CastTile> mCastTileProvider;
|
|
||||||
private final Provider<HotspotTile> mHotspotTileProvider;
|
|
||||||
private final Provider<BatterySaverTile> mBatterySaverTileProvider;
|
|
||||||
private final Provider<DataSaverTile> mDataSaverTileProvider;
|
|
||||||
private final Provider<NightDisplayTile> mNightDisplayTileProvider;
|
|
||||||
private final Provider<NfcTile> mNfcTileProvider;
|
|
||||||
private final Provider<GarbageMonitor.MemoryTile> mMemoryTileProvider;
|
|
||||||
private final Provider<UiModeNightTile> mUiModeNightTileProvider;
|
|
||||||
private final Provider<ScreenRecordTile> mScreenRecordTileProvider;
|
|
||||||
private final Provider<ReduceBrightColorsTile> mReduceBrightColorsTileProvider;
|
|
||||||
private final Provider<CameraToggleTile> mCameraToggleTileProvider;
|
|
||||||
private final Provider<MicrophoneToggleTile> mMicrophoneToggleTileProvider;
|
|
||||||
private final Provider<DeviceControlsTile> mDeviceControlsTileProvider;
|
|
||||||
private final Provider<AlarmTile> mAlarmTileProvider;
|
|
||||||
private final Provider<QuickAccessWalletTile> mQuickAccessWalletTileProvider;
|
|
||||||
private final Provider<QRCodeScannerTile> mQRCodeScannerTileProvider;
|
|
||||||
private final Provider<OneHandedModeTile> mOneHandedModeTileProvider;
|
|
||||||
private final Provider<DreamTile> mDreamTileProvider;
|
|
||||||
private final Provider<FontScalingTile> mFontScalingTileProvider;
|
|
||||||
|
|
||||||
private final Lazy<QSHost> mQsHostLazy;
|
private final Lazy<QSHost> mQsHostLazy;
|
||||||
private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
|
private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
|
||||||
|
|
||||||
@@ -104,67 +60,10 @@ public class QSFactoryImpl implements QSFactory {
|
|||||||
public QSFactoryImpl(
|
public QSFactoryImpl(
|
||||||
Lazy<QSHost> qsHostLazy,
|
Lazy<QSHost> qsHostLazy,
|
||||||
Provider<CustomTile.Builder> customTileBuilderProvider,
|
Provider<CustomTile.Builder> customTileBuilderProvider,
|
||||||
Provider<InternetTile> internetTileProvider,
|
Map<String, Provider<QSTileImpl<?>>> tileMap) {
|
||||||
Provider<BluetoothTile> bluetoothTileProvider,
|
|
||||||
Provider<DndTile> dndTileProvider,
|
|
||||||
Provider<ColorInversionTile> colorInversionTileProvider,
|
|
||||||
Provider<AirplaneModeTile> airplaneModeTileProvider,
|
|
||||||
Provider<WorkModeTile> workModeTileProvider,
|
|
||||||
Provider<RotationLockTile> rotationLockTileProvider,
|
|
||||||
Provider<FlashlightTile> flashlightTileProvider,
|
|
||||||
Provider<LocationTile> locationTileProvider,
|
|
||||||
Provider<CastTile> castTileProvider,
|
|
||||||
Provider<HotspotTile> hotspotTileProvider,
|
|
||||||
Provider<BatterySaverTile> batterySaverTileProvider,
|
|
||||||
Provider<DataSaverTile> dataSaverTileProvider,
|
|
||||||
Provider<NightDisplayTile> nightDisplayTileProvider,
|
|
||||||
Provider<NfcTile> nfcTileProvider,
|
|
||||||
Provider<GarbageMonitor.MemoryTile> memoryTileProvider,
|
|
||||||
Provider<UiModeNightTile> uiModeNightTileProvider,
|
|
||||||
Provider<ScreenRecordTile> screenRecordTileProvider,
|
|
||||||
Provider<ReduceBrightColorsTile> reduceBrightColorsTileProvider,
|
|
||||||
Provider<CameraToggleTile> cameraToggleTileProvider,
|
|
||||||
Provider<MicrophoneToggleTile> microphoneToggleTileProvider,
|
|
||||||
Provider<DeviceControlsTile> deviceControlsTileProvider,
|
|
||||||
Provider<AlarmTile> alarmTileProvider,
|
|
||||||
Provider<QuickAccessWalletTile> quickAccessWalletTileProvider,
|
|
||||||
Provider<QRCodeScannerTile> qrCodeScannerTileProvider,
|
|
||||||
Provider<OneHandedModeTile> oneHandedModeTileProvider,
|
|
||||||
Provider<ColorCorrectionTile> colorCorrectionTileProvider,
|
|
||||||
Provider<DreamTile> dreamTileProvider,
|
|
||||||
Provider<FontScalingTile> fontScalingTileProvider) {
|
|
||||||
mQsHostLazy = qsHostLazy;
|
mQsHostLazy = qsHostLazy;
|
||||||
mCustomTileBuilderProvider = customTileBuilderProvider;
|
mCustomTileBuilderProvider = customTileBuilderProvider;
|
||||||
|
mTileMap = tileMap;
|
||||||
mInternetTileProvider = internetTileProvider;
|
|
||||||
mBluetoothTileProvider = bluetoothTileProvider;
|
|
||||||
mDndTileProvider = dndTileProvider;
|
|
||||||
mColorInversionTileProvider = colorInversionTileProvider;
|
|
||||||
mAirplaneModeTileProvider = airplaneModeTileProvider;
|
|
||||||
mWorkModeTileProvider = workModeTileProvider;
|
|
||||||
mRotationLockTileProvider = rotationLockTileProvider;
|
|
||||||
mFlashlightTileProvider = flashlightTileProvider;
|
|
||||||
mLocationTileProvider = locationTileProvider;
|
|
||||||
mCastTileProvider = castTileProvider;
|
|
||||||
mHotspotTileProvider = hotspotTileProvider;
|
|
||||||
mBatterySaverTileProvider = batterySaverTileProvider;
|
|
||||||
mDataSaverTileProvider = dataSaverTileProvider;
|
|
||||||
mNightDisplayTileProvider = nightDisplayTileProvider;
|
|
||||||
mNfcTileProvider = nfcTileProvider;
|
|
||||||
mMemoryTileProvider = memoryTileProvider;
|
|
||||||
mUiModeNightTileProvider = uiModeNightTileProvider;
|
|
||||||
mScreenRecordTileProvider = screenRecordTileProvider;
|
|
||||||
mReduceBrightColorsTileProvider = reduceBrightColorsTileProvider;
|
|
||||||
mCameraToggleTileProvider = cameraToggleTileProvider;
|
|
||||||
mMicrophoneToggleTileProvider = microphoneToggleTileProvider;
|
|
||||||
mDeviceControlsTileProvider = deviceControlsTileProvider;
|
|
||||||
mAlarmTileProvider = alarmTileProvider;
|
|
||||||
mQuickAccessWalletTileProvider = quickAccessWalletTileProvider;
|
|
||||||
mQRCodeScannerTileProvider = qrCodeScannerTileProvider;
|
|
||||||
mOneHandedModeTileProvider = oneHandedModeTileProvider;
|
|
||||||
mColorCorrectionTileProvider = colorCorrectionTileProvider;
|
|
||||||
mDreamTileProvider = dreamTileProvider;
|
|
||||||
mFontScalingTileProvider = fontScalingTileProvider;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a tile with a type based on {@code tileSpec} */
|
/** Creates a tile with a type based on {@code tileSpec} */
|
||||||
@@ -181,63 +80,10 @@ public class QSFactoryImpl implements QSFactory {
|
|||||||
@Nullable
|
@Nullable
|
||||||
protected QSTileImpl createTileInternal(String tileSpec) {
|
protected QSTileImpl createTileInternal(String tileSpec) {
|
||||||
// Stock tiles.
|
// Stock tiles.
|
||||||
switch (tileSpec) {
|
if (mTileMap.containsKey(tileSpec)
|
||||||
case "internet":
|
// We should not return a Garbage Monitory Tile if the build is not Debuggable
|
||||||
return mInternetTileProvider.get();
|
&& (!tileSpec.equals(GarbageMonitor.MemoryTile.TILE_SPEC) || Build.IS_DEBUGGABLE)) {
|
||||||
case "bt":
|
return mTileMap.get(tileSpec).get();
|
||||||
return mBluetoothTileProvider.get();
|
|
||||||
case "dnd":
|
|
||||||
return mDndTileProvider.get();
|
|
||||||
case "inversion":
|
|
||||||
return mColorInversionTileProvider.get();
|
|
||||||
case "airplane":
|
|
||||||
return mAirplaneModeTileProvider.get();
|
|
||||||
case "work":
|
|
||||||
return mWorkModeTileProvider.get();
|
|
||||||
case "rotation":
|
|
||||||
return mRotationLockTileProvider.get();
|
|
||||||
case "flashlight":
|
|
||||||
return mFlashlightTileProvider.get();
|
|
||||||
case "location":
|
|
||||||
return mLocationTileProvider.get();
|
|
||||||
case "cast":
|
|
||||||
return mCastTileProvider.get();
|
|
||||||
case "hotspot":
|
|
||||||
return mHotspotTileProvider.get();
|
|
||||||
case "battery":
|
|
||||||
return mBatterySaverTileProvider.get();
|
|
||||||
case "saver":
|
|
||||||
return mDataSaverTileProvider.get();
|
|
||||||
case "night":
|
|
||||||
return mNightDisplayTileProvider.get();
|
|
||||||
case "nfc":
|
|
||||||
return mNfcTileProvider.get();
|
|
||||||
case "dark":
|
|
||||||
return mUiModeNightTileProvider.get();
|
|
||||||
case "screenrecord":
|
|
||||||
return mScreenRecordTileProvider.get();
|
|
||||||
case "reduce_brightness":
|
|
||||||
return mReduceBrightColorsTileProvider.get();
|
|
||||||
case "cameratoggle":
|
|
||||||
return mCameraToggleTileProvider.get();
|
|
||||||
case "mictoggle":
|
|
||||||
return mMicrophoneToggleTileProvider.get();
|
|
||||||
case "controls":
|
|
||||||
return mDeviceControlsTileProvider.get();
|
|
||||||
case "alarm":
|
|
||||||
return mAlarmTileProvider.get();
|
|
||||||
case "wallet":
|
|
||||||
return mQuickAccessWalletTileProvider.get();
|
|
||||||
case "qr_code_scanner":
|
|
||||||
return mQRCodeScannerTileProvider.get();
|
|
||||||
case "onehanded":
|
|
||||||
return mOneHandedModeTileProvider.get();
|
|
||||||
case "color_correction":
|
|
||||||
return mColorCorrectionTileProvider.get();
|
|
||||||
case "dream":
|
|
||||||
return mDreamTileProvider.get();
|
|
||||||
case "font_scaling":
|
|
||||||
return mFontScalingTileProvider.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom tiles
|
// Custom tiles
|
||||||
@@ -246,13 +92,6 @@ public class QSFactoryImpl implements QSFactory {
|
|||||||
mCustomTileBuilderProvider.get(), tileSpec, mQsHostLazy.get().getUserContext());
|
mCustomTileBuilderProvider.get(), tileSpec, mQsHostLazy.get().getUserContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug tiles.
|
|
||||||
if (Build.IS_DEBUGGABLE) {
|
|
||||||
if (tileSpec.equals(GarbageMonitor.MemoryTile.TILE_SPEC)) {
|
|
||||||
return mMemoryTileProvider.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Broken tiles.
|
// Broken tiles.
|
||||||
Log.w(TAG, "No stock tile spec: " + tileSpec);
|
Log.w(TAG, "No stock tile spec: " + tileSpec);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ import dagger.Lazy;
|
|||||||
|
|
||||||
/** Quick settings tile: Airplane mode **/
|
/** Quick settings tile: Airplane mode **/
|
||||||
public class AirplaneModeTile extends QSTileImpl<BooleanState> {
|
public class AirplaneModeTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "airplane";
|
||||||
|
|
||||||
private final SettingObserver mSetting;
|
private final SettingObserver mSetting;
|
||||||
private final BroadcastDispatcher mBroadcastDispatcher;
|
private final BroadcastDispatcher mBroadcastDispatcher;
|
||||||
private final Lazy<ConnectivityManager> mLazyConnectivityManager;
|
private final Lazy<ConnectivityManager> mLazyConnectivityManager;
|
||||||
|
|||||||
@@ -118,4 +118,8 @@ class AlarmTile @Inject constructor(
|
|||||||
override fun getLongClickIntent(): Intent? {
|
override fun getLongClickIntent(): Intent? {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val TILE_SPEC = "alarm"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,8 @@ import javax.inject.Inject;
|
|||||||
public class BatterySaverTile extends QSTileImpl<BooleanState> implements
|
public class BatterySaverTile extends QSTileImpl<BooleanState> implements
|
||||||
BatteryController.BatteryStateChangeCallback {
|
BatteryController.BatteryStateChangeCallback {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "battery";
|
||||||
|
|
||||||
private final BatteryController mBatteryController;
|
private final BatteryController mBatteryController;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected final SettingObserver mSetting;
|
protected final SettingObserver mSetting;
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
/** Quick settings tile: Bluetooth **/
|
/** Quick settings tile: Bluetooth **/
|
||||||
public class BluetoothTile extends QSTileImpl<BooleanState> {
|
public class BluetoothTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "bt";
|
||||||
|
|
||||||
private static final Intent BLUETOOTH_SETTINGS = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
|
private static final Intent BLUETOOTH_SETTINGS = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
|
||||||
|
|
||||||
private final BluetoothController mController;
|
private final BluetoothController mController;
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
public class CameraToggleTile extends SensorPrivacyToggleTile {
|
public class CameraToggleTile extends SensorPrivacyToggleTile {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "cameratoggle";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected CameraToggleTile(QSHost host,
|
protected CameraToggleTile(QSHost host,
|
||||||
@Background Looper backgroundLooper,
|
@Background Looper backgroundLooper,
|
||||||
|
|||||||
@@ -66,7 +66,9 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Cast **/
|
/** Quick settings tile: Cast **/
|
||||||
public class CastTile extends QSTileImpl<BooleanState> {
|
public class CastTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
private static final String INTERACTION_JANK_TAG = "cast";
|
public static final String TILE_SPEC = "cast";
|
||||||
|
|
||||||
|
private static final String INTERACTION_JANK_TAG = TILE_SPEC;
|
||||||
|
|
||||||
private static final Intent CAST_SETTINGS =
|
private static final Intent CAST_SETTINGS =
|
||||||
new Intent(Settings.ACTION_CAST_SETTINGS);
|
new Intent(Settings.ACTION_CAST_SETTINGS);
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Color correction **/
|
/** Quick settings tile: Color correction **/
|
||||||
public class ColorCorrectionTile extends QSTileImpl<BooleanState> {
|
public class ColorCorrectionTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "color_correction";
|
||||||
|
|
||||||
private final Icon mIcon = ResourceIcon.get(drawable.ic_qs_color_correction);
|
private final Icon mIcon = ResourceIcon.get(drawable.ic_qs_color_correction);
|
||||||
private final SettingObserver mSetting;
|
private final SettingObserver mSetting;
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Invert colors **/
|
/** Quick settings tile: Invert colors **/
|
||||||
public class ColorInversionTile extends QSTileImpl<BooleanState> {
|
public class ColorInversionTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "inversion";
|
||||||
private final SettingObserver mSetting;
|
private final SettingObserver mSetting;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ import javax.inject.Inject;
|
|||||||
public class DataSaverTile extends QSTileImpl<BooleanState> implements
|
public class DataSaverTile extends QSTileImpl<BooleanState> implements
|
||||||
DataSaverController.Listener{
|
DataSaverController.Listener{
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "saver";
|
||||||
|
|
||||||
private static final String INTERACTION_JANK_TAG = "start_data_saver";
|
private static final String INTERACTION_JANK_TAG = "start_data_saver";
|
||||||
|
|
||||||
private final DataSaverController mDataSaverController;
|
private final DataSaverController mDataSaverController;
|
||||||
|
|||||||
@@ -159,4 +159,8 @@ class DeviceControlsTile @Inject constructor(
|
|||||||
override fun getTileLabel(): CharSequence {
|
override fun getTileLabel(): CharSequence {
|
||||||
return mContext.getText(controlsComponent.getTileTitleId())
|
return mContext.getText(controlsComponent.getTileTitleId())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val TILE_SPEC = "controls"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Do not disturb **/
|
/** Quick settings tile: Do not disturb **/
|
||||||
public class DndTile extends QSTileImpl<BooleanState> {
|
public class DndTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "dnd";
|
||||||
|
|
||||||
private static final Intent ZEN_SETTINGS =
|
private static final Intent ZEN_SETTINGS =
|
||||||
new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);
|
new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ import javax.inject.Named;
|
|||||||
/** Quick settings tile: Screensaver (dream) **/
|
/** Quick settings tile: Screensaver (dream) **/
|
||||||
public class DreamTile extends QSTileImpl<QSTile.BooleanState> {
|
public class DreamTile extends QSTileImpl<QSTile.BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "dream";
|
||||||
|
|
||||||
private static final String LOG_TAG = "QSDream";
|
private static final String LOG_TAG = "QSDream";
|
||||||
// TODO: consider 1 animated icon instead
|
// TODO: consider 1 animated icon instead
|
||||||
private final Icon mIconDocked = ResourceIcon.get(R.drawable.ic_qs_screen_saver);
|
private final Icon mIconDocked = ResourceIcon.get(R.drawable.ic_qs_screen_saver);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import javax.inject.Inject;
|
|||||||
public class FlashlightTile extends QSTileImpl<BooleanState> implements
|
public class FlashlightTile extends QSTileImpl<BooleanState> implements
|
||||||
FlashlightController.FlashlightListener {
|
FlashlightController.FlashlightListener {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "flashlight";
|
||||||
private final FlashlightController mFlashlightController;
|
private final FlashlightController mFlashlightController;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
const val TILE_SPEC = "font_scaling"
|
||||||
private const val INTERACTION_JANK_TAG = "font_scaling"
|
private const val INTERACTION_JANK_TAG = "font_scaling"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Hotspot **/
|
/** Quick settings tile: Hotspot **/
|
||||||
public class HotspotTile extends QSTileImpl<BooleanState> {
|
public class HotspotTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "hotspot";
|
||||||
private final HotspotController mHotspotController;
|
private final HotspotController mHotspotController;
|
||||||
private final DataSaverController mDataSaverController;
|
private final DataSaverController mDataSaverController;
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
/** Quick settings tile: Internet **/
|
/** Quick settings tile: Internet **/
|
||||||
public class InternetTile extends QSTileImpl<SignalState> {
|
public class InternetTile extends QSTileImpl<SignalState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "internet";
|
||||||
|
|
||||||
private static final Intent WIFI_SETTINGS = new Intent(Settings.ACTION_WIFI_SETTINGS);
|
private static final Intent WIFI_SETTINGS = new Intent(Settings.ACTION_WIFI_SETTINGS);
|
||||||
|
|
||||||
protected final NetworkController mController;
|
protected final NetworkController mController;
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Location **/
|
/** Quick settings tile: Location **/
|
||||||
public class LocationTile extends QSTileImpl<BooleanState> {
|
public class LocationTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "location";
|
||||||
|
|
||||||
private final LocationController mController;
|
private final LocationController mController;
|
||||||
private final KeyguardStateController mKeyguard;
|
private final KeyguardStateController mKeyguard;
|
||||||
private final Callback mCallback = new Callback();
|
private final Callback mCallback = new Callback();
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
public class MicrophoneToggleTile extends SensorPrivacyToggleTile {
|
public class MicrophoneToggleTile extends SensorPrivacyToggleTile {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "mictoggle";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected MicrophoneToggleTile(QSHost host,
|
protected MicrophoneToggleTile(QSHost host,
|
||||||
@Background Looper backgroundLooper,
|
@Background Looper backgroundLooper,
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Enable/Disable NFC **/
|
/** Quick settings tile: Enable/Disable NFC **/
|
||||||
public class NfcTile extends QSTileImpl<BooleanState> {
|
public class NfcTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
private static final String NFC = "nfc";
|
public static final String TILE_SPEC = "nfc";
|
||||||
|
|
||||||
|
private static final String NFC = TILE_SPEC;
|
||||||
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_nfc);
|
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_nfc);
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ import javax.inject.Inject;
|
|||||||
public class NightDisplayTile extends QSTileImpl<BooleanState> implements
|
public class NightDisplayTile extends QSTileImpl<BooleanState> implements
|
||||||
NightDisplayListener.Callback {
|
NightDisplayListener.Callback {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "night";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pattern for {@link java.time.format.DateTimeFormatter} used to approximate the time to the
|
* Pattern for {@link java.time.format.DateTimeFormatter} used to approximate the time to the
|
||||||
* nearest hour and add on the AM/PM indicator.
|
* nearest hour and add on the AM/PM indicator.
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
/** Quick settings tile: One-handed mode **/
|
/** Quick settings tile: One-handed mode **/
|
||||||
public class OneHandedModeTile extends QSTileImpl<BooleanState> {
|
public class OneHandedModeTile extends QSTileImpl<BooleanState> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "onehanded";
|
||||||
|
|
||||||
private final Icon mIcon = ResourceIcon.get(
|
private final Icon mIcon = ResourceIcon.get(
|
||||||
com.android.internal.R.drawable.ic_qs_one_handed_mode);
|
com.android.internal.R.drawable.ic_qs_one_handed_mode);
|
||||||
private final SettingObserver mSetting;
|
private final SettingObserver mSetting;
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
/** Quick settings tile: QR Code Scanner **/
|
/** Quick settings tile: QR Code Scanner **/
|
||||||
public class QRCodeScannerTile extends QSTileImpl<QSTile.State> {
|
public class QRCodeScannerTile extends QSTileImpl<QSTile.State> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "qr_code_scanner";
|
||||||
|
|
||||||
private static final String TAG = "QRCodeScanner";
|
private static final String TAG = "QRCodeScanner";
|
||||||
|
|
||||||
private final CharSequence mLabel = mContext.getString(R.string.qr_code_scanner_title);
|
private final CharSequence mLabel = mContext.getString(R.string.qr_code_scanner_title);
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Quick access wallet **/
|
/** Quick settings tile: Quick access wallet **/
|
||||||
public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> {
|
public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "wallet";
|
||||||
|
|
||||||
private static final String TAG = "QuickAccessWalletTile";
|
private static final String TAG = "QuickAccessWalletTile";
|
||||||
private static final String FEATURE_CHROME_OS = "org.chromium.arc";
|
private static final String FEATURE_CHROME_OS = "org.chromium.arc";
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import javax.inject.Named;
|
|||||||
public class ReduceBrightColorsTile extends QSTileImpl<QSTile.BooleanState>
|
public class ReduceBrightColorsTile extends QSTileImpl<QSTile.BooleanState>
|
||||||
implements ReduceBrightColorsController.Listener{
|
implements ReduceBrightColorsController.Listener{
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "reduce_brightness";
|
||||||
private final boolean mIsAvailable;
|
private final boolean mIsAvailable;
|
||||||
private final ReduceBrightColorsController mReduceBrightColorsController;
|
private final ReduceBrightColorsController mReduceBrightColorsController;
|
||||||
private boolean mIsListening;
|
private boolean mIsListening;
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Rotation **/
|
/** Quick settings tile: Rotation **/
|
||||||
public class RotationLockTile extends QSTileImpl<BooleanState> implements
|
public class RotationLockTile extends QSTileImpl<BooleanState> implements
|
||||||
BatteryController.BatteryStateChangeCallback {
|
BatteryController.BatteryStateChangeCallback {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "rotation";
|
||||||
|
|
||||||
private static final String EMPTY_SECONDARY_STRING = "";
|
private static final String EMPTY_SECONDARY_STRING = "";
|
||||||
|
|
||||||
private final Icon mIcon = ResourceIcon.get(com.android.internal.R.drawable.ic_qs_auto_rotate);
|
private final Icon mIcon = ResourceIcon.get(com.android.internal.R.drawable.ic_qs_auto_rotate);
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ import javax.inject.Inject;
|
|||||||
*/
|
*/
|
||||||
public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState>
|
public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState>
|
||||||
implements RecordingController.RecordingStateChangeCallback {
|
implements RecordingController.RecordingStateChangeCallback {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "screenrecord";
|
||||||
|
|
||||||
private static final String TAG = "ScreenRecordTile";
|
private static final String TAG = "ScreenRecordTile";
|
||||||
private static final String INTERACTION_JANK_TAG = "screen_record";
|
private static final String INTERACTION_JANK_TAG = "screen_record";
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.android.systemui.qs.tiles;
|
package com.android.systemui.qs.tiles;
|
||||||
|
|
||||||
import android.app.UiModeManager;
|
import android.app.UiModeManager;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -60,6 +59,9 @@ import javax.inject.Inject;
|
|||||||
public class UiModeNightTile extends QSTileImpl<QSTile.BooleanState> implements
|
public class UiModeNightTile extends QSTileImpl<QSTile.BooleanState> implements
|
||||||
ConfigurationController.ConfigurationListener,
|
ConfigurationController.ConfigurationListener,
|
||||||
BatteryController.BatteryStateChangeCallback {
|
BatteryController.BatteryStateChangeCallback {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "dark";
|
||||||
|
|
||||||
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm a");
|
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm a");
|
||||||
private final UiModeManager mUiModeManager;
|
private final UiModeManager mUiModeManager;
|
||||||
private final BatteryController mBatteryController;
|
private final BatteryController mBatteryController;
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ import javax.inject.Inject;
|
|||||||
/** Quick settings tile: Work profile on/off */
|
/** Quick settings tile: Work profile on/off */
|
||||||
public class WorkModeTile extends QSTileImpl<BooleanState> implements
|
public class WorkModeTile extends QSTileImpl<BooleanState> implements
|
||||||
ManagedProfileController.Callback {
|
ManagedProfileController.Callback {
|
||||||
|
|
||||||
|
public static final String TILE_SPEC = "work";
|
||||||
|
|
||||||
private final Icon mIcon = ResourceIcon.get(R.drawable.stat_sys_managed_profile_status);
|
private final Icon mIcon = ResourceIcon.get(R.drawable.stat_sys_managed_profile_status);
|
||||||
|
|
||||||
private final ManagedProfileController mProfileController;
|
private final ManagedProfileController mProfileController;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.rotationlock
|
||||||
|
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import com.android.systemui.qs.tiles.RotationLockTile
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface RotationLockModule {
|
||||||
|
|
||||||
|
/** Inject RotationLockTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(RotationLockTile.TILE_SPEC)
|
||||||
|
fun bindRotationLockTile(rotationLockTile: RotationLockTile): QSTileImpl<*>
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.screenrecord
|
||||||
|
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import com.android.systemui.qs.tiles.ScreenRecordTile
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface ScreenRecordModule {
|
||||||
|
/** Inject ScreenRecordTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(ScreenRecordTile.TILE_SPEC)
|
||||||
|
fun bindScreenRecordTile(screenRecordTile: ScreenRecordTile): QSTileImpl<*>
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.statusbar.connectivity
|
||||||
|
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import com.android.systemui.qs.tiles.AirplaneModeTile
|
||||||
|
import com.android.systemui.qs.tiles.BluetoothTile
|
||||||
|
import com.android.systemui.qs.tiles.CastTile
|
||||||
|
import com.android.systemui.qs.tiles.DataSaverTile
|
||||||
|
import com.android.systemui.qs.tiles.HotspotTile
|
||||||
|
import com.android.systemui.qs.tiles.InternetTile
|
||||||
|
import com.android.systemui.qs.tiles.NfcTile
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface ConnectivityModule {
|
||||||
|
|
||||||
|
/** Inject InternetTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(InternetTile.TILE_SPEC)
|
||||||
|
fun bindInternetTile(internetTile: InternetTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject BluetoothTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(BluetoothTile.TILE_SPEC)
|
||||||
|
fun bindBluetoothTile(bluetoothTile: BluetoothTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject CastTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(CastTile.TILE_SPEC)
|
||||||
|
fun bindCastTile(castTile: CastTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject HotspotTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(HotspotTile.TILE_SPEC)
|
||||||
|
fun bindHotspotTile(hotspotTile: HotspotTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject AirplaneModeTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(AirplaneModeTile.TILE_SPEC)
|
||||||
|
fun bindAirplaneModeTile(airplaneModeTile: AirplaneModeTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject DataSaverTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(DataSaverTile.TILE_SPEC)
|
||||||
|
fun bindDataSaverTile(dataSaverTile: DataSaverTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject NfcTile into tileMap in QSModule */
|
||||||
|
@Binds @IntoMap @StringKey(NfcTile.TILE_SPEC) fun bindNfcTile(nfcTile: NfcTile): QSTileImpl<*>
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use mHost 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.statusbar.policy
|
||||||
|
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import com.android.systemui.qs.tiles.AlarmTile
|
||||||
|
import com.android.systemui.qs.tiles.CameraToggleTile
|
||||||
|
import com.android.systemui.qs.tiles.DndTile
|
||||||
|
import com.android.systemui.qs.tiles.FlashlightTile
|
||||||
|
import com.android.systemui.qs.tiles.LocationTile
|
||||||
|
import com.android.systemui.qs.tiles.MicrophoneToggleTile
|
||||||
|
import com.android.systemui.qs.tiles.UiModeNightTile
|
||||||
|
import com.android.systemui.qs.tiles.WorkModeTile
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface PolicyModule {
|
||||||
|
|
||||||
|
/** Inject DndTile into tileMap in QSModule */
|
||||||
|
@Binds @IntoMap @StringKey(DndTile.TILE_SPEC) fun bindDndTile(dndTile: DndTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject WorkModeTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(WorkModeTile.TILE_SPEC)
|
||||||
|
fun bindWorkModeTile(workModeTile: WorkModeTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject FlashlightTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(FlashlightTile.TILE_SPEC)
|
||||||
|
fun bindFlashlightTile(flashlightTile: FlashlightTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject LocationTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(LocationTile.TILE_SPEC)
|
||||||
|
fun bindLocationTile(locationTile: LocationTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject CameraToggleTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(CameraToggleTile.TILE_SPEC)
|
||||||
|
fun bindCameraToggleTile(cameraToggleTile: CameraToggleTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject MicrophoneToggleTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(MicrophoneToggleTile.TILE_SPEC)
|
||||||
|
fun bindMicrophoneToggleTile(microphoneToggleTile: MicrophoneToggleTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
/** Inject AlarmTile into tileMap in QSModule */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(AlarmTile.TILE_SPEC)
|
||||||
|
fun bindAlarmTile(alarmTile: AlarmTile): QSTileImpl<*>
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(UiModeNightTile.TILE_SPEC)
|
||||||
|
fun bindUiModeNightTile(uiModeNightTile: UiModeNightTile): QSTileImpl<*>
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.util.leak
|
||||||
|
|
||||||
|
import com.android.systemui.CoreStartable
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.ClassKey
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import dagger.multibindings.StringKey
|
||||||
|
|
||||||
|
@Module
|
||||||
|
interface GarbageMonitorModule {
|
||||||
|
/** Inject into GarbageMonitor.Service. */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@ClassKey(GarbageMonitor::class)
|
||||||
|
fun bindGarbageMonitorService(sysui: GarbageMonitor.Service): CoreStartable
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(GarbageMonitor.MemoryTile.TILE_SPEC)
|
||||||
|
fun bindMemoryTile(memoryTile: GarbageMonitor.MemoryTile): QSTileImpl<*>
|
||||||
|
}
|
||||||
@@ -22,6 +22,8 @@ import android.service.quickaccesswallet.QuickAccessWalletClient;
|
|||||||
|
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
import com.android.systemui.dagger.qualifiers.Background;
|
import com.android.systemui.dagger.qualifiers.Background;
|
||||||
|
import com.android.systemui.qs.tileimpl.QSTileImpl;
|
||||||
|
import com.android.systemui.qs.tiles.QuickAccessWalletTile;
|
||||||
import com.android.systemui.wallet.ui.WalletActivity;
|
import com.android.systemui.wallet.ui.WalletActivity;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
@@ -31,6 +33,7 @@ import dagger.Module;
|
|||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
import dagger.multibindings.ClassKey;
|
import dagger.multibindings.ClassKey;
|
||||||
import dagger.multibindings.IntoMap;
|
import dagger.multibindings.IntoMap;
|
||||||
|
import dagger.multibindings.StringKey;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,4 +55,11 @@ public abstract class WalletModule {
|
|||||||
@Background Executor bgExecutor) {
|
@Background Executor bgExecutor) {
|
||||||
return QuickAccessWalletClient.create(context, bgExecutor);
|
return QuickAccessWalletClient.create(context, bgExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@StringKey(QuickAccessWalletTile.TILE_SPEC)
|
||||||
|
public abstract QSTileImpl<?> bindQuickAccessWalletTile(
|
||||||
|
QuickAccessWalletTile quickAccessWalletTile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,14 +52,15 @@ import com.android.systemui.qs.tiles.UiModeNightTile
|
|||||||
import com.android.systemui.qs.tiles.WorkModeTile
|
import com.android.systemui.qs.tiles.WorkModeTile
|
||||||
import com.android.systemui.util.leak.GarbageMonitor
|
import com.android.systemui.util.leak.GarbageMonitor
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import javax.inject.Provider
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.Answers
|
import org.mockito.Answers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.inOrder
|
import org.mockito.Mockito.inOrder
|
||||||
import org.mockito.MockitoAnnotations
|
|
||||||
import org.mockito.Mockito.`when` as whenever
|
import org.mockito.Mockito.`when` as whenever
|
||||||
|
import org.mockito.MockitoAnnotations
|
||||||
|
|
||||||
private val specMap = mapOf(
|
private val specMap = mapOf(
|
||||||
"internet" to InternetTile::class.java,
|
"internet" to InternetTile::class.java,
|
||||||
@@ -140,40 +141,43 @@ class QSFactoryImplTest : SysuiTestCase() {
|
|||||||
whenever(qsHost.userContext).thenReturn(mContext)
|
whenever(qsHost.userContext).thenReturn(mContext)
|
||||||
whenever(customTileBuilder.build()).thenReturn(customTile)
|
whenever(customTileBuilder.build()).thenReturn(customTile)
|
||||||
|
|
||||||
|
val tileMap = mutableMapOf<String, Provider<QSTileImpl<*>>>(
|
||||||
|
"internet" to Provider { internetTile },
|
||||||
|
"bt" to Provider { bluetoothTile },
|
||||||
|
"dnd" to Provider { dndTile },
|
||||||
|
"inversion" to Provider { colorInversionTile },
|
||||||
|
"airplane" to Provider { airplaneTile },
|
||||||
|
"work" to Provider { workTile },
|
||||||
|
"rotation" to Provider { rotationTile },
|
||||||
|
"flashlight" to Provider { flashlightTile },
|
||||||
|
"location" to Provider { locationTile },
|
||||||
|
"cast" to Provider { castTile },
|
||||||
|
"hotspot" to Provider { hotspotTile },
|
||||||
|
"battery" to Provider { batterySaverTile },
|
||||||
|
"saver" to Provider { dataSaverTile },
|
||||||
|
"night" to Provider { nightDisplayTile },
|
||||||
|
"nfc" to Provider { nfcTile },
|
||||||
|
"dark" to Provider { darkModeTile },
|
||||||
|
"screenrecord" to Provider { screenRecordTile },
|
||||||
|
"reduce_brightness" to Provider { reduceBrightColorsTile },
|
||||||
|
"cameratoggle" to Provider { cameraToggleTile },
|
||||||
|
"mictoggle" to Provider { microphoneToggleTile },
|
||||||
|
"controls" to Provider { deviceControlsTile },
|
||||||
|
"alarm" to Provider { alarmTile },
|
||||||
|
"wallet" to Provider { quickAccessWalletTile },
|
||||||
|
"qr_code_scanner" to Provider { qrCodeScannerTile },
|
||||||
|
"onehanded" to Provider { oneHandedModeTile },
|
||||||
|
"color_correction" to Provider { colorCorrectionTile },
|
||||||
|
"dream" to Provider { dreamTile },
|
||||||
|
"font_scaling" to Provider { fontScalingTile }
|
||||||
|
)
|
||||||
|
|
||||||
factory = QSFactoryImpl(
|
factory = QSFactoryImpl(
|
||||||
{ qsHost },
|
{ qsHost },
|
||||||
{ customTileBuilder },
|
{ customTileBuilder },
|
||||||
{ internetTile },
|
tileMap,
|
||||||
{ bluetoothTile },
|
|
||||||
{ dndTile },
|
|
||||||
{ colorInversionTile },
|
|
||||||
{ airplaneTile },
|
|
||||||
{ workTile },
|
|
||||||
{ rotationTile },
|
|
||||||
{ flashlightTile },
|
|
||||||
{ locationTile },
|
|
||||||
{ castTile },
|
|
||||||
{ hotspotTile },
|
|
||||||
{ batterySaverTile },
|
|
||||||
{ dataSaverTile },
|
|
||||||
{ nightDisplayTile },
|
|
||||||
{ nfcTile },
|
|
||||||
{ memoryTile },
|
|
||||||
{ darkModeTile },
|
|
||||||
{ screenRecordTile },
|
|
||||||
{ reduceBrightColorsTile },
|
|
||||||
{ cameraToggleTile },
|
|
||||||
{ microphoneToggleTile },
|
|
||||||
{ deviceControlsTile },
|
|
||||||
{ alarmTile },
|
|
||||||
{ quickAccessWalletTile },
|
|
||||||
{ qrCodeScannerTile },
|
|
||||||
{ oneHandedModeTile },
|
|
||||||
{ colorCorrectionTile },
|
|
||||||
{ dreamTile },
|
|
||||||
{ fontScalingTile }
|
|
||||||
)
|
)
|
||||||
// When adding/removing tiles, fix also [specMap]
|
// When adding/removing tiles, fix also [specMap] and [tileMap]
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user