diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-06-14 16:13:26 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-06-14 16:13:26 -0700 |
commit | 3fe9cc5ea6a9e1acd52144c8ae6cb0492dba34ba (patch) | |
tree | 5383392d0134c178b9704fc78b0b69f7e285d058 | |
parent | 051d16ebec491f7ab504672f561e97b7e850eb1e (diff) | |
parent | e95c07bd8a4f658e035ba0ed2079357961af011b (diff) | |
download | frameworks_base-3fe9cc5ea6a9e1acd52144c8ae6cb0492dba34ba.zip frameworks_base-3fe9cc5ea6a9e1acd52144c8ae6cb0492dba34ba.tar.gz frameworks_base-3fe9cc5ea6a9e1acd52144c8ae6cb0492dba34ba.tar.bz2 |
resolved conflicts for merge of e95c07bd to master
Change-Id: I9af0c08a9f1c1f68661efe051a66835e850b76f6
9 files changed, 51 insertions, 59 deletions
diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 7d21489..2ff0413 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -31,7 +31,7 @@ oneway interface IStatusBar void animateExpand(); void animateCollapse(); void setLightsOn(boolean on); - void setMenuKeyVisible(boolean visible); + void topAppWindowChanged(boolean menuVisible); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); void setHardKeyboardStatus(boolean available, boolean enabled); void userActivity(); diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index bfc717b..3f2b1ef 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + package com.android.internal.statusbar; import com.android.internal.statusbar.IStatusBar; @@ -30,7 +30,7 @@ interface IStatusBarService void setIcon(String slot, String iconPackage, int iconId, int iconLevel); void setIconVisibility(String slot, boolean visible); void removeIcon(String slot); - void setMenuKeyVisible(boolean visible); + void topAppWindowChanged(boolean menuVisible); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); // ---- Methods below are for use by the status bar policy services ---- diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 5f0fbef..83eaaa8 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -44,6 +44,8 @@ <dimen name="status_bar_recents_fading_edge_length">20dip</dimen> <!-- Margin between recents container and glow on the right --> <dimen name="status_bar_recents_right_glow_margin">100dip</dimen> + <!-- Amount to offset bottom of notification peek window from top of status bar. --> + <dimen name="peek_window_y_offset">-12dp</dimen> <!-- thickness (height) of the navigation bar on phones that require it --> <dimen name="navigation_bar_size">42dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index da1e1c5..f81820e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -56,13 +56,12 @@ public class CommandQueue extends IStatusBar.Stub { private static final int MSG_SET_LIGHTS_ON = 7 << MSG_SHIFT; - private static final int MSG_SHOW_MENU = 8 << MSG_SHIFT; + private static final int MSG_TOP_APP_WINDOW_CHANGED = 8 << MSG_SHIFT; private static final int MSG_SHOW_IME_BUTTON = 9 << MSG_SHIFT; private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT; private static final int MSG_USER_ACTIVITY = 11 << MSG_SHIFT; - private StatusBarIconList mList; private Callbacks mCallbacks; private Handler mHandler = new H(); @@ -87,7 +86,7 @@ public class CommandQueue extends IStatusBar.Stub { public void animateExpand(); public void animateCollapse(); public void setLightsOn(boolean on); - public void setMenuKeyVisible(boolean visible); + public void topAppWindowChanged(boolean visible); public void setImeWindowStatus(IBinder token, int vis, int backDisposition); public void setHardKeyboardStatus(boolean available, boolean enabled); public void userActivity(); @@ -166,10 +165,11 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void setMenuKeyVisible(boolean visible) { + public void topAppWindowChanged(boolean menuVisible) { synchronized (mList) { - mHandler.removeMessages(MSG_SHOW_MENU); - mHandler.obtainMessage(MSG_SHOW_MENU, visible ? 1 : 0, 0, null).sendToTarget(); + mHandler.removeMessages(MSG_TOP_APP_WINDOW_CHANGED); + mHandler.obtainMessage(MSG_TOP_APP_WINDOW_CHANGED, menuVisible ? 1 : 0, 0, + null).sendToTarget(); } } @@ -253,8 +253,8 @@ public class CommandQueue extends IStatusBar.Stub { case MSG_SET_LIGHTS_ON: mCallbacks.setLightsOn(msg.arg1 != 0); break; - case MSG_SHOW_MENU: - mCallbacks.setMenuKeyVisible(msg.arg1 != 0); + case MSG_TOP_APP_WINDOW_CHANGED: + mCallbacks.topAppWindowChanged(msg.arg1 != 0); break; case MSG_SHOW_IME_BUTTON: mCallbacks.setImeWindowStatus((IBinder)msg.obj, msg.arg1, msg.arg2); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java index 23ae823..e567dc7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java @@ -78,7 +78,7 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac disable(switches[0]); setLightsOn(switches[1] != 0); - setMenuKeyVisible(switches[2] != 0); + topAppWindowChanged(switches[2] != 0); // StatusBarManagerService has a back up of IME token and it's restored here. setImeWindowStatus(binders.get(0), switches[3], switches[4]); setHardKeyboardStatus(switches[5] != 0, switches[6] != 0); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 687de07..cc8358e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1144,7 +1144,7 @@ public class PhoneStatusBar extends StatusBar { } // Not supported - public void setMenuKeyVisible(boolean visible) { } + public void topAppWindowChanged(boolean visible) { } public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { } @Override public void setHardKeyboardStatus(boolean available, boolean enabled) { } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index ffb45ca..68eade0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -246,11 +246,12 @@ public class TabletStatusBar extends StatusBar implements 512, // ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, - WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN + WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH, PixelFormat.TRANSLUCENT); lp.gravity = Gravity.BOTTOM | Gravity.RIGHT; + lp.y = res.getDimensionPixelOffset(R.dimen.peek_window_y_offset); lp.setTitle("NotificationPeekWindow"); lp.windowAnimations = com.android.internal.R.style.Animation_Toast; @@ -956,14 +957,14 @@ public class TabletStatusBar extends StatusBar implements mHandler.sendEmptyMessage(on ? MSG_SHOW_CHROME : MSG_HIDE_CHROME); } - public void setMenuKeyVisible(boolean visible) { + public void topAppWindowChanged(boolean windowVisible) { if (DEBUG) { - Slog.d(TAG, (visible?"showing":"hiding") + " the MENU button"); + Slog.d(TAG, (windowVisible?"showing":"hiding") + " the MENU button"); } - mMenuButton.setVisibility(visible ? View.VISIBLE : View.GONE); + mMenuButton.setVisibility(windowVisible ? View.VISIBLE : View.GONE); // See above re: lights-out policy for legacy apps. - if (visible) setLightsOn(true); + if (windowVisible) setLightsOn(true); // XXX: HACK: not sure if this is the best way to catch a new activity that might require a // change in compatibility features, but it's a start. diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 9dd2625..5728989 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -330,6 +330,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final Rect mTmpVisibleFrame = new Rect(); WindowState mTopFullscreenOpaqueWindowState; + WindowState mTopAppWindowState; + WindowState mLastTopAppWindowState; boolean mTopIsFullscreen; boolean mForceStatusBar; boolean mHideLockScreen; @@ -340,7 +342,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { Intent mDeskDockIntent; int mShortcutKeyPressed = -1; boolean mConsumeShortcutKeyUp; - boolean mShowMenuKey = false; // track FLAG_NEEDS_MENU_KEY on frontmost window // support for activating the lock screen while the screen is on boolean mAllowLockscreenWhenOn; @@ -1957,12 +1958,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { // 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 = cf.left = vf.left = mUnrestrictedScreenLeft; - pf.top = df.top = cf.top = vf.top = mUnrestrictedScreenTop; - pf.right = df.right = cf.right = vf.right - = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth; - pf.bottom = df.bottom = cf.bottom = vf.bottom - = mUnrestrictedScreenTop+mUnrestrictedScreenHeight; + 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; } else { pf.left = mContentLeft; pf.top = mContentTop; @@ -2032,6 +2032,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { /** {@inheritDoc} */ public void beginAnimationLw(int displayWidth, int displayHeight) { mTopFullscreenOpaqueWindowState = null; + mTopAppWindowState = null; mForceStatusBar = false; mHideLockScreen = false; @@ -2067,6 +2068,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } } + if (mTopAppWindowState == null && win.isVisibleOrBehindKeyguardLw()) { + if (attrs.type >= FIRST_APPLICATION_WINDOW + && attrs.type <= LAST_APPLICATION_WINDOW) { + mTopAppWindowState = win; + } + } } /** {@inheritDoc} */ @@ -2110,22 +2117,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } - boolean topNeedsMenu = mShowMenuKey; - if (lp != null) { - topNeedsMenu = (lp.flags & WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0; - } - - if (DEBUG_LAYOUT) Log.v(TAG, "Top window " - + (topNeedsMenu ? "needs" : "does not need") - + " the MENU key"); - mTopIsFullscreen = topIsFullscreen; - final boolean changedMenu = (topNeedsMenu != mShowMenuKey); - if (changedMenu) { - final boolean topNeedsMenuF = topNeedsMenu; + if (mTopAppWindowState != null && mTopAppWindowState != mLastTopAppWindowState) { + mLastTopAppWindowState = mTopAppWindowState; - mShowMenuKey = topNeedsMenu; + final boolean topNeedsMenu = (mTopAppWindowState.getAttrs().flags + & WindowManager.LayoutParams.FLAG_NEEDS_MENU_KEY) != 0; mHandler.post(new Runnable() { public void run() { @@ -2140,9 +2138,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final IStatusBarService sbs = mStatusBarService; if (mStatusBarService != null) { try { - if (changedMenu) { - sbs.setMenuKeyVisible(topNeedsMenuF); - } + sbs.topAppWindowChanged(topNeedsMenu); } catch (RemoteException e) { // This should be impossible because we're in the same process. mStatusBarService = null; diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java index 1d2072c..b1bce50 100644 --- a/services/java/com/android/server/StatusBarManagerService.java +++ b/services/java/com/android/server/StatusBarManagerService.java @@ -16,21 +16,16 @@ package com.android.server; -import android.app.PendingIntent; import android.app.StatusBarManager; import android.content.BroadcastReceiver; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.res.Resources; -import android.net.Uri; import android.os.IBinder; import android.os.RemoteException; import android.os.Binder; import android.os.Handler; -import android.os.SystemClock; import android.util.Slog; import android.view.View; @@ -253,25 +248,23 @@ public class StatusBarManagerService extends IStatusBarService.Stub * Hide or show the on-screen Menu key. Only call this from the window manager, typically in * response to a window with FLAG_NEEDS_MENU_KEY set. */ - public void setMenuKeyVisible(final boolean visible) { + public void topAppWindowChanged(final boolean menuVisible) { enforceStatusBar(); - if (SPEW) Slog.d(TAG, (visible?"showing":"hiding") + " MENU key"); + if (SPEW) Slog.d(TAG, (menuVisible?"showing":"hiding") + " MENU key"); synchronized(mLock) { - if (mMenuVisible != visible) { - mMenuVisible = visible; - mHandler.post(new Runnable() { - public void run() { - if (mBar != null) { - try { - mBar.setMenuKeyVisible(visible); - } catch (RemoteException ex) { - } + mMenuVisible = menuVisible; + mHandler.post(new Runnable() { + public void run() { + if (mBar != null) { + try { + mBar.topAppWindowChanged(menuVisible); + } catch (RemoteException ex) { } } - }); - } + } + }); } } |