Support Android 13 DP1 (#1666)
This commit is contained in:
parent
89713ce3cb
commit
b0d1e7a2bb
|
|
@ -10,7 +10,7 @@ A Riru module trying to provide an ART hooking framework which delivers consiste
|
|||
|
||||
## Supported Versions
|
||||
|
||||
Android 8.1 ~ 12, 12L Beta2
|
||||
Android 8.1 ~ 12, 12L Beta3, 13 DP1
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
|||
|
|
@ -3,5 +3,5 @@ name=${api} - LSPosed
|
|||
version=${versionName} (${versionCode})
|
||||
versionCode=${versionCode}
|
||||
author=${authorList}
|
||||
description=Another enhanced implementation of Xposed Framework. Supports Android 8.1 ~ 12, 12L Beta2. ${requirement}.
|
||||
description=Another enhanced implementation of Xposed Framework. Supports Android 8.1 ~ 12, 12L Beta3, 13 DP1. ${requirement}.
|
||||
updateJson=${updateJson}
|
||||
|
|
|
|||
|
|
@ -107,6 +107,9 @@ public class PackageService {
|
|||
public static PackageInfo getPackageInfo(String packageName, int flags, int userId) throws RemoteException {
|
||||
IPackageManager pm = getPackageManager();
|
||||
if (pm == null) return null;
|
||||
if (Build.VERSION.SDK_INT + Build.VERSION.PREVIEW_SDK_INT > Build.VERSION_CODES.S) {
|
||||
return pm.getPackageInfo(packageName, (long) flags, userId);
|
||||
}
|
||||
return pm.getPackageInfo(packageName, flags, userId);
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +119,7 @@ public class PackageService {
|
|||
Map<Integer, PackageInfo> res = new HashMap<>();
|
||||
if (pm == null) return res;
|
||||
for (var user : UserService.getUsers()) {
|
||||
var info = pm.getPackageInfo(packageName, flags, user.id);
|
||||
var info = getPackageInfo(packageName, flags, user.id);
|
||||
if (info != null && info.applicationInfo != null) res.put(user.id, info);
|
||||
}
|
||||
return res;
|
||||
|
|
@ -125,6 +128,9 @@ public class PackageService {
|
|||
public static ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) throws RemoteException {
|
||||
IPackageManager pm = getPackageManager();
|
||||
if (pm == null) return null;
|
||||
if (Build.VERSION.SDK_INT + Build.VERSION.PREVIEW_SDK_INT > Build.VERSION_CODES.S) {
|
||||
return pm.getApplicationInfo(packageName, (long) flags, userId);
|
||||
}
|
||||
return pm.getApplicationInfo(packageName, flags, userId);
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +141,8 @@ public class PackageService {
|
|||
if (pm == null) return ParceledListSlice.emptyList();
|
||||
for (var user : UserService.getUsers()) {
|
||||
// in case pkginfo of other users in primary user
|
||||
res.addAll(pm.getInstalledPackages(flags, user.id).getList().parallelStream()
|
||||
res.addAll((Build.VERSION.SDK_INT + Build.VERSION.PREVIEW_SDK_INT > Build.VERSION_CODES.S ? pm.getInstalledPackages((long) flags, user.id) : pm.getInstalledPackages(flags, user.id))
|
||||
.getList().parallelStream()
|
||||
.filter(info -> info.applicationInfo != null && info.applicationInfo.uid / PER_USER_RANGE == user.id)
|
||||
.filter(info -> {
|
||||
try {
|
||||
|
|
@ -196,27 +203,27 @@ public class PackageService {
|
|||
if (pm == null) return null;
|
||||
PackageInfo pkgInfo;
|
||||
try {
|
||||
pkgInfo = pm.getPackageInfo(packageName, flags | PackageManager.GET_ACTIVITIES | PackageManager.GET_SERVICES | PackageManager.GET_RECEIVERS | PackageManager.GET_PROVIDERS, userId);
|
||||
pkgInfo = getPackageInfo(packageName, flags | PackageManager.GET_ACTIVITIES | PackageManager.GET_SERVICES | PackageManager.GET_RECEIVERS | PackageManager.GET_PROVIDERS, userId);
|
||||
} catch (Exception e) {
|
||||
pkgInfo = pm.getPackageInfo(packageName, flags, userId);
|
||||
pkgInfo = getPackageInfo(packageName, flags, userId);
|
||||
if (pkgInfo == null) return null;
|
||||
try {
|
||||
pkgInfo.activities = pm.getPackageInfo(packageName, flags | PackageManager.GET_ACTIVITIES, userId).activities;
|
||||
pkgInfo.activities = getPackageInfo(packageName, flags | PackageManager.GET_ACTIVITIES, userId).activities;
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
try {
|
||||
pkgInfo.services = pm.getPackageInfo(packageName, flags | PackageManager.GET_SERVICES, userId).services;
|
||||
pkgInfo.services = getPackageInfo(packageName, flags | PackageManager.GET_SERVICES, userId).services;
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
try {
|
||||
pkgInfo.receivers = pm.getPackageInfo(packageName, flags | PackageManager.GET_RECEIVERS, userId).receivers;
|
||||
pkgInfo.receivers = getPackageInfo(packageName, flags | PackageManager.GET_RECEIVERS, userId).receivers;
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
try {
|
||||
pkgInfo.providers = pm.getPackageInfo(packageName, flags | PackageManager.GET_PROVIDERS, userId).providers;
|
||||
pkgInfo.providers = getPackageInfo(packageName, flags | PackageManager.GET_PROVIDERS, userId).providers;
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
|
|
@ -279,7 +286,7 @@ public class PackageService {
|
|||
public static ParceledListSlice<ResolveInfo> queryIntentActivities(Intent intent, String resolvedType, int flags, int userId) throws RemoteException {
|
||||
IPackageManager pm = getPackageManager();
|
||||
if (pm == null) return null;
|
||||
return new ParceledListSlice<>(pm.queryIntentActivities(intent, resolvedType, flags, userId).getList());
|
||||
return new ParceledListSlice<>((Build.VERSION.SDK_INT + Build.VERSION.PREVIEW_SDK_INT > Build.VERSION_CODES.S ? pm.queryIntentActivities(intent, resolvedType, (long) flags, userId) : pm.queryIntentActivities(intent, resolvedType, flags, userId)).getList());
|
||||
}
|
||||
|
||||
public static Intent getLaunchIntentForPackage(String packageName) throws RemoteException {
|
||||
|
|
|
|||
|
|
@ -19,20 +19,39 @@ public interface IPackageManager extends IInterface {
|
|||
ApplicationInfo getApplicationInfo(String packageName, int flags, int userId)
|
||||
throws RemoteException;
|
||||
|
||||
@RequiresApi(33)
|
||||
ApplicationInfo getApplicationInfo(String packageName, long flags, int userId)
|
||||
throws RemoteException;
|
||||
|
||||
PackageInfo getPackageInfo(String packageName, int flags, int userId)
|
||||
throws RemoteException;
|
||||
|
||||
@RequiresApi(33)
|
||||
PackageInfo getPackageInfo(String packageName, long flags, int userId)
|
||||
throws RemoteException;
|
||||
|
||||
int getPackageUid(String packageName, int flags, int userId) throws RemoteException;
|
||||
|
||||
@RequiresApi(33)
|
||||
int getPackageUid(String packageName, long flags, int userId) throws RemoteException;
|
||||
|
||||
String[] getPackagesForUid(int uid)
|
||||
throws RemoteException;
|
||||
|
||||
ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId)
|
||||
throws RemoteException;
|
||||
|
||||
@RequiresApi(33)
|
||||
ParceledListSlice<PackageInfo> getInstalledPackages(long flags, int userId)
|
||||
throws RemoteException;
|
||||
|
||||
ParceledListSlice<ApplicationInfo> getInstalledApplications(int flags, int userId)
|
||||
throws RemoteException;
|
||||
|
||||
@RequiresApi(33)
|
||||
ParceledListSlice<ApplicationInfo> getInstalledApplications(long flags, int userId)
|
||||
throws RemoteException;
|
||||
|
||||
int getUidForSharedUser(String sharedUserName)
|
||||
throws RemoteException;
|
||||
|
||||
|
|
@ -64,7 +83,11 @@ public interface IPackageManager extends IInterface {
|
|||
int installReason, List<String> whiteListedPermissions) throws RemoteException;
|
||||
|
||||
ParceledListSlice<ResolveInfo> queryIntentActivities(Intent intent,
|
||||
String resolvedType, int flags, int userId) throws RemoteException;
|
||||
String resolvedType, int flags, int userId) throws RemoteException;
|
||||
|
||||
@RequiresApi(33)
|
||||
ParceledListSlice<ResolveInfo> queryIntentActivities(Intent intent,
|
||||
String resolvedType, long flags, int userId) throws RemoteException;
|
||||
|
||||
boolean performDexOptMode(String packageName, boolean checkProfiles,
|
||||
String targetCompilerFilter, boolean force, boolean bootComplete, String splitName)
|
||||
|
|
|
|||
Loading…
Reference in New Issue