Search in sources :

Example 31 with PackageUserState

use of android.content.pm.PackageUserState in project android_frameworks_base by ParanoidAndroid.

the class PackageSettingBase method restoreComponentLPw.

boolean restoreComponentLPw(String componentClassName, int userId) {
    PackageUserState state = modifyUserStateComponents(userId, true, true);
    boolean changed = state.disabledComponents != null ? state.disabledComponents.remove(componentClassName) : false;
    changed |= state.enabledComponents != null ? state.enabledComponents.remove(componentClassName) : false;
    return changed;
}
Also used : PackageUserState(android.content.pm.PackageUserState)

Example 32 with PackageUserState

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

Example 33 with PackageUserState

use of android.content.pm.PackageUserState in project platform_frameworks_base by android.

the class PackageManagerService method generatePackageInfo.

private PackageInfo generatePackageInfo(PackageSetting ps, int flags, int userId) {
    if (!sUserManager.exists(userId))
        return null;
    if (ps == null) {
        return null;
    }
    final PackageParser.Package p = ps.pkg;
    if (p == null) {
        return null;
    }
    final PermissionsState permissionsState = ps.getPermissionsState();
    // Compute GIDs only if requested
    final int[] gids = (flags & PackageManager.GET_GIDS) == 0 ? EMPTY_INT_ARRAY : permissionsState.computeGids(userId);
    // Compute granted permissions only if package has requested permissions
    final Set<String> permissions = ArrayUtils.isEmpty(p.requestedPermissions) ? Collections.<String>emptySet() : permissionsState.getPermissions(userId);
    final PackageUserState state = ps.readUserState(userId);
    return PackageParser.generatePackageInfo(p, gids, flags, ps.firstInstallTime, ps.lastUpdateTime, permissions, state, userId);
}
Also used : PackageParser(android.content.pm.PackageParser) PackageUserState(android.content.pm.PackageUserState)

Example 34 with PackageUserState

use of android.content.pm.PackageUserState in project platform_frameworks_base by android.

the class PackageSettingBase method setUserState.

void setUserState(int userId, long ceDataInode, int enabled, boolean installed, boolean stopped, boolean notLaunched, boolean hidden, boolean suspended, String lastDisableAppCaller, ArraySet<String> enabledComponents, ArraySet<String> disabledComponents, boolean blockUninstall, int domainVerifState, int linkGeneration) {
    PackageUserState state = modifyUserState(userId);
    state.ceDataInode = ceDataInode;
    state.enabled = enabled;
    state.installed = installed;
    state.stopped = stopped;
    state.notLaunched = notLaunched;
    state.hidden = hidden;
    state.suspended = suspended;
    state.lastDisableAppCaller = lastDisableAppCaller;
    state.enabledComponents = enabledComponents;
    state.disabledComponents = disabledComponents;
    state.blockUninstall = blockUninstall;
    state.domainVerificationStatus = domainVerifState;
    state.appLinkGeneration = linkGeneration;
}
Also used : PackageUserState(android.content.pm.PackageUserState)

Example 35 with PackageUserState

use of android.content.pm.PackageUserState in project platform_frameworks_base by android.

the class PackageSettingBase method restoreComponentLPw.

boolean restoreComponentLPw(String componentClassName, int userId) {
    PackageUserState state = modifyUserStateComponents(userId, true, true);
    boolean changed = state.disabledComponents != null ? state.disabledComponents.remove(componentClassName) : false;
    changed |= state.enabledComponents != null ? state.enabledComponents.remove(componentClassName) : false;
    return changed;
}
Also used : PackageUserState(android.content.pm.PackageUserState)

Aggregations

PackageUserState (android.content.pm.PackageUserState)60 EphemeralApplicationInfo (android.content.pm.EphemeralApplicationInfo)5 FastXmlSerializer (com.android.internal.util.FastXmlSerializer)5 JournaledFile (com.android.internal.util.JournaledFile)5 BufferedOutputStream (java.io.BufferedOutputStream)5 File (java.io.File)5 FileOutputStream (java.io.FileOutputStream)5 IOException (java.io.IOException)5 XmlSerializer (org.xmlpull.v1.XmlSerializer)5 PackageParser (android.content.pm.PackageParser)4 AtomicFile (android.util.AtomicFile)4 PackageInfo (android.content.pm.PackageInfo)1