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

Commit c929dc6e authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Do not predictive back to translucent task, which could be trampoline." into main

parents 19dd37f1 14131fdd
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -312,7 +312,9 @@ class BackNavigationController {
                    // another task.
                    final Task prevParent = prevTask.getParent().asTask();
                    final Task currParent = currentTask.getParent().asTask();
                    if (prevTask.inMultiWindowMode() && prevParent != currParent) {
                    if ((prevTask.inMultiWindowMode() && prevParent != currParent)
                            // Do not animate to translucent task, it could be trampoline.
                            || hasTranslucentActivity(currentActivity, prevActivities)) {
                        backType = BackNavigationInfo.TYPE_CALLBACK;
                    } else {
                        removedWindowContainer = prevTask;
@@ -527,7 +529,7 @@ class BackNavigationController {
        }
        for (int i = prevActivities.size() - 1; i >= 0; --i) {
            final ActivityRecord test = prevActivities.get(i);
            if (!test.occludesParent() || test.showWallpaper()) {
            if (!test.occludesParent() || test.hasWallpaper()) {
                return true;
            }
        }
+12 −0
Original line number Diff line number Diff line
@@ -3889,6 +3889,18 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        return false;
    }


    /** @return {@code true} if this container wants to show wallpaper. */
    boolean hasWallpaper() {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final WindowContainer child = mChildren.get(i);
            if (child.hasWallpaper()) {
                return true;
            }
        }
        return false;
    }

    @Nullable
    static WindowContainer fromBinder(IBinder binder) {
        return RemoteToken.fromBinder(binder).getContainer();
+1 −0
Original line number Diff line number Diff line
@@ -5857,6 +5857,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        return hasWallpaper();
    }

    @Override
    boolean hasWallpaper() {
        return (mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0 || hasWallpaperForLetterboxBackground();
    }
+10 −0
Original line number Diff line number Diff line
@@ -167,8 +167,18 @@ public class BackNavigationControllerTests extends WindowTestsBase {
        assertThat(typeToString(backNavigationInfo.getType()))
                .isEqualTo(typeToString(BackNavigationInfo.TYPE_CALLBACK));

        // reset drawing status to test if previous task is translucent activity
        backNavigationInfo.onBackNavigationFinished(false);
        mBackNavigationController.clearBackAnimations();
        // simulate translucent
        recordA.setOccludesParent(false);
        backNavigationInfo = startBackNavigation();
        assertThat(typeToString(backNavigationInfo.getType()))
                .isEqualTo(typeToString(BackNavigationInfo.TYPE_CALLBACK));

        // reset drawing status to test keyguard occludes
        topActivity.setOccludesParent(true);
        recordA.setOccludesParent(true);
        backNavigationInfo.onBackNavigationFinished(false);
        mBackNavigationController.clearBackAnimations();
        makeWindowVisibleAndDrawn(topActivity.findMainWindow());