Search in sources :

Example 6 with IGateKeeperService

use of android.service.gatekeeper.IGateKeeperService in project platform_frameworks_base by android.

the class UserManagerService method removeUserState.

private void removeUserState(final int userHandle) {
    try {
        mContext.getSystemService(StorageManager.class).destroyUserKey(userHandle);
    } catch (IllegalStateException e) {
        // This may be simply because the user was partially created.
        Slog.i(LOG_TAG, "Destroying key for user " + userHandle + " failed, continuing anyway", e);
    }
    // Cleanup gatekeeper secure user id
    try {
        final IGateKeeperService gk = GateKeeper.getService();
        if (gk != null) {
            gk.clearSecureUserId(userHandle);
        }
    } catch (Exception ex) {
        Slog.w(LOG_TAG, "unable to clear GK secure user id");
    }
    // Cleanup package manager settings
    mPm.cleanUpUser(this, userHandle);
    // Clean up all data before removing metadata
    mPm.destroyUserData(userHandle, StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE);
    // Remove this user from the list
    synchronized (mUsersLock) {
        mUsers.remove(userHandle);
        mIsUserManaged.delete(userHandle);
    }
    synchronized (mUserStates) {
        mUserStates.delete(userHandle);
    }
    synchronized (mRestrictionsLock) {
        mBaseUserRestrictions.remove(userHandle);
        mAppliedUserRestrictions.remove(userHandle);
        mCachedEffectiveUserRestrictions.remove(userHandle);
        mDevicePolicyLocalUserRestrictions.remove(userHandle);
    }
    // Update the user list
    synchronized (mPackagesLock) {
        writeUserListLP();
    }
    // Remove user file
    AtomicFile userFile = new AtomicFile(new File(mUsersDir, userHandle + XML_SUFFIX));
    userFile.delete();
    updateUserIds();
}
Also used : IGateKeeperService(android.service.gatekeeper.IGateKeeperService) AtomicFile(android.util.AtomicFile) StorageManager(android.os.storage.StorageManager) AtomicFile(android.util.AtomicFile) File(java.io.File) ErrnoException(android.system.ErrnoException) FileNotFoundException(java.io.FileNotFoundException) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) RemoteException(android.os.RemoteException) IOException(java.io.IOException)

Example 7 with IGateKeeperService

use of android.service.gatekeeper.IGateKeeperService in project android_frameworks_base by DirtyUnicorns.

the class LockSettingsService method removeUser.

private void removeUser(int userId, boolean unknownUser) {
    mStorage.removeUser(userId);
    mStrongAuth.removeUser(userId);
    final KeyStore ks = KeyStore.getInstance();
    ks.onUserRemoved(userId);
    try {
        final IGateKeeperService gk = getGateKeeperService();
        if (gk != null) {
            gk.clearSecureUserId(userId);
        }
    } catch (RemoteException ex) {
        Slog.w(TAG, "unable to clear GK secure user id");
    }
    if (unknownUser || mUserManager.getUserInfo(userId).isManagedProfile()) {
        removeKeystoreProfileKey(userId);
    }
}
Also used : IGateKeeperService(android.service.gatekeeper.IGateKeeperService) RemoteException(android.os.RemoteException) KeyStore(android.security.KeyStore)

Example 8 with IGateKeeperService

use of android.service.gatekeeper.IGateKeeperService in project android_frameworks_base by AOSPA.

the class LockSettingsService method removeUser.

private void removeUser(int userId, boolean unknownUser) {
    mStorage.removeUser(userId);
    mStrongAuth.removeUser(userId);
    final KeyStore ks = KeyStore.getInstance();
    ks.onUserRemoved(userId);
    try {
        final IGateKeeperService gk = getGateKeeperService();
        if (gk != null) {
            gk.clearSecureUserId(userId);
        }
    } catch (RemoteException ex) {
        Slog.w(TAG, "unable to clear GK secure user id");
    }
    if (unknownUser || mUserManager.getUserInfo(userId).isManagedProfile()) {
        removeKeystoreProfileKey(userId);
    }
}
Also used : IGateKeeperService(android.service.gatekeeper.IGateKeeperService) RemoteException(android.os.RemoteException) KeyStore(android.security.KeyStore)

Example 9 with IGateKeeperService

use of android.service.gatekeeper.IGateKeeperService in project android_frameworks_base by crdroidandroid.

the class LockSettingsService method removeUser.

private void removeUser(int userId, boolean unknownUser) {
    mStorage.removeUser(userId);
    mStrongAuth.removeUser(userId);
    final KeyStore ks = KeyStore.getInstance();
    ks.onUserRemoved(userId);
    try {
        final IGateKeeperService gk = getGateKeeperService();
        if (gk != null) {
            gk.clearSecureUserId(userId);
        }
    } catch (RemoteException ex) {
        Slog.w(TAG, "unable to clear GK secure user id");
    }
    if (unknownUser || mUserManager.getUserInfo(userId).isManagedProfile()) {
        removeKeystoreProfileKey(userId);
    }
}
Also used : IGateKeeperService(android.service.gatekeeper.IGateKeeperService) RemoteException(android.os.RemoteException) KeyStore(android.security.KeyStore)

Aggregations

RemoteException (android.os.RemoteException)9 IGateKeeperService (android.service.gatekeeper.IGateKeeperService)9 KeyStore (android.security.KeyStore)5 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)4 StorageManager (android.os.storage.StorageManager)4 ErrnoException (android.system.ErrnoException)4 AtomicFile (android.util.AtomicFile)4 File (java.io.File)4 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)4