Fix notification permission for letterboxed activity

The transparent activities letterbox policy was not applied
because notification permission requests are launched from
a process for a uid  different from the one associated with
the first opaque activity. This led to misalignment between
a notification permission dialog and an activity below it.

This CL removes a condition that checked that launchedFromUid
and UID of the first opaque activity are the same.

Fixes: 265116754
Test: Launch an app with a notification permission request dialog
anche check it's cenetered with the letterboxed activity below. Also
`atest WmTests:SizeCompatTests`

Change-Id: I2c50b55fe99e189ce6f4c5efe7a20e58c19d8660
This commit is contained in:
Massimo Carli
2023-01-11 12:39:42 +00:00
parent 06da15b36e
commit 9913118662
2 changed files with 2 additions and 24 deletions

View File

@@ -1007,10 +1007,9 @@ final class LetterboxUiController {
final ActivityRecord firstOpaqueActivityBeneath = mActivityRecord.getTask().getActivity(
ActivityRecord::fillsParent, mActivityRecord, false /* includeBoundary */,
true /* traverseTopToBottom */);
if (firstOpaqueActivityBeneath == null
|| mActivityRecord.launchedFromUid != firstOpaqueActivityBeneath.getUid()) {
if (firstOpaqueActivityBeneath == null) {
// We skip letterboxing if the translucent activity doesn't have any opaque
// activities beneath of if it's launched from a different user (e.g. notification)
// activities beneath
return;
}
inheritConfiguration(firstOpaqueActivityBeneath);

View File

@@ -196,27 +196,6 @@ public class SizeCompatTests extends WindowTestsBase {
assertEquals(1.5f, translucentActivity.getMaxAspectRatio(), 0.00001f);
}
@Test
public void testNotApplyStrategyToTranslucentActivitiesWithDifferentUid() {
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);
setUpDisplaySizeWithApp(2000, 1000);
prepareUnresizable(mActivity, 1.5f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT);
mActivity.info.setMinAspectRatio(1.2f);
mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */);
// Translucent Activity
final ActivityRecord translucentActivity = new ActivityBuilder(mAtm)
.setScreenOrientation(SCREEN_ORIENTATION_LANDSCAPE)
.setMinAspectRatio(1.1f)
.setMaxAspectRatio(3f)
.build();
doReturn(false).when(translucentActivity).fillsParent();
mTask.addChild(translucentActivity);
// We check bounds
final Rect opaqueBounds = mActivity.getConfiguration().windowConfiguration.getBounds();
final Rect translucentRequestedBounds = translucentActivity.getRequestedOverrideBounds();
assertNotEquals(opaqueBounds, translucentRequestedBounds);
}
@Test
public void testApplyStrategyToMultipleTranslucentActivities() {
mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true);