Wrap whole onTransact (#2740)
This commit is contained in:
parent
8d73414d2d
commit
134cd71fa0
|
|
@ -100,39 +100,43 @@ public class BridgeService {
|
||||||
public static boolean onTransact(@NonNull Parcel data, @Nullable Parcel reply, int flags) {
|
public static boolean onTransact(@NonNull Parcel data, @Nullable Parcel reply, int flags) {
|
||||||
if (!ParcelUtils.safeEnforceInterface(data, DESCRIPTOR)) return false;
|
if (!ParcelUtils.safeEnforceInterface(data, DESCRIPTOR)) return false;
|
||||||
|
|
||||||
ACTION action = ACTION.values()[data.readInt()];
|
try {
|
||||||
|
ACTION action = ACTION.values()[data.readInt()];
|
||||||
|
|
||||||
Log.d(TAG, "onTransact: action=" + action + ", callingUid=" + Binder.getCallingUid() + ", callingPid=" + Binder.getCallingPid());
|
Log.d(TAG, "onTransact: action=" + action + ", callingUid=" + Binder.getCallingUid() + ", callingPid=" + Binder.getCallingPid());
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case ACTION_SEND_BINDER: {
|
case ACTION_SEND_BINDER: {
|
||||||
if (Binder.getCallingUid() == 0) {
|
if (Binder.getCallingUid() == 0) {
|
||||||
receiveFromBridge(data.readStrongBinder());
|
receiveFromBridge(data.readStrongBinder());
|
||||||
if (reply != null) {
|
if (reply != null) {
|
||||||
reply.writeNoException();
|
reply.writeNoException();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
break;
|
||||||
|
}
|
||||||
|
case ACTION_GET_BINDER: {
|
||||||
|
IBinder binder = null;
|
||||||
|
try {
|
||||||
|
String processName = data.readString();
|
||||||
|
IBinder heartBeat = data.readStrongBinder();
|
||||||
|
var applicationService = service == null ? null : service.requestApplicationService(Binder.getCallingUid(), Binder.getCallingPid(), processName, heartBeat);
|
||||||
|
if (applicationService != null) binder = applicationService.asBinder();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, Log.getStackTraceString(e));
|
||||||
|
}
|
||||||
|
if (binder != null && reply != null) {
|
||||||
|
reply.writeNoException();
|
||||||
|
Log.d(TAG, "got binder is " + binder);
|
||||||
|
reply.writeStrongBinder(binder);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ACTION_GET_BINDER: {
|
|
||||||
IBinder binder = null;
|
|
||||||
try {
|
|
||||||
String processName = data.readString();
|
|
||||||
IBinder heartBeat = data.readStrongBinder();
|
|
||||||
var applicationService = service == null ? null : service.requestApplicationService(Binder.getCallingUid(), Binder.getCallingPid(), processName, heartBeat);
|
|
||||||
if (applicationService != null) binder = applicationService.asBinder();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(TAG, Log.getStackTraceString(e));
|
|
||||||
}
|
|
||||||
if (binder != null && reply != null) {
|
|
||||||
reply.writeNoException();
|
|
||||||
Log.d(TAG, "got binder is " + binder);
|
|
||||||
reply.writeStrongBinder(binder);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.e(TAG, "onTransact", e);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue