diff options
author | Dianne Hackborn <> | 2009-03-25 17:10:37 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-25 17:10:37 -0700 |
commit | 9ed4a4b0d7dadeadd57bd81e2cc538670d9654b9 (patch) | |
tree | 56013c48a17caee49d0f29abe72b5a3d4eac72a0 | |
parent | 61be3ae6963019dc993efbc4282afe1266ca3928 (diff) | |
download | frameworks_base-9ed4a4b0d7dadeadd57bd81e2cc538670d9654b9.zip frameworks_base-9ed4a4b0d7dadeadd57bd81e2cc538670d9654b9.tar.gz frameworks_base-9ed4a4b0d7dadeadd57bd81e2cc538670d9654b9.tar.bz2 |
Automated import from //branches/donutburger/...@142722,142722
-rw-r--r-- | services/java/com/android/server/PowerManagerService.java | 49 | ||||
-rw-r--r-- | services/java/com/android/server/WindowManagerService.java | 9 |
2 files changed, 38 insertions, 20 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index a900b3e..bbca401 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -1373,8 +1373,9 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage } private void updateLightsLocked(int newState, int forceState) { - int oldState = mPowerState; - int difference = (newState ^ oldState) | forceState; + final int oldState = mPowerState; + final int realDifference = (newState ^ oldState); + final int difference = realDifference | forceState; if (difference == 0) { return; } @@ -1430,22 +1431,29 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage if ((difference & (SCREEN_ON_BIT | SCREEN_BRIGHT_BIT)) != 0) { if (ANIMATE_SCREEN_LIGHTS) { - int nominalCurrentValue; - switch (oldState & (SCREEN_BRIGHT_BIT|SCREEN_ON_BIT)) { - case SCREEN_BRIGHT_BIT | SCREEN_ON_BIT: - nominalCurrentValue = preferredBrightness; - break; - case SCREEN_ON_BIT: - nominalCurrentValue = Power.BRIGHTNESS_DIM; - break; - case 0: - nominalCurrentValue = Power.BRIGHTNESS_OFF; - break; - case SCREEN_BRIGHT_BIT: - default: - // not possible - nominalCurrentValue = (int)mScreenBrightness.curValue; - break; + int nominalCurrentValue = -1; + // If there was an actual difference in the light state, then + // figure out the "ideal" current value based on the previous + // state. Otherwise, this is a change due to the brightness + // override, so we want to animate from whatever the current + // value is. + if ((realDifference & (SCREEN_ON_BIT | SCREEN_BRIGHT_BIT)) != 0) { + switch (oldState & (SCREEN_BRIGHT_BIT|SCREEN_ON_BIT)) { + case SCREEN_BRIGHT_BIT | SCREEN_ON_BIT: + nominalCurrentValue = preferredBrightness; + break; + case SCREEN_ON_BIT: + nominalCurrentValue = Power.BRIGHTNESS_DIM; + break; + case 0: + nominalCurrentValue = Power.BRIGHTNESS_OFF; + break; + case SCREEN_BRIGHT_BIT: + default: + // not possible + nominalCurrentValue = (int)mScreenBrightness.curValue; + break; + } } if ((newState & SCREEN_BRIGHT_BIT) == 0) { // dim or turn off backlight, depending on if the screen is on @@ -1575,7 +1583,9 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage curValue = (float)initialValue; } targetValue = target; - delta = (targetValue-nominalCurrentValue) / stepsToTarget; + delta = (targetValue - + (nominalCurrentValue >= 0 ? nominalCurrentValue : curValue)) + / stepsToTarget; if (mSpew) { String noticeMe = nominalCurrentValue == curValue ? "" : " ******************"; Log.i(TAG, "Setting target " + mask + ": cur=" + curValue @@ -1596,6 +1606,7 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage int curIntValue = (int)curValue; boolean more = true; if (delta == 0) { + curValue = curIntValue = targetValue; more = false; } else if (delta > 0) { if (curIntValue >= targetValue) { diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 56f8bc1..ed8b23a 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -7799,6 +7799,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo boolean blurring = false; boolean dimming = false; boolean covered = false; + boolean syswin = false; for (i=N-1; i>=0; i--) { WindowState w = (WindowState)mWindows.get(i); @@ -8058,9 +8059,15 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo if ((attrFlags&FLAG_KEEP_SCREEN_ON) != 0) { holdScreen = w.mSession; } - if (w.mAttrs.screenBrightness >= 0 && screenBrightness < 0) { + if (!syswin && w.mAttrs.screenBrightness >= 0 + && screenBrightness < 0) { screenBrightness = w.mAttrs.screenBrightness; } + if (attrs.type == WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG + || attrs.type == WindowManager.LayoutParams.TYPE_KEYGUARD + || attrs.type == WindowManager.LayoutParams.TYPE_SYSTEM_ERROR) { + syswin = true; + } } if (w.isFullscreenOpaque(dw, dh)) { // This window completely covers everything behind it, |