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

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

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/22381002', 'googleplex-android-review.googlesource.com/23351139', 'googleplex-android-review.googlesource.com/23351578'] into sparse-10335664-L84700000961336915.
SPARSE_CHANGE: I7b3dcd06e7483fde745a1d56dfee7c4efc262ed7
SPARSE_CHANGE: I9fc10876c03933ac8aac05205d56ad6537df72a8
SPARSE_CHANGE: I427f0bc23f00d245c5093c75f13c9e533209362e

Change-Id: I708c6ee224423cb70cd13405a280377776fd3be2
parents 0cf84886 76342090
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import static android.view.Display.INVALID_DISPLAY;
import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded;
import static android.window.ConfigurationHelper.isDifferentDisplay;
import static android.window.ConfigurationHelper.shouldUpdateResources;
import static android.window.ConfigurationHelper.shouldUpdateWindowMetricsBounds;

import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;

@@ -5987,6 +5988,11 @@ public final class ActivityThread extends ClientTransactionHandler
    public static boolean shouldReportChange(@Nullable Configuration currentConfig,
            @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets sizeBuckets,
            int handledConfigChanges) {
        // Always report changes in window configuration bounds
        if (shouldUpdateWindowMetricsBounds(currentConfig, newConfig)) {
            return true;
        }

        final int publicDiff = currentConfig.diffPublicOnly(newConfig);
        // Don't report the change if there's no public diff between current and new config.
        if (publicDiff == 0) {
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class ConfigurationHelper {
     * @see WindowManager#getCurrentWindowMetrics()
     * @see WindowManager#getMaximumWindowMetrics()
     */
    private static boolean shouldUpdateWindowMetricsBounds(@NonNull Configuration currentConfig,
    public static boolean shouldUpdateWindowMetricsBounds(@NonNull Configuration currentConfig,
            @NonNull Configuration newConfig) {
        final Rect currentBounds = currentConfig.windowConfiguration.getBounds();
        final Rect newBounds = newConfig.windowConfiguration.getBounds();
+2 −4
Original line number Diff line number Diff line
@@ -351,10 +351,8 @@ public class ActivityThreadTest {
        final Rect bounds = activity.getWindowManager().getCurrentWindowMetrics().getBounds();
        assertEquals(activityConfigPortrait.windowConfiguration.getBounds(), bounds);

        // Ensure that Activity#onConfigurationChanged() not be called because the changes in
        // WindowConfiguration shouldn't be reported, and we only apply the latest Configuration
        // update in transaction.
        assertEquals(numOfConfig, activity.mNumOfConfigChanges);
        // Ensure changes in window configuration bounds are reported
        assertEquals(numOfConfig + 1, activity.mNumOfConfigChanges);
    }

    @Test
+1 −10
Original line number Diff line number Diff line
@@ -381,24 +381,15 @@ public class WindowLayoutComponentImpl implements WindowLayoutComponent {
            final Rect taskBounds = taskConfig.windowConfiguration.getBounds();
            final WindowManager windowManager = Objects.requireNonNull(
                    context.getSystemService(WindowManager.class));
            final Rect currentBounds = windowManager.getCurrentWindowMetrics().getBounds();
            final Rect maxBounds = windowManager.getMaximumWindowMetrics().getBounds();
            boolean isTaskExpanded = maxBounds.equals(taskBounds);
            boolean isActivityExpanded = maxBounds.equals(currentBounds);
            /*
             * We need to proxy being in full screen because when a user enters PiP and exits PiP
             * the task windowingMode will report multi-window/pinned until the transition is
             * finished in WM Shell.
             * maxBounds == taskWindowBounds is a proxy check to verify the window is full screen
             * For tasks that are letterboxed, we use currentBounds == maxBounds to filter these
             * out.
             */
            // TODO(b/262900133) remove currentBounds check when letterboxed apps report bounds.
            // currently we don't want to report to letterboxed apps since they do not update the
            // window bounds when the Activity is moved.  An inaccurate fold will be reported so
            // we skip.
            return isTaskExpanded && (isActivityExpanded
                    || mTaskFragmentOrganizer.isActivityEmbedded(activityToken));
            return isTaskExpanded;
        } else {
            // TODO(b/242674941): use task windowing mode for window context that associates with
            //  activity.
+8 −10
Original line number Diff line number Diff line
@@ -260,22 +260,20 @@ public class KeyguardService extends Service {
                );
            }

            public void mergeAnimation(IBinder transition, TransitionInfo info,
                    SurfaceControl.Transaction t, IBinder mergeTarget,
                    IRemoteTransitionFinishedCallback finishCallback) {
            public void mergeAnimation(IBinder candidateTransition, TransitionInfo candidateInfo,
                    SurfaceControl.Transaction candidateT, IBinder currentTransition,
                    IRemoteTransitionFinishedCallback candidateFinishCallback) {
                try {
                    final IRemoteTransitionFinishedCallback origFinishCB;
                    final IRemoteTransitionFinishedCallback currentFinishCB;
                    synchronized (mFinishCallbacks) {
                        origFinishCB = mFinishCallbacks.remove(transition);
                        currentFinishCB = mFinishCallbacks.remove(currentTransition);
                    }
                    info.releaseAllSurfaces();
                    t.close();
                    if (origFinishCB == null) {
                        // already finished (or not started yet), so do nothing.
                    if (currentFinishCB == null) {
                        Slog.e(TAG, "Called mergeAnimation, but finish callback is missing");
                        return;
                    }
                    runner.onAnimationCancelled(false /* isKeyguardOccluded */);
                    origFinishCB.onTransitionFinished(null /* wct */, null /* t */);
                    currentFinishCB.onTransitionFinished(null /* wct */, null /* t */);
                } catch (RemoteException e) {
                    // nothing, we'll just let it finish on its own I guess.
                }
Loading