summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-03-21 16:16:52 +0100
committerDanny Baumann <dannybaumann@web.de>2013-03-24 13:07:32 +0100
commit667cdc82096a82d44c59914cdcd5652549b5fce1 (patch)
tree872dc08a89732b4119d7e850f3f62e7e28029bca /policy
parent4baf37a1cd78ef7c9d8293004777af420c0d1dc7 (diff)
downloadframeworks_base-667cdc82096a82d44c59914cdcd5652549b5fce1.zip
frameworks_base-667cdc82096a82d44c59914cdcd5652549b5fce1.tar.gz
frameworks_base-667cdc82096a82d44c59914cdcd5652549b5fce1.tar.bz2
Fix up expanded desktop behaviour.
The expanded desktop mode had a number of issues: - It didn't handle multi-user scenarios correctly - In the keyguard, the status bar was shown while the navigation bar was hidden, which was inconsistent to the !keyguard case - Live wallpaper sizing was incorrect when expanded desktop mode was enabled due wallpaper windows not being recalculated correctly after enabling expanded desktop This patch should fix all of those items. Change-Id: I976ffae3a56d411b00026f86b16efa9743a23293
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java86
1 files changed, 67 insertions, 19 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 635d1ec..e815781 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -475,6 +475,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
boolean mForcingShowNavBar;
int mForcingShowNavBarLayer;
+ int mExpandedDesktopStyle = -1;
+
// States of keyguard dismiss.
private static final int DISMISS_KEYGUARD_NONE = 0; // Keyguard not being dismissed.
private static final int DISMISS_KEYGUARD_START = 1; // Keyguard needs to be dismissed.
@@ -1334,7 +1336,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
public void updateSettings() {
ContentResolver resolver = mContext.getContentResolver();
- boolean updateRotation = false;
+ boolean updateRotation = false, updateDisplayMetrics = false;
synchronized (mLock) {
mEndcallBehavior = Settings.System.getIntForUser(resolver,
Settings.System.END_BUTTON_BEHAVIOR,
@@ -1415,6 +1417,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
+ int expandedDesktopStyle = Settings.System.getIntForUser(resolver,
+ Settings.System.EXPANDED_DESKTOP_STYLE, 0, UserHandle.USER_CURRENT);
+ if (Settings.System.getIntForUser(resolver,
+ Settings.System.EXPANDED_DESKTOP_STATE, 0, UserHandle.USER_CURRENT) == 0) {
+ expandedDesktopStyle = 0;
+ }
+
+ if (expandedDesktopStyle != mExpandedDesktopStyle) {
+ mExpandedDesktopStyle = expandedDesktopStyle;
+ updateDisplayMetrics = true;
+ }
+
// Configure rotation lock.
int userRotation = Settings.System.getIntForUser(resolver,
Settings.System.USER_ROTATION, Surface.ROTATION_0,
@@ -1459,9 +1473,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
// Update navigation bar dimensions
- boolean desktopExpanded = Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_DESKTOP_STATE, 0) == 1;
- if (desktopExpanded) {
+ if (expandedDesktopHidesNavigationBar()) {
// Set the navigation bar's dimensions to 0 in expanded desktop mode
mNavigationBarWidthForRotation[mPortraitRotation]
= mNavigationBarWidthForRotation[mUpsideDownRotation]
@@ -1494,6 +1506,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (updateRotation) {
updateRotation(true);
+ } else if (updateDisplayMetrics) {
+ updateDisplayMetrics();
}
}
@@ -2833,8 +2847,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if ((fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR))
== (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) {
int availRight, availBottom;
- if (mCanHideNavigationBar &&
- (systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) {
+ if (shouldHideNavigationBarLw(systemUiVisibility)) {
availRight = mUnrestrictedScreenLeft + mUnrestrictedScreenWidth;
availBottom = mUnrestrictedScreenTop + mUnrestrictedScreenHeight;
} else {
@@ -2919,8 +2932,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// For purposes of positioning and showing the nav bar, if we have
// decided that it can't be hidden (because of the screen aspect ratio),
// then take that into account.
- navVisible |= !mCanHideNavigationBar;
- navVisible &= (Settings.System.getInt(mContext.getContentResolver(), Settings.System.EXPANDED_DESKTOP_STATE, 0) == 0);
+ if (expandedDesktopHidesNavigationBar()) {
+ navVisible = false;
+ } else if (!mCanHideNavigationBar) {
+ navVisible = true;
+ }
if (mNavigationBar != null) {
// Force the navigation bar to its appropriate place and
@@ -2999,8 +3015,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// Let the status bar determine its size.
mStatusBar.computeFrameLw(pf, df, vf, vf);
- // For layout, the status bar is always at the top with our fixed height.
- mStableTop = mUnrestrictedScreenTop + mStatusBarHeight;
+ // For layout, the status bar is always at the top with our fixed height
+ // (except if it's hidden by expanded desktop, in which case we know it's
+ // never shown)
+ if (!expandedDesktopHidesStatusBar()) {
+ mStableTop = mUnrestrictedScreenTop + mStatusBarHeight;
+ }
// If the status bar is hidden, we don't want to cause
// windows behind it to scroll.
@@ -3202,8 +3222,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
"Laying out status bar window: (%d,%d - %d,%d)",
pf.left, pf.top, pf.right, pf.bottom));
}
- } else if (mCanHideNavigationBar
- && (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0
+ } else if (shouldHideNavigationBarLw(sysUiFl)
&& attrs.type >= WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW
&& attrs.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) {
// Asking for layout as if the nav bar is hidden, lets the
@@ -3293,8 +3312,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
pf.right = df.right = cf.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
pf.bottom = df.bottom = cf.bottom
= mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
- } else if (mCanHideNavigationBar
- && (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0
+ } else if (shouldHideNavigationBarLw(sysUiFl)
&& attrs.type >= WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW
&& attrs.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) {
// Asking for layout as if the nav bar is hidden, lets the
@@ -3399,6 +3417,28 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
+ private boolean expandedDesktopHidesStatusBar() {
+ return mExpandedDesktopStyle == 2;
+ }
+
+ private boolean expandedDesktopHidesNavigationBar() {
+ return mExpandedDesktopStyle != 0;
+ }
+
+ private boolean shouldHideNavigationBarLw(int systemUiVisibility) {
+ if (expandedDesktopHidesNavigationBar()) {
+ return true;
+ }
+
+ if (mCanHideNavigationBar) {
+ if ((systemUiVisibility & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
private void offsetInputMethodWindowLw(WindowState win) {
int top = win.getContentFrameLw().top;
top += win.getGivenContentInsetsLw().top;
@@ -3521,7 +3561,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (DEBUG_LAYOUT) Log.i(TAG, "force=" + mForceStatusBar
+ " forcefkg=" + mForceStatusBarFromKeyguard
+ " top=" + mTopFullscreenOpaqueWindowState);
- if (mForceStatusBar || mForceStatusBarFromKeyguard) {
+ if (expandedDesktopHidesStatusBar()) {
+ if (DEBUG_LAYOUT) Log.v(TAG, "Hiding status bar: expanded desktop enabled");
+ if (mStatusBar.hideLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT;
+ } else if (mForceStatusBar || mForceStatusBarFromKeyguard) {
if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar: forced");
if (mStatusBar.showLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT;
} else if (mTopFullscreenOpaqueWindowState != null) {
@@ -3537,10 +3580,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// and mTopIsFullscreen is that that mTopIsFullscreen is set only if the window
// has the FLAG_FULLSCREEN set. Not sure if there is another way that to be the
// case though.
- if (topIsFullscreen || (Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_DESKTOP_STATE, 0) == 1 &&
- Settings.System.getInt(mContext.getContentResolver(),
- Settings.System.EXPANDED_DESKTOP_STYLE, 0) == 2)) {
+ if (topIsFullscreen) {
if (DEBUG_LAYOUT) Log.v(TAG, "** HIDING status bar");
if (mStatusBar.hideLw(true)) {
changes |= FINISH_LAYOUT_REDO_LAYOUT;
@@ -4931,6 +4971,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
}
+ void updateDisplayMetrics() {
+ try {
+ mWindowManager.updateDisplayMetrics();
+ } catch (RemoteException e) {
+ // Ignore
+ }
+ }
+
/**
* Return an Intent to launch the currently active dock app as home. Returns
* null if the standard home should be launched, which is the case if any of the following is