Loading packages/CarSystemUI/src/com/android/systemui/qs/car/CarStatusBarHeader.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import androidx.annotation.IdRes; import com.android.settingslib.Utils; import com.android.systemui.BatteryMeterView; import com.android.systemui.R; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher; /** * A view that forms the header of the notification panel. This view will ensure that any Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/DarkIconDispatcher.java→packages/SystemUI/plugin/src/com/android/systemui/plugins/DarkIconDispatcher.java +52 −29 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * Copyright (C) 2018 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 * 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. * 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; package com.android.systemui.plugins; import android.graphics.Color; import android.graphics.Rect; import android.view.View; import android.widget.ImageView; import com.android.systemui.Dumpable; import com.android.systemui.statusbar.phone.LightBarTransitionsController; import java.io.FileDescriptor; import java.io.PrintWriter; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.plugins.annotations.DependsOn; import com.android.systemui.plugins.annotations.ProvidesInterface; /** * Dispatches events to {@link DarkReceiver}s about changes in darkness, tint area and dark * intensity * intensity. Accessible through {@link PluginDependency} */ public interface DarkIconDispatcher extends Dumpable { @ProvidesInterface(version = DarkIconDispatcher.VERSION) @DependsOn(target = DarkReceiver.class) public interface DarkIconDispatcher { int VERSION = 1; /** * Sets the dark area so {@link #applyDark} only affects the icons in the specified area. * * @param r the area in which icons should change its tint, in logical screen * coordinates */ void setIconsDarkArea(Rect r); LightBarTransitionsController getTransitionsController(); /** * Adds a receiver to receive callbacks onDarkChanged */ void addDarkReceiver(DarkReceiver receiver); /** * Adds a receiver to receive callbacks onDarkChanged */ void addDarkReceiver(ImageView imageView); // Must have been previously been added through one of the addDarkReceive methods above. /** * Must have been previously been added through one of the addDarkReceive methods above. */ void removeDarkReceiver(DarkReceiver object); void removeDarkReceiver(ImageView object); // Used to reapply darkness on an object, must have previously been added through // addDarkReceiver. void applyDark(DarkReceiver object); /** * Must have been previously been added through one of the addDarkReceive methods above. */ void removeDarkReceiver(ImageView object); /** * Dumpable interface * Used to reapply darkness on an object, must have previously been added through * addDarkReceiver. */ default void dump(FileDescriptor fd, PrintWriter pw, String[] args) {} void applyDark(DarkReceiver object); int DEFAULT_ICON_TINT = Color.WHITE; Rect sTmpRect = new Rect(); int[] sTmpInt2 = new int[2]; /** * @return the tint to apply to {@param view} depending on the desired tint {@param color} and * the screen {@param tintArea} in which to apply that tint * @return the tint to apply to view depending on the desired tint color and * the screen tintArea in which to apply that tint */ static int getTint(Rect tintArea, View view, int color) { if (isInArea(tintArea, view)) { Loading @@ -67,8 +85,8 @@ public interface DarkIconDispatcher extends Dumpable { } /** * @return the dark intensity to apply to {@param view} depending on the desired dark * {@param intensity} and the screen {@param tintArea} in which to apply that intensity * @return the dark intensity to apply to view depending on the desired dark * intensity and the screen tintArea in which to apply that intensity */ static float getDarkIntensity(Rect tintArea, View view, float intensity) { if (isInArea(tintArea, view)) { Loading @@ -79,7 +97,7 @@ public interface DarkIconDispatcher extends Dumpable { } /** * @return true if more than half of the {@param view} area are in {@param area}, false * @return true if more than half of the view area are in area, false * otherwise */ static boolean isInArea(Rect area, View view) { Loading @@ -99,7 +117,12 @@ public interface DarkIconDispatcher extends Dumpable { return majorityOfWidth && coversFullStatusBar; } /** * Receives a callback on darkness changes */ @ProvidesInterface(version = DarkReceiver.VERSION) interface DarkReceiver { int VERSION = 1; void onDarkChanged(Rect area, float darkIntensity, int tint); } } packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +2 −2 Original line number Diff line number Diff line Loading @@ -48,14 +48,14 @@ import android.widget.TextView; import com.android.settingslib.Utils; import com.android.settingslib.graph.BatteryMeterDrawableBase; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; import com.android.systemui.statusbar.policy.IconLogger; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; Loading packages/SystemUI/src/com/android/systemui/Dependency.java +1 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.fragments.FragmentService; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.PluginDependencyProvider; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.power.EnhancedEstimates; Loading Loading @@ -79,7 +80,6 @@ import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.CastController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DataSaverController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.ExtensionController; Loading packages/SystemUI/src/com/android/systemui/DependencyBinder.java +1 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui; import com.android.systemui.appops.AppOpsController; import com.android.systemui.appops.AppOpsControllerImpl; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.power.PowerNotificationWarnings; import com.android.systemui.power.PowerUI; Loading @@ -37,7 +38,6 @@ import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.BluetoothControllerImpl; import com.android.systemui.statusbar.policy.CastController; import com.android.systemui.statusbar.policy.CastControllerImpl; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; import com.android.systemui.statusbar.policy.ExtensionController; Loading Loading
packages/CarSystemUI/src/com/android/systemui/qs/car/CarStatusBarHeader.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import androidx.annotation.IdRes; import com.android.settingslib.Utils; import com.android.systemui.BatteryMeterView; import com.android.systemui.R; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher; /** * A view that forms the header of the notification panel. This view will ensure that any Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/DarkIconDispatcher.java→packages/SystemUI/plugin/src/com/android/systemui/plugins/DarkIconDispatcher.java +52 −29 Original line number Diff line number Diff line /* * Copyright (C) 2017 The Android Open Source Project * Copyright (C) 2018 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 * 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. * 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; package com.android.systemui.plugins; import android.graphics.Color; import android.graphics.Rect; import android.view.View; import android.widget.ImageView; import com.android.systemui.Dumpable; import com.android.systemui.statusbar.phone.LightBarTransitionsController; import java.io.FileDescriptor; import java.io.PrintWriter; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.plugins.annotations.DependsOn; import com.android.systemui.plugins.annotations.ProvidesInterface; /** * Dispatches events to {@link DarkReceiver}s about changes in darkness, tint area and dark * intensity * intensity. Accessible through {@link PluginDependency} */ public interface DarkIconDispatcher extends Dumpable { @ProvidesInterface(version = DarkIconDispatcher.VERSION) @DependsOn(target = DarkReceiver.class) public interface DarkIconDispatcher { int VERSION = 1; /** * Sets the dark area so {@link #applyDark} only affects the icons in the specified area. * * @param r the area in which icons should change its tint, in logical screen * coordinates */ void setIconsDarkArea(Rect r); LightBarTransitionsController getTransitionsController(); /** * Adds a receiver to receive callbacks onDarkChanged */ void addDarkReceiver(DarkReceiver receiver); /** * Adds a receiver to receive callbacks onDarkChanged */ void addDarkReceiver(ImageView imageView); // Must have been previously been added through one of the addDarkReceive methods above. /** * Must have been previously been added through one of the addDarkReceive methods above. */ void removeDarkReceiver(DarkReceiver object); void removeDarkReceiver(ImageView object); // Used to reapply darkness on an object, must have previously been added through // addDarkReceiver. void applyDark(DarkReceiver object); /** * Must have been previously been added through one of the addDarkReceive methods above. */ void removeDarkReceiver(ImageView object); /** * Dumpable interface * Used to reapply darkness on an object, must have previously been added through * addDarkReceiver. */ default void dump(FileDescriptor fd, PrintWriter pw, String[] args) {} void applyDark(DarkReceiver object); int DEFAULT_ICON_TINT = Color.WHITE; Rect sTmpRect = new Rect(); int[] sTmpInt2 = new int[2]; /** * @return the tint to apply to {@param view} depending on the desired tint {@param color} and * the screen {@param tintArea} in which to apply that tint * @return the tint to apply to view depending on the desired tint color and * the screen tintArea in which to apply that tint */ static int getTint(Rect tintArea, View view, int color) { if (isInArea(tintArea, view)) { Loading @@ -67,8 +85,8 @@ public interface DarkIconDispatcher extends Dumpable { } /** * @return the dark intensity to apply to {@param view} depending on the desired dark * {@param intensity} and the screen {@param tintArea} in which to apply that intensity * @return the dark intensity to apply to view depending on the desired dark * intensity and the screen tintArea in which to apply that intensity */ static float getDarkIntensity(Rect tintArea, View view, float intensity) { if (isInArea(tintArea, view)) { Loading @@ -79,7 +97,7 @@ public interface DarkIconDispatcher extends Dumpable { } /** * @return true if more than half of the {@param view} area are in {@param area}, false * @return true if more than half of the view area are in area, false * otherwise */ static boolean isInArea(Rect area, View view) { Loading @@ -99,7 +117,12 @@ public interface DarkIconDispatcher extends Dumpable { return majorityOfWidth && coversFullStatusBar; } /** * Receives a callback on darkness changes */ @ProvidesInterface(version = DarkReceiver.VERSION) interface DarkReceiver { int VERSION = 1; void onDarkChanged(Rect area, float darkIntensity, int tint); } }
packages/SystemUI/src/com/android/systemui/BatteryMeterView.java +2 −2 Original line number Diff line number Diff line Loading @@ -48,14 +48,14 @@ import android.widget.TextView; import com.android.settingslib.Utils; import com.android.settingslib.graph.BatteryMeterDrawableBase; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.statusbar.phone.StatusBarIconController; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver; import com.android.systemui.statusbar.policy.IconLogger; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService.Tunable; Loading
packages/SystemUI/src/com/android/systemui/Dependency.java +1 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.fragments.FragmentService; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.PluginDependencyProvider; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.power.EnhancedEstimates; Loading Loading @@ -79,7 +80,6 @@ import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.CastController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DataSaverController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.ExtensionController; Loading
packages/SystemUI/src/com/android/systemui/DependencyBinder.java +1 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui; import com.android.systemui.appops.AppOpsController; import com.android.systemui.appops.AppOpsControllerImpl; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.power.PowerNotificationWarnings; import com.android.systemui.power.PowerUI; Loading @@ -37,7 +38,6 @@ import com.android.systemui.statusbar.policy.BluetoothController; import com.android.systemui.statusbar.policy.BluetoothControllerImpl; import com.android.systemui.statusbar.policy.CastController; import com.android.systemui.statusbar.policy.CastControllerImpl; import com.android.systemui.statusbar.policy.DarkIconDispatcher; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; import com.android.systemui.statusbar.policy.ExtensionController; Loading