Merge "Move OnBackInvokedCallback to window package." into tm-dev
This commit is contained in:
@@ -4073,7 +4073,7 @@ package android.app {
|
||||
method @Deprecated public void onTabUnselected(android.app.ActionBar.Tab, android.app.FragmentTransaction);
|
||||
}
|
||||
|
||||
@UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
@UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.window.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
ctor public Activity();
|
||||
method public void addContentView(android.view.View, android.view.ViewGroup.LayoutParams);
|
||||
method public void closeContextMenu();
|
||||
@@ -4116,7 +4116,7 @@ package android.app {
|
||||
method public int getMaxNumPictureInPictureActions();
|
||||
method public final android.media.session.MediaController getMediaController();
|
||||
method @NonNull public android.view.MenuInflater getMenuInflater();
|
||||
method @NonNull public android.view.OnBackInvokedDispatcher getOnBackInvokedDispatcher();
|
||||
method @NonNull public android.window.OnBackInvokedDispatcher getOnBackInvokedDispatcher();
|
||||
method public final android.app.Activity getParent();
|
||||
method @Nullable public android.content.Intent getParentActivityIntent();
|
||||
method public android.content.SharedPreferences getPreferences(int);
|
||||
@@ -5002,7 +5002,7 @@ package android.app {
|
||||
method public void onDateSet(android.widget.DatePicker, int, int, int);
|
||||
}
|
||||
|
||||
public class Dialog implements android.content.DialogInterface android.view.KeyEvent.Callback android.view.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
public class Dialog implements android.content.DialogInterface android.view.KeyEvent.Callback android.window.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
ctor public Dialog(@NonNull @UiContext android.content.Context);
|
||||
ctor public Dialog(@NonNull @UiContext android.content.Context, @StyleRes int);
|
||||
ctor protected Dialog(@NonNull @UiContext android.content.Context, boolean, @Nullable android.content.DialogInterface.OnCancelListener);
|
||||
@@ -5022,7 +5022,7 @@ package android.app {
|
||||
method @NonNull @UiContext public final android.content.Context getContext();
|
||||
method @Nullable public android.view.View getCurrentFocus();
|
||||
method @NonNull public android.view.LayoutInflater getLayoutInflater();
|
||||
method @NonNull public android.view.OnBackInvokedDispatcher getOnBackInvokedDispatcher();
|
||||
method @NonNull public android.window.OnBackInvokedDispatcher getOnBackInvokedDispatcher();
|
||||
method @Nullable public final android.app.Activity getOwnerActivity();
|
||||
method @Nullable public final android.view.SearchEvent getSearchEvent();
|
||||
method public final int getVolumeControlStream();
|
||||
@@ -49032,21 +49032,6 @@ package android.view {
|
||||
field public int toolType;
|
||||
}
|
||||
|
||||
public interface OnBackInvokedCallback {
|
||||
method public default void onBackInvoked();
|
||||
}
|
||||
|
||||
public interface OnBackInvokedDispatcher {
|
||||
method public void registerOnBackInvokedCallback(@NonNull android.view.OnBackInvokedCallback, @IntRange(from=0) int);
|
||||
method public void unregisterOnBackInvokedCallback(@NonNull android.view.OnBackInvokedCallback);
|
||||
field public static final int PRIORITY_DEFAULT = 0; // 0x0
|
||||
field public static final int PRIORITY_OVERLAY = 1000000; // 0xf4240
|
||||
}
|
||||
|
||||
public interface OnBackInvokedDispatcherOwner {
|
||||
method @NonNull public android.view.OnBackInvokedDispatcher getOnBackInvokedDispatcher();
|
||||
}
|
||||
|
||||
public interface OnReceiveContentListener {
|
||||
method @Nullable public android.view.ContentInfo onReceiveContent(@NonNull android.view.View, @NonNull android.view.ContentInfo);
|
||||
}
|
||||
@@ -57908,6 +57893,21 @@ package android.widget.inline {
|
||||
|
||||
package android.window {
|
||||
|
||||
public interface OnBackInvokedCallback {
|
||||
method public default void onBackInvoked();
|
||||
}
|
||||
|
||||
public interface OnBackInvokedDispatcher {
|
||||
method public void registerOnBackInvokedCallback(@NonNull android.window.OnBackInvokedCallback, @IntRange(from=0) int);
|
||||
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
|
||||
}
|
||||
|
||||
public interface OnBackInvokedDispatcherOwner {
|
||||
method @NonNull public android.window.OnBackInvokedDispatcher getOnBackInvokedDispatcher();
|
||||
}
|
||||
|
||||
public interface SplashScreen {
|
||||
method public void clearOnExitAnimationListener();
|
||||
method public void setOnExitAnimationListener(@NonNull android.window.SplashScreen.OnExitAnimationListener);
|
||||
|
||||
@@ -10,7 +10,7 @@ package android {
|
||||
|
||||
package android.app {
|
||||
|
||||
@UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
@UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.window.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
method public final boolean addDumpable(@NonNull android.util.Dumpable);
|
||||
}
|
||||
|
||||
|
||||
@@ -463,7 +463,7 @@ package android.accounts {
|
||||
|
||||
package android.app {
|
||||
|
||||
@UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
@UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.window.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
method public void convertFromTranslucent();
|
||||
method public boolean convertToTranslucent(android.app.Activity.TranslucentConversionListener, android.app.ActivityOptions);
|
||||
method @Deprecated public boolean isBackgroundVisibleBehind();
|
||||
|
||||
@@ -103,7 +103,7 @@ package android.animation {
|
||||
|
||||
package android.app {
|
||||
|
||||
@UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
@UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.window.OnBackInvokedDispatcherOwner android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
|
||||
method public final boolean addDumpable(@NonNull android.util.Dumpable);
|
||||
method public void dumpInternal(@NonNull String, @Nullable java.io.FileDescriptor, @NonNull java.io.PrintWriter, @Nullable String[]);
|
||||
method public void onMovedToDisplay(int, android.content.res.Configuration);
|
||||
@@ -2833,10 +2833,6 @@ package android.view {
|
||||
field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800
|
||||
}
|
||||
|
||||
public interface OnBackInvokedDispatcher {
|
||||
field public static final long DISPATCH_BACK_INVOCATION_AHEAD_OF_TIME = 195946584L; // 0xbade858L
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) public @interface RemotableViewMethod {
|
||||
method public abstract String asyncImpl() default "";
|
||||
}
|
||||
@@ -3250,6 +3246,10 @@ package android.window {
|
||||
field public static final int FEATURE_WINDOW_TOKENS = 2; // 0x2
|
||||
}
|
||||
|
||||
public interface OnBackInvokedDispatcher {
|
||||
field public static final long DISPATCH_BACK_INVOCATION_AHEAD_OF_TIME = 195946584L; // 0xbade858L
|
||||
}
|
||||
|
||||
public final class SplashScreenView extends android.widget.FrameLayout {
|
||||
method @Nullable public android.view.View getBrandingView();
|
||||
}
|
||||
|
||||
@@ -120,9 +120,6 @@ import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.OnBackInvokedCallback;
|
||||
import android.view.OnBackInvokedDispatcher;
|
||||
import android.view.OnBackInvokedDispatcherOwner;
|
||||
import android.view.RemoteAnimationDefinition;
|
||||
import android.view.SearchEvent;
|
||||
import android.view.View;
|
||||
@@ -149,6 +146,9 @@ import android.view.translation.UiTranslationSpec;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.Toolbar;
|
||||
import android.window.OnBackInvokedCallback;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
import android.window.OnBackInvokedDispatcherOwner;
|
||||
import android.window.SplashScreen;
|
||||
import android.window.WindowOnBackInvokedDispatcher;
|
||||
|
||||
|
||||
@@ -52,9 +52,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.OnBackInvokedCallback;
|
||||
import android.view.OnBackInvokedDispatcher;
|
||||
import android.view.OnBackInvokedDispatcherOwner;
|
||||
import android.view.SearchEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnCreateContextMenuListener;
|
||||
@@ -63,6 +60,9 @@ import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.window.OnBackInvokedCallback;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
import android.window.OnBackInvokedDispatcherOwner;
|
||||
import android.window.WindowOnBackInvokedDispatcher;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
@@ -40,7 +40,7 @@ import android.util.ArraySet;
|
||||
import android.util.Printer;
|
||||
import android.util.SparseArray;
|
||||
import android.util.proto.ProtoOutputStream;
|
||||
import android.view.OnBackInvokedCallback;
|
||||
import android.window.OnBackInvokedCallback;
|
||||
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.internal.util.Parcelling;
|
||||
@@ -2582,7 +2582,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the application will use the {@link android.view.OnBackInvokedCallback}
|
||||
* Returns whether the application will use the {@link android.window.OnBackInvokedCallback}
|
||||
* navigation system instead of the {@link android.view.KeyEvent#KEYCODE_BACK} and related
|
||||
* callbacks.
|
||||
*
|
||||
|
||||
@@ -196,6 +196,9 @@ import android.view.contentcapture.MainContentCaptureSession;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Scroller;
|
||||
import android.window.ClientWindowFrames;
|
||||
import android.window.OnBackInvokedCallback;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
import android.window.OnBackInvokedDispatcherOwner;
|
||||
import android.window.SurfaceSyncer;
|
||||
import android.window.WindowOnBackInvokedDispatcher;
|
||||
|
||||
@@ -223,7 +226,6 @@ import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Queue;
|
||||
|
||||
@@ -61,7 +61,7 @@ public final class BackNavigationInfo implements Parcelable {
|
||||
public static final int TYPE_CROSS_TASK = 3;
|
||||
|
||||
/**
|
||||
* A {@link android.view.OnBackInvokedCallback} is available and needs to be called.
|
||||
* A {@link OnBackInvokedCallback} is available and needs to be called.
|
||||
* <p>
|
||||
*/
|
||||
public static final int TYPE_CALLBACK = 4;
|
||||
@@ -206,13 +206,13 @@ public final class BackNavigationInfo implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link android.view.OnBackInvokedCallback} of the top level window or null if
|
||||
* Returns the {@link OnBackInvokedCallback} of the top level window or null if
|
||||
* the client didn't register a callback.
|
||||
* <p>
|
||||
* This is never null when {@link #getType} returns {@link #TYPE_CALLBACK}.
|
||||
*
|
||||
* @see android.view.OnBackInvokedCallback
|
||||
* @see android.view.OnBackInvokedDispatcher
|
||||
* @see OnBackInvokedCallback
|
||||
* @see OnBackInvokedDispatcher
|
||||
*/
|
||||
@Nullable
|
||||
public IOnBackInvokedCallback getOnBackInvokedCallback() {
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.view;
|
||||
package android.window;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.window.BackEvent;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* Interface for applications to register back invocation callbacks. This allows the client
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.view;
|
||||
package android.window;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.IntRange;
|
||||
@@ -39,7 +39,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
public interface OnBackInvokedDispatcher {
|
||||
/**
|
||||
* Enables dispatching the "back" action via {@link android.view.OnBackInvokedDispatcher}.
|
||||
* Enables dispatching the "back" action via {@link OnBackInvokedDispatcher}.
|
||||
*
|
||||
* When enabled, the following APIs are no longer invoked:
|
||||
* <ul>
|
||||
@@ -100,7 +100,7 @@ public interface OnBackInvokedDispatcher {
|
||||
* @param priority The priority of the callback.
|
||||
* @throws {@link IllegalArgumentException} if the priority is negative.
|
||||
*/
|
||||
@SuppressLint("SamShouldBeLast")
|
||||
@SuppressLint({"SamShouldBeLast", "ExecutorRegistration"})
|
||||
void registerOnBackInvokedCallback(
|
||||
@NonNull OnBackInvokedCallback callback, @Priority @IntRange(from = 0) int priority);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.view;
|
||||
package android.window;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
|
||||
@@ -20,9 +20,6 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.OnBackInvokedCallback;
|
||||
import android.view.OnBackInvokedDispatcher;
|
||||
import android.view.OnBackInvokedDispatcherOwner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,15 +27,13 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.IWindow;
|
||||
import android.view.IWindowSession;
|
||||
import android.view.OnBackInvokedCallback;
|
||||
import android.view.OnBackInvokedDispatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Provides window based implementation of {@link android.view.OnBackInvokedDispatcher}.
|
||||
* Provides window based implementation of {@link OnBackInvokedDispatcher}.
|
||||
*
|
||||
* Callbacks with higher priorities receive back dispatching first.
|
||||
* Within the same priority, callbacks receive back dispatching in the reverse order
|
||||
@@ -43,7 +41,7 @@ import java.util.TreeMap;
|
||||
*
|
||||
* When the top priority callback is updated, the new callback is propagated to the Window Manager
|
||||
* if the window the instance is associated with has been attached. It is allowed to register /
|
||||
* unregister {@link android.view.OnBackInvokedCallback}s before the window is attached, although
|
||||
* unregister {@link OnBackInvokedCallback}s before the window is attached, although
|
||||
* callbacks will not receive dispatches until window attachment.
|
||||
*
|
||||
* @hide
|
||||
@@ -223,7 +221,7 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher {
|
||||
* Returns if the legacy back behavior should be used.
|
||||
*
|
||||
* Legacy back behavior dispatches KEYCODE_BACK instead of invoking the application registered
|
||||
* {@link android.view.OnBackInvokedCallback}.
|
||||
* {@link OnBackInvokedCallback}.
|
||||
*/
|
||||
public static boolean isOnBackInvokedCallbackEnabled(@Nullable Context context) {
|
||||
// new back is enabled if the app targets T AND the feature flag is enabled AND the app
|
||||
|
||||
@@ -91,8 +91,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.OnBackInvokedDispatcher;
|
||||
import android.view.OnBackInvokedDispatcherOwner;
|
||||
import android.view.ScrollCaptureCallback;
|
||||
import android.view.SearchEvent;
|
||||
import android.view.SurfaceHolder.Callback2;
|
||||
@@ -112,6 +110,8 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
import android.window.OnBackInvokedDispatcherOwner;
|
||||
import android.window.ProxyOnBackInvokedDispatcher;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
@@ -2035,7 +2035,7 @@
|
||||
{@link android.app.Activity#onBackPressed Activity.onBackPressed()}
|
||||
and related event will be forwarded to the Activities and View, otherwise those events
|
||||
will be replaced by a call to
|
||||
{@link android.view.OnBackInvokedCallback#onBackInvoked
|
||||
{@link android.window.OnBackInvokedCallback#onBackInvoked
|
||||
OnBackInvokedCallback.onBackInvoked()} on the focused window. -->
|
||||
<attr name="enableOnBackInvokedCallback" format="boolean"/>
|
||||
</declare-styleable>
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.app.EmptyActivity;
|
||||
import android.app.Instrumentation;
|
||||
import android.os.RemoteException;
|
||||
import android.support.test.uiautomator.UiDevice;
|
||||
import android.view.OnBackInvokedCallback;
|
||||
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.test.core.app.ActivityScenario;
|
||||
|
||||
@@ -27,8 +27,6 @@ import android.os.RemoteException;
|
||||
import android.platform.test.annotations.Presubmit;
|
||||
import android.view.IWindow;
|
||||
import android.view.IWindowSession;
|
||||
import android.view.OnBackInvokedCallback;
|
||||
import android.view.OnBackInvokedDispatcher;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
|
||||
@@ -69,13 +69,13 @@ import android.view.InputChannel;
|
||||
import android.view.InsetsSourceControl;
|
||||
import android.view.InsetsState;
|
||||
import android.view.InsetsVisibilities;
|
||||
import android.view.OnBackInvokedDispatcher;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.SurfaceSession;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.window.ClientWindowFrames;
|
||||
import android.window.IOnBackInvokedCallback;
|
||||
import android.window.OnBackInvokedDispatcher;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.os.logging.MetricsLoggerWrapper;
|
||||
|
||||
Reference in New Issue
Block a user