diff options
| author | 2022-03-09 05:06:22 +0000 | |
|---|---|---|
| committer | 2022-03-09 05:06:22 +0000 | |
| commit | 83645e6dd0487c67d149c96115a00e98ee401b2e (patch) | |
| tree | d60f4da0b89faf88a850c7949763902fda76b503 | |
| parent | aea2082a03e6e6636eb6e33df829e38d6d649391 (diff) | |
| parent | f4f345dbeee8d81479a2c74b51d28a3649ecf26c (diff) | |
Merge changes Ib5bcfb6a,I46c2a472,If0c75774 into tm-dev
* changes:
Stub out some FDE methods in StorageManager
Stop trying to update FDE password from LockSettingsService
Remove clearEncryptionPassword() from LockPatternUtils
4 files changed, 8 insertions, 82 deletions
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index b501730f1eeb..312abf877f53 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -83,7 +83,6 @@ import android.os.UserHandle; import android.provider.DeviceConfig; import android.provider.MediaStore; import android.provider.Settings; -import android.sysprop.VoldProperties; import android.system.ErrnoException; import android.system.Os; import android.system.OsConstants; @@ -1739,10 +1738,7 @@ public class StorageManager { * false not encrypted or file encrypted */ public static boolean isBlockEncrypted() { - if (!isEncrypted()) { - return false; - } - return RoSystemProperties.CRYPTO_BLOCK_ENCRYPTED; + return false; } /** {@hide} @@ -1752,18 +1748,7 @@ public class StorageManager { * false not encrypted, file encrypted or default block encrypted */ public static boolean isNonDefaultBlockEncrypted() { - if (!isBlockEncrypted()) { - return false; - } - - try { - IStorageManager storageManager = IStorageManager.Stub.asInterface( - ServiceManager.getService("mount")); - return storageManager.getPasswordType() != CRYPT_TYPE_DEFAULT; - } catch (RemoteException e) { - Log.e(TAG, "Error getting encryption type"); - return false; - } + return false; } /** {@hide} @@ -1777,8 +1762,7 @@ public class StorageManager { * framework, so no service needs to check for changes during their lifespan */ public static boolean isBlockEncrypting() { - final String state = VoldProperties.encrypt_progress().orElse(""); - return !"".equalsIgnoreCase(state); + return false; } /** {@hide} @@ -1793,8 +1777,7 @@ public class StorageManager { * framework, so no service needs to check for changes during their lifespan */ public static boolean inCryptKeeperBounce() { - final String status = VoldProperties.decrypt().orElse(""); - return "trigger_restart_min_framework".equals(status); + return false; } /** {@hide} */ diff --git a/core/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl index db4bc2c7e24a..851e8e0f3269 100644 --- a/core/java/com/android/internal/widget/ILockSettings.aidl +++ b/core/java/com/android/internal/widget/ILockSettings.aidl @@ -97,7 +97,6 @@ interface ILockSettings { boolean hasSecureLockScreen(); boolean tryUnlockWithCachedUnifiedChallenge(int userId); void removeCachedUnifiedChallenge(int userId); - void updateEncryptionPassword(int type, in byte[] password); boolean registerWeakEscrowTokenRemovedListener(in IWeakEscrowTokenRemovedListener listener); boolean unregisterWeakEscrowTokenRemovedListener(in IWeakEscrowTokenRemovedListener listener); long addWeakEscrowToken(in byte[] token, int userId, in IWeakEscrowTokenActivatedListener callback); diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 5fb915b388be..82ae42441032 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -784,17 +784,6 @@ public class LockPatternUtils { } /** - * Clears the encryption password. - */ - public void clearEncryptionPassword() { - try { - getLockSettings().updateEncryptionPassword(StorageManager.CRYPT_TYPE_DEFAULT, null); - } catch (RemoteException e) { - Log.e(TAG, "Couldn't clear encryption password"); - } - } - - /** * Retrieves the quality mode for {@code userHandle}. * @see DevicePolicyManager#getPasswordQuality(android.content.ComponentName) * diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java index 0f4648a3f0f8..3db11d84cbeb 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsService.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java @@ -1800,7 +1800,10 @@ public class LockSettingsService extends ILockSettings.Stub { } private void onPostPasswordChanged(LockscreenCredential newCredential, int userHandle) { - updateEncryptionPasswordIfNeeded(newCredential, userHandle); + if (userHandle == UserHandle.USER_SYSTEM && isDeviceEncryptionEnabled() && + shouldEncryptWithCredentials() && newCredential.isNone()) { + setCredentialRequiredToDecrypt(false); + } if (newCredential.isPattern()) { setBoolean(LockPatternUtils.PATTERN_EVER_CHOSEN_KEY, true, userHandle); } @@ -1809,26 +1812,6 @@ public class LockSettingsService extends ILockSettings.Stub { } /** - * Update device encryption password if calling user is USER_SYSTEM and device supports - * encryption. - */ - private void updateEncryptionPasswordIfNeeded(LockscreenCredential credential, int userHandle) { - // Update the device encryption password. - if (userHandle != UserHandle.USER_SYSTEM || !isDeviceEncryptionEnabled()) { - return; - } - if (!shouldEncryptWithCredentials()) { - updateEncryptionPassword(StorageManager.CRYPT_TYPE_DEFAULT, null); - return; - } - if (credential.isNone()) { - // Set the encryption password to default. - setCredentialRequiredToDecrypt(false); - } - updateEncryptionPassword(credential.getStorageCryptType(), credential.getCredential()); - } - - /** * Store the hash of the *current* password in the password history list, if device policy * enforces password history requirement. */ @@ -1942,34 +1925,6 @@ public class LockSettingsService extends ILockSettings.Stub { } } - /** Update the encryption password if it is enabled **/ - @Override - public void updateEncryptionPassword(final int type, final byte[] password) { - if (!hasSecureLockScreen() && password != null && password.length != 0) { - throw new UnsupportedOperationException( - "This operation requires the lock screen feature."); - } - if (!isDeviceEncryptionEnabled()) { - return; - } - final IBinder service = ServiceManager.getService("mount"); - if (service == null) { - Slog.e(TAG, "Could not find the mount service to update the encryption password"); - return; - } - - // TODO(b/120484642): This is a location where we still use a String for vold - String passwordString = password != null ? new String(password) : null; - mHandler.post(() -> { - IStorageManager storageManager = mInjector.getStorageManager(); - try { - storageManager.changeEncryptionPassword(type, passwordString); - } catch (RemoteException e) { - Slog.e(TAG, "Error changing encryption password", e); - } - }); - } - /** Register the given WeakEscrowTokenRemovedListener. */ @Override public boolean registerWeakEscrowTokenRemovedListener( |