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

Commit 36868916 authored by Vadim Caen's avatar Vadim Caen
Browse files

Change parameter order to make it SAM compatible

Move the callback as the last paramter to registerOnBackInvokedCallback

Test: Existing
Bug: 224562951
Change-Id: I8608a03b53baa04bedee81d2e86b2339abd6c594
parent e5f99e63
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57925,7 +57925,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
+1 −1
Original line number Diff line number Diff line
@@ -466,7 +466,7 @@ public class Dialog implements DialogInterface, Window.Callback,
                }
            };
            getOnBackInvokedDispatcher().registerOnBackInvokedCallback(
                    mDefaultBackCallback, OnBackInvokedDispatcher.PRIORITY_DEFAULT);
                    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