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

Unverified Commit 4915af0e authored by Michael Bestas's avatar Michael Bestas
Browse files

Merge tag 'android-13.0.0_r72' of...

Merge tag 'android-13.0.0_r72' of https://android.googlesource.com/platform/frameworks/base into staging/lineage-20.0_merge-android-13.0.0_r67

Android 13.0.0 Release 72 (TQ3C.230805.001.A3)

* tag 'android-13.0.0_r72' of https://android.googlesource.com/platform/frameworks/base: (88 commits)
  Keyguard: use transition state for syncing occlude [RESTRICT AUTOMERGE]
  Report folding features to letterboxed apps.
  Send update config change when letterbox is moved
  Cancel current animation instead of candidate
  Merge "Resolve StatusHints image exploit across user." into sc-v2-dev am: e371b301
  Remove unnecessary padding code
  Use Settings.System.getIntForUser instead of getInt to make sure user specific settings are used
  DO NOT MERGE Verify URI permissions in MediaMetadata
  Visit URIs in themed remoteviews icons.
  Check URIs in sized remote views.
  Fix PrivacyChip not visible issue
  Update Pip launches to not enter pinned task if in background.
  Validate ComponentName for MediaButtonBroadcastReceiver
  Implement visitUris for RemoteViews ViewGroupActionAdd.
  Check URIs in notification public version.
  Preserve flags for non-runtime permissions upon package update.
  On device lockdown, always show the keyguard
  Ensure policy has no absurdly long strings
  Verify URI permissions for notification shortcutIcon.
  Do not load drawable for wallet card if the card image icon iscreated with content URI.
  ...

 Conflicts:
	packages/SystemUI/src/com/android/systemui/shade/QuickSettingsController.java

