Fix broadcast on SDK 32 (#2065)

This commit is contained in:
LoveSy 2022-08-08 21:45:58 +08:00 committed by GitHub
parent 5b00618822
commit 1b3b838760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -79,6 +79,14 @@ public class ActivityManagerService {
int appOp, Bundle options, boolean serialized, boolean sticky, int userId) throws RemoteException {
IActivityManager am = getActivityManager();
if (am == null || thread == null) return -1;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S_V2) {
try {
return am.broadcastIntentWithFeature(thread, callingFeatureId, intent, resolvedType, resultTo,
resultCode, resultData, null, requiredPermissions, null, null, appOp, null,
serialized, sticky, userId);
} catch (NoSuchMethodError ignored) {
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return am.broadcastIntentWithFeature(thread, callingFeatureId, intent, resolvedType, resultTo,
resultCode, resultData, null, requiredPermissions, null, appOp, null,

View File

@ -33,6 +33,13 @@ import android.os.RemoteException;
import androidx.annotation.RequiresApi;
public interface IActivityManager extends IInterface {
@RequiresApi(32)
int broadcastIntentWithFeature(IApplicationThread caller, String callingFeatureId,
Intent intent, String resolvedType, IIntentReceiver resultTo,
int resultCode, String resultData, Bundle resultExtras,
String[] requiredPermissions, String[] excludedPermissions,
String[] excludePackages, int appOp, Bundle bOptions,
boolean serialized, boolean sticky, int userId) throws RemoteException;
@RequiresApi(31)
int broadcastIntentWithFeature(IApplicationThread caller, String callingFeatureId,
Intent intent, String resolvedType, IIntentReceiver resultTo,