diff options
author | Joe Onorato <joeo@google.com> | 2011-01-23 19:26:13 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-23 19:26:13 -0800 |
commit | 4c541b1303b0ee2b9b0d19bee85d3780c5c4c110 (patch) | |
tree | 74f17a86f6b48fa5b0fa579b206611b6512d161e /policy | |
parent | 2bed570bba183249c6ca9ca1151d1d23808de8c1 (diff) | |
parent | 664644d9e012aa2a28ac96f305b1ce6499ec8806 (diff) | |
download | frameworks_base-4c541b1303b0ee2b9b0d19bee85d3780c5c4c110.zip frameworks_base-4c541b1303b0ee2b9b0d19bee85d3780c5c4c110.tar.gz frameworks_base-4c541b1303b0ee2b9b0d19bee85d3780c5c4c110.tar.bz2 |
Merge "visibility ("lights out") API." into honeycomb
Diffstat (limited to 'policy')
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 0d0e89c..67e0e67 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -34,6 +34,7 @@ import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.PixelFormat; import android.graphics.Rect; +import android.os.Binder; import android.os.Build; import android.os.Handler; import android.os.IBinder; @@ -270,7 +271,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { int mPointerLocationMode = 0; PointerLocationView mPointerLocationView = null; InputChannel mPointerLocationInputChannel; - + + // The last window we were told about in focusChanged. + WindowState mFocusedWindow; + private final InputHandler mPointerLocationInputHandler = new BaseInputHandler() { @Override public void handleMotion(MotionEvent event, InputQueue.FinishedCallback finishedCallback) { @@ -1953,7 +1957,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { mKeyguardMediator.setHidden(false); } } - + + updateSystemUiVisibility(); + // update since mAllowLockscreenWhenOn might have changed updateLockScreenTimeout(); return changes; @@ -1993,6 +1999,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { return true; } + public void focusChanged(WindowState lastFocus, WindowState newFocus) { + mFocusedWindow = newFocus; + updateSystemUiVisibility(); + } + /** {@inheritDoc} */ public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) { // lid changed state @@ -2838,6 +2849,34 @@ public class PhoneWindowManager implements WindowManagerPolicy { return mScreenOn; } + private void updateSystemUiVisibility() { + // If there is no window focused, there will be nobody to handle the events + // anyway, so just hang on in whatever state we're in until things settle down. + if (mFocusedWindow != null) { + final int visibility = mFocusedWindow.getAttrs().systemUiVisibility; + mHandler.post(new Runnable() { + public void run() { + if (mStatusBarService == null) { + mStatusBarService = IStatusBarService.Stub.asInterface( + ServiceManager.getService("statusbar")); + } + if (mStatusBarService != null) { + // need to assume status bar privileges to invoke lights on + long origId = Binder.clearCallingIdentity(); + try { + mStatusBarService.setSystemUiVisibility(visibility); + } catch (RemoteException e) { + // not much to be done + mStatusBarService = null; + } finally { + Binder.restoreCallingIdentity(origId); + } + } + } + }); + } + } + public void dump(String prefix, FileDescriptor fd, PrintWriter pw, String[] args) { pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode); pw.print(" mSystemRead="); pw.println(mSystemReady); |