[core] Unblock receiver by calling finish receiver (#685)
This commit is contained in:
parent
18c7f60171
commit
7e6c230494
|
|
@ -110,6 +110,13 @@ public class ActivityManagerService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
|
||||||
|
boolean abortBroadcast, int flags) throws RemoteException {
|
||||||
|
IActivityManager am = getActivityManager();
|
||||||
|
if (am == null || thread == null) return;
|
||||||
|
am.finishReceiver(who, resultCode, resultData, map, abortBroadcast, flags);
|
||||||
|
}
|
||||||
|
|
||||||
public static int bindService(Intent service,
|
public static int bindService(Intent service,
|
||||||
String resolvedType, IServiceConnection connection, int flags,
|
String resolvedType, IServiceConnection connection, int flags,
|
||||||
String callingPackage, int userId) throws RemoteException {
|
String callingPackage, int userId) throws RemoteException {
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,11 @@ public class LSPosedService extends ILSPosedService.Stub {
|
||||||
@Override
|
@Override
|
||||||
public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) {
|
public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) {
|
||||||
new Thread(() -> dispatchPackageChanged(intent)).start();
|
new Thread(() -> dispatchPackageChanged(intent)).start();
|
||||||
|
try {
|
||||||
|
ActivityManagerService.finishReceiver(this, resultCode, data, extras, false, intent.getFlags());
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.e(TAG, "finish receiver", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -205,6 +210,11 @@ public class LSPosedService extends ILSPosedService.Stub {
|
||||||
@Override
|
@Override
|
||||||
public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) {
|
public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered, boolean sticky, int sendingUser) {
|
||||||
new Thread(() -> dispatchBootCompleted(intent)).start();
|
new Thread(() -> dispatchBootCompleted(intent)).start();
|
||||||
|
try {
|
||||||
|
ActivityManagerService.finishReceiver(this, resultCode, data, extras, false, intent.getFlags());
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.e(TAG, "finish receiver", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, intentFilter, null, 0, 0);
|
}, intentFilter, null, 0, 0);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,10 @@ public interface IActivityManager extends IInterface {
|
||||||
|
|
||||||
Intent registerReceiver(IApplicationThread caller, String callerPackage,
|
Intent registerReceiver(IApplicationThread caller, String callerPackage,
|
||||||
IIntentReceiver receiver, IntentFilter filter,
|
IIntentReceiver receiver, IntentFilter filter,
|
||||||
String requiredPermission, int userId, int flags);
|
String requiredPermission, int userId, int flags) throws RemoteException;
|
||||||
|
|
||||||
|
void finishReceiver(IBinder who, int resultCode, String resultData, Bundle map,
|
||||||
|
boolean abortBroadcast, int flags) throws RemoteException;
|
||||||
|
|
||||||
@RequiresApi(30)
|
@RequiresApi(30)
|
||||||
Intent registerReceiverWithFeature(IApplicationThread caller, String callerPackage,
|
Intent registerReceiverWithFeature(IApplicationThread caller, String callerPackage,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue