Loading core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -631,6 +631,7 @@ package android { field public static final int elevation = 16843840; // 0x1010440 field public static final int elevation = 16843840; // 0x1010440 field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 field public static final int ems = 16843096; // 0x1010158 field public static final int enableOnBackInvokedCallback; field public static final int enableVrMode = 16844069; // 0x1010525 field public static final int enableVrMode = 16844069; // 0x1010525 field public static final int enabled = 16842766; // 0x101000e field public static final int enabled = 16842766; // 0x101000e field public static final int end = 16843996; // 0x10104dc field public static final int end = 16843996; // 0x10104dc core/java/android/app/Activity.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -1656,7 +1656,10 @@ public class Activity extends ContextThemeWrapper } } mRestoredFromBundle = savedInstanceState != null; mRestoredFromBundle = savedInstanceState != null; mCalled = true; mCalled = true; if (!WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { boolean aheadOfTimeBack = WindowOnBackInvokedDispatcher .isOnBackInvokedCallbackEnabled(this); if (aheadOfTimeBack) { // Add onBackPressed as default back behavior. // Add onBackPressed as default back behavior. mDefaultBackCallback = new OnBackInvokedCallback() { mDefaultBackCallback = new OnBackInvokedCallback() { @Override @Override Loading core/java/android/app/Dialog.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -456,7 +456,8 @@ public class Dialog implements DialogInterface, Window.Callback, */ */ protected void onStart() { protected void onStart() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); if (mContext != null && !WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { if (mContext != null && WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) { // Add onBackPressed as default back behavior. // Add onBackPressed as default back behavior. mDefaultBackCallback = new OnBackInvokedCallback() { mDefaultBackCallback = new OnBackInvokedCallback() { @Override @Override Loading Loading @@ -703,7 +704,7 @@ public class Dialog implements DialogInterface, Window.Callback, if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE) if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE) && event.isTracking() && event.isTracking() && !event.isCanceled() && !event.isCanceled() && WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { && !WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) { onBackPressed(); onBackPressed(); return true; return true; } } Loading core/java/android/content/pm/ApplicationInfo.java +26 −0 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.util.ArraySet; import android.util.Printer; import android.util.Printer; import android.util.SparseArray; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream; import android.view.OnBackInvokedCallback; import com.android.internal.util.ArrayUtils; import com.android.internal.util.ArrayUtils; import com.android.internal.util.Parcelling; import com.android.internal.util.Parcelling; Loading Loading @@ -801,11 +802,24 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { */ */ public static final int PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE = 1 << 2; public static final int PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE = 1 << 2; /** * If false, {@link android.view.KeyEvent#KEYCODE_BACK} related events will be forwarded to * the Activities, Dialogs and Views and {@link android.app.Activity#onBackPressed()}, * {@link android.app.Dialog#onBackPressed} will be called. Otherwise, those events will be * replaced by a call to {@link OnBackInvokedCallback#onBackInvoked()} on the focused window. * * @hide * @see android.R.styleable.AndroidManifestApplication_enableOnBackInvokedCallback */ public static final int PRIVATE_FLAG_EXT_ENABLE_ON_BACK_INVOKED_CALLBACK = 1 << 3; /** @hide */ /** @hide */ @IntDef(flag = true, prefix = { "PRIVATE_FLAG_EXT_" }, value = { @IntDef(flag = true, prefix = { "PRIVATE_FLAG_EXT_" }, value = { PRIVATE_FLAG_EXT_PROFILEABLE, PRIVATE_FLAG_EXT_PROFILEABLE, PRIVATE_FLAG_EXT_REQUEST_FOREGROUND_SERVICE_EXEMPTION, PRIVATE_FLAG_EXT_REQUEST_FOREGROUND_SERVICE_EXEMPTION, PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE, PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE, PRIVATE_FLAG_EXT_ENABLE_ON_BACK_INVOKED_CALLBACK, }) }) @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) public @interface ApplicationInfoPrivateFlagsExt {} public @interface ApplicationInfoPrivateFlagsExt {} Loading Loading @@ -1683,6 +1697,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { pw.println(prefix + "localeConfigRes=0x" pw.println(prefix + "localeConfigRes=0x" + Integer.toHexString(localeConfigRes)); + Integer.toHexString(localeConfigRes)); } } pw.println(prefix + "enableOnBackInvokedCallback=" + isOnBackInvokedCallbackEnabled()); } } pw.println(prefix + "createTimestamp=" + createTimestamp); pw.println(prefix + "createTimestamp=" + createTimestamp); if (mKnownActivityEmbeddingCerts != null) { if (mKnownActivityEmbeddingCerts != null) { Loading Loading @@ -2565,6 +2580,17 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { & ApplicationInfo.PRIVATE_FLAG_EXT_REQUEST_FOREGROUND_SERVICE_EXEMPTION) != 0; & ApplicationInfo.PRIVATE_FLAG_EXT_REQUEST_FOREGROUND_SERVICE_EXEMPTION) != 0; } } /** * Returns whether the application will use the {@link android.view.OnBackInvokedCallback} * navigation system instead of the {@link android.view.KeyEvent#KEYCODE_BACK} and related * callbacks. * * @hide */ public boolean isOnBackInvokedCallbackEnabled() { return ((privateFlagsExt & PRIVATE_FLAG_EXT_ENABLE_ON_BACK_INVOKED_CALLBACK)) != 0; } /** /** * @hide * @hide */ */ Loading core/java/android/view/ViewRootImpl.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -1201,7 +1201,7 @@ public final class ViewRootImpl implements ViewParent, mTmpFrames.displayFrame, mTempRect2, mTmpFrames.frame); mTmpFrames.displayFrame, mTempRect2, mTmpFrames.frame); setFrame(mTmpFrames.frame); setFrame(mTmpFrames.frame); registerBackCallbackOnWindow(); registerBackCallbackOnWindow(); if (WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { if (!WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) { // For apps requesting legacy back behavior, we add a compat callback that // For apps requesting legacy back behavior, we add a compat callback that // dispatches {@link KeyEvent#KEYCODE_BACK} to their root views. // dispatches {@link KeyEvent#KEYCODE_BACK} to their root views. // This way from system point of view, these apps are providing custom // This way from system point of view, these apps are providing custom Loading Loading @@ -6507,7 +6507,7 @@ public final class ViewRootImpl implements ViewParent, if (isBack(event) if (isBack(event) && mContext != null && mContext != null && !WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { && WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) { // Invoke the appropriate {@link OnBackInvokedCallback} if the new back // Invoke the appropriate {@link OnBackInvokedCallback} if the new back // navigation should be used, and the key event is not handled by anything else. // navigation should be used, and the key event is not handled by anything else. OnBackInvokedCallback topCallback = OnBackInvokedCallback topCallback = Loading Loading
core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -631,6 +631,7 @@ package android { field public static final int elevation = 16843840; // 0x1010440 field public static final int elevation = 16843840; // 0x1010440 field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 field public static final int ems = 16843096; // 0x1010158 field public static final int enableOnBackInvokedCallback; field public static final int enableVrMode = 16844069; // 0x1010525 field public static final int enableVrMode = 16844069; // 0x1010525 field public static final int enabled = 16842766; // 0x101000e field public static final int enabled = 16842766; // 0x101000e field public static final int end = 16843996; // 0x10104dc field public static final int end = 16843996; // 0x10104dc
core/java/android/app/Activity.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -1656,7 +1656,10 @@ public class Activity extends ContextThemeWrapper } } mRestoredFromBundle = savedInstanceState != null; mRestoredFromBundle = savedInstanceState != null; mCalled = true; mCalled = true; if (!WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { boolean aheadOfTimeBack = WindowOnBackInvokedDispatcher .isOnBackInvokedCallbackEnabled(this); if (aheadOfTimeBack) { // Add onBackPressed as default back behavior. // Add onBackPressed as default back behavior. mDefaultBackCallback = new OnBackInvokedCallback() { mDefaultBackCallback = new OnBackInvokedCallback() { @Override @Override Loading
core/java/android/app/Dialog.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -456,7 +456,8 @@ public class Dialog implements DialogInterface, Window.Callback, */ */ protected void onStart() { protected void onStart() { if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); if (mActionBar != null) mActionBar.setShowHideAnimationEnabled(true); if (mContext != null && !WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { if (mContext != null && WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) { // Add onBackPressed as default back behavior. // Add onBackPressed as default back behavior. mDefaultBackCallback = new OnBackInvokedCallback() { mDefaultBackCallback = new OnBackInvokedCallback() { @Override @Override Loading Loading @@ -703,7 +704,7 @@ public class Dialog implements DialogInterface, Window.Callback, if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE) if ((keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_ESCAPE) && event.isTracking() && event.isTracking() && !event.isCanceled() && !event.isCanceled() && WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { && !WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) { onBackPressed(); onBackPressed(); return true; return true; } } Loading
core/java/android/content/pm/ApplicationInfo.java +26 −0 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.util.ArraySet; import android.util.Printer; import android.util.Printer; import android.util.SparseArray; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream; import android.view.OnBackInvokedCallback; import com.android.internal.util.ArrayUtils; import com.android.internal.util.ArrayUtils; import com.android.internal.util.Parcelling; import com.android.internal.util.Parcelling; Loading Loading @@ -801,11 +802,24 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { */ */ public static final int PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE = 1 << 2; public static final int PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE = 1 << 2; /** * If false, {@link android.view.KeyEvent#KEYCODE_BACK} related events will be forwarded to * the Activities, Dialogs and Views and {@link android.app.Activity#onBackPressed()}, * {@link android.app.Dialog#onBackPressed} will be called. Otherwise, those events will be * replaced by a call to {@link OnBackInvokedCallback#onBackInvoked()} on the focused window. * * @hide * @see android.R.styleable.AndroidManifestApplication_enableOnBackInvokedCallback */ public static final int PRIVATE_FLAG_EXT_ENABLE_ON_BACK_INVOKED_CALLBACK = 1 << 3; /** @hide */ /** @hide */ @IntDef(flag = true, prefix = { "PRIVATE_FLAG_EXT_" }, value = { @IntDef(flag = true, prefix = { "PRIVATE_FLAG_EXT_" }, value = { PRIVATE_FLAG_EXT_PROFILEABLE, PRIVATE_FLAG_EXT_PROFILEABLE, PRIVATE_FLAG_EXT_REQUEST_FOREGROUND_SERVICE_EXEMPTION, PRIVATE_FLAG_EXT_REQUEST_FOREGROUND_SERVICE_EXEMPTION, PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE, PRIVATE_FLAG_EXT_ATTRIBUTIONS_ARE_USER_VISIBLE, PRIVATE_FLAG_EXT_ENABLE_ON_BACK_INVOKED_CALLBACK, }) }) @Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE) public @interface ApplicationInfoPrivateFlagsExt {} public @interface ApplicationInfoPrivateFlagsExt {} Loading Loading @@ -1683,6 +1697,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { pw.println(prefix + "localeConfigRes=0x" pw.println(prefix + "localeConfigRes=0x" + Integer.toHexString(localeConfigRes)); + Integer.toHexString(localeConfigRes)); } } pw.println(prefix + "enableOnBackInvokedCallback=" + isOnBackInvokedCallbackEnabled()); } } pw.println(prefix + "createTimestamp=" + createTimestamp); pw.println(prefix + "createTimestamp=" + createTimestamp); if (mKnownActivityEmbeddingCerts != null) { if (mKnownActivityEmbeddingCerts != null) { Loading Loading @@ -2565,6 +2580,17 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { & ApplicationInfo.PRIVATE_FLAG_EXT_REQUEST_FOREGROUND_SERVICE_EXEMPTION) != 0; & ApplicationInfo.PRIVATE_FLAG_EXT_REQUEST_FOREGROUND_SERVICE_EXEMPTION) != 0; } } /** * Returns whether the application will use the {@link android.view.OnBackInvokedCallback} * navigation system instead of the {@link android.view.KeyEvent#KEYCODE_BACK} and related * callbacks. * * @hide */ public boolean isOnBackInvokedCallbackEnabled() { return ((privateFlagsExt & PRIVATE_FLAG_EXT_ENABLE_ON_BACK_INVOKED_CALLBACK)) != 0; } /** /** * @hide * @hide */ */ Loading
core/java/android/view/ViewRootImpl.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -1201,7 +1201,7 @@ public final class ViewRootImpl implements ViewParent, mTmpFrames.displayFrame, mTempRect2, mTmpFrames.frame); mTmpFrames.displayFrame, mTempRect2, mTmpFrames.frame); setFrame(mTmpFrames.frame); setFrame(mTmpFrames.frame); registerBackCallbackOnWindow(); registerBackCallbackOnWindow(); if (WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { if (!WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) { // For apps requesting legacy back behavior, we add a compat callback that // For apps requesting legacy back behavior, we add a compat callback that // dispatches {@link KeyEvent#KEYCODE_BACK} to their root views. // dispatches {@link KeyEvent#KEYCODE_BACK} to their root views. // This way from system point of view, these apps are providing custom // This way from system point of view, these apps are providing custom Loading Loading @@ -6507,7 +6507,7 @@ public final class ViewRootImpl implements ViewParent, if (isBack(event) if (isBack(event) && mContext != null && mContext != null && !WindowOnBackInvokedDispatcher.shouldUseLegacyBack()) { && WindowOnBackInvokedDispatcher.isOnBackInvokedCallbackEnabled(mContext)) { // Invoke the appropriate {@link OnBackInvokedCallback} if the new back // Invoke the appropriate {@link OnBackInvokedCallback} if the new back // navigation should be used, and the key event is not handled by anything else. // navigation should be used, and the key event is not handled by anything else. OnBackInvokedCallback topCallback = OnBackInvokedCallback topCallback = Loading