Merge "The rounded corners from getCurrentMetrics should account for taskbar" into tm-qpr-dev

This commit is contained in:
Shawn Lin
2022-07-05 11:30:33 +00:00
committed by Android (Google) Code Review

View File

@@ -265,7 +265,7 @@ class InsetsPolicy {
state = originalState; state = originalState;
} }
state = adjustVisibilityForIme(target, state, state == originalState); state = adjustVisibilityForIme(target, state, state == originalState);
return adjustInsetsForRoundedCorners(target, state, state == originalState); return adjustInsetsForRoundedCorners(target.mToken, state, state == originalState);
} }
InsetsState adjustInsetsForWindow(WindowState target, InsetsState originalState) { InsetsState adjustInsetsForWindow(WindowState target, InsetsState originalState) {
@@ -290,7 +290,8 @@ class InsetsPolicy {
final InsetsState originalState = mDisplayContent.getInsetsPolicy() final InsetsState originalState = mDisplayContent.getInsetsPolicy()
.enforceInsetsPolicyForTarget(type, WINDOWING_MODE_FULLSCREEN, alwaysOnTop, .enforceInsetsPolicyForTarget(type, WINDOWING_MODE_FULLSCREEN, alwaysOnTop,
mStateController.getRawInsetsState()); mStateController.getRawInsetsState());
return adjustVisibilityForTransientTypes(originalState); InsetsState state = adjustVisibilityForTransientTypes(originalState);
return adjustInsetsForRoundedCorners(token, state, state == originalState);
} }
/** /**
@@ -465,15 +466,19 @@ class InsetsPolicy {
return originalState; return originalState;
} }
private InsetsState adjustInsetsForRoundedCorners(WindowState w, InsetsState originalState, private InsetsState adjustInsetsForRoundedCorners(WindowToken token, InsetsState originalState,
boolean copyState) { boolean copyState) {
final Task task = w.getTask(); if (token != null) {
if (task != null && !task.getWindowConfiguration().tasksAreFloating()) { final ActivityRecord activityRecord = token.asActivityRecord();
// Use task bounds to calculating rounded corners if the task is not floating. final Task task = activityRecord != null ? activityRecord.getTask() : null;
final Rect roundedCornerFrame = new Rect(task.getBounds()); if (task != null && !task.getWindowConfiguration().tasksAreFloating()) {
final InsetsState state = copyState ? new InsetsState(originalState) : originalState; // Use task bounds to calculating rounded corners if the task is not floating.
state.setRoundedCornerFrame(roundedCornerFrame); final Rect roundedCornerFrame = new Rect(task.getBounds());
return state; final InsetsState state = copyState ? new InsetsState(originalState)
: originalState;
state.setRoundedCornerFrame(roundedCornerFrame);
return state;
}
} }
return originalState; return originalState;
} }