Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 631dacc1 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7037678 from 26bf81f9 to rvc-qpr2-release

Change-Id: I2702338101342b506ee2466f9b8327f82a6d71fd
parents 13e8ce1e 26bf81f9
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -251,11 +251,6 @@ public class SliceManagerService extends ISliceManager.Stub {
                }
            }
        }
        // Fallback to allowing uri permissions through.
        if (mContext.checkUriPermission(uri, pid, uid, Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
                == PERMISSION_GRANTED) {
            return PackageManager.PERMISSION_GRANTED;
        }
        return PackageManager.PERMISSION_DENIED;
    }

+2 −2
Original line number Diff line number Diff line
@@ -491,8 +491,8 @@ public class DeviceStorageMonitorService extends SystemService {
                        com.android.internal.R.string.low_internal_storage_view_text);
            }

            PendingIntent intent = PendingIntent.getActivityAsUser(context, 0, lowMemIntent, 0,
                    null, UserHandle.CURRENT);
            PendingIntent intent = PendingIntent.getActivityAsUser(context, 0, lowMemIntent,
                    PendingIntent.FLAG_IMMUTABLE, null, UserHandle.CURRENT);
            Notification notification =
                    new Notification.Builder(context, SystemNotificationChannels.ALERTS)
                            .setSmallIcon(com.android.internal.R.drawable.stat_notify_disk_full)
+1 −1
Original line number Diff line number Diff line
@@ -5728,7 +5728,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            }

            if (animatingRecents != null && animatingRecents == mFixedRotationLaunchingApp
                    && animatingRecents.isVisible()) {
                    && animatingRecents.isVisible() && animatingRecents != topRunningActivity()) {
                // The recents activity should be going to be invisible (switch to another app or
                // return to original top). Only clear the top launching record without finishing
                // the transform immediately because it won't affect display orientation. And before
+10 −1
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ public class SliceManagerServiceTest extends UiServiceTestCase {
        LocalServices.addService(UsageStatsManagerInternal.class,
                mock(UsageStatsManagerInternal.class));
        mContext.addMockSystemService(AppOpsManager.class, mock(AppOpsManager.class));
        mContext.getTestablePermissions().setPermission(TEST_URI, PERMISSION_GRANTED);

        mContextSpy = spy(mContext);
        mService = spy(new SliceManagerService(mContextSpy, TestableLooper.get(this).getLooper()));
@@ -90,6 +89,7 @@ public class SliceManagerServiceTest extends UiServiceTestCase {

    @Test
    public void testAddPinCreatesPinned() throws RemoteException {
        grantSlicePermission();
        doReturn("pkg").when(mService).getDefaultHome(anyInt());

        mService.pinSlice("pkg", TEST_URI, EMPTY_SPECS, mToken);
@@ -99,6 +99,7 @@ public class SliceManagerServiceTest extends UiServiceTestCase {

    @Test
    public void testRemovePinDestroysPinned() throws RemoteException {
        grantSlicePermission();
        doReturn("pkg").when(mService).getDefaultHome(anyInt());

        mService.pinSlice("pkg", TEST_URI, EMPTY_SPECS, mToken);
@@ -130,11 +131,13 @@ public class SliceManagerServiceTest extends UiServiceTestCase {

    @Test(expected = IllegalStateException.class)
    public void testNoPinThrow() throws Exception {
        grantSlicePermission();
        mService.getPinnedSpecs(TEST_URI, "pkg");
    }

    @Test
    public void testGetPinnedSpecs() throws Exception {
        grantSlicePermission();
        SliceSpec[] specs = new SliceSpec[] {
            new SliceSpec("Something", 1) };
        mService.pinSlice("pkg", TEST_URI, specs, mToken);
@@ -143,4 +146,10 @@ public class SliceManagerServiceTest extends UiServiceTestCase {
        assertEquals(specs, mService.getPinnedSpecs(TEST_URI, "pkg"));
    }

    private void grantSlicePermission() {
        doReturn(PERMISSION_GRANTED).when(mService).checkSlicePermission(
                eq(TEST_URI), anyString(), anyString(), anyInt(), anyInt(), any());
        doReturn(PERMISSION_GRANTED).when(mService).checkAccess(
                anyString(), eq(TEST_URI), anyInt(), anyInt());
    }
}
+26 −9
Original line number Diff line number Diff line
@@ -393,23 +393,25 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
        // Simulate giving up the swipe up gesture to keep the original activity as top.
        mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
        // The rotation transform should be cleared after updating orientation with display.
        assertFalse(activity.hasFixedRotationTransform());
        assertFalse(mDefaultDisplay.hasTopFixedRotationLaunchingApp());
        assertTopFixedRotationLaunchingAppCleared(activity);

        // Simulate swiping up recents (home) in different rotation.
        final ActivityRecord home = mDefaultDisplay.getDefaultTaskDisplayArea().getHomeActivity();
        mDefaultDisplay.setFixedRotationLaunchingApp(home, (mDefaultDisplay.getRotation() + 1) % 4);
        mController = new RecentsAnimationController(mWm, mMockRunner, mAnimationCallbacks,
                mDefaultDisplay.getDisplayId());
        initializeRecentsAnimationController(mController, home);
        assertTrue(home.hasFixedRotationTransform());
        startRecentsInDifferentRotation(home);

        // If the recents activity becomes the top running activity (e.g. the original top activity
        // is either finishing or moved to back during recents animation), the display orientation
        // will be determined by it so the fixed rotation must be cleared.
        activity.finishing = true;
        mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
        assertTopFixedRotationLaunchingAppCleared(home);

        startRecentsInDifferentRotation(home);
        // Assume recents activity becomes invisible for some reason (e.g. screen off).
        home.setVisible(false);
        mController.cleanupAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION);
        // Although there won't be a transition finish callback, the fixed rotation must be cleared.
        assertFalse(home.hasFixedRotationTransform());
        assertFalse(mDefaultDisplay.hasTopFixedRotationLaunchingApp());
        assertTopFixedRotationLaunchingAppCleared(home);
    }

    @Test
@@ -503,6 +505,21 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
        return homeActivity;
    }

    private void startRecentsInDifferentRotation(ActivityRecord recentsActivity) {
        final DisplayContent displayContent = recentsActivity.mDisplayContent;
        displayContent.setFixedRotationLaunchingApp(recentsActivity,
                (displayContent.getRotation() + 1) % 4);
        mController = new RecentsAnimationController(mWm, mMockRunner, mAnimationCallbacks,
                displayContent.getDisplayId());
        initializeRecentsAnimationController(mController, recentsActivity);
        assertTrue(recentsActivity.hasFixedRotationTransform());
    }

    private static void assertTopFixedRotationLaunchingAppCleared(ActivityRecord activity) {
        assertFalse(activity.hasFixedRotationTransform());
        assertFalse(activity.mDisplayContent.hasTopFixedRotationLaunchingApp());
    }

    private static void initializeRecentsAnimationController(RecentsAnimationController controller,
            ActivityRecord activity) {
        controller.initialize(activity.getActivityType(), new SparseBooleanArray(), activity);