Search in sources :

Example 16 with EphemeralApplicationInfo

use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by AOSPA.

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

Example 17 with EphemeralApplicationInfo

use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by AOSPA.

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 18 with EphemeralApplicationInfo

use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by ResurrectionRemix.

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)

Example 19 with EphemeralApplicationInfo

use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by ResurrectionRemix.

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

Example 20 with EphemeralApplicationInfo

use of android.content.pm.EphemeralApplicationInfo in project android_frameworks_base by crdroidandroid.

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)

Aggregations

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