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,16 +466,20 @@ 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) {
final ActivityRecord activityRecord = token.asActivityRecord();
final Task task = activityRecord != null ? activityRecord.getTask() : null;
if (task != null && !task.getWindowConfiguration().tasksAreFloating()) { if (task != null && !task.getWindowConfiguration().tasksAreFloating()) {
// Use task bounds to calculating rounded corners if the task is not floating. // Use task bounds to calculating rounded corners if the task is not floating.
final Rect roundedCornerFrame = new Rect(task.getBounds()); final Rect roundedCornerFrame = new Rect(task.getBounds());
final InsetsState state = copyState ? new InsetsState(originalState) : originalState; final InsetsState state = copyState ? new InsetsState(originalState)
: originalState;
state.setRoundedCornerFrame(roundedCornerFrame); state.setRoundedCornerFrame(roundedCornerFrame);
return state; return state;
} }
}
return originalState; return originalState;
} }