From 91dc9b557416b4024ed2a2ff64dea614f07a02a5 Mon Sep 17 00:00:00 2001 From: jhenrique09 Date: Thu, 10 Aug 2023 12:26:01 +0000 Subject: [PATCH] SystemUIGoogle: Fix BatteryControllerImplGoogle injection Change-Id: I4bc2b02f2928cb231413fb60aecf3ef58b9fcb96 --- .../systemui/dagger/SystemUIGoogleModule.java | 3 +- .../dagger/SystemUIGooglePolicyModule.java | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 SystemUIGoogle/src/com/google/android/systemui/statusbar/policy/dagger/SystemUIGooglePolicyModule.java diff --git a/SystemUIGoogle/src/com/google/android/systemui/dagger/SystemUIGoogleModule.java b/SystemUIGoogle/src/com/google/android/systemui/dagger/SystemUIGoogleModule.java index d97b81f..1c9c967 100644 --- a/SystemUIGoogle/src/com/google/android/systemui/dagger/SystemUIGoogleModule.java +++ b/SystemUIGoogle/src/com/google/android/systemui/dagger/SystemUIGoogleModule.java @@ -102,6 +102,7 @@ import com.google.android.systemui.statusbar.KeyguardIndicationControllerGoogle; import com.google.android.systemui.statusbar.policy.BatteryControllerImplGoogle; import com.google.android.systemui.elmyra.ServiceConfigurationGoogle; +import com.google.android.systemui.statusbar.policy.dagger.SystemUIGooglePolicyModule; import com.android.systemui.statusbar.connectivity.BluetoothModule; import com.android.systemui.qs.tiles.CustomQSModule; @@ -132,7 +133,7 @@ StatusBarEventsModule.class, CustomQSModule.class, BluetoothModule.class, - AospPolicyModule.class, + SystemUIGooglePolicyModule.class, RotationLockModule.class }) public abstract class SystemUIGoogleModule { diff --git a/SystemUIGoogle/src/com/google/android/systemui/statusbar/policy/dagger/SystemUIGooglePolicyModule.java b/SystemUIGoogle/src/com/google/android/systemui/statusbar/policy/dagger/SystemUIGooglePolicyModule.java new file mode 100644 index 0000000..fa7ede0 --- /dev/null +++ b/SystemUIGoogle/src/com/google/android/systemui/statusbar/policy/dagger/SystemUIGooglePolicyModule.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2023 The PixelExperience 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.google.android.systemui.statusbar.policy.dagger; + +import android.content.Context; +import android.os.Handler; +import android.os.PowerManager; + +import com.android.systemui.broadcast.BroadcastDispatcher; +import com.android.systemui.dagger.SysUISingleton; +import com.android.systemui.dagger.qualifiers.Background; +import com.android.systemui.dagger.qualifiers.Main; +import com.android.systemui.demomode.DemoModeController; +import com.android.systemui.dump.DumpManager; +import com.android.systemui.power.EnhancedEstimates; +import com.android.systemui.settings.UserContentResolverProvider; +import com.android.systemui.statusbar.policy.BatteryController; + +import com.google.android.systemui.statusbar.policy.BatteryControllerImplGoogle; +import com.google.android.systemui.reversecharging.ReverseChargingController; + +import dagger.Module; +import dagger.Provides; + +@Module +public class SystemUIGooglePolicyModule { + @Provides + @SysUISingleton + static BatteryController provideBatteryController( + Context context, + EnhancedEstimates enhancedEstimates, + PowerManager powerManager, + BroadcastDispatcher broadcastDispatcher, + DemoModeController demoModeController, + DumpManager dumpManager, + @Main Handler mainHandler, + @Background Handler bgHandler, + UserContentResolverProvider userContentResolverProvider, + ReverseChargingController reverseChargingController) { + BatteryController bC = new BatteryControllerImplGoogle( + context, + enhancedEstimates, + powerManager, + broadcastDispatcher, + demoModeController, + dumpManager, + mainHandler, + bgHandler, + userContentResolverProvider, + reverseChargingController); + bC.init(); + return bC; + } +}