| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.window; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.os.Parcel; |
| 21 |
import android.os.Parcelable; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public final class OnBackInvokedCallbackInfo implements Parcelable { |
| 28 |
@NonNull |
| 29 |
private final IOnBackInvokedCallback mCallback; |
| 30 |
private @OnBackInvokedDispatcher.Priority int mPriority; |
| 31 |
|
| 32 |
public OnBackInvokedCallbackInfo(@NonNull IOnBackInvokedCallback callback, int priority) { |
| 33 |
mCallback = callback; |
| 34 |
mPriority = priority; |
| 35 |
} |
| 36 |
|
| 37 |
private OnBackInvokedCallbackInfo(@NonNull Parcel in) { |
| 38 |
mCallback = IOnBackInvokedCallback.Stub.asInterface(in.readStrongBinder()); |
| 39 |
mPriority = in.readInt(); |
| 40 |
} |
| 41 |
|
| 42 |
@Override |
| 43 |
public int describeContents() { |
| 44 |
return 0; |
| 45 |
} |
| 46 |
|
| 47 |
@Override |
| 48 |
public void writeToParcel(@NonNull Parcel dest, int flags) { |
| 49 |
dest.writeStrongInterface(mCallback); |
| 50 |
dest.writeInt(mPriority); |
| 51 |
} |
| 52 |
|
| 53 |
public static final Creator<OnBackInvokedCallbackInfo> CREATOR = |
| 54 |
new Creator<OnBackInvokedCallbackInfo>() { |
| 55 |
@Override |
| 56 |
public OnBackInvokedCallbackInfo createFromParcel(Parcel in) { |
| 57 |
return new OnBackInvokedCallbackInfo(in); |
| 58 |
} |
| 59 |
|
| 60 |
@Override |
| 61 |
public OnBackInvokedCallbackInfo[] newArray(int size) { |
| 62 |
return new OnBackInvokedCallbackInfo[size]; |
| 63 |
} |
| 64 |
}; |
| 65 |
|
| 66 |
public boolean isSystemCallback() { |
| 67 |
return mPriority == OnBackInvokedDispatcher.PRIORITY_SYSTEM; |
| 68 |
} |
| 69 |
|
| 70 |
@NonNull |
| 71 |
public IOnBackInvokedCallback getCallback() { |
| 72 |
return mCallback; |
| 73 |
} |
| 74 |
|
| 75 |
@OnBackInvokedDispatcher.Priority |
| 76 |
public int getPriority() { |
| 77 |
return mPriority; |
| 78 |
} |
| 79 |
|
| 80 |
@Override |
| 81 |
public String toString() { |
| 82 |
return "OnBackInvokedCallbackInfo{" |
| 83 |
+ "mCallback=" + mCallback + ", mPriority=" + mPriority + '}'; |
| 84 |
} |
| 85 |
} |