use of android.content.pm.EphemeralApplicationInfo in project platform_frameworks_base by android.
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);
}
use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by DirtyUnicorns.
the class EphemeralApplicationRegistry method addUninstalledEphemeralAppLPw.
private void addUninstalledEphemeralAppLPw(PackageParser.Package pkg, int userId) {
EphemeralApplicationInfo uninstalledApp = createEphemeralAppInfoForPackage(pkg, userId);
if (uninstalledApp == null) {
return;
}
if (mUninstalledEphemeralApps == null) {
mUninstalledEphemeralApps = new SparseArray<>();
}
List<UninstalledEphemeralAppState> uninstalledAppStates = mUninstalledEphemeralApps.get(userId);
if (uninstalledAppStates == null) {
uninstalledAppStates = new ArrayList<>();
mUninstalledEphemeralApps.put(userId, uninstalledAppStates);
}
UninstalledEphemeralAppState uninstalledAppState = new UninstalledEphemeralAppState(uninstalledApp, System.currentTimeMillis());
uninstalledAppStates.add(uninstalledAppState);
writeUninstalledEphemeralAppMetadata(uninstalledApp, userId);
writeEphemeralApplicationIconLPw(pkg, userId);
}
use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by DirtyUnicorns.
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);
}
use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by DirtyUnicorns.
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 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);
}
}
Aggregations