ParanoidSystemUI: Update to Android 13 QPR3

Change-Id: Ica8dc756fc69d2ed08c5501b6e8698244e6af647
This commit is contained in:
Jake Weinstein 2023-06-13 09:02:22 +09:00
parent dfbf9f4311
commit 9514fc5e54
12 changed files with 151 additions and 124 deletions

View File

@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package co.aospa.systemui.dagger;
import com.android.systemui.dagger.DefaultComponentBinder;
@ -34,8 +35,8 @@ import dagger.Subcomponent;
NotificationInsetsModule.class,
QsFrameTranslateModule.class,
SystemUIBinder.class,
ParanoidSystemUICoreStartableModule.class,
SystemUIModule.class,
ParanoidSystemUICoreStartableModule.class,
ParanoidSystemUIModule.class})
public interface ParanoidSysUIComponent extends SysUIComponent {
@SysUISingleton

View File

@ -28,12 +28,16 @@ import com.android.systemui.accessibility.SystemActions
import com.android.systemui.accessibility.WindowMagnification
import com.android.systemui.biometrics.AuthController
import com.android.systemui.clipboardoverlay.ClipboardListener
import com.android.systemui.dagger.SystemUICoreStartableModule;
import com.android.systemui.controls.dagger.StartControlsStartableModule
import com.android.systemui.dagger.qualifiers.PerUser
import com.android.systemui.dreams.DreamMonitor
import com.android.systemui.globalactions.GlobalActionsComponent
import com.android.systemui.keyboard.PhysicalKeyboardCoreStartable
import com.android.systemui.keyboard.KeyboardUI
import com.android.systemui.keyguard.KeyguardViewMediator
import com.android.systemui.keyguard.data.quickaffordance.MuteQuickAffordanceCoreStartable
import com.android.systemui.log.SessionTracker
import com.android.systemui.media.dialog.MediaOutputSwitcherDialogUI
import com.android.systemui.media.RingtonePlayer
import com.android.systemui.media.taptotransfer.MediaTttCommandLineHelper
import com.android.systemui.media.taptotransfer.receiver.MediaTttChipControllerReceiver
@ -61,9 +65,12 @@ import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap
/**
* Fork of [SystemUICoreStartableModule]
* Collection of {@link CoreStartable}s that should be run on AOSP.
*/
@Module(includes = [MultiUserUtilsModule::class])
@Module(includes = [
MultiUserUtilsModule::class,
StartControlsStartableModule::class
])
abstract class ParanoidSystemUICoreStartableModule {
/** Inject into AuthController. */
@Binds
@ -124,7 +131,7 @@ abstract class ParanoidSystemUICoreStartableModule {
@IntoMap
@ClassKey(KeyguardBiometricLockoutLogger::class)
abstract fun bindKeyguardBiometricLockoutLogger(
sysui: KeyguardBiometricLockoutLogger
sysui: KeyguardBiometricLockoutLogger
): CoreStartable
/** Inject into KeyguardViewMediator. */
@ -212,6 +219,12 @@ abstract class ParanoidSystemUICoreStartableModule {
@ClassKey(ToastUI::class)
abstract fun bindToastUI(service: ToastUI): CoreStartable
/** Inject into MediaOutputSwitcherDialogUI. */
@Binds
@IntoMap
@ClassKey(MediaOutputSwitcherDialogUI::class)
abstract fun MediaOutputSwitcherDialogUI(sysui: MediaOutputSwitcherDialogUI): CoreStartable
/** Inject into VolumeUI. */
@Binds
@IntoMap
@ -274,4 +287,23 @@ abstract class ParanoidSystemUICoreStartableModule {
@IntoMap
@ClassKey(StylusUsiPowerStartable::class)
abstract fun bindStylusUsiPowerStartable(sysui: StylusUsiPowerStartable): CoreStartable
@Binds
@IntoMap
@ClassKey(PhysicalKeyboardCoreStartable::class)
abstract fun bindKeyboardCoreStartable(listener: PhysicalKeyboardCoreStartable): CoreStartable
/** Inject into MuteQuickAffordanceCoreStartable*/
@Binds
@IntoMap
@ClassKey(MuteQuickAffordanceCoreStartable::class)
abstract fun bindMuteQuickAffordanceCoreStartable(
sysui: MuteQuickAffordanceCoreStartable
): CoreStartable
/**Inject into DreamMonitor */
@Binds
@IntoMap
@ClassKey(DreamMonitor::class)
abstract fun bindDreamMonitor(sysui: DreamMonitor): CoreStartable
}

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package co.aospa.systemui.dagger;
import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
@ -25,8 +26,8 @@ import android.os.Handler;
import com.android.internal.logging.UiEventLogger;
import com.android.keyguard.KeyguardViewController;
import com.android.systemui.battery.BatterySaverModule;
import com.android.systemui.controls.controller.ControlsTileResourceConfiguration;
import com.android.systemui.dagger.ReferenceSystemUIModule;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dock.DockManager;
@ -40,6 +41,7 @@ import com.android.systemui.power.dagger.PowerModule;
import com.android.systemui.qs.dagger.QSModule;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsImplementation;
import com.android.systemui.rotationlock.RotationLockModule;
import com.android.systemui.screenshot.ReferenceScreenshotModule;
import com.android.systemui.shade.NotificationShadeWindowControllerImpl;
import com.android.systemui.shade.ShadeController;
@ -73,6 +75,7 @@ import javax.inject.Named;
import co.aospa.systemui.controls.AospaControlsTileResourceConfigurationImpl;
import co.aospa.systemui.qs.tileimpl.ParanoidQSFactoryImpl;
import co.aospa.systemui.qs.tileimpl.ParanoidQSModule;
import co.aospa.systemui.volume.dagger.ParanoidVolumeModule;
import dagger.Binds;
import dagger.Module;
@ -83,13 +86,16 @@ import dagger.Provides;
*/
@Module(includes = {
AospPolicyModule.class,
BatterySaverModule.class,
GestureModule.class,
MediaModule.class,
PowerModule.class,
QSModule.class,
ReferenceScreenshotModule.class,
RotationLockModule.class,
StartCentralSurfacesModule.class,
StatusBarEventsModule.class,
ParanoidQSModule.class,
ParanoidVolumeModule.class
})
public abstract class ParanoidSystemUIModule {

View File

@ -22,135 +22,34 @@ import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.external.CustomTile;
import com.android.systemui.qs.tileimpl.QSFactoryImpl;
import com.android.systemui.qs.tileimpl.QSTileImpl;
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.CellularTile;
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.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.WifiTile;
import com.android.systemui.qs.tiles.WorkModeTile;
import com.android.systemui.util.leak.GarbageMonitor;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Provider;
import co.aospa.systemui.qs.tiles.AlwaysOnDisplayTile;
import co.aospa.systemui.qs.tiles.CaffeineTile;
import co.aospa.systemui.qs.tiles.DataSwitchTile;
import co.aospa.systemui.qs.tiles.DcDimmingTile;
import co.aospa.systemui.qs.tiles.HeadsUpTile;
import co.aospa.systemui.qs.tiles.PowerShareTile;
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
public class ParanoidQSFactoryImpl extends QSFactoryImpl {
private final Provider<AlwaysOnDisplayTile> mAODTileProvider;
private final Provider<CaffeineTile> mCaffeineTileProvider;
private final Provider<DataSwitchTile> mDataSwitchTileProvider;
private final Provider<HeadsUpTile> mHeadsUpTileProvider;
private final Provider<DcDimmingTile> mDcDimmingTileProvider;
private final Provider<PowerShareTile> mPowerShareTileProvider;
@Inject
public ParanoidQSFactoryImpl(Lazy<QSHost> qsHostLazy,
public ParanoidQSFactoryImpl(
Lazy<QSHost> qsHostLazy,
Provider<CustomTile.Builder> customTileBuilderProvider,
Provider<WifiTile> wifiTileProvider,
Provider<InternetTile> internetTileProvider,
Provider<BluetoothTile> bluetoothTileProvider,
Provider<CellularTile> cellularTileProvider,
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<AlwaysOnDisplayTile> aodTileProvider,
Provider<CaffeineTile> caffeineTileProvider,
Provider<DataSwitchTile> dataSwitchTileProvider,
Provider<HeadsUpTile> headsUpTileProvider,
Provider<DcDimmingTile> dcDimTileProvider,
Provider<PowerShareTile> powerShareTileProvider) {
super(qsHostLazy, customTileBuilderProvider, wifiTileProvider, internetTileProvider,
bluetoothTileProvider, cellularTileProvider, dndTileProvider,
colorInversionTileProvider, airplaneModeTileProvider, workModeTileProvider,
rotationLockTileProvider, flashlightTileProvider, locationTileProvider,
castTileProvider, hotspotTileProvider, batterySaverTileProvider,
dataSaverTileProvider, nightDisplayTileProvider, nfcTileProvider,
memoryTileProvider, uiModeNightTileProvider, screenRecordTileProvider,
reduceBrightColorsTileProvider, cameraToggleTileProvider,
microphoneToggleTileProvider, deviceControlsTileProvider, alarmTileProvider,
quickAccessWalletTileProvider, qrCodeScannerTileProvider, oneHandedModeTileProvider,
colorCorrectionTileProvider, dreamTileProvider);
mAODTileProvider = aodTileProvider;
mCaffeineTileProvider = caffeineTileProvider;
mDataSwitchTileProvider = dataSwitchTileProvider;
mHeadsUpTileProvider = headsUpTileProvider;
mDcDimmingTileProvider = dcDimTileProvider;
mPowerShareTileProvider = powerShareTileProvider;
}
@Nullable
@Override
protected QSTileImpl createTileInternal(String tileSpec) {
switch (tileSpec) {
case "aod":
return mAODTileProvider.get();
case "caffeine":
return mCaffeineTileProvider.get();
case "dataswitch":
return mDataSwitchTileProvider.get();
case "heads_up":
return mHeadsUpTileProvider.get();
case "dc_dimming":
return mDcDimmingTileProvider.get();
case "powershare":
return mPowerShareTileProvider.get();
default:
return super.createTileInternal(tileSpec);
}
Map<String, Provider<QSTileImpl<?>>> tileMap) {
super(qsHostLazy, customTileBuilderProvider, tileMap);
}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright (C) 2023 Paranoid Android
*
* 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 co.aospa.systemui.qs.tileimpl;
import com.android.systemui.qs.tileimpl.QSTileImpl
import co.aospa.systemui.qs.tiles.AlwaysOnDisplayTile;
import co.aospa.systemui.qs.tiles.CaffeineTile;
import co.aospa.systemui.qs.tiles.DataSwitchTile;
import co.aospa.systemui.qs.tiles.DcDimmingTile;
import co.aospa.systemui.qs.tiles.HeadsUpTile;
import co.aospa.systemui.qs.tiles.PowerShareTile;
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoMap
import dagger.multibindings.StringKey
@Module
interface ParanoidQSModule {
/** Inject AlwaysOnDisplayTile into tileMap in QSModule */
@Binds
@IntoMap
@StringKey(AlwaysOnDisplayTile.TILE_SPEC)
fun bindAlwaysOnDisplayTile(alwaysOnDisplayTile: AlwaysOnDisplayTile): QSTileImpl<*>
/** Inject CaffeineTile into tileMap in QSModule */
@Binds
@IntoMap
@StringKey(CaffeineTile.TILE_SPEC)
fun bindCaffeineTile(caffeineTile: CaffeineTile): QSTileImpl<*>
/** Inject DataSwitchTile into tileMap in QSModule */
@Binds
@IntoMap
@StringKey(DataSwitchTile.TILE_SPEC)
fun bindDataSwitchTile(dataSwitchTile: DataSwitchTile): QSTileImpl<*>
/** Inject DcDimmingTile into tileMap in QSModule */
@Binds
@IntoMap
@StringKey(DcDimmingTile.TILE_SPEC)
fun bindDcDimmingTile(dcDimmingTile: DcDimmingTile): QSTileImpl<*>
/** Inject HeadsUpTile into tileMap in QSModule */
@Binds
@IntoMap
@StringKey(HeadsUpTile.TILE_SPEC)
fun bindHeadsUpTile(headsUpTile: HeadsUpTile): QSTileImpl<*>
/** Inject PowerShareTile into tileMap in QSModule */
@Binds
@IntoMap
@StringKey(PowerShareTile.TILE_SPEC)
fun bindPowerShareTile(powerShareTile: PowerShareTile): QSTileImpl<*>
}

View File

@ -50,6 +50,8 @@ import javax.inject.Inject;
public class AlwaysOnDisplayTile extends QSTileImpl<BooleanState> implements
BatteryController.BatteryStateChangeCallback {
public static final String TILE_SPEC = "aod";
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_aod);
private final BatteryController mBatteryController;

View File

@ -49,6 +49,8 @@ import javax.inject.Inject;
/** Quick settings tile: Caffeine **/
public class CaffeineTile extends QSTileImpl<BooleanState> {
public static final String TILE_SPEC = "caffeine";
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_caffeine);
private final PowerManager.WakeLock mWakeLock;

View File

@ -40,6 +40,7 @@ import java.util.List;
import javax.inject.Inject;
public class DataSwitchTile extends QSTileImpl<BooleanState> {
public static final String TILE_SPEC = "dataswitch";
private static final String SETTING_USER_PREF_DATA_SUB = "user_preferred_data_sub";
private final SubscriptionManager mSubscriptionManager;
private final TelephonyManager mTelephonyManager;

View File

@ -52,6 +52,7 @@ import javax.inject.Inject;
/** Quick settings tile: DC Dimming **/
public class DcDimmingTile extends QSTileImpl<QSTile.BooleanState> {
public static final String TILE_SPEC = "dcdimming";
private DcDimmingManager mDcDimmingManager;
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_dc_dimming_tile);

View File

@ -49,6 +49,8 @@ import javax.inject.Inject;
/** Quick settings tile: Heads up **/
public class HeadsUpTile extends QSTileImpl<BooleanState> {
public static final String TILE_SPEC = "heads_up";
private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_heads_up);
private static final Intent NOTIFICATION_SETTINGS =

View File

@ -53,6 +53,7 @@ import javax.inject.Inject;
public class PowerShareTile extends QSTileImpl<BooleanState>
implements BatteryController.BatteryStateChangeCallback {
public static final String TILE_SPEC = "powershare";
private IPowerShare mPowerShare;
private BatteryController mBatteryController;
private NotificationManager mNotificationManager;

View File

@ -20,6 +20,7 @@ import android.content.Context;
import android.media.AudioManager;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
import com.android.systemui.plugins.ActivityStarter;
@ -28,6 +29,7 @@ import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.volume.VolumeDialogImpl;
import com.android.systemui.volume.VolumePanelFactory;
@ -35,6 +37,9 @@ import com.android.systemui.volume.dagger.VolumeModule;
import co.aospa.systemui.tristate.dagger.TriStateModule;
import co.aospa.systemui.volume.ParanoidVolumeDialogComponent;
import java.util.concurrent.Executor;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
@ -61,6 +66,8 @@ public interface ParanoidVolumeModule {
VolumePanelFactory volumePanelFactory,
ActivityStarter activityStarter,
InteractionJankMonitor interactionJankMonitor,
DeviceConfigProxy deviceConfigProxy,
@Main Executor executor,
DumpManager dumpManager) {
VolumeDialogImpl impl = new VolumeDialogImpl(
context,
@ -72,6 +79,8 @@ public interface ParanoidVolumeModule {
volumePanelFactory,
activityStarter,
interactionJankMonitor,
deviceConfigProxy,
executor,
dumpManager);
impl.setStreamImportant(AudioManager.STREAM_SYSTEM, false);
impl.setAutomute(true);