use of android.content.pm.EphemeralApplicationInfo in project platform_frameworks_base by android.
the class EphemeralApplicationRegistry method propagateEphemeralAppPermissionsIfNeeded.
private void propagateEphemeralAppPermissionsIfNeeded(PackageParser.Package pkg, int userId) {
EphemeralApplicationInfo appInfo = getOrParseUninstalledEphemeralAppInfo(pkg.packageName, userId);
if (appInfo == null) {
return;
}
if (ArrayUtils.isEmpty(appInfo.getGrantedPermissions())) {
return;
}
final long identity = Binder.clearCallingIdentity();
try {
for (String grantedPermission : appInfo.getGrantedPermissions()) {
mService.grantRuntimePermission(pkg.packageName, grantedPermission, userId);
}
} finally {
Binder.restoreCallingIdentity(identity);
}
}
use of android.content.pm.EphemeralApplicationInfo in project platform_frameworks_base by android.
the class EphemeralApplicationRegistry method getInstalledEphemeralApplicationsLPr.
private List<EphemeralApplicationInfo> getInstalledEphemeralApplicationsLPr(int userId) {
List<EphemeralApplicationInfo> result = null;
final int packageCount = mService.mPackages.size();
for (int i = 0; i < packageCount; i++) {
PackageParser.Package pkg = mService.mPackages.valueAt(i);
if (!pkg.applicationInfo.isEphemeralApp()) {
continue;
}
EphemeralApplicationInfo info = createEphemeralAppInfoForPackage(pkg, userId);
if (info == null) {
continue;
}
if (result == null) {
result = new ArrayList<>();
}
result.add(info);
}
return result;
}
use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by ResurrectionRemix.
the class EphemeralApplicationRegistry method getInstalledEphemeralApplicationsLPr.
private List<EphemeralApplicationInfo> getInstalledEphemeralApplicationsLPr(int userId) {
List<EphemeralApplicationInfo> result = null;
final int packageCount = mService.mPackages.size();
for (int i = 0; i < packageCount; i++) {
PackageParser.Package pkg = mService.mPackages.valueAt(i);
if (!pkg.applicationInfo.isEphemeralApp()) {
continue;
}
EphemeralApplicationInfo info = createEphemeralAppInfoForPackage(pkg, userId);
if (info == null) {
continue;
}
if (result == null) {
result = new ArrayList<>();
}
result.add(info);
}
return result;
}
use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by ResurrectionRemix.
the class EphemeralApplicationRegistry method propagateEphemeralAppPermissionsIfNeeded.
private void propagateEphemeralAppPermissionsIfNeeded(PackageParser.Package pkg, int userId) {
EphemeralApplicationInfo appInfo = getOrParseUninstalledEphemeralAppInfo(pkg.packageName, userId);
if (appInfo == null) {
return;
}
if (ArrayUtils.isEmpty(appInfo.getGrantedPermissions())) {
return;
}
final long identity = Binder.clearCallingIdentity();
try {
for (String grantedPermission : appInfo.getGrantedPermissions()) {
mService.grantRuntimePermission(pkg.packageName, grantedPermission, userId);
}
} finally {
Binder.restoreCallingIdentity(identity);
}
}
use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by AOSPA.
the class EphemeralApplicationRegistry method createEphemeralAppInfoForPackage.
private EphemeralApplicationInfo createEphemeralAppInfoForPackage(PackageParser.Package pkg, int userId) {
PackageSetting ps = (PackageSetting) pkg.mExtras;
if (ps == null) {
return null;
}
PackageUserState userState = ps.readUserState(userId);
if (userState == null || !userState.installed || userState.hidden) {
return null;
}
String[] requestedPermissions = new String[pkg.requestedPermissions.size()];
pkg.requestedPermissions.toArray(requestedPermissions);
Set<String> permissions = ps.getPermissionsState().getPermissions(userId);
String[] grantedPermissions = new String[permissions.size()];
permissions.toArray(grantedPermissions);
return new EphemeralApplicationInfo(pkg.applicationInfo, requestedPermissions, grantedPermissions);
}
Aggregations