Loading core/java/android/view/IWindowSession.aidl +6 −6 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ import android.view.Surface; import android.view.SurfaceControl; import android.view.SurfaceControl.Transaction; import android.window.ClientWindowFrames; import android.window.IOnBackInvokedCallback; import android.window.OnBackInvokedCallbackInfo; import java.util.List; Loading Loading @@ -371,14 +371,14 @@ interface IWindowSession { in String hashAlgorithm, in RemoteCallback callback); /** * Sets the {@link IOnBackInvokedCallback} to be invoked for a window when back is triggered. * Sets the {@link OnBackInvokedCallbackInfo} containing the callback to be invoked for * a window when back is triggered. * * @param window The token for the window to set the callback to. * @param callback The {@link IOnBackInvokedCallback} to set. * @param priority The priority of the callback. * @param callbackInfo The {@link OnBackInvokedCallbackInfo} to set. */ oneway void setOnBackInvokedCallback( IWindow window, IOnBackInvokedCallback callback, int priority); oneway void setOnBackInvokedCallbackInfo( IWindow window, in OnBackInvokedCallbackInfo callbackInfo); /** * Clears a touchable region set by {@link #setInsets}. Loading core/java/android/view/WindowlessWindowManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ import android.os.RemoteException; import android.util.Log; import android.util.MergedConfiguration; import android.window.ClientWindowFrames; import android.window.IOnBackInvokedCallback; import android.window.OnBackInvokedCallbackInfo; import java.util.HashMap; import java.util.List; Loading Loading @@ -529,8 +529,8 @@ public class WindowlessWindowManager implements IWindowSession { } @Override public void setOnBackInvokedCallback(IWindow iWindow, IOnBackInvokedCallback iOnBackInvokedCallback, int priority) throws RemoteException { } public void setOnBackInvokedCallbackInfo(IWindow iWindow, OnBackInvokedCallbackInfo callbackInfo) throws RemoteException { } @Override public boolean dropForAccessibility(IWindow window, int x, int y) { Loading core/java/android/window/OnBackInvokedCallbackInfo.aidl 0 → 100644 +21 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package android.window; /** @hide */ parcelable OnBackInvokedCallbackInfo; core/java/android/window/OnBackInvokedCallbackInfo.java 0 → 100644 +85 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.window; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; /** * Data object to hold an {@link IOnBackInvokedCallback} and its priority. * @hide */ public final class OnBackInvokedCallbackInfo implements Parcelable { @NonNull private final IOnBackInvokedCallback mCallback; private @OnBackInvokedDispatcher.Priority int mPriority; public OnBackInvokedCallbackInfo(@NonNull IOnBackInvokedCallback callback, int priority) { mCallback = callback; mPriority = priority; } private OnBackInvokedCallbackInfo(@NonNull Parcel in) { mCallback = IOnBackInvokedCallback.Stub.asInterface(in.readStrongBinder()); mPriority = in.readInt(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeStrongInterface(mCallback); dest.writeInt(mPriority); } public static final Creator<OnBackInvokedCallbackInfo> CREATOR = new Creator<OnBackInvokedCallbackInfo>() { @Override public OnBackInvokedCallbackInfo createFromParcel(Parcel in) { return new OnBackInvokedCallbackInfo(in); } @Override public OnBackInvokedCallbackInfo[] newArray(int size) { return new OnBackInvokedCallbackInfo[size]; } }; public boolean isSystemCallback() { return mPriority == OnBackInvokedDispatcher.PRIORITY_SYSTEM; } @NonNull public IOnBackInvokedCallback getCallback() { return mCallback; } @OnBackInvokedDispatcher.Priority public int getPriority() { return mPriority; } @Override public String toString() { return "OnBackInvokedCallbackInfo{" + "mCallback=" + mCallback + ", mPriority=" + mPriority + '}'; } } core/java/android/window/WindowOnBackInvokedDispatcher.java +4 −3 Original line number Diff line number Diff line Loading @@ -161,11 +161,12 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { } try { if (callback == null) { mWindowSession.setOnBackInvokedCallback(mWindow, null, PRIORITY_DEFAULT); mWindowSession.setOnBackInvokedCallbackInfo(mWindow, null); } else { int priority = mAllCallbacks.get(callback); mWindowSession.setOnBackInvokedCallback( mWindow, new OnBackInvokedCallbackWrapper(callback), priority); mWindowSession.setOnBackInvokedCallbackInfo( mWindow, new OnBackInvokedCallbackInfo( new OnBackInvokedCallbackWrapper(callback), priority)); } if (DEBUG && callback == null) { Log.d(TAG, TextUtils.formatSimple("setTopOnBackInvokedCallback(null) Callers:%s", Loading Loading
core/java/android/view/IWindowSession.aidl +6 −6 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ import android.view.Surface; import android.view.SurfaceControl; import android.view.SurfaceControl.Transaction; import android.window.ClientWindowFrames; import android.window.IOnBackInvokedCallback; import android.window.OnBackInvokedCallbackInfo; import java.util.List; Loading Loading @@ -371,14 +371,14 @@ interface IWindowSession { in String hashAlgorithm, in RemoteCallback callback); /** * Sets the {@link IOnBackInvokedCallback} to be invoked for a window when back is triggered. * Sets the {@link OnBackInvokedCallbackInfo} containing the callback to be invoked for * a window when back is triggered. * * @param window The token for the window to set the callback to. * @param callback The {@link IOnBackInvokedCallback} to set. * @param priority The priority of the callback. * @param callbackInfo The {@link OnBackInvokedCallbackInfo} to set. */ oneway void setOnBackInvokedCallback( IWindow window, IOnBackInvokedCallback callback, int priority); oneway void setOnBackInvokedCallbackInfo( IWindow window, in OnBackInvokedCallbackInfo callbackInfo); /** * Clears a touchable region set by {@link #setInsets}. Loading
core/java/android/view/WindowlessWindowManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ import android.os.RemoteException; import android.util.Log; import android.util.MergedConfiguration; import android.window.ClientWindowFrames; import android.window.IOnBackInvokedCallback; import android.window.OnBackInvokedCallbackInfo; import java.util.HashMap; import java.util.List; Loading Loading @@ -529,8 +529,8 @@ public class WindowlessWindowManager implements IWindowSession { } @Override public void setOnBackInvokedCallback(IWindow iWindow, IOnBackInvokedCallback iOnBackInvokedCallback, int priority) throws RemoteException { } public void setOnBackInvokedCallbackInfo(IWindow iWindow, OnBackInvokedCallbackInfo callbackInfo) throws RemoteException { } @Override public boolean dropForAccessibility(IWindow window, int x, int y) { Loading
core/java/android/window/OnBackInvokedCallbackInfo.aidl 0 → 100644 +21 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package android.window; /** @hide */ parcelable OnBackInvokedCallbackInfo;
core/java/android/window/OnBackInvokedCallbackInfo.java 0 → 100644 +85 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.window; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; /** * Data object to hold an {@link IOnBackInvokedCallback} and its priority. * @hide */ public final class OnBackInvokedCallbackInfo implements Parcelable { @NonNull private final IOnBackInvokedCallback mCallback; private @OnBackInvokedDispatcher.Priority int mPriority; public OnBackInvokedCallbackInfo(@NonNull IOnBackInvokedCallback callback, int priority) { mCallback = callback; mPriority = priority; } private OnBackInvokedCallbackInfo(@NonNull Parcel in) { mCallback = IOnBackInvokedCallback.Stub.asInterface(in.readStrongBinder()); mPriority = in.readInt(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeStrongInterface(mCallback); dest.writeInt(mPriority); } public static final Creator<OnBackInvokedCallbackInfo> CREATOR = new Creator<OnBackInvokedCallbackInfo>() { @Override public OnBackInvokedCallbackInfo createFromParcel(Parcel in) { return new OnBackInvokedCallbackInfo(in); } @Override public OnBackInvokedCallbackInfo[] newArray(int size) { return new OnBackInvokedCallbackInfo[size]; } }; public boolean isSystemCallback() { return mPriority == OnBackInvokedDispatcher.PRIORITY_SYSTEM; } @NonNull public IOnBackInvokedCallback getCallback() { return mCallback; } @OnBackInvokedDispatcher.Priority public int getPriority() { return mPriority; } @Override public String toString() { return "OnBackInvokedCallbackInfo{" + "mCallback=" + mCallback + ", mPriority=" + mPriority + '}'; } }
core/java/android/window/WindowOnBackInvokedDispatcher.java +4 −3 Original line number Diff line number Diff line Loading @@ -161,11 +161,12 @@ public class WindowOnBackInvokedDispatcher implements OnBackInvokedDispatcher { } try { if (callback == null) { mWindowSession.setOnBackInvokedCallback(mWindow, null, PRIORITY_DEFAULT); mWindowSession.setOnBackInvokedCallbackInfo(mWindow, null); } else { int priority = mAllCallbacks.get(callback); mWindowSession.setOnBackInvokedCallback( mWindow, new OnBackInvokedCallbackWrapper(callback), priority); mWindowSession.setOnBackInvokedCallbackInfo( mWindow, new OnBackInvokedCallbackInfo( new OnBackInvokedCallbackWrapper(callback), priority)); } if (DEBUG && callback == null) { Log.d(TAG, TextUtils.formatSimple("setTopOnBackInvokedCallback(null) Callers:%s", Loading