diff options
Diffstat (limited to 'policy/src/com')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 53 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 112 |
2 files changed, 109 insertions, 56 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index cce30c7..92171c1 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -124,6 +124,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private static final int CUSTOM_TITLE_COMPATIBLE_FEATURES = DEFAULT_FEATURES | (1 << FEATURE_CUSTOM_TITLE) | (1 << FEATURE_CONTENT_TRANSITIONS) | + (1 << FEATURE_ACTIVITY_TRANSITIONS) | (1 << FEATURE_ACTION_MODE_OVERLAY); private static final Transition USE_DEFAULT_TRANSITION = new TransitionSet(); @@ -149,6 +150,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // mDecor itself, or a child of mDecor where the contents go. private ViewGroup mContentParent; + private ViewGroup mContentRoot; + SurfaceHolder.Callback2 mTakeSurfaceCallback; InputQueue.Callback mTakeInputQueueCallback; @@ -2153,6 +2156,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private int mLastTopInset = 0; private int mLastBottomInset = 0; + private int mLastRightInset = 0; private int mLastSystemUiVisibility = 0; @@ -2731,7 +2735,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { mFrameOffsets.set(insets.getSystemWindowInsets()); - updateColorViews(insets); + insets = updateColorViews(insets); insets = updateStatusGuard(insets); updateNavigationGuard(insets); if (getForeground() != null) { @@ -2748,8 +2752,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private WindowInsets updateColorViews(WindowInsets insets) { if (!mIsFloating && ActivityManager.isHighEndGfx()) { if (insets != null) { - mLastTopInset = insets.getStableInsetTop(); - mLastBottomInset = insets.getStableInsetBottom(); + mLastTopInset = Math.min(insets.getStableInsetTop(), + insets.getSystemWindowInsetTop()); + mLastBottomInset = Math.min(insets.getStableInsetBottom(), + insets.getSystemWindowInsetBottom()); + mLastRightInset = Math.min(insets.getStableInsetRight(), + insets.getSystemWindowInsetRight()); } mStatusColorView = updateColorViewInt(mStatusColorView, SYSTEM_UI_FLAG_FULLSCREEN, FLAG_TRANSLUCENT_STATUS, @@ -2764,8 +2772,39 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { com.android.internal.R.id.navigationBarBackground, false /* hiddenByWindowFlag */); } + + WindowManager.LayoutParams attrs = getAttributes(); + int sysUiVisibility = attrs.systemUiVisibility | attrs.subtreeSystemUiVisibility; + + // When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need + // to ensure that the rest of the view hierarchy doesn't notice it, unless they've + // explicitly asked for it. + + boolean consumingNavBar = + (attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0 + && (sysUiVisibility & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0 + && (mLastSystemUiVisibility & SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0; + + int consumedRight = consumingNavBar ? mLastRightInset : 0; + int consumedBottom = consumingNavBar ? mLastBottomInset : 0; + + if (mContentRoot != null + && mContentRoot.getLayoutParams() instanceof MarginLayoutParams) { + MarginLayoutParams lp = (MarginLayoutParams) mContentRoot.getLayoutParams(); + if (lp.rightMargin != consumedRight || lp.bottomMargin != consumedBottom) { + lp.rightMargin = consumedRight; + lp.bottomMargin = consumedBottom; + mContentRoot.setLayoutParams(lp); + } + } + if (insets != null) { - insets = insets.consumeStableInsets(); + insets = insets.consumeStableInsets().replaceSystemWindowInsets( + insets.getSystemWindowInsetLeft(), + insets.getSystemWindowInsetTop(), + insets.getSystemWindowInsetRight() - consumedRight, + insets.getSystemWindowInsetBottom() - consumedBottom + ); } return insets; } @@ -3207,6 +3246,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (a.getBoolean(R.styleable.Window_windowContentTransitions, false)) { requestFeature(FEATURE_CONTENT_TRANSITIONS); } + if (a.getBoolean(R.styleable.Window_windowActivityTransitions, false)) { + requestFeature(FEATURE_ACTIVITY_TRANSITIONS); + } final WindowManager windowService = (WindowManager) getContext().getSystemService( Context.WINDOW_SERVICE); @@ -3377,6 +3419,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { View in = mLayoutInflater.inflate(layoutResource, null); decor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)); + mContentRoot = (ViewGroup) in; ViewGroup contentParent = (ViewGroup)findViewById(ID_ANDROID_CONTENT); if (contentParent == null) { @@ -3516,7 +3559,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // Only inflate or create a new TransitionManager if the caller hasn't // already set a custom one. - if (hasFeature(FEATURE_CONTENT_TRANSITIONS)) { + if (hasFeature(FEATURE_ACTIVITY_TRANSITIONS)) { if (mTransitionManager == null) { final int transitionRes = getWindowStyle().getResourceId( R.styleable.Window_windowContentTransitionManager, diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 0ddbb1e..02adef4 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -68,7 +68,7 @@ import android.service.dreams.DreamManagerInternal; import android.service.dreams.DreamService; import android.service.dreams.IDreamManager; import android.speech.RecognizerIntent; -import android.telecomm.TelecommManager; +import android.telecom.TelecomManager; import android.util.DisplayMetrics; import android.util.EventLog; import android.util.Log; @@ -435,6 +435,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { WindowState mTopFullscreenOpaqueWindowState; HashSet<IApplicationToken> mAppsToBeHidden = new HashSet<IApplicationToken>(); + HashSet<IApplicationToken> mAppsThatDismissKeyguard = new HashSet<IApplicationToken>(); boolean mTopIsFullscreen; boolean mForceStatusBar; boolean mForceStatusBarFromKeyguard; @@ -1516,8 +1517,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (ActivityManager.isHighEndGfx() && (attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) { - attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; } } @@ -1754,6 +1754,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } + @Override + public WindowState getWinShowWhenLockedLw() { + return mWinShowWhenLocked; + } + /** {@inheritDoc} */ @Override public View addStartingWindow(IBinder appToken, String packageName, int theme, @@ -1822,8 +1827,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { params.packageName = packageName; params.windowAnimations = win.getWindowStyle().getResourceId( com.android.internal.R.styleable.Window_windowAnimationStyle, 0); - params.privateFlags |= - WindowManager.LayoutParams.PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED; params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS; if (!compatInfo.supportsScreen()) { @@ -2124,8 +2127,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { ServiceManager.checkService(DreamService.DREAM_SERVICE)); } - TelecommManager getTelecommService() { - return (TelecommManager) mContext.getSystemService(Context.TELECOMM_SERVICE); + TelecomManager getTelecommService() { + return (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE); } static IAudioService getAudioService() { @@ -2214,8 +2217,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { // If an incoming call is ringing, HOME is totally disabled. // (The user is already on the InCallUI at this point, // and his ONLY options are to answer or reject the call.) - TelecommManager telecommManager = getTelecommService(); - if (telecommManager != null && telecommManager.isRinging()) { + TelecomManager telecomManager = getTelecommService(); + if (telecomManager != null && telecomManager.isRinging()) { Log.i(TAG, "Ignoring HOME; there's a ringing incoming call."); return -1; } @@ -3749,6 +3752,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight) { mTopFullscreenOpaqueWindowState = null; mAppsToBeHidden.clear(); + mAppsThatDismissKeyguard.clear(); mForceStatusBar = false; mForceStatusBarFromKeyguard = false; mForcingShowNavBar = false; @@ -3789,7 +3793,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mShowingLockscreen = true; } boolean appWindow = attrs.type >= FIRST_APPLICATION_WINDOW - && attrs.type <= LAST_APPLICATION_WINDOW; + && attrs.type < FIRST_SYSTEM_WINDOW; if (attrs.type == TYPE_DREAM) { // If the lockscreen was showing when the dream started then wait // for the dream to draw before hiding the lockscreen. @@ -3804,38 +3808,44 @@ public class PhoneWindowManager implements WindowManagerPolicy { final boolean dismissKeyguard = (fl & FLAG_DISMISS_KEYGUARD) != 0; final boolean secureKeyguard = isKeyguardSecure(); if (appWindow) { - if (showWhenLocked || (dismissKeyguard && !secureKeyguard)) { + final IApplicationToken appToken = win.getAppToken(); + if (showWhenLocked) { // Remove any previous windows with the same appToken. - mAppsToBeHidden.remove(win.getAppToken()); - if (mAppsToBeHidden.isEmpty() && showWhenLocked && - isKeyguardSecureIncludingHidden()) { + mAppsToBeHidden.remove(appToken); + mAppsThatDismissKeyguard.remove(appToken); + if (mAppsToBeHidden.isEmpty() && isKeyguardSecureIncludingHidden()) { mWinShowWhenLocked = win; mHideLockScreen = true; mForceStatusBarFromKeyguard = false; } + } else if (dismissKeyguard) { + if (secureKeyguard) { + mAppsToBeHidden.add(appToken); + } else { + mAppsToBeHidden.remove(appToken); + } + mAppsThatDismissKeyguard.add(appToken); } else { - mAppsToBeHidden.add(win.getAppToken()); + mAppsToBeHidden.add(appToken); } if (attrs.x == 0 && attrs.y == 0 && attrs.width == WindowManager.LayoutParams.MATCH_PARENT && attrs.height == WindowManager.LayoutParams.MATCH_PARENT) { if (DEBUG_LAYOUT) Slog.v(TAG, "Fullscreen window: " + win); mTopFullscreenOpaqueWindowState = win; - if (mAppsToBeHidden.isEmpty()) { - if (showWhenLocked) { - if (DEBUG_LAYOUT) Slog.v(TAG, - "Setting mHideLockScreen to true by win " + win); - mHideLockScreen = true; - mForceStatusBarFromKeyguard = false; - } - if (dismissKeyguard && mDismissKeyguard == DISMISS_KEYGUARD_NONE) { - if (DEBUG_LAYOUT) Slog.v(TAG, - "Setting mDismissKeyguard true by win " + win); - mDismissKeyguard = mWinDismissingKeyguard == win ? - DISMISS_KEYGUARD_CONTINUE : DISMISS_KEYGUARD_START; - mWinDismissingKeyguard = win; - mForceStatusBarFromKeyguard = mShowingLockscreen && secureKeyguard; - } + if (!mAppsThatDismissKeyguard.isEmpty() && + mDismissKeyguard == DISMISS_KEYGUARD_NONE) { + if (DEBUG_LAYOUT) Slog.v(TAG, + "Setting mDismissKeyguard true by win " + win); + mDismissKeyguard = mWinDismissingKeyguard == win ? + DISMISS_KEYGUARD_CONTINUE : DISMISS_KEYGUARD_START; + mWinDismissingKeyguard = win; + mForceStatusBarFromKeyguard = mShowingLockscreen && secureKeyguard; + } else if (mAppsToBeHidden.isEmpty() && showWhenLocked) { + if (DEBUG_LAYOUT) Slog.v(TAG, + "Setting mHideLockScreen to true by win " + win); + mHideLockScreen = true; + mForceStatusBarFromKeyguard = false; } if ((fl & FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) != 0) { mAllowLockscreenWhenOn = true; @@ -4308,9 +4318,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } } if (down) { - TelecommManager telecommManager = getTelecommService(); - if (telecommManager != null) { - if (telecommManager.isRinging()) { + TelecomManager telecomManager = getTelecommService(); + if (telecomManager != null) { + if (telecomManager.isRinging()) { // If an incoming call is ringing, either VOLUME key means // "silence ringer". We handle these keys here, rather than // in the InCallScreen, to make sure we'll respond to them @@ -4322,14 +4332,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { // Silence the ringer. (It's safe to call this // even if the ringer has already been silenced.) - telecommManager.silenceRinger(); + telecomManager.silenceRinger(); // And *don't* pass this key thru to the current activity // (which is probably the InCallScreen.) result &= ~ACTION_PASS_TO_USER; break; } - if (telecommManager.isInCall() + if (telecomManager.isInCall() && (result & ACTION_PASS_TO_USER) == 0) { // If we are in call but we decided not to pass the key to // the application, just pass it to the session service. @@ -4355,10 +4365,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { case KeyEvent.KEYCODE_ENDCALL: { result &= ~ACTION_PASS_TO_USER; if (down) { - TelecommManager telecommManager = getTelecommService(); + TelecomManager telecomManager = getTelecommService(); boolean hungUp = false; - if (telecommManager != null) { - hungUp = telecommManager.endCall(); + if (telecomManager != null) { + hungUp = telecomManager.endCall(); } interceptPowerKeyDown(!interactive || hungUp); } else { @@ -4395,19 +4405,19 @@ public class PhoneWindowManager implements WindowManagerPolicy { interceptScreenshotChord(); } - TelecommManager telecommManager = getTelecommService(); + TelecomManager telecomManager = getTelecommService(); boolean hungUp = false; - if (telecommManager != null) { - if (telecommManager.isRinging()) { + if (telecomManager != null) { + if (telecomManager.isRinging()) { // Pressing Power while there's a ringing incoming // call should silence the ringer. - telecommManager.silenceRinger(); + telecomManager.silenceRinger(); } else if ((mIncallPowerBehavior & Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR_HANGUP) != 0 - && telecommManager.isInCall() && interactive) { + && telecomManager.isInCall() && interactive) { // Otherwise, if "Power button ends call" is enabled, // the Power button will hang up any current active call. - hungUp = telecommManager.endCall(); + hungUp = telecomManager.endCall(); } } interceptPowerKeyDown(!interactive || hungUp @@ -4445,9 +4455,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: if (down) { - TelecommManager telecommManager = getTelecommService(); - if (telecommManager != null) { - if (telecommManager.isInCall()) { + TelecomManager telecomManager = getTelecommService(); + if (telecomManager != null) { + if (telecomManager.isInCall()) { // Suppress PLAY/PAUSE toggle when phone is ringing or in-call // to avoid music playback. break; @@ -4480,12 +4490,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { case KeyEvent.KEYCODE_CALL: { if (down) { - TelecommManager telecommManager = getTelecommService(); - if (telecommManager != null) { - if (telecommManager.isRinging()) { + TelecomManager telecomManager = getTelecommService(); + if (telecomManager != null) { + if (telecomManager.isRinging()) { Log.i(TAG, "interceptKeyBeforeQueueing:" + " CALL key-down while ringing: Answer the call!"); - telecommManager.acceptRingingCall(); + telecomManager.acceptRingingCall(); // And *don't* pass this key thru to the current activity // (which is presumably the InCallScreen.) |