The rounded corners from getCurrentMetrics should account for taskbar

Bug: 233218376
Test: call getCurrentMetrics when taskbar is visible/invisible and see
      if the returned rounded corner values are correct.
Change-Id: I655b9b7c8ae1f1e135b3800c3a55cb18c8641325
This commit is contained in:
Shawn Lin
2022-05-26 17:07:41 +08:00
parent dfc5118d0f
commit a8b27153b0

View File

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