Initial commit
This commit is contained in:
79
sources/android/support/v4/os/IResultReceiver.java
Normal file
79
sources/android/support/v4/os/IResultReceiver.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package android.support.v4.os;
|
||||
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.IInterface;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IResultReceiver extends IInterface {
|
||||
|
||||
public static abstract class Stub extends Binder implements IResultReceiver {
|
||||
|
||||
private static class Proxy implements IResultReceiver {
|
||||
private IBinder a;
|
||||
|
||||
Proxy(IBinder iBinder) {
|
||||
this.a = iBinder;
|
||||
}
|
||||
|
||||
@Override // android.support.v4.os.IResultReceiver
|
||||
public void a(int i, Bundle bundle) throws RemoteException {
|
||||
Parcel obtain = Parcel.obtain();
|
||||
try {
|
||||
obtain.writeInterfaceToken("android.support.v4.os.IResultReceiver");
|
||||
obtain.writeInt(i);
|
||||
if (bundle != null) {
|
||||
obtain.writeInt(1);
|
||||
bundle.writeToParcel(obtain, 0);
|
||||
} else {
|
||||
obtain.writeInt(0);
|
||||
}
|
||||
this.a.transact(1, obtain, null, 1);
|
||||
} finally {
|
||||
obtain.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
|
||||
public Stub() {
|
||||
attachInterface(this, "android.support.v4.os.IResultReceiver");
|
||||
}
|
||||
|
||||
public static IResultReceiver a(IBinder iBinder) {
|
||||
if (iBinder == null) {
|
||||
return null;
|
||||
}
|
||||
IInterface queryLocalInterface = iBinder.queryLocalInterface("android.support.v4.os.IResultReceiver");
|
||||
return (queryLocalInterface == null || !(queryLocalInterface instanceof IResultReceiver)) ? new Proxy(iBinder) : (IResultReceiver) queryLocalInterface;
|
||||
}
|
||||
|
||||
@Override // android.os.IInterface
|
||||
public IBinder asBinder() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.os.Binder
|
||||
public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
|
||||
if (i == 1) {
|
||||
parcel.enforceInterface("android.support.v4.os.IResultReceiver");
|
||||
a(parcel.readInt(), parcel.readInt() != 0 ? (Bundle) Bundle.CREATOR.createFromParcel(parcel) : null);
|
||||
return true;
|
||||
}
|
||||
if (i != 1598968902) {
|
||||
return super.onTransact(i, parcel, parcel2, i2);
|
||||
}
|
||||
parcel2.writeString("android.support.v4.os.IResultReceiver");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void a(int i, Bundle bundle) throws RemoteException;
|
||||
}
|
108
sources/android/support/v4/os/ResultReceiver.java
Normal file
108
sources/android/support/v4/os/ResultReceiver.java
Normal file
@@ -0,0 +1,108 @@
|
||||
package android.support.v4.os;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
import android.support.v4.os.IResultReceiver;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ResultReceiver implements Parcelable {
|
||||
public static final Parcelable.Creator<ResultReceiver> CREATOR = new Parcelable.Creator<ResultReceiver>() { // from class: android.support.v4.os.ResultReceiver.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public ResultReceiver createFromParcel(Parcel parcel) {
|
||||
return new ResultReceiver(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public ResultReceiver[] newArray(int i) {
|
||||
return new ResultReceiver[i];
|
||||
}
|
||||
};
|
||||
final Handler mHandler;
|
||||
final boolean mLocal;
|
||||
IResultReceiver mReceiver;
|
||||
|
||||
class MyResultReceiver extends IResultReceiver.Stub {
|
||||
MyResultReceiver() {
|
||||
}
|
||||
|
||||
@Override // android.support.v4.os.IResultReceiver
|
||||
public void a(int i, Bundle bundle) {
|
||||
ResultReceiver resultReceiver = ResultReceiver.this;
|
||||
Handler handler = resultReceiver.mHandler;
|
||||
if (handler != null) {
|
||||
handler.post(resultReceiver.new MyRunnable(i, bundle));
|
||||
} else {
|
||||
resultReceiver.onReceiveResult(i, bundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MyRunnable implements Runnable {
|
||||
final int a;
|
||||
final Bundle b;
|
||||
|
||||
MyRunnable(int i, Bundle bundle) {
|
||||
this.a = i;
|
||||
this.b = bundle;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ResultReceiver.this.onReceiveResult(this.a, this.b);
|
||||
}
|
||||
}
|
||||
|
||||
public ResultReceiver(Handler handler) {
|
||||
this.mLocal = true;
|
||||
this.mHandler = handler;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected void onReceiveResult(int i, Bundle bundle) {
|
||||
}
|
||||
|
||||
public void send(int i, Bundle bundle) {
|
||||
if (this.mLocal) {
|
||||
Handler handler = this.mHandler;
|
||||
if (handler != null) {
|
||||
handler.post(new MyRunnable(i, bundle));
|
||||
return;
|
||||
} else {
|
||||
onReceiveResult(i, bundle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
IResultReceiver iResultReceiver = this.mReceiver;
|
||||
if (iResultReceiver != null) {
|
||||
try {
|
||||
iResultReceiver.a(i, bundle);
|
||||
} catch (RemoteException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
synchronized (this) {
|
||||
if (this.mReceiver == null) {
|
||||
this.mReceiver = new MyResultReceiver();
|
||||
}
|
||||
parcel.writeStrongBinder(this.mReceiver.asBinder());
|
||||
}
|
||||
}
|
||||
|
||||
ResultReceiver(Parcel parcel) {
|
||||
this.mLocal = false;
|
||||
this.mHandler = null;
|
||||
this.mReceiver = IResultReceiver.Stub.a(parcel.readStrongBinder());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user