parent
4ad1d95915
commit
106aea6da8
|
|
@ -98,6 +98,11 @@ public class ActivityManagerService {
|
||||||
String requiredPermission, int userId, int flags) throws RemoteException {
|
String requiredPermission, int userId, int flags) throws RemoteException {
|
||||||
IActivityManager am = getActivityManager();
|
IActivityManager am = getActivityManager();
|
||||||
if (am == null || thread == null) return null;
|
if (am == null || thread == null) return null;
|
||||||
|
try {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S || (Build.VERSION.SDK_INT == Build.VERSION_CODES.R && Build.VERSION.PREVIEW_SDK_INT != 0))
|
||||||
|
return am.registerReceiverWithFeature(thread, callerPackage, callingFeatureId, "null", receiver, filter, requiredPermission, userId, flags);
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
return am.registerReceiverWithFeature(thread, callerPackage, callingFeatureId, receiver, filter, requiredPermission, userId, flags);
|
return am.registerReceiverWithFeature(thread, callerPackage, callingFeatureId, receiver, filter, requiredPermission, userId, flags);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -299,13 +299,17 @@ public class PackageService {
|
||||||
|
|
||||||
// Install manager
|
// Install manager
|
||||||
IPackageInstaller installerService = pm.getPackageInstaller();
|
IPackageInstaller installerService = pm.getPackageInstaller();
|
||||||
PackageInstaller installer;
|
PackageInstaller installer = null;
|
||||||
// S Preview
|
// S Preview
|
||||||
if (Build.VERSION.SDK_INT > 30 || Build.VERSION.SDK_INT == 30 && Build.VERSION.PREVIEW_SDK_INT != 0) {
|
if (Build.VERSION.SDK_INT > 30 || Build.VERSION.SDK_INT == 30 && Build.VERSION.PREVIEW_SDK_INT != 0) {
|
||||||
Constructor<PackageInstaller> installerConstructor = PackageInstaller.class.getConstructor(IPackageInstaller.class, String.class, String.class, int.class);
|
try {
|
||||||
installerConstructor.setAccessible(true);
|
Constructor<PackageInstaller> installerConstructor = PackageInstaller.class.getConstructor(IPackageInstaller.class, String.class, String.class, int.class);
|
||||||
installer = installerConstructor.newInstance(installerService, null, null, 0);
|
installerConstructor.setAccessible(true);
|
||||||
} else {
|
installer = installerConstructor.newInstance(installerService, null, null, 0);
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (installer == null) {
|
||||||
Constructor<PackageInstaller> installerConstructor = PackageInstaller.class.getConstructor(IPackageInstaller.class, String.class, int.class);
|
Constructor<PackageInstaller> installerConstructor = PackageInstaller.class.getConstructor(IPackageInstaller.class, String.class, int.class);
|
||||||
installerConstructor.setAccessible(true);
|
installerConstructor.setAccessible(true);
|
||||||
installer = installerConstructor.newInstance(installerService, null, 0);
|
installer = installerConstructor.newInstance(installerService, null, 0);
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,11 @@ public interface IActivityManager extends IInterface {
|
||||||
String callingFeatureId, IIntentReceiver receiver, IntentFilter filter,
|
String callingFeatureId, IIntentReceiver receiver, IntentFilter filter,
|
||||||
String requiredPermission, int userId, int flags) throws RemoteException;
|
String requiredPermission, int userId, int flags) throws RemoteException;
|
||||||
|
|
||||||
|
@RequiresApi(31)
|
||||||
|
Intent registerReceiverWithFeature(IApplicationThread caller, String callerPackage, String callingFeatureId,
|
||||||
|
String receiverId, IIntentReceiver receiver, IntentFilter filter,
|
||||||
|
String requiredPermission, int userId, int flags) throws RemoteException;
|
||||||
|
|
||||||
int bindService(IApplicationThread caller, IBinder token, Intent service,
|
int bindService(IApplicationThread caller, IBinder token, 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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue