[core] Fix notification when modules updated/installed (#370)

Co-authored-by: tehcneko <7764726+tehcneko@users.noreply.github.com>
This commit is contained in:
LoveSy 2021-03-18 09:24:34 +08:00 committed by GitHub
parent 7c1ea44479
commit 83786b6dea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import android.app.IActivityManager;
import android.app.IApplicationThread;
import android.content.IIntentReceiver;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
@ -63,7 +64,11 @@ public class ActivityManagerService {
int appOp, Bundle options, boolean serialized, boolean sticky, int userId) throws RemoteException {
IActivityManager am = getActivityManager();
if (am == null) return -1;
return am.broadcastIntentWithFeature(caller, callingFeatureId, intent, resolvedType, resultTo, resultCode, resultData, map, requiredPermissions, appOp, options, serialized, sticky, userId);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
return am.broadcastIntentWithFeature(caller, callingFeatureId, intent, resolvedType, resultTo, resultCode, resultData, map, requiredPermissions, appOp, options, serialized, sticky, userId);
} else {
return am.broadcastIntent(caller, intent, resolvedType, resultTo, resultCode, resultData, map, requiredPermissions, appOp, options, serialized, sticky, userId);
}
}
public static void forceStopPackage(String packageName, int userId) throws RemoteException {

View File

@ -19,6 +19,7 @@
package org.lsposed.lspd.service;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@ -31,7 +32,6 @@ import android.util.Log;
import java.util.Arrays;
import org.lsposed.lspd.Application;
import pxb.android.arsc.Config;
import static org.lsposed.lspd.service.ServiceManager.TAG;
@ -101,7 +101,7 @@ public class LSPosedService extends ILSPosedService.Stub {
broadcastIntent.addFlags(0x01000000);
broadcastIntent.addFlags(0x00400000);
broadcastIntent.setData(intent.getData());
broadcastIntent.setPackage(ConfigManager.getInstance().getManagerPackageName());
broadcastIntent.setComponent(ComponentName.unflattenFromString(ConfigManager.getInstance().getManagerPackageName() + "/.receivers.ServiceReceiver"));
try {
ActivityManagerService.broadcastIntentWithFeature(null, null, broadcastIntent,

View File

@ -25,12 +25,21 @@ import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IInterface;
import android.os.RemoteException;
import androidx.annotation.RequiresApi;
public interface IActivityManager extends IInterface {
@RequiresApi(30)
int broadcastIntentWithFeature(IApplicationThread caller, String callingFeatureId,
Intent intent, String resolvedType, IIntentReceiver resultTo, int resultCode,
String resultData, Bundle map, String[] requiredPermissions,
int appOp, Bundle options, boolean serialized, boolean sticky, int userId);
int appOp, Bundle options, boolean serialized, boolean sticky, int userId) throws RemoteException;
int broadcastIntent(IApplicationThread caller, Intent intent,
String resolvedType, IIntentReceiver resultTo, int resultCode,
String resultData, Bundle map, String[] requiredPermissions,
int appOp, Bundle options, boolean serialized, boolean sticky, int userId) throws RemoteException;
void forceStopPackage(String packageName, int userId);