Loading core/proto/android/server/windowmanagerservice.proto +2 −1 Original line number Diff line number Diff line Loading @@ -346,6 +346,7 @@ message ActivityRecordProto { optional int32 proc_id = 29; optional bool translucent = 30; optional bool pip_auto_enter_enabled = 31; optional bool in_size_compat_mode = 32; } /* represents WindowToken */ Loading Loading @@ -406,7 +407,7 @@ message WindowStateProto { optional int64 finished_seamless_rotation_frame = 40; optional WindowFramesProto window_frames = 41; optional bool force_seamless_rotation = 42; optional bool in_size_compat_mode = 43; optional bool has_compat_scale = 43; optional float global_scale = 44; } Loading services/core/java/com/android/server/wm/ActivityRecord.java +2 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ import static com.android.server.wm.ActivityRecordProto.CLIENT_VISIBLE; import static com.android.server.wm.ActivityRecordProto.DEFER_HIDING_CLIENT; import static com.android.server.wm.ActivityRecordProto.FILLS_PARENT; import static com.android.server.wm.ActivityRecordProto.FRONT_OF_TASK; import static com.android.server.wm.ActivityRecordProto.IN_SIZE_COMPAT_MODE; import static com.android.server.wm.ActivityRecordProto.IS_ANIMATING; import static com.android.server.wm.ActivityRecordProto.IS_WAITING_FOR_TRANSITION_START; import static com.android.server.wm.ActivityRecordProto.LAST_ALL_DRAWN; Loading Loading @@ -8262,6 +8263,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A proto.write(PROC_ID, app.getPid()); } proto.write(PIP_AUTO_ENTER_ENABLED, pictureInPictureArgs.isAutoEnterEnabled()); proto.write(IN_SIZE_COMPAT_MODE, inSizeCompatMode()); } @Override Loading services/core/java/com/android/server/wm/DisplayPolicy.java +3 −3 Original line number Diff line number Diff line Loading @@ -1410,9 +1410,9 @@ public class DisplayPolicy { boolean localClient) { final InsetsState state = mDisplayContent.getInsetsPolicy().getInsetsForWindowMetrics(attrs); final boolean inSizeCompatMode = WindowState.inSizeCompatMode(attrs, windowToken); outInsetsState.set(state, inSizeCompatMode || localClient); if (inSizeCompatMode) { final boolean hasCompatScale = WindowState.hasCompatScale(attrs, windowToken); outInsetsState.set(state, hasCompatScale || localClient); if (hasCompatScale) { final float compatScale = windowToken != null ? windowToken.getSizeCompatScale() : mDisplayContent.mCompatibleScreenScale; Loading services/core/java/com/android/server/wm/WindowState.java +22 −22 Original line number Diff line number Diff line Loading @@ -168,8 +168,8 @@ import static com.android.server.wm.WindowStateProto.FINISHED_SEAMLESS_ROTATION_ import static com.android.server.wm.WindowStateProto.FORCE_SEAMLESS_ROTATION; import static com.android.server.wm.WindowStateProto.GIVEN_CONTENT_INSETS; import static com.android.server.wm.WindowStateProto.GLOBAL_SCALE; import static com.android.server.wm.WindowStateProto.HAS_COMPAT_SCALE; import static com.android.server.wm.WindowStateProto.HAS_SURFACE; import static com.android.server.wm.WindowStateProto.IN_SIZE_COMPAT_MODE; import static com.android.server.wm.WindowStateProto.IS_ON_SCREEN; import static com.android.server.wm.WindowStateProto.IS_READY_FOR_DISPLAY; import static com.android.server.wm.WindowStateProto.IS_VISIBLE; Loading Loading @@ -1088,18 +1088,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP * scaling override set. * @see CompatModePackages#getCompatScale * @see android.content.res.CompatibilityInfo#supportsScreen * @see ActivityRecord#inSizeCompatMode() * @see ActivityRecord#hasSizeCompatBounds() */ boolean inSizeCompatMode() { return mOverrideScale != 1f || inSizeCompatMode(mAttrs, mActivityRecord); boolean hasCompatScale() { return mOverrideScale != 1f || hasCompatScale(mAttrs, mActivityRecord); } /** * @return {@code true} if the application runs in size compatibility mode. * @see android.content.res.CompatibilityInfo#supportsScreen * @see ActivityRecord#inSizeCompatMode() * @see ActivityRecord#hasSizeCompatBounds() */ static boolean inSizeCompatMode(WindowManager.LayoutParams attrs, WindowToken windowToken) { static boolean hasCompatScale(WindowManager.LayoutParams attrs, WindowToken windowToken) { return (attrs.privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0 || (windowToken != null && windowToken.hasSizeCompatBounds() // Exclude starting window because it is not displayed by the application. Loading Loading @@ -1304,7 +1304,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP windowFrames.offsetFrames(-layoutXDiff, -layoutYDiff); windowFrames.mCompatFrame.set(windowFrames.mFrame); if (inSizeCompatMode()) { if (hasCompatScale()) { // Also the scaled frame that we report to the app needs to be // adjusted to be in its coordinate space. windowFrames.mCompatFrame.scale(mInvGlobalScale); Loading Loading @@ -1576,7 +1576,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP */ InsetsState getCompatInsetsState() { InsetsState state = getInsetsState(); if (inSizeCompatMode()) { if (hasCompatScale()) { state = new InsetsState(state, true); state.scale(mInvGlobalScale); } Loading Loading @@ -1714,7 +1714,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } void prelayout() { if (inSizeCompatMode()) { if (hasCompatScale()) { if (mOverrideScale != 1f) { mGlobalScale = mToken.hasSizeCompatBounds() ? mToken.getSizeCompatScale() * mOverrideScale Loading Loading @@ -3630,7 +3630,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP void fillClientWindowFrames(ClientWindowFrames outFrames) { outFrames.frame.set(mWindowFrames.mCompatFrame); outFrames.displayFrame.set(mWindowFrames.mDisplayFrame); if (mInvGlobalScale != 1.0f && inSizeCompatMode()) { if (mInvGlobalScale != 1.0f && hasCompatScale()) { outFrames.displayFrame.scale(mInvGlobalScale); } Loading Loading @@ -4030,7 +4030,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP proto.write(PENDING_SEAMLESS_ROTATION, mPendingSeamlessRotate != null); proto.write(FINISHED_SEAMLESS_ROTATION_FRAME, mFinishSeamlessRotateFrameNumber); proto.write(FORCE_SEAMLESS_ROTATION, mForceSeamlesslyRotate); proto.write(IN_SIZE_COMPAT_MODE, inSizeCompatMode()); proto.write(HAS_COMPAT_SCALE, hasCompatScale()); proto.write(GLOBAL_SCALE, mGlobalScale); proto.end(token); } Loading Loading @@ -4132,7 +4132,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP pw.println(prefix + "mHasSurface=" + mHasSurface + " isReadyForDisplay()=" + isReadyForDisplay() + " mWindowRemovalAllowed=" + mWindowRemovalAllowed); if (inSizeCompatMode()) { if (hasCompatScale()) { pw.println(prefix + "mCompatFrame=" + mWindowFrames.mCompatFrame.toShortString(sTmpSB)); } if (dumpAll) { Loading Loading @@ -4255,18 +4255,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP float x, y; int w,h; final boolean inSizeCompatMode = inSizeCompatMode(); final boolean hasCompatScale = hasCompatScale(); if ((mAttrs.flags & FLAG_SCALED) != 0) { if (mAttrs.width < 0) { w = pw; } else if (inSizeCompatMode) { } else if (hasCompatScale) { w = (int)(mAttrs.width * mGlobalScale + .5f); } else { w = mAttrs.width; } if (mAttrs.height < 0) { h = ph; } else if (inSizeCompatMode) { } else if (hasCompatScale) { h = (int)(mAttrs.height * mGlobalScale + .5f); } else { h = mAttrs.height; Loading @@ -4274,21 +4274,21 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } else { if (mAttrs.width == MATCH_PARENT) { w = pw; } else if (inSizeCompatMode) { } else if (hasCompatScale) { w = (int)(mRequestedWidth * mGlobalScale + .5f); } else { w = mRequestedWidth; } if (mAttrs.height == MATCH_PARENT) { h = ph; } else if (inSizeCompatMode) { } else if (hasCompatScale) { h = (int)(mRequestedHeight * mGlobalScale + .5f); } else { h = mRequestedHeight; } } if (inSizeCompatMode) { if (hasCompatScale) { x = mAttrs.x * mGlobalScale; y = mAttrs.y * mGlobalScale; } else { Loading Loading @@ -4316,7 +4316,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // We need to make sure we update the CompatFrame as it is used for // cropping decisions, etc, on systems where we lack a decor layer. windowFrames.mCompatFrame.set(windowFrames.mFrame); if (inSizeCompatMode) { if (hasCompatScale) { // See comparable block in computeFrameLw. windowFrames.mCompatFrame.scale(mInvGlobalScale); } Loading Loading @@ -4434,7 +4434,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP float translateToWindowX(float x) { float winX = x - mWindowFrames.mFrame.left; if (inSizeCompatMode()) { if (hasCompatScale()) { winX *= mGlobalScale; } return winX; Loading @@ -4442,7 +4442,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP float translateToWindowY(float y) { float winY = y - mWindowFrames.mFrame.top; if (inSizeCompatMode()) { if (hasCompatScale()) { winY *= mGlobalScale; } return winY; Loading Loading @@ -5375,7 +5375,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP * scaled, the insets also need to be scaled for surface position in global coordinate. */ private void transformSurfaceInsetsPosition(Point outPos, Rect surfaceInsets) { if (!inSizeCompatMode()) { if (!hasCompatScale()) { outPos.x = surfaceInsets.left; outPos.y = surfaceInsets.top; return; Loading Loading
core/proto/android/server/windowmanagerservice.proto +2 −1 Original line number Diff line number Diff line Loading @@ -346,6 +346,7 @@ message ActivityRecordProto { optional int32 proc_id = 29; optional bool translucent = 30; optional bool pip_auto_enter_enabled = 31; optional bool in_size_compat_mode = 32; } /* represents WindowToken */ Loading Loading @@ -406,7 +407,7 @@ message WindowStateProto { optional int64 finished_seamless_rotation_frame = 40; optional WindowFramesProto window_frames = 41; optional bool force_seamless_rotation = 42; optional bool in_size_compat_mode = 43; optional bool has_compat_scale = 43; optional float global_scale = 44; } Loading
services/core/java/com/android/server/wm/ActivityRecord.java +2 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ import static com.android.server.wm.ActivityRecordProto.CLIENT_VISIBLE; import static com.android.server.wm.ActivityRecordProto.DEFER_HIDING_CLIENT; import static com.android.server.wm.ActivityRecordProto.FILLS_PARENT; import static com.android.server.wm.ActivityRecordProto.FRONT_OF_TASK; import static com.android.server.wm.ActivityRecordProto.IN_SIZE_COMPAT_MODE; import static com.android.server.wm.ActivityRecordProto.IS_ANIMATING; import static com.android.server.wm.ActivityRecordProto.IS_WAITING_FOR_TRANSITION_START; import static com.android.server.wm.ActivityRecordProto.LAST_ALL_DRAWN; Loading Loading @@ -8262,6 +8263,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A proto.write(PROC_ID, app.getPid()); } proto.write(PIP_AUTO_ENTER_ENABLED, pictureInPictureArgs.isAutoEnterEnabled()); proto.write(IN_SIZE_COMPAT_MODE, inSizeCompatMode()); } @Override Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +3 −3 Original line number Diff line number Diff line Loading @@ -1410,9 +1410,9 @@ public class DisplayPolicy { boolean localClient) { final InsetsState state = mDisplayContent.getInsetsPolicy().getInsetsForWindowMetrics(attrs); final boolean inSizeCompatMode = WindowState.inSizeCompatMode(attrs, windowToken); outInsetsState.set(state, inSizeCompatMode || localClient); if (inSizeCompatMode) { final boolean hasCompatScale = WindowState.hasCompatScale(attrs, windowToken); outInsetsState.set(state, hasCompatScale || localClient); if (hasCompatScale) { final float compatScale = windowToken != null ? windowToken.getSizeCompatScale() : mDisplayContent.mCompatibleScreenScale; Loading
services/core/java/com/android/server/wm/WindowState.java +22 −22 Original line number Diff line number Diff line Loading @@ -168,8 +168,8 @@ import static com.android.server.wm.WindowStateProto.FINISHED_SEAMLESS_ROTATION_ import static com.android.server.wm.WindowStateProto.FORCE_SEAMLESS_ROTATION; import static com.android.server.wm.WindowStateProto.GIVEN_CONTENT_INSETS; import static com.android.server.wm.WindowStateProto.GLOBAL_SCALE; import static com.android.server.wm.WindowStateProto.HAS_COMPAT_SCALE; import static com.android.server.wm.WindowStateProto.HAS_SURFACE; import static com.android.server.wm.WindowStateProto.IN_SIZE_COMPAT_MODE; import static com.android.server.wm.WindowStateProto.IS_ON_SCREEN; import static com.android.server.wm.WindowStateProto.IS_READY_FOR_DISPLAY; import static com.android.server.wm.WindowStateProto.IS_VISIBLE; Loading Loading @@ -1088,18 +1088,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP * scaling override set. * @see CompatModePackages#getCompatScale * @see android.content.res.CompatibilityInfo#supportsScreen * @see ActivityRecord#inSizeCompatMode() * @see ActivityRecord#hasSizeCompatBounds() */ boolean inSizeCompatMode() { return mOverrideScale != 1f || inSizeCompatMode(mAttrs, mActivityRecord); boolean hasCompatScale() { return mOverrideScale != 1f || hasCompatScale(mAttrs, mActivityRecord); } /** * @return {@code true} if the application runs in size compatibility mode. * @see android.content.res.CompatibilityInfo#supportsScreen * @see ActivityRecord#inSizeCompatMode() * @see ActivityRecord#hasSizeCompatBounds() */ static boolean inSizeCompatMode(WindowManager.LayoutParams attrs, WindowToken windowToken) { static boolean hasCompatScale(WindowManager.LayoutParams attrs, WindowToken windowToken) { return (attrs.privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0 || (windowToken != null && windowToken.hasSizeCompatBounds() // Exclude starting window because it is not displayed by the application. Loading Loading @@ -1304,7 +1304,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP windowFrames.offsetFrames(-layoutXDiff, -layoutYDiff); windowFrames.mCompatFrame.set(windowFrames.mFrame); if (inSizeCompatMode()) { if (hasCompatScale()) { // Also the scaled frame that we report to the app needs to be // adjusted to be in its coordinate space. windowFrames.mCompatFrame.scale(mInvGlobalScale); Loading Loading @@ -1576,7 +1576,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP */ InsetsState getCompatInsetsState() { InsetsState state = getInsetsState(); if (inSizeCompatMode()) { if (hasCompatScale()) { state = new InsetsState(state, true); state.scale(mInvGlobalScale); } Loading Loading @@ -1714,7 +1714,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } void prelayout() { if (inSizeCompatMode()) { if (hasCompatScale()) { if (mOverrideScale != 1f) { mGlobalScale = mToken.hasSizeCompatBounds() ? mToken.getSizeCompatScale() * mOverrideScale Loading Loading @@ -3630,7 +3630,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP void fillClientWindowFrames(ClientWindowFrames outFrames) { outFrames.frame.set(mWindowFrames.mCompatFrame); outFrames.displayFrame.set(mWindowFrames.mDisplayFrame); if (mInvGlobalScale != 1.0f && inSizeCompatMode()) { if (mInvGlobalScale != 1.0f && hasCompatScale()) { outFrames.displayFrame.scale(mInvGlobalScale); } Loading Loading @@ -4030,7 +4030,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP proto.write(PENDING_SEAMLESS_ROTATION, mPendingSeamlessRotate != null); proto.write(FINISHED_SEAMLESS_ROTATION_FRAME, mFinishSeamlessRotateFrameNumber); proto.write(FORCE_SEAMLESS_ROTATION, mForceSeamlesslyRotate); proto.write(IN_SIZE_COMPAT_MODE, inSizeCompatMode()); proto.write(HAS_COMPAT_SCALE, hasCompatScale()); proto.write(GLOBAL_SCALE, mGlobalScale); proto.end(token); } Loading Loading @@ -4132,7 +4132,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP pw.println(prefix + "mHasSurface=" + mHasSurface + " isReadyForDisplay()=" + isReadyForDisplay() + " mWindowRemovalAllowed=" + mWindowRemovalAllowed); if (inSizeCompatMode()) { if (hasCompatScale()) { pw.println(prefix + "mCompatFrame=" + mWindowFrames.mCompatFrame.toShortString(sTmpSB)); } if (dumpAll) { Loading Loading @@ -4255,18 +4255,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP float x, y; int w,h; final boolean inSizeCompatMode = inSizeCompatMode(); final boolean hasCompatScale = hasCompatScale(); if ((mAttrs.flags & FLAG_SCALED) != 0) { if (mAttrs.width < 0) { w = pw; } else if (inSizeCompatMode) { } else if (hasCompatScale) { w = (int)(mAttrs.width * mGlobalScale + .5f); } else { w = mAttrs.width; } if (mAttrs.height < 0) { h = ph; } else if (inSizeCompatMode) { } else if (hasCompatScale) { h = (int)(mAttrs.height * mGlobalScale + .5f); } else { h = mAttrs.height; Loading @@ -4274,21 +4274,21 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } else { if (mAttrs.width == MATCH_PARENT) { w = pw; } else if (inSizeCompatMode) { } else if (hasCompatScale) { w = (int)(mRequestedWidth * mGlobalScale + .5f); } else { w = mRequestedWidth; } if (mAttrs.height == MATCH_PARENT) { h = ph; } else if (inSizeCompatMode) { } else if (hasCompatScale) { h = (int)(mRequestedHeight * mGlobalScale + .5f); } else { h = mRequestedHeight; } } if (inSizeCompatMode) { if (hasCompatScale) { x = mAttrs.x * mGlobalScale; y = mAttrs.y * mGlobalScale; } else { Loading Loading @@ -4316,7 +4316,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // We need to make sure we update the CompatFrame as it is used for // cropping decisions, etc, on systems where we lack a decor layer. windowFrames.mCompatFrame.set(windowFrames.mFrame); if (inSizeCompatMode) { if (hasCompatScale) { // See comparable block in computeFrameLw. windowFrames.mCompatFrame.scale(mInvGlobalScale); } Loading Loading @@ -4434,7 +4434,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP float translateToWindowX(float x) { float winX = x - mWindowFrames.mFrame.left; if (inSizeCompatMode()) { if (hasCompatScale()) { winX *= mGlobalScale; } return winX; Loading @@ -4442,7 +4442,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP float translateToWindowY(float y) { float winY = y - mWindowFrames.mFrame.top; if (inSizeCompatMode()) { if (hasCompatScale()) { winY *= mGlobalScale; } return winY; Loading Loading @@ -5375,7 +5375,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP * scaled, the insets also need to be scaled for surface position in global coordinate. */ private void transformSurfaceInsetsPosition(Point outPos, Rect surfaceInsets) { if (!inSizeCompatMode()) { if (!hasCompatScale()) { outPos.x = surfaceInsets.left; outPos.y = surfaceInsets.top; return; Loading