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

Commit 1b585503 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topics "presubmit-am-859dd3744ae243f9a8cb2f6234a9ef1e",...

Merge changes from topics "presubmit-am-859dd3744ae243f9a8cb2f6234a9ef1e", "register_api" into tm-dev

* changes:
  Change parameter order to make it SAM compatible
  Fix a problem that Dialog does not close in new dispatch.
parents a90ee326 36868916
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57959,7 +57959,7 @@ package android.window {
  }
  public interface OnBackInvokedDispatcher {
    method public void registerOnBackInvokedCallback(@NonNull android.window.OnBackInvokedCallback, @IntRange(from=0) int);
    method public void registerOnBackInvokedCallback(@IntRange(from=0) int, @NonNull android.window.OnBackInvokedCallback);
    method public void unregisterOnBackInvokedCallback(@NonNull android.window.OnBackInvokedCallback);
    field public static final int PRIORITY_DEFAULT = 0; // 0x0
    field public static final int PRIORITY_OVERLAY = 1000000; // 0xf4240
+2 −1
Original line number Diff line number Diff line
@@ -465,7 +465,8 @@ public class Dialog implements DialogInterface, Window.Callback,
                    onBackPressed();
                }
            };
            getOnBackInvokedDispatcher().registerSystemOnBackInvokedCallback(mDefaultBackCallback);
            getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
                    OnBackInvokedDispatcher.PRIORITY_DEFAULT, mDefaultBackCallback);
            mDefaultBackCallback = null;
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -10923,7 +10923,7 @@ public final class ViewRootImpl implements ViewParent,
            }
        };
        mOnBackInvokedDispatcher.registerOnBackInvokedCallback(
                mCompatOnBackInvokedCallback, OnBackInvokedDispatcher.PRIORITY_DEFAULT);
                OnBackInvokedDispatcher.PRIORITY_DEFAULT, mCompatOnBackInvokedCallback);
    }

    private void unregisterCompatOnBackInvokedCallback() {
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import android.view.View;
 * within the same priority. Between different pirorities, callbacks with higher priority
 * are invoked first.
 *
 * See {@link OnBackInvokedDispatcher#registerOnBackInvokedCallback(OnBackInvokedCallback, int)}
 * See {@link OnBackInvokedDispatcher#registerOnBackInvokedCallback(int, OnBackInvokedCallback)}
 * for specifying callback priority.
 */
public interface OnBackInvokedCallback {
+3 −3
Original line number Diff line number Diff line
@@ -94,15 +94,15 @@ public interface OnBackInvokedDispatcher {
     * Within the same priority level, callbacks are invoked in the reverse order in which
     * they are registered. Higher priority callbacks are invoked before lower priority ones.
     *
     * @param priority The priority of the callback.
     * @param callback The callback to be registered. If the callback instance has been already
     *                 registered, the existing instance (no matter its priority) will be
     *                 unregistered and registered again.
     * @param priority The priority of the callback.
     * @throws {@link IllegalArgumentException} if the priority is negative.
     */
    @SuppressLint({"SamShouldBeLast", "ExecutorRegistration"})
    @SuppressLint({"ExecutorRegistration"})
    void registerOnBackInvokedCallback(
            @NonNull OnBackInvokedCallback callback, @Priority @IntRange(from = 0) int priority);
            @Priority @IntRange(from = 0) int priority, @NonNull OnBackInvokedCallback callback);

    /**
     * Unregisters a {@link OnBackInvokedCallback}.
Loading