Loading packages/SystemUI/src/com/android/systemui/doze/DozeBrightnessHostForwarder.java 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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.doze; /** * Forwards the currently used brightness to {@link DozeHost}. */ public class DozeBrightnessHostForwarder extends DozeMachine.Service.Delegate { private final DozeHost mHost; public DozeBrightnessHostForwarder(DozeMachine.Service wrappedService, DozeHost host) { super(wrappedService); mHost = host; } @Override public void setDozeScreenBrightness(int brightness) { super.setDozeScreenBrightness(brightness); mHost.setDozeScreenBrightness(brightness); } } packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +6 −2 Original line number Diff line number Diff line Loading @@ -49,8 +49,12 @@ public class DozeFactory { WakeLock wakeLock = new DelayedWakeLock(handler, WakeLock.createPartial(context, "Doze")); DozeMachine.Service wrappedService = DozeSuspendScreenStatePreventingAdapter.wrapIfNeeded( DozeScreenStatePreventingAdapter.wrapIfNeeded(dozeService, params), params); DozeMachine.Service wrappedService = dozeService; wrappedService = new DozeBrightnessHostForwarder(wrappedService, host); wrappedService = DozeScreenStatePreventingAdapter.wrapIfNeeded(wrappedService, params); wrappedService = DozeSuspendScreenStatePreventingAdapter.wrapIfNeeded(wrappedService, params); DozeMachine machine = new DozeMachine(wrappedService, config, wakeLock); machine.setParts(new DozeMachine.Part[]{ new DozePauser(handler, machine, alarmManager), Loading packages/SystemUI/src/com/android/systemui/doze/DozeHost.java +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public interface DozeHost { void onDoubleTap(float x, float y); void setDozeScreenBrightness(int value); interface Callback { default void onNotificationHeadsUp() {} Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java +8 −4 Original line number Diff line number Diff line Loading @@ -163,8 +163,8 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { } mHandler.postDelayed(mReleaseFingerprintWakeLockRunnable, FINGERPRINT_WAKELOCK_TIMEOUT_MS); if (mDozeScrimController.isPulsing()) { if (pulsingOrAod()) { // If we are waking the device up while we are pulsing the clock and the // notifications would light up first, creating an unpleasant animation. // Defer changing the screen brightness by forcing doze brightness on our window Loading @@ -175,6 +175,12 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { Trace.endSection(); } private boolean pulsingOrAod() { boolean pulsing = mDozeScrimController.isPulsing(); boolean dozingWithScreenOn = mStatusBar.isDozing() && !mStatusBar.isScreenFullyOff(); return pulsing || dozingWithScreenOn; } @Override public void onFingerprintAuthenticated(int userId) { Trace.beginSection("FingerprintUnlockController#onFingerprintAuthenticated"); Loading Loading @@ -269,13 +275,11 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { private int calculateMode() { boolean unlockingAllowed = mUpdateMonitor.isUnlockingWithFingerprintAllowed(); boolean pulsing = mDozeScrimController.isPulsing(); boolean dozingWithScreenOn = mStatusBar.isDozing() && !mStatusBar.isScreenFullyOff(); if (!mUpdateMonitor.isDeviceInteractive()) { if (!mStatusBarKeyguardViewManager.isShowing()) { return MODE_ONLY_WAKE; } else if ((pulsing || dozingWithScreenOn) && unlockingAllowed) { } else if (pulsingOrAod() && unlockingAllowed) { return MODE_WAKE_AND_UNLOCK_PULSING; } else if (unlockingAllowed || !mUnlockMethodCache.isMethodSecure()) { return MODE_WAKE_AND_UNLOCK; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +5 −0 Original line number Diff line number Diff line Loading @@ -5432,6 +5432,11 @@ public class StatusBar extends SystemUI implements DemoMode, } } @Override public void setDozeScreenBrightness(int value) { mStatusBarWindowManager.setDozeScreenBrightness(value); } public void dispatchDoubleTap(float viewX, float viewY) { dispatchTap(mAmbientIndicationContainer, viewX, viewY); dispatchTap(mAmbientIndicationContainer, viewX, viewY); Loading Loading
packages/SystemUI/src/com/android/systemui/doze/DozeBrightnessHostForwarder.java 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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.doze; /** * Forwards the currently used brightness to {@link DozeHost}. */ public class DozeBrightnessHostForwarder extends DozeMachine.Service.Delegate { private final DozeHost mHost; public DozeBrightnessHostForwarder(DozeMachine.Service wrappedService, DozeHost host) { super(wrappedService); mHost = host; } @Override public void setDozeScreenBrightness(int brightness) { super.setDozeScreenBrightness(brightness); mHost.setDozeScreenBrightness(brightness); } }
packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +6 −2 Original line number Diff line number Diff line Loading @@ -49,8 +49,12 @@ public class DozeFactory { WakeLock wakeLock = new DelayedWakeLock(handler, WakeLock.createPartial(context, "Doze")); DozeMachine.Service wrappedService = DozeSuspendScreenStatePreventingAdapter.wrapIfNeeded( DozeScreenStatePreventingAdapter.wrapIfNeeded(dozeService, params), params); DozeMachine.Service wrappedService = dozeService; wrappedService = new DozeBrightnessHostForwarder(wrappedService, host); wrappedService = DozeScreenStatePreventingAdapter.wrapIfNeeded(wrappedService, params); wrappedService = DozeSuspendScreenStatePreventingAdapter.wrapIfNeeded(wrappedService, params); DozeMachine machine = new DozeMachine(wrappedService, config, wakeLock); machine.setParts(new DozeMachine.Part[]{ new DozePauser(handler, machine, alarmManager), Loading
packages/SystemUI/src/com/android/systemui/doze/DozeHost.java +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ public interface DozeHost { void onDoubleTap(float x, float y); void setDozeScreenBrightness(int value); interface Callback { default void onNotificationHeadsUp() {} Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java +8 −4 Original line number Diff line number Diff line Loading @@ -163,8 +163,8 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { } mHandler.postDelayed(mReleaseFingerprintWakeLockRunnable, FINGERPRINT_WAKELOCK_TIMEOUT_MS); if (mDozeScrimController.isPulsing()) { if (pulsingOrAod()) { // If we are waking the device up while we are pulsing the clock and the // notifications would light up first, creating an unpleasant animation. // Defer changing the screen brightness by forcing doze brightness on our window Loading @@ -175,6 +175,12 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { Trace.endSection(); } private boolean pulsingOrAod() { boolean pulsing = mDozeScrimController.isPulsing(); boolean dozingWithScreenOn = mStatusBar.isDozing() && !mStatusBar.isScreenFullyOff(); return pulsing || dozingWithScreenOn; } @Override public void onFingerprintAuthenticated(int userId) { Trace.beginSection("FingerprintUnlockController#onFingerprintAuthenticated"); Loading Loading @@ -269,13 +275,11 @@ public class FingerprintUnlockController extends KeyguardUpdateMonitorCallback { private int calculateMode() { boolean unlockingAllowed = mUpdateMonitor.isUnlockingWithFingerprintAllowed(); boolean pulsing = mDozeScrimController.isPulsing(); boolean dozingWithScreenOn = mStatusBar.isDozing() && !mStatusBar.isScreenFullyOff(); if (!mUpdateMonitor.isDeviceInteractive()) { if (!mStatusBarKeyguardViewManager.isShowing()) { return MODE_ONLY_WAKE; } else if ((pulsing || dozingWithScreenOn) && unlockingAllowed) { } else if (pulsingOrAod() && unlockingAllowed) { return MODE_WAKE_AND_UNLOCK_PULSING; } else if (unlockingAllowed || !mUnlockMethodCache.isMethodSecure()) { return MODE_WAKE_AND_UNLOCK; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +5 −0 Original line number Diff line number Diff line Loading @@ -5432,6 +5432,11 @@ public class StatusBar extends SystemUI implements DemoMode, } } @Override public void setDozeScreenBrightness(int value) { mStatusBarWindowManager.setDozeScreenBrightness(value); } public void dispatchDoubleTap(float viewX, float viewY) { dispatchTap(mAmbientIndicationContainer, viewX, viewY); dispatchTap(mAmbientIndicationContainer, viewX, viewY); Loading