[core] Fix broadcast on Android 12 (#1456)
This commit is contained in:
parent
cc19aa42c1
commit
ed4d230821
|
|
@ -78,7 +78,11 @@ 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.R) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
return am.broadcastIntentWithFeature(thread, callingFeatureId, intent, resolvedType, resultTo,
|
||||
resultCode, resultData, null, requiredPermissions, null, appOp, null,
|
||||
serialized, sticky, userId);
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
return am.broadcastIntentWithFeature(thread, callingFeatureId, intent, resolvedType, resultTo, resultCode, resultData, map, requiredPermissions, appOp, options, serialized, sticky, userId);
|
||||
} else {
|
||||
return am.broadcastIntent(thread, intent, resolvedType, resultTo, resultCode, resultData, map, requiredPermissions, appOp, options, serialized, sticky, userId);
|
||||
|
|
|
|||
|
|
@ -719,12 +719,13 @@ public class ConfigManager {
|
|||
self.packageName = packageName;
|
||||
self.userId = 0;
|
||||
scopes.add(self);
|
||||
int finalMid = mid;
|
||||
executeInTransaction(() -> {
|
||||
db.delete("scope", "mid = ?", new String[]{String.valueOf(mid)});
|
||||
db.delete("scope", "mid = ?", new String[]{String.valueOf(finalMid)});
|
||||
for (Application app : scopes) {
|
||||
if (app.packageName.equals("android") && app.userId != 0) continue;
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("mid", mid);
|
||||
values.put("mid", finalMid);
|
||||
values.put("app_pkg_name", app.packageName);
|
||||
values.put("user_id", app.userId);
|
||||
db.insertWithOnConflict("scope", null, values, SQLiteDatabase.CONFLICT_IGNORE);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,13 @@ import android.os.RemoteException;
|
|||
import androidx.annotation.RequiresApi;
|
||||
|
||||
public interface IActivityManager extends IInterface {
|
||||
@RequiresApi(31)
|
||||
int broadcastIntentWithFeature(IApplicationThread caller, String callingFeatureId,
|
||||
Intent intent, String resolvedType, IIntentReceiver resultTo,
|
||||
int resultCode, String resultData, Bundle resultExtras,
|
||||
String[] requiredPermissions, String[] excludedPermissions, int appOp, Bundle bOptions,
|
||||
boolean serialized, boolean sticky, int userId) throws RemoteException;
|
||||
|
||||
@RequiresApi(30)
|
||||
int broadcastIntentWithFeature(IApplicationThread caller, String callingFeatureId,
|
||||
Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode,
|
||||
|
|
|
|||
Loading…
Reference in New Issue