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

Commit 9f54dcf9 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/26459886',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/26459886', 'googleplex-android-review.googlesource.com/26454707', 'googleplex-android-review.googlesource.com/25920373'] into 24Q2-release.

Change-Id: Ic3826fe116d80937c652d0f5a9ce6be1697c43cd
parents ed34c64d f90b1070
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -275,18 +275,24 @@ public class AudioMix implements Parcelable {
        if (o == null || getClass() != o.getClass()) return false;

        final AudioMix that = (AudioMix) o;
        boolean tokenMatch = android.media.audiopolicy.Flags.audioMixOwnership()
                ? Objects.equals(this.mToken, that.mToken)
                : true;
        return Objects.equals(this.mRouteFlags, that.mRouteFlags)
            && Objects.equals(this.mRule, that.mRule)
            && Objects.equals(this.mMixType, that.mMixType)
            && Objects.equals(this.mFormat, that.mFormat)
            && Objects.equals(this.mToken, that.mToken);
            && tokenMatch;
    }

    /** @hide */
    @Override
    public int hashCode() {
        if (android.media.audiopolicy.Flags.audioMixOwnership()) {
            return Objects.hash(mRouteFlags, mRule, mMixType, mFormat, mToken);
        }
        return Objects.hash(mRouteFlags, mRule, mMixType, mFormat);
    }

    @Override
    public int describeContents() {
+1 −1
Original line number Diff line number Diff line
@@ -1213,7 +1213,7 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub
        mContext.startActivityAsUser(
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK),
                ActivityOptions.makeBasic().setLaunchDisplayId(displayId).toBundle(),
                mContext.getUser());
                UserHandle.SYSTEM);
    }

    private void onSecureWindowShown(int displayId, int uid) {
+16 −15
Original line number Diff line number Diff line
@@ -157,14 +157,22 @@ class WallpaperController {
            mFindResults.setUseTopWallpaperAsTarget(true);
        }

        if (mService.mPolicy.isKeyguardLocked() && w.canShowWhenLocked()) {
        if (mService.mPolicy.isKeyguardLocked()) {
            if (w.canShowWhenLocked()) {
                if (mService.mPolicy.isKeyguardOccluded() || (useShellTransition
                        ? w.inTransition() : mService.mPolicy.isKeyguardUnoccluding())) {
                // The lowest show when locked window decides whether we need to put the wallpaper
                // behind.
                    // The lowest show-when-locked window decides whether to show wallpaper.
                    mFindResults.mNeedsShowWhenLockedWallpaper = !isFullscreen(w.mAttrs)
                            || (w.mActivityRecord != null && !w.mActivityRecord.fillsParent());
                }
            } else if (w.hasWallpaper() && mService.mPolicy.isKeyguardHostWindow(w.mAttrs)
                    && w.mTransitionController.isTransitionOnDisplay(mDisplayContent)) {
                // If we have no candidates at all, notification shade is allowed to be the target
                // of last resort even if it has not been made visible yet.
                if (DEBUG_WALLPAPER) Slog.v(TAG, "Found keyguard as wallpaper target: " + w);
                mFindResults.setWallpaperTarget(w);
                return false;
            }
        }

        final boolean animationWallpaper = animatingContainer != null
@@ -200,14 +208,7 @@ class WallpaperController {

    private boolean isRecentsTransitionTarget(WindowState w) {
        if (w.mTransitionController.isShellTransitionsEnabled()) {
            // Because the recents activity is invisible in background while keyguard is occluded
            // (the activity window is on screen while keyguard is locked) with recents animation,
            // the task animating by recents needs to be wallpaper target to make wallpaper visible.
            // While for unlocked case, because recents activity will be moved to top, it can be
            // the wallpaper target naturally.
            return w.mActivityRecord != null && w.mAttrs.type == TYPE_BASE_APPLICATION
                    && mDisplayContent.isKeyguardLocked()
                    && w.mTransitionController.isTransientHide(w.getTask());
            return false;
        }
        // The window is either the recents activity or is in the task animating by the recents.
        final RecentsAnimationController controller = mService.getRecentsAnimationController();
+6 −4
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;
import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -305,12 +307,12 @@ public class WallpaperControllerTests extends WindowTestsBase {
        final WallpaperController wallpaperController = mDisplayContent.mWallpaperController;
        wallpaperController.adjustWallpaperWindows();
        // Wallpaper is visible because the show-when-locked activity is translucent.
        assertTrue(wallpaperController.isWallpaperTarget(wallpaperWindow));
        assertSame(wallpaperWindow, wallpaperController.getWallpaperTarget());

        behind.mActivityRecord.setShowWhenLocked(true);
        wallpaperController.adjustWallpaperWindows();
        // Wallpaper is invisible because the lowest show-when-locked activity is opaque.
        assertTrue(wallpaperController.isWallpaperTarget(null));
        assertNull(wallpaperController.getWallpaperTarget());

        // A show-when-locked wallpaper is used for lockscreen. So the top wallpaper should
        // be the one that is not show-when-locked.
@@ -374,10 +376,10 @@ public class WallpaperControllerTests extends WindowTestsBase {
        // The activity in restore-below task should not be the target if keyguard is not locked.
        mDisplayContent.mWallpaperController.adjustWallpaperWindows();
        assertNotEquals(appWin, mDisplayContent.mWallpaperController.getWallpaperTarget());
        // The activity in restore-below task should be the target if keyguard is occluded.
        // The activity in restore-below task should not be the target if keyguard is occluded.
        doReturn(true).when(mDisplayContent).isKeyguardLocked();
        mDisplayContent.mWallpaperController.adjustWallpaperWindows();
        assertEquals(appWin, mDisplayContent.mWallpaperController.getWallpaperTarget());
        assertNotEquals(appWin, mDisplayContent.mWallpaperController.getWallpaperTarget());
    }

    @Test