summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-02-20 07:38:31 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-02-20 07:38:31 -0800
commit15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b (patch)
treed03d027a7ed97af616904e02a7b420babf40d44f /services
parent3001a035439d8134a7d70d796376d1dfbff3cdcd (diff)
downloadframeworks_base-15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b.zip
frameworks_base-15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b.tar.gz
frameworks_base-15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b.tar.bz2
auto import from //branches/cupcake/...@132569
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/PowerManagerService.java54
-rw-r--r--services/java/com/android/server/WindowManagerService.java17
2 files changed, 42 insertions, 29 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 16b5819..f41d21f 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -246,8 +246,13 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage
public void acquire() {
if (!mRefCounted || mCount++ == 0) {
- PowerManagerService.this.acquireWakeLockLocked(mFlags, mToken,
- MY_UID, mTag);
+ long ident = Binder.clearCallingIdentity();
+ try {
+ PowerManagerService.this.acquireWakeLockLocked(mFlags, mToken,
+ MY_UID, mTag);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
}
}
@@ -1285,8 +1290,9 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage
} finally {
Binder.restoreCallingIdentity(identity);
}
+ mPowerState &= ~SCREEN_ON_BIT;
if (!mScreenBrightness.animating) {
- err = turnScreenOffLocked(becauseOfUser);
+ err = screenOffFinishedAnimating(becauseOfUser);
} else {
mOffBecauseOfUser = becauseOfUser;
err = 0;
@@ -1297,33 +1303,25 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage
}
}
- private int turnScreenOffLocked(boolean becauseOfUser) {
- if ((mPowerState&SCREEN_ON_BIT) != 0) {
- EventLog.writeEvent(LOG_POWER_SCREEN_STATE, 0, becauseOfUser ? 1 : 0,
- mTotalTouchDownTime, mTouchCycles);
- mLastTouchDown = 0;
- int err = Power.setScreenState(false);
+ private int screenOffFinishedAnimating(boolean becauseOfUser) {
+ // I don't think we need to check the current state here because all of these
+ // Power.setScreenState and sendNotificationLocked can both handle being
+ // called multiple times in the same state. -joeo
+ EventLog.writeEvent(LOG_POWER_SCREEN_STATE, 0, becauseOfUser ? 1 : 0,
+ mTotalTouchDownTime, mTouchCycles);
+ mLastTouchDown = 0;
+ int err = Power.setScreenState(false);
+ if (mScreenOnStartTime != 0) {
mScreenOnTime += SystemClock.elapsedRealtime() - mScreenOnStartTime;
mScreenOnStartTime = 0;
- if (err == 0) {
- //
- // FIXME(joeo)
- //
- // The problem that causes the screen not to come on is that this isn't
- // called until after the animation is done. It needs to be set right
- // away, and the anmiation's state needs to be recorded separately.
- //
- //
-
- mPowerState &= ~SCREEN_ON_BIT;
- int why = becauseOfUser
- ? WindowManagerPolicy.OFF_BECAUSE_OF_USER
- : WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT;
- sendNotificationLocked(false, why);
- }
- return err;
}
- return 0;
+ if (err == 0) {
+ int why = becauseOfUser
+ ? WindowManagerPolicy.OFF_BECAUSE_OF_USER
+ : WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT;
+ sendNotificationLocked(false, why);
+ }
+ return err;
}
private boolean batteryIsLow() {
@@ -1538,7 +1536,7 @@ class PowerManagerService extends IPowerManager.Stub implements LocalPowerManage
animating = more;
if (!more) {
if (mask == Power.SCREEN_LIGHT && curIntValue == Power.BRIGHTNESS_OFF) {
- turnScreenOffLocked(mOffBecauseOfUser);
+ screenOffFinishedAnimating(mOffBecauseOfUser);
}
}
return more;
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index fc22bad..10a2d29 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -2088,6 +2088,11 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
}
}
int or = wtoken.requestedOrientation;
+ // If this application is fullscreen, then just take whatever
+ // orientation it has and ignores whatever is under it.
+ if (wtoken.appFullscreen) {
+ return or;
+ }
// If this application has requested an explicit orientation,
// then use it.
if (or == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE ||
@@ -5594,6 +5599,10 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
return mFrame;
}
+ public Rect getShownFrameLw() {
+ return mShownFrame;
+ }
+
public Rect getDisplayFrameLw() {
return mDisplayFrame;
}
@@ -6221,10 +6230,16 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo
}
public boolean fillsScreenLw(int screenWidth, int screenHeight,
- boolean shownFrame) {
+ boolean shownFrame, boolean onlyOpaque) {
if (mSurface == null) {
return false;
}
+ if (mAppToken != null && !mAppToken.appFullscreen) {
+ return false;
+ }
+ if (onlyOpaque && mAttrs.format != PixelFormat.OPAQUE) {
+ return false;
+ }
final Rect frame = shownFrame ? mShownFrame : mFrame;
if (frame.left <= 0 && frame.top <= 0
&& frame.right >= screenWidth