diff options
Diffstat (limited to 'policy')
4 files changed, 65 insertions, 18 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java index 6ee5861..f52bb26 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java @@ -18,6 +18,7 @@ package com.android.internal.policy.impl; import com.android.internal.R; +import android.app.ActivityManager; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.res.Resources; @@ -107,13 +108,16 @@ public class KeyguardViewManager implements KeyguardWindowController { int flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER | WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING - | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED - | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM /*| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR*/ ; if (!mNeedsInput) { flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; } + if (ActivityManager.isHighEndGfx(((WindowManager)mContext.getSystemService( + Context.WINDOW_SERVICE)).getDefaultDisplay())) { + flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED + | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM; + } WindowManager.LayoutParams lp = new WindowManager.LayoutParams( stretch, stretch, WindowManager.LayoutParams.TYPE_KEYGUARD, flags, PixelFormat.TRANSLUCENT); diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java index ee6d2ee..06b7fb9 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -143,6 +143,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback, */ private static final int KEYGUARD_DONE_DRAWING_TIMEOUT_MS = 2000; + /** + * Allow the user to operate the status bar when the keyguard is engaged (without a pattern or + * password). + */ + private static final boolean ENABLE_STATUS_BAR_IN_KEYGUARD = true; + private Context mContext; private AlarmManager mAlarmManager; private StatusBarManager mStatusBarManager; @@ -1132,9 +1138,10 @@ public class KeyguardViewMediator implements KeyguardViewCallback, } } - // if the keyguard is shown, allow the status bar to open - // only if the keyguard is insecure and is covered by another window - boolean enable = !mShowing || (mHidden && !isSecure()); + // if the keyguard is shown, allow the status bar to open only if the keyguard is + // insecure and (is covered by another window OR this feature is enabled in general) + boolean enable = !mShowing + || ((ENABLE_STATUS_BAR_IN_KEYGUARD || mHidden) && !isSecure()); mStatusBarManager.disable(enable ? StatusBarManager.DISABLE_NONE : ( StatusBarManager.DISABLE_EXPAND diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 6dd4948..0ee6488 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -235,6 +235,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } @Override + public void setUiOptions(int uiOptions, int mask) { + mUiOptions = (mUiOptions & ~mask) | (uiOptions & mask); + } + + @Override public void setContentView(int layoutResID) { if (mContentParent == null) { installDecor(); @@ -392,6 +397,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // Preparing the panel menu can involve a lot of manipulation; // don't dispatch change events to presenters until we're done. st.menu.stopDispatchingItemsChanged(); + + // Restore action view state before we prepare. This gives apps + // an opportunity to override frozen/restored state in onPrepare. + if (st.frozenActionViewState != null) { + st.menu.restoreActionViewStates(st.frozenActionViewState); + st.frozenActionViewState = null; + } + if (!cb.onPreparePanel(st.featureId, st.createdPanelView, st.menu)) { st.menu.startDispatchingItemsChanged(); return false; @@ -410,11 +423,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { st.isHandled = false; mPreparedPanel = st; - if (st.frozenActionViewState != null) { - st.menu.restoreActionViewStates(st.frozenActionViewState); - st.frozenActionViewState = null; - } - return true; } diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index a2dbb78..b60a038 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -243,6 +243,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { int mStatusBarHeight; final ArrayList<WindowState> mStatusBarPanels = new ArrayList<WindowState>(); WindowState mNavigationBar = null; + boolean mHasNavigationBar = false; + int mNavigationBarWidth = 0, mNavigationBarHeight = 0; WindowState mKeyguard = null; KeyguardViewMediator mKeyguardMediator; @@ -796,6 +798,17 @@ public class PhoneWindowManager implements WindowManagerPolicy { mStatusBarCanHide ? com.android.internal.R.dimen.status_bar_height : com.android.internal.R.dimen.system_bar_height); + + mHasNavigationBar = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_showNavigationBar); + mNavigationBarHeight = mHasNavigationBar + ? mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.navigation_bar_height) + : 0; + mNavigationBarWidth = mHasNavigationBar + ? mContext.getResources().getDimensionPixelSize( + com.android.internal.R.dimen.navigation_bar_width) + : 0; } public void updateSettings() { @@ -1110,19 +1123,26 @@ public class PhoneWindowManager implements WindowManagerPolicy { } public int getNonDecorDisplayWidth(int rotation, int fullWidth) { - return fullWidth; + // Assumes that the navigation bar appears on the side of the display in landscape. + final boolean horizontal + = (rotation == Surface.ROTATION_270 || rotation == Surface.ROTATION_90); + return fullWidth - (horizontal ? mNavigationBarWidth : 0); } public int getNonDecorDisplayHeight(int rotation, int fullHeight) { - return mStatusBarCanHide ? fullHeight : (fullHeight - mStatusBarHeight); + final boolean horizontal + = (rotation == Surface.ROTATION_270 || rotation == Surface.ROTATION_90); + return fullHeight + - (mStatusBarCanHide ? 0 : mStatusBarHeight) + - (horizontal ? 0 : mNavigationBarHeight); } public int getConfigDisplayWidth(int rotation, int fullWidth) { - return fullWidth; + return getNonDecorDisplayWidth(rotation, fullWidth); } public int getConfigDisplayHeight(int rotation, int fullHeight) { - return fullHeight - mStatusBarHeight; + return getNonDecorDisplayHeight(rotation, fullHeight); } public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs) { @@ -1851,7 +1871,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { final Rect cf = mTmpContentFrame; final Rect vf = mTmpVisibleFrame; - final boolean hasNavBar = (mNavigationBar != null && mNavigationBar.isVisibleLw()); + final boolean hasNavBar = (mHasNavigationBar + && mNavigationBar != null && mNavigationBar.isVisibleLw()); if (attrs.type == TYPE_INPUT_METHOD) { pf.left = df.left = cf.left = vf.left = mDockLeft; @@ -1943,6 +1964,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { ? mRestrictedScreenTop+mRestrictedScreenHeight : mUnrestrictedScreenTop+mUnrestrictedScreenHeight; + if (DEBUG_LAYOUT) { + Log.v(TAG, String.format( + "Laying out IN_SCREEN status bar window: (%d,%d - %d,%d)", + pf.left, pf.top, pf.right, pf.bottom)); + } } else if (attrs.type == TYPE_NAVIGATION_BAR) { // The navigation bar has Real Ultimate Power. pf.left = df.left = mUnrestrictedScreenLeft; @@ -2824,7 +2850,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { // or orientation sensor disabled //or case.unspecified if (mHdmiPlugged) { - return Surface.ROTATION_0; + return mLandscapeRotation; } else if (mLidOpen == LID_OPEN) { return mLidOpenRotation; } else if (mDockMode == Intent.EXTRA_DOCK_STATE_CAR && mCarDockRotation >= 0) { @@ -3203,7 +3229,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { int result = ActivityManagerNative.getDefault() .startActivity(null, dock, dock.resolveTypeIfNeeded(mContext.getContentResolver()), - null, 0, null, null, 0, true /* onlyIfNeeded*/, false); + null, 0, null, null, 0, true /* onlyIfNeeded*/, false, + null, null, false); if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) { return false; } @@ -3212,7 +3239,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { int result = ActivityManagerNative.getDefault() .startActivity(null, mHomeIntent, mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()), - null, 0, null, null, 0, true /* onlyIfNeeded*/, false); + null, 0, null, null, 0, true /* onlyIfNeeded*/, false, + null, null, false); if (result == IActivityManager.START_RETURN_INTENT_TO_CALLER) { return false; } |