am 33b02ef2: am 03fdca1b: Merge "Fixed a bug where the heads-up would not show when full screen" into mnc-dev
* commit '33b02ef23b38675807f14d1d06270fd247acba2d': Fixed a bug where the heads-up would not show when full screen
This commit is contained in:
@@ -21,7 +21,6 @@ import android.annotation.SystemApi;
|
||||
import android.app.Presentation;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.os.IBinder;
|
||||
@@ -1119,6 +1118,15 @@ public interface WindowManager extends ViewManager {
|
||||
*/
|
||||
public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
|
||||
|
||||
/**
|
||||
* Flag to force the status bar window to be visible all the time. If the bar is hidden when
|
||||
* this flag is set it will be shown again and the bar will have a transparent background.
|
||||
* This can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public static final int PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT = 0x00001000;
|
||||
|
||||
/**
|
||||
* Control flags that are private to the platform.
|
||||
* @hide
|
||||
|
||||
@@ -157,7 +157,8 @@ public class CommandQueue extends IStatusBar.Stub {
|
||||
|
||||
public void setSystemUiVisibility(int vis, int mask) {
|
||||
synchronized (mList) {
|
||||
mHandler.removeMessages(MSG_SET_SYSTEMUI_VISIBILITY);
|
||||
// Don't coalesce these, since it might have one time flags set such as
|
||||
// STATUS_BAR_UNHIDE which might get lost.
|
||||
mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, vis, mask, null).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,6 +529,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
= new HashMap<>();
|
||||
private HashSet<Entry> mHeadsUpEntriesToRemoveOnSwitch = new HashSet<>();
|
||||
private RankingMap mLatestRankingMap;
|
||||
private boolean mNoAnimationOnNextBarModeChange;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
@@ -1709,6 +1710,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
* State is one or more of the DISABLE constants from StatusBarManager.
|
||||
*/
|
||||
public void disable(int state1, int state2, boolean animate) {
|
||||
animate &= mStatusBarWindowState != WINDOW_STATE_HIDDEN;
|
||||
mDisabledUnmodified1 = state1;
|
||||
mDisabledUnmodified2 = state2;
|
||||
state1 = adjustDisableFlags(state1);
|
||||
@@ -1868,6 +1870,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
public void onHeadsUpPinnedModeChanged(boolean inPinnedMode) {
|
||||
if (inPinnedMode) {
|
||||
mStatusBarWindowManager.setHeadsUpShowing(true);
|
||||
mStatusBarWindowManager.setForceStatusBarVisible(true);
|
||||
} else {
|
||||
Runnable endRunnable = new Runnable() {
|
||||
@Override
|
||||
@@ -2132,6 +2135,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
// Shrink the window to the size of the status bar only
|
||||
mStatusBarWindowManager.setStatusBarExpanded(false);
|
||||
mStatusBarWindowManager.setForceStatusBarVisible(false);
|
||||
mStatusBarView.setFocusable(true);
|
||||
|
||||
// Close any "App info" popups that might have snuck on-screen
|
||||
@@ -2272,6 +2276,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
setAreThereNotifications();
|
||||
}
|
||||
|
||||
// ready to unhide
|
||||
if ((vis & View.STATUS_BAR_UNHIDE) != 0) {
|
||||
mSystemUiVisibility &= ~View.STATUS_BAR_UNHIDE;
|
||||
mNoAnimationOnNextBarModeChange = true;
|
||||
}
|
||||
|
||||
// update status bar mode
|
||||
final int sbMode = computeBarMode(oldVal, newVal, mStatusBarView.getBarTransitions(),
|
||||
View.STATUS_BAR_TRANSIENT, View.STATUS_BAR_TRANSLUCENT);
|
||||
@@ -2303,10 +2313,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
}
|
||||
|
||||
// ready to unhide
|
||||
if ((vis & View.STATUS_BAR_UNHIDE) != 0) {
|
||||
mSystemUiVisibility &= ~View.STATUS_BAR_UNHIDE;
|
||||
}
|
||||
if ((vis & View.NAVIGATION_BAR_UNHIDE) != 0) {
|
||||
mSystemUiVisibility &= ~View.NAVIGATION_BAR_UNHIDE;
|
||||
}
|
||||
@@ -2351,17 +2357,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
private void checkBarModes() {
|
||||
if (mDemoMode) return;
|
||||
checkBarMode(mStatusBarMode, mStatusBarWindowState, mStatusBarView.getBarTransitions());
|
||||
checkBarMode(mStatusBarMode, mStatusBarWindowState, mStatusBarView.getBarTransitions(),
|
||||
mNoAnimationOnNextBarModeChange);
|
||||
if (mNavigationBarView != null) {
|
||||
checkBarMode(mNavigationBarMode,
|
||||
mNavigationBarWindowState, mNavigationBarView.getBarTransitions());
|
||||
mNavigationBarWindowState, mNavigationBarView.getBarTransitions(),
|
||||
mNoAnimationOnNextBarModeChange);
|
||||
}
|
||||
mNoAnimationOnNextBarModeChange = false;
|
||||
}
|
||||
|
||||
private void checkBarMode(int mode, int windowState, BarTransitions transitions) {
|
||||
private void checkBarMode(int mode, int windowState, BarTransitions transitions,
|
||||
boolean noAnimation) {
|
||||
final boolean powerSave = mBatteryController.isPowerSave();
|
||||
final boolean anim = (mScreenOn == null || mScreenOn) && windowState != WINDOW_STATE_HIDDEN
|
||||
&& !powerSave;
|
||||
final boolean anim = !noAnimation && (mScreenOn == null || mScreenOn)
|
||||
&& windowState != WINDOW_STATE_HIDDEN && !powerSave;
|
||||
if (powerSave && getBarState() == StatusBarState.SHADE) {
|
||||
mode = MODE_WARNING;
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ public class StatusBarWindowManager {
|
||||
|
||||
private void apply(State state) {
|
||||
applyKeyguardFlags(state);
|
||||
applyForceStatusBarVisibleFlag(state);
|
||||
applyFocusableFlag(state);
|
||||
adjustScreenOrientation(state);
|
||||
applyHeight(state);
|
||||
@@ -178,6 +179,16 @@ public class StatusBarWindowManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyForceStatusBarVisibleFlag(State state) {
|
||||
if (state.forceStatusBarVisible) {
|
||||
mLpChanged.privateFlags |= WindowManager
|
||||
.LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
|
||||
} else {
|
||||
mLpChanged.privateFlags &= ~WindowManager
|
||||
.LayoutParams.PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT;
|
||||
}
|
||||
}
|
||||
|
||||
private void applyModalFlag(State state) {
|
||||
if (state.headsUpShowing) {
|
||||
mLpChanged.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
|
||||
@@ -240,6 +251,11 @@ public class StatusBarWindowManager {
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
public void setForceStatusBarVisible(boolean forceStatusBarVisible) {
|
||||
mCurrentState.forceStatusBarVisible = forceStatusBarVisible;
|
||||
apply(mCurrentState);
|
||||
}
|
||||
|
||||
private static class State {
|
||||
boolean keyguardShowing;
|
||||
boolean keyguardOccluded;
|
||||
@@ -250,6 +266,7 @@ public class StatusBarWindowManager {
|
||||
boolean keyguardFadingAway;
|
||||
boolean qsExpanded;
|
||||
boolean headsUpShowing;
|
||||
boolean forceStatusBarVisible;
|
||||
|
||||
/**
|
||||
* The {@link BaseStatusBar} state from the status bar.
|
||||
|
||||
@@ -58,6 +58,9 @@ public class BarController {
|
||||
private int mTransientBarState;
|
||||
private boolean mPendingShow;
|
||||
private long mLastTranslucent;
|
||||
private boolean mShowTransparent;
|
||||
private boolean mSetUnHideFlagWhenNextTransparent;
|
||||
private boolean mNoAnimationOnNextShow;
|
||||
|
||||
public BarController(String tag, int transientFlag, int unhideFlag, int translucentFlag,
|
||||
int statusBarManagerId, int translucentWmFlag) {
|
||||
@@ -74,6 +77,14 @@ public class BarController {
|
||||
mWin = win;
|
||||
}
|
||||
|
||||
public void setShowTransparent(boolean transparent) {
|
||||
if (transparent != mShowTransparent) {
|
||||
mShowTransparent = transparent;
|
||||
mSetUnHideFlagWhenNextTransparent = transparent;
|
||||
mNoAnimationOnNextShow = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void showTransient() {
|
||||
if (mWin != null) {
|
||||
setTransientBarState(TRANSIENT_BAR_SHOW_REQUESTED);
|
||||
@@ -135,7 +146,9 @@ public class BarController {
|
||||
}
|
||||
final boolean wasVis = mWin.isVisibleLw();
|
||||
final boolean wasAnim = mWin.isAnimatingLw();
|
||||
final boolean change = show ? mWin.showLw(true) : mWin.hideLw(true);
|
||||
final boolean change = show ? mWin.showLw(!mNoAnimationOnNextShow)
|
||||
: mWin.hideLw(!mNoAnimationOnNextShow);
|
||||
mNoAnimationOnNextShow = false;
|
||||
final int state = computeStateLw(wasVis, wasAnim, mWin, change);
|
||||
final boolean stateChanged = updateStateLw(state);
|
||||
return change || stateChanged;
|
||||
@@ -233,6 +246,13 @@ public class BarController {
|
||||
setTransientBarState(TRANSIENT_BAR_NONE); // request denied
|
||||
}
|
||||
}
|
||||
if (mShowTransparent) {
|
||||
vis |= View.SYSTEM_UI_TRANSPARENT;
|
||||
if (mSetUnHideFlagWhenNextTransparent) {
|
||||
vis |= mUnhideFlag;
|
||||
mSetUnHideFlagWhenNextTransparent = false;
|
||||
}
|
||||
}
|
||||
if (mTransientBarState != TRANSIENT_BAR_NONE) {
|
||||
vis |= mTransientFlag; // ignore clear requests until transition completes
|
||||
vis &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE; // never show transient bars in low profile
|
||||
|
||||
@@ -476,6 +476,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
boolean mTopIsFullscreen;
|
||||
boolean mForceStatusBar;
|
||||
boolean mForceStatusBarFromKeyguard;
|
||||
private boolean mForceStatusBarTransparent;
|
||||
boolean mHideLockScreen;
|
||||
boolean mForcingShowNavBar;
|
||||
int mForcingShowNavBarLayer;
|
||||
@@ -4129,6 +4130,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
mAppsThatDismissKeyguard.clear();
|
||||
mForceStatusBar = false;
|
||||
mForceStatusBarFromKeyguard = false;
|
||||
mForceStatusBarTransparent = false;
|
||||
mForcingShowNavBar = false;
|
||||
mForcingShowNavBarLayer = -1;
|
||||
|
||||
@@ -4154,8 +4156,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
mForcingShowNavBar = true;
|
||||
mForcingShowNavBarLayer = win.getSurfaceLayer();
|
||||
}
|
||||
if (attrs.type == TYPE_STATUS_BAR && (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
|
||||
mForceStatusBarFromKeyguard = true;
|
||||
if (attrs.type == TYPE_STATUS_BAR) {
|
||||
if ((attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
|
||||
mForceStatusBarFromKeyguard = true;
|
||||
}
|
||||
if ((attrs.privateFlags & PRIVATE_FLAG_FORCE_STATUS_BAR_VISIBLE_TRANSPARENT) != 0) {
|
||||
mForceStatusBarTransparent = true;
|
||||
}
|
||||
}
|
||||
|
||||
boolean appWindow = attrs.type >= FIRST_APPLICATION_WINDOW
|
||||
@@ -4302,7 +4309,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
if (DEBUG_LAYOUT) Slog.i(TAG, "force=" + mForceStatusBar
|
||||
+ " forcefkg=" + mForceStatusBarFromKeyguard
|
||||
+ " top=" + mTopFullscreenOpaqueWindowState);
|
||||
if (mForceStatusBar || mForceStatusBarFromKeyguard) {
|
||||
boolean shouldBeTransparent = mForceStatusBarTransparent
|
||||
&& !mForceStatusBar
|
||||
&& !mForceStatusBarFromKeyguard;
|
||||
if (!shouldBeTransparent) {
|
||||
mStatusBarController.setShowTransparent(false /* transparent */);
|
||||
} else if (!mStatusBar.isVisibleLw()) {
|
||||
mStatusBarController.setShowTransparent(true /* transparent */);
|
||||
}
|
||||
if (mForceStatusBar || mForceStatusBarFromKeyguard || mForceStatusBarTransparent) {
|
||||
if (DEBUG_LAYOUT) Slog.v(TAG, "Showing status bar: forced");
|
||||
if (mStatusBarController.setBarShowingLw(true)) {
|
||||
changes |= FINISH_LAYOUT_REDO_LAYOUT;
|
||||
|
||||
Reference in New Issue
Block a user