Change-Id: I3184ab0dadbf31e2de9d89dc16a94432cf8f04e2
parents 260ac0f7 33643dd3
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) {
+57 −10
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;

/**
@@ -433,6 +434,7 @@ public abstract class WallpaperService extends Service {
                Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED,
                        reportDraw ? 1 : 0,
                        mergedConfiguration);
                mIWallpaperEngine.mPendingResizeCount.incrementAndGet();
                mCaller.sendMessage(msg);
            }

@@ -1021,6 +1023,10 @@ public abstract class WallpaperService extends Service {
            out.print(prefix); out.print("mZoom="); out.println(mZoom);
            out.print(prefix); out.print("mPreviewSurfacePosition=");
                    out.println(mPreviewSurfacePosition);
            final int pendingCount = mIWallpaperEngine.mPendingResizeCount.get();
            if (pendingCount != 0) {
                out.print(prefix); out.print("mPendingResizeCount="); out.println(pendingCount);
            }
            synchronized (mLock) {
                out.print(prefix); out.print("mPendingXOffset="); out.print(mPendingXOffset);
                        out.print(" mPendingXOffset="); out.println(mPendingXOffset);
@@ -1083,10 +1089,6 @@ public abstract class WallpaperService extends Service {
            }
        }

        private void updateConfiguration(MergedConfiguration mergedConfiguration) {
            mMergedConfiguration.setTo(mergedConfiguration);
        }

        void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNeeded) {
            if (mDestroyed) {
                Log.w(TAG, "Ignoring updateSurface due to destroyed");
@@ -1135,7 +1137,7 @@ public abstract class WallpaperService extends Service {
                            | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

                    final Configuration config = mMergedConfiguration.getMergedConfiguration();
                    final Rect maxBounds = config.windowConfiguration.getMaxBounds();
                    final Rect maxBounds = new Rect(config.windowConfiguration.getMaxBounds());
                    if (myWidth == ViewGroup.LayoutParams.MATCH_PARENT
                            && myHeight == ViewGroup.LayoutParams.MATCH_PARENT) {
                        mLayout.width = myWidth;
@@ -1195,6 +1197,17 @@ public abstract class WallpaperService extends Service {
                    final int relayoutResult = mSession.relayout(mWindow, mLayout, mWidth, mHeight,
                            View.VISIBLE, 0, 0, 0, mWinFrames, mMergedConfiguration,
                            mSurfaceControl, mInsetsState, mTempControls, mSyncSeqIdBundle);
                    final Rect outMaxBounds = mMergedConfiguration.getMergedConfiguration()
                            .windowConfiguration.getMaxBounds();
                    if (!outMaxBounds.equals(maxBounds)) {
                        Log.i(TAG, "Retry updateSurface because bounds changed from relayout: "
                                + maxBounds + " -> " + outMaxBounds);
                        mSurfaceHolder.mSurfaceLock.unlock();
                        mDrawingAllowed = false;
                        mCaller.sendMessage(mCaller.obtainMessageI(MSG_WINDOW_RESIZED,
                                redrawNeeded ? 1 : 0));
                        return;
                    }

                    final int transformHint = SurfaceControl.rotationToBufferTransform(
                            (mDisplayInstallOrientation + mDisplay.getRotation()) % 4);
@@ -1461,6 +1474,8 @@ public abstract class WallpaperService extends Service {
            mPreviousWallpaperDimAmount = mWallpaperDimAmount;
            mDisplayState = mDisplay.getCommittedState();
            mDisplayInstallOrientation = mDisplay.getInstallOrientation();
            mMergedConfiguration.setOverrideConfiguration(
                    mDisplayContext.getResources().getConfiguration());

            if (DEBUG) Log.v(TAG, "onCreate(): " + this);
            Trace.beginSection("WPMS.Engine.onCreate");
@@ -2262,6 +2277,8 @@ public abstract class WallpaperService extends Service {
        final IBinder mWindowToken;
        final int mWindowType;
        final boolean mIsPreview;
        final AtomicInteger mPendingResizeCount = new AtomicInteger();
        boolean mReportDraw;
        boolean mShownReported;
        int mReqWidth;
        int mReqHeight;
@@ -2513,11 +2530,7 @@ public abstract class WallpaperService extends Service {
                    mEngine.doCommand(cmd);
                } break;
                case MSG_WINDOW_RESIZED: {
                    final boolean reportDraw = message.arg1 != 0;
                    mEngine.updateConfiguration(((MergedConfiguration) message.obj));
                    mEngine.updateSurface(true, false, reportDraw);
                    mEngine.doOffsetsChanged(true);
                    mEngine.scaleAndCropScreenshot();
                    handleResized((MergedConfiguration) message.obj, message.arg1 != 0);
                } break;
                case MSG_WINDOW_MOVED: {
                    // Do nothing. What does it mean for a Wallpaper to move?
@@ -2562,6 +2575,40 @@ public abstract class WallpaperService extends Service {
                    Log.w(TAG, "Unknown message type " + message.what);
            }
        }

        /**
         * In general this performs relayout for IWindow#resized. If there are several pending
         * (in the message queue) MSG_WINDOW_RESIZED from server side, only the last one will be
         * handled (ignore intermediate states). Note that this procedure cannot be skipped if the
         * configuration is not changed because this is also used to dispatch insets changes.
         */
        private void handleResized(MergedConfiguration config, boolean reportDraw) {
            // The config can be null when retrying for a changed config from relayout, otherwise
            // it is from IWindow#resized which always sends non-null config.
            final int pendingCount = config != null ? mPendingResizeCount.decrementAndGet() : -1;
            if (reportDraw) {
                mReportDraw = true;
            }
            if (pendingCount > 0) {
                if (DEBUG) {
                    Log.d(TAG, "Skip outdated resize, bounds="
                            + config.getMergedConfiguration().windowConfiguration.getMaxBounds()
                            + " pendingCount=" + pendingCount);
                }
                return;
            }
            if (config != null) {
                if (DEBUG) {
                    Log.d(TAG, "Update config from resized, bounds="
                            + config.getMergedConfiguration().windowConfiguration.getMaxBounds());
                }
                mEngine.mMergedConfiguration.setTo(config);
            }
            mEngine.updateSurface(true /* forceRelayout */, false /* forceReport */, mReportDraw);
            mReportDraw = false;
            mEngine.doOffsetsChanged(true);
            mEngine.scaleAndCropScreenshot();
        }
    }

    /**
+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
+5 −7
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;

/**
@@ -129,14 +128,13 @@ public final class DeviceStateManagerFoldingFeatureProducer
    }

    @Override
    protected void onListenersChanged(
            @NonNull Set<Consumer<List<CommonFoldingFeature>>> callbacks) {
        super.onListenersChanged(callbacks);
        if (callbacks.isEmpty()) {
    protected void onListenersChanged() {
        super.onListenersChanged();
        if (hasListeners()) {
            mRawFoldSupplier.addDataChangedCallback(this::notifyFoldingFeatureChange);
        } else {
            mCurrentDeviceState = INVALID_DEVICE_STATE;
            mRawFoldSupplier.removeDataChangedCallback(this::notifyFoldingFeatureChange);
        } else {
            mRawFoldSupplier.addDataChangedCallback(this::notifyFoldingFeatureChange);
        }
    }

Loading