Loading packages/SystemUI/src/com/android/systemui/accessibility/ModeSwitchesController.java +3 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import android.view.Display; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.dagger.SysUISingleton; import javax.inject.Inject; /** * A class to control {@link MagnificationModeSwitch}. It shows the button UI with following * conditions: Loading @@ -44,6 +46,7 @@ public class ModeSwitchesController implements SwitchListener { private final DisplayIdIndexSupplier<MagnificationModeSwitch> mSwitchSupplier; private SwitchListener mSwitchListenerDelegate; @Inject public ModeSwitchesController(Context context) { mSwitchSupplier = new SwitchSupplier(context, context.getSystemService(DisplayManager.class), this::onSwitch); Loading packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt +8 −4 Original line number Diff line number Diff line Loading @@ -31,10 +31,13 @@ import android.util.SparseArray import com.android.internal.annotations.VisibleForTesting import com.android.systemui.Dumpable import com.android.systemui.broadcast.logging.BroadcastDispatcherLogger import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dump.DumpManager import com.android.systemui.settings.UserTracker import java.io.PrintWriter import java.util.concurrent.Executor import javax.inject.Inject data class ReceiverData( val receiver: BroadcastReceiver, Loading Loading @@ -63,14 +66,15 @@ private const val DEBUG = true * Broadcast handling may be asynchronous *without* calling goAsync(), as it's running within sysui * and doesn't need to worry about being killed. */ open class BroadcastDispatcher @JvmOverloads constructor ( @SysUISingleton open class BroadcastDispatcher @Inject constructor( private val context: Context, private val bgLooper: Looper, private val bgExecutor: Executor, @Background private val bgLooper: Looper, @Background private val bgExecutor: Executor, private val dumpManager: DumpManager, private val logger: BroadcastDispatcherLogger, private val userTracker: UserTracker, private val removalPendingStore: PendingRemovalStore = PendingRemovalStore(logger) private val removalPendingStore: PendingRemovalStore ) : Dumpable { // Only modify in BG thread Loading packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcherModule.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.broadcast; import com.android.systemui.CoreStartable; import dagger.Binds; import dagger.Module; import dagger.multibindings.ClassKey; import dagger.multibindings.IntoMap; /** */ @Module public abstract class BroadcastDispatcherModule { /** Ensures BroadcastDispatcher is initialized. */ @Binds @IntoMap @ClassKey(BroadcastDispatcherStartable.class) abstract CoreStartable bindsBroadastDispatcherStartable(BroadcastDispatcherStartable s); } packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcherStartable.kt 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.broadcast import android.content.Context import com.android.systemui.CoreStartable import javax.inject.Inject class BroadcastDispatcherStartable @Inject constructor( context: Context, val broadcastDispatcher: BroadcastDispatcher ) : CoreStartable(context) { override fun start() { broadcastDispatcher.initialize() } } No newline at end of file packages/SystemUI/src/com/android/systemui/broadcast/PendingRemovalStore.kt +2 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ import com.android.systemui.Dumpable import com.android.systemui.broadcast.logging.BroadcastDispatcherLogger import com.android.systemui.util.indentIfPossible import java.io.PrintWriter import javax.inject.Inject /** * Store information about requests for unregistering receivers from [BroadcastDispatcher], before Loading @@ -15,7 +16,7 @@ import java.io.PrintWriter * * This helps make unregistering a receiver a *sync* operation. */ class PendingRemovalStore( class PendingRemovalStore @Inject constructor( private val logger: BroadcastDispatcherLogger ) : Dumpable { @GuardedBy("pendingRemoval") Loading Loading
packages/SystemUI/src/com/android/systemui/accessibility/ModeSwitchesController.java +3 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import android.view.Display; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.dagger.SysUISingleton; import javax.inject.Inject; /** * A class to control {@link MagnificationModeSwitch}. It shows the button UI with following * conditions: Loading @@ -44,6 +46,7 @@ public class ModeSwitchesController implements SwitchListener { private final DisplayIdIndexSupplier<MagnificationModeSwitch> mSwitchSupplier; private SwitchListener mSwitchListenerDelegate; @Inject public ModeSwitchesController(Context context) { mSwitchSupplier = new SwitchSupplier(context, context.getSystemService(DisplayManager.class), this::onSwitch); Loading
packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt +8 −4 Original line number Diff line number Diff line Loading @@ -31,10 +31,13 @@ import android.util.SparseArray import com.android.internal.annotations.VisibleForTesting import com.android.systemui.Dumpable import com.android.systemui.broadcast.logging.BroadcastDispatcherLogger import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dump.DumpManager import com.android.systemui.settings.UserTracker import java.io.PrintWriter import java.util.concurrent.Executor import javax.inject.Inject data class ReceiverData( val receiver: BroadcastReceiver, Loading Loading @@ -63,14 +66,15 @@ private const val DEBUG = true * Broadcast handling may be asynchronous *without* calling goAsync(), as it's running within sysui * and doesn't need to worry about being killed. */ open class BroadcastDispatcher @JvmOverloads constructor ( @SysUISingleton open class BroadcastDispatcher @Inject constructor( private val context: Context, private val bgLooper: Looper, private val bgExecutor: Executor, @Background private val bgLooper: Looper, @Background private val bgExecutor: Executor, private val dumpManager: DumpManager, private val logger: BroadcastDispatcherLogger, private val userTracker: UserTracker, private val removalPendingStore: PendingRemovalStore = PendingRemovalStore(logger) private val removalPendingStore: PendingRemovalStore ) : Dumpable { // Only modify in BG thread Loading
packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcherModule.java 0 → 100644 +34 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.broadcast; import com.android.systemui.CoreStartable; import dagger.Binds; import dagger.Module; import dagger.multibindings.ClassKey; import dagger.multibindings.IntoMap; /** */ @Module public abstract class BroadcastDispatcherModule { /** Ensures BroadcastDispatcher is initialized. */ @Binds @IntoMap @ClassKey(BroadcastDispatcherStartable.class) abstract CoreStartable bindsBroadastDispatcherStartable(BroadcastDispatcherStartable s); }
packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcherStartable.kt 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.broadcast import android.content.Context import com.android.systemui.CoreStartable import javax.inject.Inject class BroadcastDispatcherStartable @Inject constructor( context: Context, val broadcastDispatcher: BroadcastDispatcher ) : CoreStartable(context) { override fun start() { broadcastDispatcher.initialize() } } No newline at end of file
packages/SystemUI/src/com/android/systemui/broadcast/PendingRemovalStore.kt +2 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ import com.android.systemui.Dumpable import com.android.systemui.broadcast.logging.BroadcastDispatcherLogger import com.android.systemui.util.indentIfPossible import java.io.PrintWriter import javax.inject.Inject /** * Store information about requests for unregistering receivers from [BroadcastDispatcher], before Loading @@ -15,7 +16,7 @@ import java.io.PrintWriter * * This helps make unregistering a receiver a *sync* operation. */ class PendingRemovalStore( class PendingRemovalStore @Inject constructor( private val logger: BroadcastDispatcherLogger ) : Dumpable { @GuardedBy("pendingRemoval") Loading