Merge "Revert "Destroy docked divider surface when it's hidden.""
This commit is contained in:
committed by
Android (Google) Code Review
commit
83b41adbca
@@ -110,7 +110,6 @@ import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.util.SparseIntArray;
|
||||
import android.util.TimeUtils;
|
||||
import android.util.TypedValue;
|
||||
@@ -406,7 +405,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
/**
|
||||
* Windows whose surface should be destroyed.
|
||||
*/
|
||||
private final ArrayList<WindowState> mDestroySurface = new ArrayList<>();
|
||||
final ArrayList<WindowState> mDestroySurface = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Windows with a preserved surface waiting to be destroyed. These windows
|
||||
@@ -443,11 +442,11 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
WindowState[] mRebuildTmp = new WindowState[20];
|
||||
|
||||
/**
|
||||
* Stores for each user whether screencapture is disabled for all their windows.
|
||||
* Stores for each user whether screencapture is disabled
|
||||
* This array is essentially a cache for all userId for
|
||||
* {@link android.app.admin.DevicePolicyManager#getScreenCaptureDisabled}
|
||||
*/
|
||||
private SparseBooleanArray mScreenCaptureDisabled = new SparseBooleanArray();
|
||||
SparseArray<Boolean> mScreenCaptureDisabled = new SparseArray<>();
|
||||
|
||||
IInputMethodManager mInputMethodManager;
|
||||
|
||||
@@ -2109,11 +2108,25 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
executeAppTransition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether screen capture is disabled for all windows of a specific user.
|
||||
*/
|
||||
boolean isScreenCaptureDisabledLocked(int userId) {
|
||||
Boolean disabled = mScreenCaptureDisabled.get(userId);
|
||||
if (disabled == null) {
|
||||
return false;
|
||||
}
|
||||
return disabled;
|
||||
}
|
||||
|
||||
boolean isSecureLocked(WindowState w) {
|
||||
if ((w.mAttrs.flags & FLAG_SECURE) != 0) {
|
||||
if ((w.mAttrs.flags&WindowManager.LayoutParams.FLAG_SECURE) != 0) {
|
||||
return true;
|
||||
}
|
||||
return mScreenCaptureDisabled.get(UserHandle.getUserId(w.mOwnerUid));
|
||||
if (isScreenCaptureDisabledLocked(UserHandle.getUserId(w.mOwnerUid))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2637,10 +2650,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
Slog.i(TAG, "Relayout " + win + ": oldVis=" + oldVisibility
|
||||
+ " newVis=" + viewVisibility, stack);
|
||||
}
|
||||
final AppWindowToken appToken = win.mAppToken;
|
||||
final boolean visible = viewVisibility == View.VISIBLE
|
||||
&& (appToken == null ? win.mPolicyVisibility : !appToken.clientHidden);
|
||||
if (visible) {
|
||||
if (viewVisibility == View.VISIBLE &&
|
||||
(win.mAppToken == null || !win.mAppToken.clientHidden)) {
|
||||
result = relayoutVisibleWindow(outConfig, result, win, winAnimator, attrChanges,
|
||||
oldVisibility);
|
||||
try {
|
||||
@@ -2726,8 +2737,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mWallpaperControllerLocked.updateWallpaperOffset(
|
||||
win, displayInfo.logicalWidth, displayInfo.logicalHeight, false);
|
||||
}
|
||||
if (appToken != null) {
|
||||
appToken.updateReportedVisibilityLocked();
|
||||
if (win.mAppToken != null) {
|
||||
win.mAppToken.updateReportedVisibilityLocked();
|
||||
}
|
||||
if (winAnimator.mReportSurfaceResized) {
|
||||
winAnimator.mReportSurfaceResized = false;
|
||||
@@ -10200,25 +10211,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mDestroySurface.add(win);
|
||||
}
|
||||
|
||||
boolean destroySurfacesLocked() {
|
||||
boolean wallpaperDestroyed = false;
|
||||
for (int i = mDestroySurface.size() - 1; i >= 0; i--) {
|
||||
WindowState win = mDestroySurface.get(i);
|
||||
win.mDestroying = false;
|
||||
if (mInputMethodWindow == win) {
|
||||
mInputMethodWindow = null;
|
||||
}
|
||||
if (mWallpaperControllerLocked.isWallpaperTarget(win)) {
|
||||
wallpaperDestroyed = true;
|
||||
}
|
||||
if (!win.shouldSaveSurface()) {
|
||||
win.mWinAnimator.destroySurfaceLocked();
|
||||
}
|
||||
}
|
||||
mDestroySurface.clear();
|
||||
return wallpaperDestroyed;
|
||||
}
|
||||
|
||||
private final class LocalService extends WindowManagerInternal {
|
||||
@Override
|
||||
public void requestTraversalFromDisplayManager() {
|
||||
|
||||
@@ -411,10 +411,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
|
||||
final private Rect mTmpRect = new Rect();
|
||||
|
||||
// This window often remains added but hidden, so we want to destroy its surface when it's not
|
||||
// visible.
|
||||
private final boolean mDestroySurfaceWhenHidden;
|
||||
|
||||
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
|
||||
WindowState attachedWindow, int appOp, int seq, WindowManager.LayoutParams a,
|
||||
int viewVisibility, final DisplayContent displayContent) {
|
||||
@@ -462,7 +458,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
mSubLayer = 0;
|
||||
mInputWindowHandle = null;
|
||||
mWinAnimator = null;
|
||||
mDestroySurfaceWhenHidden = false;
|
||||
return;
|
||||
}
|
||||
mDeathRecipient = deathRecipient;
|
||||
@@ -561,7 +556,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
mInputWindowHandle = new InputWindowHandle(
|
||||
mAppToken != null ? mAppToken.mInputApplicationHandle : null, this,
|
||||
displayContent.getDisplayId());
|
||||
mDestroySurfaceWhenHidden = mAttrs.type == TYPE_DOCK_DIVIDER;
|
||||
}
|
||||
|
||||
void attach() {
|
||||
@@ -1319,10 +1313,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
mHasSurface = hasSurface;
|
||||
}
|
||||
|
||||
boolean shouldDestroySurfaceWhenAnimationFinishes() {
|
||||
return mExiting || (mDestroySurfaceWhenHidden && !mPolicyVisibilityAfterAnim);
|
||||
}
|
||||
|
||||
private final class DeadWindowEventReceiver extends InputEventReceiver {
|
||||
DeadWindowEventReceiver(InputChannel inputChannel) {
|
||||
super(inputChannel, mService.mH.getLooper());
|
||||
@@ -1605,11 +1595,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
// Already showing.
|
||||
return false;
|
||||
}
|
||||
if (!mHasSurface && mDestroySurfaceWhenHidden) {
|
||||
// This is a window that doesn't retain the surface when it's hidden, so immediately
|
||||
// when we want to show it again, we need to create the surface for it.
|
||||
mWinAnimator.createSurfaceLocked();
|
||||
}
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility true: " + this);
|
||||
if (doAnimation) {
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG, "doAnimation: mPolicyVisibility="
|
||||
@@ -1645,7 +1630,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
doAnimation = false;
|
||||
}
|
||||
}
|
||||
final boolean current = doAnimation ? mPolicyVisibilityAfterAnim : mPolicyVisibility;
|
||||
boolean current = doAnimation ? mPolicyVisibilityAfterAnim
|
||||
: mPolicyVisibility;
|
||||
if (!current) {
|
||||
// Already hiding.
|
||||
return false;
|
||||
@@ -1656,9 +1642,11 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
doAnimation = false;
|
||||
}
|
||||
}
|
||||
mPolicyVisibilityAfterAnim = false;
|
||||
if (!doAnimation) {
|
||||
if (doAnimation) {
|
||||
mPolicyVisibilityAfterAnim = false;
|
||||
} else {
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility false: " + this);
|
||||
mPolicyVisibilityAfterAnim = false;
|
||||
mPolicyVisibility = false;
|
||||
// Window is no longer visible -- make sure if we were waiting
|
||||
// for it to be displayed before enabling the display, that
|
||||
|
||||
@@ -446,7 +446,7 @@ class WindowStateAnimator {
|
||||
}
|
||||
}
|
||||
|
||||
if (!mWin.shouldDestroySurfaceWhenAnimationFinishes()) {
|
||||
if (!mWin.mExiting) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -454,13 +454,12 @@ class WindowStateAnimator {
|
||||
return;
|
||||
}
|
||||
|
||||
if (localLOGV) Slog.v(TAG, "Exit animation finished in " + this + ": remove="
|
||||
+ mWin.mRemoveOnExit);
|
||||
if (WindowManagerService.localLOGV) Slog.v(
|
||||
TAG, "Exit animation finished in " + this
|
||||
+ ": remove=" + mWin.mRemoveOnExit);
|
||||
if (mSurfaceController != null && mSurfaceController.hasSurface()) {
|
||||
mService.scheduleSurfaceDestroy(mWin);
|
||||
if (mWin.mExiting) {
|
||||
mWin.mDestroying = true;
|
||||
}
|
||||
mService.mDestroySurface.add(mWin);
|
||||
mWin.mDestroying = true;
|
||||
hide("finishExit");
|
||||
}
|
||||
mWin.mExiting = false;
|
||||
@@ -646,7 +645,7 @@ class WindowStateAnimator {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (localLOGV) {
|
||||
if (WindowManagerService.localLOGV) {
|
||||
Slog.v(TAG, "Got surface: " + mSurfaceController
|
||||
+ ", set left=" + w.mFrame.left + " top=" + w.mFrame.top
|
||||
+ ", animLayer=" + mAnimLayer);
|
||||
@@ -667,7 +666,7 @@ class WindowStateAnimator {
|
||||
mAnimLayer);
|
||||
mLastHidden = true;
|
||||
|
||||
if (localLOGV) Slog.v(
|
||||
if (WindowManagerService.localLOGV) Slog.v(
|
||||
TAG, "Created surface " + this);
|
||||
}
|
||||
return mSurfaceController;
|
||||
@@ -974,7 +973,7 @@ class WindowStateAnimator {
|
||||
//Slog.i(TAG, "Not applying alpha transform");
|
||||
}
|
||||
|
||||
if ((DEBUG_SURFACE_TRACE || localLOGV)
|
||||
if ((DEBUG_SURFACE_TRACE || WindowManagerService.localLOGV)
|
||||
&& (mShownAlpha == 1.0 || mShownAlpha == 0.0)) Slog.v(
|
||||
TAG, "computeShownFrameLocked: Animating " + this + " mAlpha=" + mAlpha
|
||||
+ " self=" + (selfTransformation ? mTransformation.getAlpha() : "null")
|
||||
@@ -995,7 +994,7 @@ class WindowStateAnimator {
|
||||
return;
|
||||
}
|
||||
|
||||
if (localLOGV) Slog.v(
|
||||
if (WindowManagerService.localLOGV) Slog.v(
|
||||
TAG, "computeShownFrameLocked: " + this +
|
||||
" not attached, mAlpha=" + mAlpha);
|
||||
|
||||
|
||||
@@ -296,8 +296,10 @@ class WindowSurfaceController {
|
||||
}
|
||||
|
||||
boolean showRobustlyInTransaction() {
|
||||
if (SHOW_TRANSACTIONS) logSurface("SHOW (performLayout)", null);
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this + " during relayout");
|
||||
if (SHOW_TRANSACTIONS) logSurface(
|
||||
"SHOW (performLayout)", null);
|
||||
if (DEBUG_VISIBILITY) Slog.v(TAG, "Showing " + this
|
||||
+ " during relayout");
|
||||
|
||||
if (mHiddenForCrop) {
|
||||
return false;
|
||||
|
||||
@@ -381,7 +381,25 @@ class WindowSurfacePlacer {
|
||||
}
|
||||
|
||||
// Destroy the surface of any windows that are no longer visible.
|
||||
final boolean wallpaperDestroyed = mService.destroySurfacesLocked();
|
||||
boolean wallpaperDestroyed = false;
|
||||
i = mService.mDestroySurface.size();
|
||||
if (i > 0) {
|
||||
do {
|
||||
i--;
|
||||
WindowState win = mService.mDestroySurface.get(i);
|
||||
win.mDestroying = false;
|
||||
if (mService.mInputMethodWindow == win) {
|
||||
mService.mInputMethodWindow = null;
|
||||
}
|
||||
if (mWallpaperControllerLocked.isWallpaperTarget(win)) {
|
||||
wallpaperDestroyed = true;
|
||||
}
|
||||
if (!win.shouldSaveSurface()) {
|
||||
win.mWinAnimator.destroySurfaceLocked();
|
||||
}
|
||||
} while (i > 0);
|
||||
mService.mDestroySurface.clear();
|
||||
}
|
||||
|
||||
// Time to remove any exiting tokens?
|
||||
for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
|
||||
|
||||
Reference in New Issue
Block a user