use of android.content.pm.ParceledListSlice in project android_frameworks_base by crdroidandroid.
the class PackageInstallerService method getMySessions.
@Override
public ParceledListSlice<SessionInfo> getMySessions(String installerPackageName, int userId) {
mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "getMySessions");
mAppOps.checkPackage(Binder.getCallingUid(), installerPackageName);
final List<SessionInfo> result = new ArrayList<>();
synchronized (mSessions) {
for (int i = 0; i < mSessions.size(); i++) {
final PackageInstallerSession session = mSessions.valueAt(i);
if (Objects.equals(session.installerPackageName, installerPackageName) && session.userId == userId) {
result.add(session.generateInfo());
}
}
}
return new ParceledListSlice<>(result);
}
use of android.content.pm.ParceledListSlice in project android_frameworks_base by crdroidandroid.
the class AppWidgetServiceImpl method getInstalledProvidersForProfile.
@Override
public ParceledListSlice<AppWidgetProviderInfo> getInstalledProvidersForProfile(int categoryFilter, int profileId) {
final int userId = UserHandle.getCallingUserId();
if (DEBUG) {
Slog.i(TAG, "getInstalledProvidersForProfiles() " + userId);
}
// Ensure the profile is in the group and enabled.
if (!mSecurityPolicy.isEnabledGroupProfile(profileId)) {
return null;
}
synchronized (mLock) {
ensureGroupStateLoadedLocked(userId);
ArrayList<AppWidgetProviderInfo> result = new ArrayList<AppWidgetProviderInfo>();
final int providerCount = mProviders.size();
for (int i = 0; i < providerCount; i++) {
Provider provider = mProviders.get(i);
AppWidgetProviderInfo info = provider.info;
// Ignore an invalid provider or one not matching the filter.
if (provider.zombie || (info.widgetCategory & categoryFilter) == 0) {
continue;
}
// Add providers only for the requested profile that are white-listed.
final int providerProfileId = info.getProfile().getIdentifier();
if (providerProfileId == profileId && mSecurityPolicy.isProviderInCallerOrInProfileAndWhitelListed(provider.id.componentName.getPackageName(), providerProfileId)) {
result.add(cloneIfLocalBinder(info));
}
}
return new ParceledListSlice<AppWidgetProviderInfo>(result);
}
}
use of android.content.pm.ParceledListSlice in project android_packages_apps_Settings by LineageOS.
the class ZenAccessSettings method getPackagesRequestingNotificationPolicyAccess.
private ArraySet<String> getPackagesRequestingNotificationPolicyAccess() {
ArraySet<String> requestingPackages = new ArraySet<>();
try {
final String[] PERM = { android.Manifest.permission.ACCESS_NOTIFICATION_POLICY };
final ParceledListSlice list = AppGlobals.getPackageManager().getPackagesHoldingPermissions(PERM, 0, /*flags*/
ActivityManager.getCurrentUser());
final List<PackageInfo> pkgs = list.getList();
if (pkgs != null) {
for (PackageInfo info : pkgs) {
requestingPackages.add(info.packageName);
}
}
} catch (RemoteException e) {
Log.e(TAG, "Cannot reach packagemanager", e);
}
return requestingPackages;
}
Aggregations