summaryrefslogtreecommitdiffstats
path: root/policy/src
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2010-11-24 10:26:50 -0800
committerJoe Onorato <joeo@google.com>2010-11-24 10:26:50 -0800
commit29fc2c9705e1bb8ae098fca016032d2325031587 (patch)
tree2b7e7ed7a40e3d31fa843094f31ecfb4fb257a19 /policy/src
parent93fbae34ce8b6a1907b6f1daf42f17e3f0025346 (diff)
downloadframeworks_base-29fc2c9705e1bb8ae098fca016032d2325031587.zip
frameworks_base-29fc2c9705e1bb8ae098fca016032d2325031587.tar.gz
frameworks_base-29fc2c9705e1bb8ae098fca016032d2325031587.tar.bz2
Allow status bar panels to be on top of the status bar.
Change-Id: I3c74ece5f7042e6302717f4263746d59d5447ec9
Diffstat (limited to 'policy/src')
-rwxr-xr-xpolicy/src/com/android/internal/policy/impl/PhoneWindowManager.java116
1 files changed, 79 insertions, 37 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 1c1a46e..5c8d88b 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -103,6 +103,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL;
+import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
@@ -148,31 +149,32 @@ public class PhoneWindowManager implements WindowManagerPolicy {
static final int APPLICATION_LAYER = 2;
static final int PHONE_LAYER = 3;
static final int SEARCH_BAR_LAYER = 4;
- static final int STATUS_BAR_PANEL_LAYER = 5;
+ static final int STATUS_BAR_SUB_PANEL_LAYER = 5;
static final int SYSTEM_DIALOG_LAYER = 6;
// toasts and the plugged-in battery thing
static final int TOAST_LAYER = 7;
static final int STATUS_BAR_LAYER = 8;
+ static final int STATUS_BAR_PANEL_LAYER = 9;
// SIM errors and unlock. Not sure if this really should be in a high layer.
- static final int PRIORITY_PHONE_LAYER = 9;
+ static final int PRIORITY_PHONE_LAYER = 10;
// like the ANR / app crashed dialogs
- static final int SYSTEM_ALERT_LAYER = 10;
+ static final int SYSTEM_ALERT_LAYER = 11;
// system-level error dialogs
- static final int SYSTEM_ERROR_LAYER = 11;
+ static final int SYSTEM_ERROR_LAYER = 12;
// on-screen keyboards and other such input method user interfaces go here.
- static final int INPUT_METHOD_LAYER = 12;
+ static final int INPUT_METHOD_LAYER = 13;
// on-screen keyboards and other such input method user interfaces go here.
- static final int INPUT_METHOD_DIALOG_LAYER = 13;
+ static final int INPUT_METHOD_DIALOG_LAYER = 14;
// the keyguard; nothing on top of these can take focus, since they are
// responsible for power management when displayed.
- static final int KEYGUARD_LAYER = 14;
- static final int KEYGUARD_DIALOG_LAYER = 15;
+ static final int KEYGUARD_LAYER = 15;
+ static final int KEYGUARD_DIALOG_LAYER = 16;
// the drag layer: input for drag-and-drop is associated with this window,
// which sits above all other focusable windows
- static final int DRAG_LAYER = 16;
+ static final int DRAG_LAYER = 17;
// things in here CAN NOT take focus, but are shown on top of everything else.
- static final int SYSTEM_OVERLAY_LAYER = 17;
- static final int SECURE_SYSTEM_OVERLAY_LAYER = 18;
+ static final int SYSTEM_OVERLAY_LAYER = 18;
+ static final int SECURE_SYSTEM_OVERLAY_LAYER = 19;
static final int APPLICATION_MEDIA_SUBLAYER = -2;
static final int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1;
@@ -274,10 +276,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
};
+ // The current size of the screen; really; (ir)regardless of whether the status
+ // bar can be hidden or not
+ int mUnrestrictedScreenLeft, mUnrestrictedScreenTop;
+ int mUnrestrictedScreenWidth, mUnrestrictedScreenHeight;
// The current size of the screen; these may be different than (0,0)-(dw,dh)
// if the status bar can't be hidden; in that case it effectively carves out
// that area of the display from all other windows.
- int mScreenLeft, mScreenTop, mScreenWidth, mScreenHeight;
+ int mRestrictedScreenLeft, mRestrictedScreenTop;
+ int mRestrictedScreenWidth, mRestrictedScreenHeight;
// During layout, the current screen borders with all outer decoration
// (status bar, input method dock) accounted for.
int mCurLeft, mCurTop, mCurRight, mCurBottom;
@@ -906,6 +913,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return STATUS_BAR_LAYER;
case TYPE_STATUS_BAR_PANEL:
return STATUS_BAR_PANEL_LAYER;
+ case TYPE_STATUS_BAR_SUB_PANEL:
+ return STATUS_BAR_SUB_PANEL_LAYER;
case TYPE_SYSTEM_DIALOG:
return SYSTEM_DIALOG_LAYER;
case TYPE_SEARCH_BAR:
@@ -1126,6 +1135,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
"PhoneWindowManager");
mStatusBarPanels.add(win);
break;
+ case TYPE_STATUS_BAR_SUB_PANEL:
+ mContext.enforceCallingOrSelfPermission(
+ android.Manifest.permission.STATUS_BAR_SERVICE,
+ "PhoneWindowManager");
+ mStatusBarPanels.add(win);
+ break;
case TYPE_KEYGUARD:
if (mKeyguard != null) {
return WindowManagerImpl.ADD_MULTIPLE_SINGLETON;
@@ -1401,8 +1416,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if ((fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_FULLSCREEN | FLAG_LAYOUT_INSET_DECOR))
== (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) {
contentInset.set(mCurLeft, mCurTop,
- (mScreenLeft+mScreenWidth) - mCurRight,
- (mScreenTop+mScreenHeight) - mCurBottom);
+ (mRestrictedScreenLeft+mRestrictedScreenWidth) - mCurRight,
+ (mRestrictedScreenTop+mRestrictedScreenHeight) - mCurBottom);
} else {
contentInset.setEmpty();
}
@@ -1410,9 +1425,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
/** {@inheritDoc} */
public void beginLayoutLw(int displayWidth, int displayHeight) {
- mScreenLeft = mScreenTop = 0;
- mScreenWidth = displayWidth;
- mScreenHeight = displayHeight;
+ mUnrestrictedScreenLeft = mUnrestrictedScreenTop = 0;
+ mUnrestrictedScreenWidth = displayWidth;
+ mUnrestrictedScreenHeight = displayHeight;
+ mRestrictedScreenLeft = mRestrictedScreenTop = 0;
+ mRestrictedScreenWidth = displayWidth;
+ mRestrictedScreenHeight = displayHeight;
mDockLeft = mContentLeft = mCurLeft = 0;
mDockTop = mContentTop = mCurTop = 0;
mDockRight = mContentRight = mCurRight = displayWidth;
@@ -1451,16 +1469,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} else {
// Status bar can't go away; the part of the screen it
// covers does not exist for anything behind it.
- if (mScreenTop == r.top) {
- mScreenTop = r.bottom;
- mScreenHeight -= (r.bottom-r.top);
- } else if ((mScreenHeight-mScreenTop) == r.bottom) {
- mScreenHeight -= (r.bottom-r.top);
+ if (mRestrictedScreenTop == r.top) {
+ mRestrictedScreenTop = r.bottom;
+ mRestrictedScreenHeight -= (r.bottom-r.top);
+ } else if ((mRestrictedScreenHeight-mRestrictedScreenTop) == r.bottom) {
+ mRestrictedScreenHeight -= (r.bottom-r.top);
}
- mContentTop = mCurTop = mDockTop = mScreenTop;
- mContentBottom = mCurBottom = mDockBottom = mScreenTop+mScreenHeight;
- if (DEBUG_LAYOUT) Log.v(TAG, "Status bar: mScreenTop=" + mScreenTop
- + " mScreenHeight=" + mScreenHeight);
+ mContentTop = mCurTop = mDockTop = mRestrictedScreenTop;
+ mContentBottom = mCurBottom = mDockBottom
+ = mRestrictedScreenTop + mRestrictedScreenHeight;
+ if (DEBUG_LAYOUT) Log.v(TAG, "Status bar: mRestrictedScreenTop="
+ + mRestrictedScreenTop
+ + " mRestrictedScreenHeight=" + mRestrictedScreenHeight);
}
}
}
@@ -1552,10 +1572,21 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// frame is the same as the one we are attached to.
setAttachedWindowFrames(win, fl, sim, attached, true, pf, df, cf, vf);
} else {
- pf.left = df.left = mScreenLeft;
- pf.top = df.top = mScreenTop;
- pf.right = df.right = mScreenLeft+mScreenWidth;
- pf.bottom = df.bottom = mScreenTop+mScreenHeight;
+ if (attrs.type == TYPE_STATUS_BAR_PANEL) {
+ // Status bar panels are the only windows who can go on top of
+ // the status bar. They are protected by the STATUS_BAR_SERVICE
+ // permission, so they have the same privileges as the status
+ // bar itself.
+ pf.left = df.left = mUnrestrictedScreenLeft;
+ pf.top = df.top = mUnrestrictedScreenTop;
+ pf.right = df.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
+ pf.bottom = df.bottom = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
+ } else {
+ pf.left = df.left = mRestrictedScreenLeft;
+ pf.top = df.top = mRestrictedScreenTop;
+ pf.right = df.right = mRestrictedScreenLeft+mRestrictedScreenWidth;
+ pf.bottom = df.bottom = mRestrictedScreenTop+mRestrictedScreenHeight;
+ }
if (adjust != SOFT_INPUT_ADJUST_RESIZE) {
cf.left = mDockLeft;
cf.top = mDockTop;
@@ -1579,10 +1610,20 @@ public class PhoneWindowManager implements WindowManagerPolicy {
} else if ((fl & FLAG_LAYOUT_IN_SCREEN) != 0) {
// A window that has requested to fill the entire screen just
// gets everything, period.
- pf.left = df.left = cf.left = mScreenLeft;
- pf.top = df.top = cf.top = mScreenTop;
- pf.right = df.right = cf.right = mScreenLeft+mScreenWidth;
- pf.bottom = df.bottom = cf.bottom = mScreenTop+mScreenHeight;
+ if (attrs.type == TYPE_STATUS_BAR_PANEL) {
+ pf.left = df.left = cf.left = mUnrestrictedScreenLeft;
+ pf.top = df.top = cf.top = mUnrestrictedScreenTop;
+ pf.right = df.right = cf.right
+ = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
+ pf.bottom = df.bottom = cf.bottom
+ = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
+ } else {
+ pf.left = df.left = cf.left = mRestrictedScreenLeft;
+ pf.top = df.top = cf.top = mRestrictedScreenTop;
+ pf.right = df.right = cf.right = mRestrictedScreenLeft+mRestrictedScreenWidth;
+ pf.bottom = df.bottom = cf.bottom
+ = mRestrictedScreenTop+mRestrictedScreenHeight;
+ }
if (adjust != SOFT_INPUT_ADJUST_NOTHING) {
vf.left = mCurLeft;
vf.top = mCurTop;
@@ -1841,9 +1882,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
rect.union(w.getShownFrameLw());
}
}
- final int insetw = mScreenWidth/10;
- final int inseth = mScreenHeight/10;
- if (rect.contains(insetw, inseth, mScreenWidth-insetw, mScreenHeight-inseth)) {
+ final int insetw = mRestrictedScreenWidth/10;
+ final int inseth = mRestrictedScreenHeight/10;
+ if (rect.contains(insetw, inseth, mRestrictedScreenWidth-insetw,
+ mRestrictedScreenHeight-inseth)) {
// All of the status bar windows put together cover the
// screen, so the app can't be seen. (Note this test doesn't
// work if the rects of these windows are at off offsets or