Search in sources :

Example 1 with EphemeralApplicationInfo

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);
    }
}
Also used : EphemeralApplicationInfo(android.content.pm.EphemeralApplicationInfo)

Example 2 with EphemeralApplicationInfo

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;
}
Also used : PackageParser(android.content.pm.PackageParser) EphemeralApplicationInfo(android.content.pm.EphemeralApplicationInfo)

Example 3 with EphemeralApplicationInfo

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;
}
Also used : PackageParser(android.content.pm.PackageParser) EphemeralApplicationInfo(android.content.pm.EphemeralApplicationInfo)

Example 4 with EphemeralApplicationInfo

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);
    }
}
Also used : EphemeralApplicationInfo(android.content.pm.EphemeralApplicationInfo)

Example 5 with EphemeralApplicationInfo

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);
}
Also used : PackageUserState(android.content.pm.PackageUserState) EphemeralApplicationInfo(android.content.pm.EphemeralApplicationInfo)

Aggregations

EphemeralApplicationInfo (android.content.pm.EphemeralApplicationInfo)20 PackageParser (android.content.pm.PackageParser)5 PackageUserState (android.content.pm.PackageUserState)5