summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeBrightnessHostForwarder.java36
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeHost.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java6
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java4
7 files changed, 65 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeBrightnessHostForwarder.java b/packages/SystemUI/src/com/android/systemui/doze/DozeBrightnessHostForwarder.java
new file mode 100644
index 000000000000..0aeb12875ea1
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeBrightnessHostForwarder.java
@@ -0,0 +1,36 @@
+/*
+ * 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);
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java b/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
index 4804ac23f3af..91ca571e9f7a 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java
@@ -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),
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
index 180b3caab65b..4aff5c630e5f 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeHost.java
@@ -41,6 +41,7 @@ public interface DozeHost {
void onDoubleTap(float x, float y);
+ void setDozeScreenBrightness(int value);
interface Callback {
default void onNotificationHeadsUp() {}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
index 3dd20b1beb49..a5ea967e93be 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
@@ -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
@@ -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");
@@ -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;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 877c3d2d1afe..b734929ea56b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -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);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
index 6104befeb432..836b2ef7e149 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
@@ -58,7 +58,7 @@ public class StatusBarWindowManager implements RemoteInputController.Callback, D
private boolean mHasTopUiChanged;
private int mBarHeight;
private final boolean mKeyguardScreenRotation;
- private final float mScreenBrightnessDoze;
+ private float mScreenBrightnessDoze;
private final State mCurrentState = new State();
private OtherwisedCollapsedListener mListener;
@@ -111,6 +111,10 @@ public class StatusBarWindowManager implements RemoteInputController.Callback, D
mLpChanged.copyFrom(mLp);
}
+ public void setDozeScreenBrightness(int value) {
+ mScreenBrightnessDoze = value / 255f;
+ }
+
public void setKeyguardDark(boolean dark) {
int vis = mStatusBarView.getSystemUiVisibility();
if (dark) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java
index 8ff9fa9fe6f3..c164a31a6b84 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeHostFake.java
@@ -101,4 +101,8 @@ class DozeHostFake implements DozeHost {
doubleTapX = y;
doubleTapY = y;
}
+
+ @Override
+ public void setDozeScreenBrightness(int value) {
+ }
}