Replace ParceledListSlice with ParcelableListSlice (#1936)
This commit is contained in:
parent
2f0de5b7f3
commit
b392f331c8
|
|
@ -37,6 +37,7 @@ import android.content.Intent;
|
|||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ParceledListSlice;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.content.pm.ShortcutManager;
|
||||
|
|
@ -82,7 +83,7 @@ import java.util.UUID;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import hidden.HiddenApiBridge;
|
||||
import io.github.xposed.xposedservice.utils.ParceledListSlice;
|
||||
import rikka.parcelablelist.ParcelableListSlice;
|
||||
|
||||
public class LSPManagerService extends ILSPManagerService.Stub {
|
||||
// this maybe useful when obtaining the manager binder
|
||||
|
|
@ -293,7 +294,7 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
|||
final NotificationChannel channel =
|
||||
new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, CHANNEL_IMP);
|
||||
im.createNotificationChannels("android",
|
||||
new android.content.pm.ParceledListSlice<>(Collections.singletonList(channel)));
|
||||
new ParceledListSlice<>(Collections.singletonList(channel)));
|
||||
im.enqueueNotificationWithTag("android", "android", modulePackageName,
|
||||
pushAndGetNotificationId(modulePackageName, moduleUserId),
|
||||
notification, 0);
|
||||
|
|
@ -586,7 +587,7 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ParceledListSlice<PackageInfo> getInstalledPackagesFromAllUsers(int flags, boolean filterNoProcess) throws RemoteException {
|
||||
public ParcelableListSlice<PackageInfo> getInstalledPackagesFromAllUsers(int flags, boolean filterNoProcess) throws RemoteException {
|
||||
return PackageService.getInstalledPackagesFromAllUsers(flags, filterNoProcess);
|
||||
}
|
||||
|
||||
|
|
@ -735,7 +736,7 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ParceledListSlice<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId) throws RemoteException {
|
||||
public ParcelableListSlice<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId) throws RemoteException {
|
||||
return PackageService.queryIntentActivities(intent, intent.getType(), flags, userId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ import java.util.Set;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.github.xposed.xposedservice.utils.ParceledListSlice;
|
||||
import rikka.parcelablelist.ParcelableListSlice;
|
||||
|
||||
public class PackageService {
|
||||
|
||||
|
|
@ -135,10 +135,10 @@ public class PackageService {
|
|||
}
|
||||
|
||||
// Only for manager
|
||||
public static ParceledListSlice<PackageInfo> getInstalledPackagesFromAllUsers(int flags, boolean filterNoProcess) throws RemoteException {
|
||||
public static ParcelableListSlice<PackageInfo> getInstalledPackagesFromAllUsers(int flags, boolean filterNoProcess) throws RemoteException {
|
||||
List<PackageInfo> res = new ArrayList<>();
|
||||
IPackageManager pm = getPackageManager();
|
||||
if (pm == null) return ParceledListSlice.emptyList();
|
||||
if (pm == null) return ParcelableListSlice.emptyList();
|
||||
for (var user : UserService.getUsers()) {
|
||||
// in case pkginfo of other users in primary user
|
||||
res.addAll((Build.VERSION.SDK_INT + Build.VERSION.PREVIEW_SDK_INT > Build.VERSION_CODES.S_V2 ? pm.getInstalledPackages((long) flags, user.id) : pm.getInstalledPackages(flags, user.id))
|
||||
|
|
@ -154,7 +154,7 @@ public class PackageService {
|
|||
.collect(Collectors.toList()));
|
||||
}
|
||||
if (filterNoProcess) {
|
||||
return new ParceledListSlice<>(res.parallelStream().filter(packageInfo -> {
|
||||
return new ParcelableListSlice<>(res.parallelStream().filter(packageInfo -> {
|
||||
try {
|
||||
PackageInfo pkgInfo = getPackageInfoWithComponents(packageInfo.packageName, MATCH_ALL_FLAGS, packageInfo.applicationInfo.uid / PER_USER_RANGE);
|
||||
return !fetchProcesses(pkgInfo).isEmpty();
|
||||
|
|
@ -164,7 +164,7 @@ public class PackageService {
|
|||
}
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
return new ParceledListSlice<>(res);
|
||||
return new ParcelableListSlice<>(res);
|
||||
}
|
||||
|
||||
private static Set<String> fetchProcesses(PackageInfo pkgInfo) {
|
||||
|
|
@ -283,17 +283,17 @@ public class PackageService {
|
|||
}
|
||||
}
|
||||
|
||||
public static ParceledListSlice<ResolveInfo> queryIntentActivities(Intent intent, String resolvedType, int flags, int userId) throws RemoteException {
|
||||
public static ParcelableListSlice<ResolveInfo> queryIntentActivities(Intent intent, String resolvedType, int flags, int userId) throws RemoteException {
|
||||
IPackageManager pm = getPackageManager();
|
||||
if (pm == null) return null;
|
||||
return new ParceledListSlice<>((Build.VERSION.SDK_INT + Build.VERSION.PREVIEW_SDK_INT > Build.VERSION_CODES.S_V2 ? pm.queryIntentActivities(intent, resolvedType, (long) flags, userId) : pm.queryIntentActivities(intent, resolvedType, flags, userId)).getList());
|
||||
return new ParcelableListSlice<>((Build.VERSION.SDK_INT + Build.VERSION.PREVIEW_SDK_INT > Build.VERSION_CODES.S_V2 ? pm.queryIntentActivities(intent, resolvedType, (long) flags, userId) : pm.queryIntentActivities(intent, resolvedType, flags, userId)).getList());
|
||||
}
|
||||
|
||||
public static Intent getLaunchIntentForPackage(String packageName) throws RemoteException {
|
||||
Intent intentToResolve = new Intent(Intent.ACTION_MAIN);
|
||||
intentToResolve.addCategory(Intent.CATEGORY_INFO);
|
||||
intentToResolve.setPackage(packageName);
|
||||
ParceledListSlice<ResolveInfo> ris = queryIntentActivities(intentToResolve, intentToResolve.getType(), 0, 0);
|
||||
var ris = queryIntentActivities(intentToResolve, intentToResolve.getType(), 0, 0);
|
||||
|
||||
// Otherwise, try to find a main launcher activity.
|
||||
if (ris == null || ris.getList().size() <= 0) {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 96930161f918d08a689076f500f128522a237a75
|
||||
Subproject commit ae963e444fcdf1ad45f662e0c706568f34506528
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit d3cd9313644499c181212dd66602f6ab2aa75ab6
|
||||
Subproject commit 5867b673803e255c4f0c75b9055fe7da3209e2ae
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package org.lsposed.lspd;
|
||||
|
||||
import io.github.xposed.xposedservice.utils.ParceledListSlice;
|
||||
import rikka.parcelablelist.ParcelableListSlice;
|
||||
import org.lsposed.lspd.models.UserInfo;
|
||||
import org.lsposed.lspd.models.Application;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ interface ILSPManagerService {
|
|||
|
||||
String getApi() = 1;
|
||||
|
||||
ParceledListSlice<PackageInfo> getInstalledPackagesFromAllUsers(int flags, boolean filterNoProcess) = 2;
|
||||
ParcelableListSlice<PackageInfo> getInstalledPackagesFromAllUsers(int flags, boolean filterNoProcess) = 2;
|
||||
|
||||
String[] enabledModules() = 3;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ interface ILSPManagerService {
|
|||
|
||||
int startActivityAsUserWithFeature(in Intent intent, int userId) = 30;
|
||||
|
||||
ParceledListSlice<ResolveInfo> queryIntentActivitiesAsUser(in Intent intent, int flags, int userId) = 31;
|
||||
ParcelableListSlice<ResolveInfo> queryIntentActivitiesAsUser(in Intent intent, int flags, int userId) = 31;
|
||||
|
||||
boolean dex2oatFlagsLoaded() = 32;
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ac9744ab71bc899c7954239fadbad605521c4b0c
|
||||
Subproject commit 4eea6d5794e046aeae4e57022c6cc1f7201559d5
|
||||
Loading…
Reference in New Issue