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

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

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

Merge cherrypicks of ['googleplex-android-review.googlesource.com/24308899', 'googleplex-android-review.googlesource.com/24310240', 'googleplex-android-review.googlesource.com/23727470', 'googleplex-android-review.googlesource.com/24444452', 'googleplex-android-review.googlesource.com/24424817', 'googleplex-android-review.googlesource.com/24248274', 'googleplex-android-review.googlesource.com/24484185', 'googleplex-android-review.googlesource.com/24499883', 'googleplex-android-review.googlesource.com/24681253', 'googleplex-android-review.googlesource.com/24499331', 'googleplex-android-review.googlesource.com/24485253', 'googleplex-android-review.googlesource.com/24026633', 'googleplex-android-review.googlesource.com/24499047', 'googleplex-android-review.googlesource.com/24422641', 'googleplex-android-review.googlesource.com/24733945', 'googleplex-android-review.googlesource.com/24677183', 'googleplex-android-review.googlesource.com/24708071', 'googleplex-android-review.googlesource.com/24758914'] into udc-release.

Change-Id: I8023576b9abf5d7976ab4ded6a1c803001da870b
parents 299fe6f5 17fc586c
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -454,12 +454,11 @@ public class Dialog implements DialogInterface, Window.Callback,
     */
    protected void onStart() {
        if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true);
        if (mContext != null
        if (allowsRegisterDefaultOnBackInvokedCallback() && mContext != null
                && WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) {
            // Add onBackPressed as default back behavior.
            mDefaultBackCallback = this::onBackPressed;
            getOnBackInvokedDispatcher().registerSystemOnBackInvokedCallback(mDefaultBackCallback);
            mDefaultBackCallback = null;
        }
    }

@@ -470,9 +469,18 @@ public class Dialog implements DialogInterface, Window.Callback,
        if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(false);
        if (mDefaultBackCallback != null) {
            getOnBackInvokedDispatcher().unregisterOnBackInvokedCallback(mDefaultBackCallback);
            mDefaultBackCallback = null;
        }
    }

    /**
     * Whether this dialog allows to register the default onBackInvokedCallback.
     * @hide
     */
    protected boolean allowsRegisterDefaultOnBackInvokedCallback() {
        return true;
    }

    private static final String DIALOG_SHOWING_TAG = "android:dialogShowing";
    private static final String DIALOG_HIERARCHY_TAG = "android:dialogHierarchy";

@@ -697,7 +705,8 @@ public class Dialog implements DialogInterface, Window.Callback,
        if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE)
                && event.isTracking()
                && !event.isCanceled()
                && !WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) {
                && (!WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)
                || !allowsRegisterDefaultOnBackInvokedCallback())) {
            onBackPressed();
            return true;
        }
+5 −2
Original line number Diff line number Diff line
@@ -3485,8 +3485,11 @@ public class Notification implements Parcelable
     *
     * @hide
     */
    public void setAllowlistToken(@Nullable IBinder token) {
        mAllowlistToken = token;
    public void clearAllowlistToken() {
        mAllowlistToken = null;
        if (publicVersion != null) {
            publicVersion.clearAllowlistToken();
        }
    }
    /**
+24 −7
Original line number Diff line number Diff line
@@ -211,6 +211,11 @@ public final class AttributionSource implements Parcelable {
                token, mAttributionSourceState.renouncedPermissions, getNext());
    }

    /** @hide */
    public AttributionSource withDefaultToken() {
        return withToken(sDefaultToken);
    }

    /** @hide */
    public AttributionSource withPid(int pid) {
        return new AttributionSource(getUid(), pid, getPackageName(), getAttributionTag(),
@@ -520,16 +525,28 @@ public final class AttributionSource implements Parcelable {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AttributionSource that = (AttributionSource) o;
        return mAttributionSourceState.uid == that.mAttributionSourceState.uid
        return equalsExceptToken(that) && Objects.equals(
                mAttributionSourceState.token, that.mAttributionSourceState.token);
    }

    /**
     * We store trusted attribution sources without their token (the token is the key to the map)
     * to avoid having a strong reference to the token. This means, when checking the equality of a
     * supplied AttributionSource in PermissionManagerService.isTrustedAttributionSource, we want to
     * compare everything except the token.
     *
     * @hide
     */
    public boolean equalsExceptToken(@Nullable AttributionSource o) {
        if (o == null) return false;
        return mAttributionSourceState.uid == o.mAttributionSourceState.uid
                && Objects.equals(mAttributionSourceState.packageName,
                        that.mAttributionSourceState.packageName)
                o.mAttributionSourceState.packageName)
                && Objects.equals(mAttributionSourceState.attributionTag,
                        that.mAttributionSourceState.attributionTag)
                && Objects.equals(mAttributionSourceState.token,
                        that.mAttributionSourceState.token)
                o.mAttributionSourceState.attributionTag)
                && Arrays.equals(mAttributionSourceState.renouncedPermissions,
                        that.mAttributionSourceState.renouncedPermissions)
                && Objects.equals(getNext(), that.getNext());
                o.mAttributionSourceState.renouncedPermissions)
                && Objects.equals(getNext(), o.getNext());
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -172,7 +172,8 @@ public class UsbConfiguration implements Parcelable {
            String name = in.readString();
            int attributes = in.readInt();
            int maxPower = in.readInt();
            Parcelable[] interfaces = in.readParcelableArray(UsbInterface.class.getClassLoader());
            Parcelable[] interfaces = in.readParcelableArray(
                    UsbInterface.class.getClassLoader(), UsbInterface.class);
            UsbConfiguration configuration = new UsbConfiguration(id, name, attributes, maxPower);
            configuration.setInterfaces(interfaces);
            return configuration;
+7 −0
Original line number Diff line number Diff line
@@ -79,6 +79,13 @@ final class SoftInputWindow extends Dialog {
    @WindowState
    private int mWindowState = WindowState.TOKEN_PENDING;

    @Override
    protected boolean allowsRegisterDefaultOnBackInvokedCallback() {
        // Do not register OnBackInvokedCallback from Dialog#onStart, InputMethodService will
        // register CompatOnBackInvokedCallback for input method window.
        return false;
    }

    /**
     * Set {@link IBinder} window token to the window.
     *
Loading