Use StorageManager.isFileEncrypted() instead of deprecated methods
Since emulated FBE is no longer supported, isFileEncryptedNativeOnly() and isFileEncryptedNativeOrEmulated() are the same as the new method isFileEncrypted(). Replace all calls to these deprecated methods in this repository with isFileEncrypted(). Bug: 232458753 Change-Id: I95beea86ef771396c2e08f2d6a643fdc629ad89f
This commit is contained in:
@@ -131,7 +131,7 @@ public class BiometricUtils {
|
||||
if (WizardManagerHelper.isAnySetupWizard(activityIntent)) {
|
||||
// Default to PIN lock in setup wizard
|
||||
Intent intent = new Intent(context, SetupChooseLockGeneric.class);
|
||||
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
|
||||
if (StorageManager.isFileEncrypted()) {
|
||||
intent.putExtra(
|
||||
LockPatternUtils.PASSWORD_TYPE_KEY,
|
||||
DevicePolicyManager.PASSWORD_QUALITY_NUMERIC);
|
||||
|
@@ -97,7 +97,7 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
|
||||
@Override
|
||||
public void onNavigateNext(View view) {
|
||||
// Ensure that all users are unlocked so that we can move their data
|
||||
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
|
||||
if (StorageManager.isFileEncrypted()) {
|
||||
for (UserInfo user : getSystemService(UserManager.class).getUsers()) {
|
||||
if (!StorageManager.isUserKeyUnlocked(user.id)) {
|
||||
Log.d(TAG, "User " + user.id + " is currently locked; requesting unlock");
|
||||
|
@@ -79,7 +79,7 @@ public class StorageWizardMoveConfirm extends StorageWizardBase {
|
||||
@Override
|
||||
public void onNavigateNext(View view) {
|
||||
// Ensure that all users are unlocked so that we can move their data
|
||||
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
|
||||
if (StorageManager.isFileEncrypted()) {
|
||||
for (UserInfo user : getSystemService(UserManager.class).getUsers()) {
|
||||
if (!StorageManager.isUserKeyUnlocked(user.id)) {
|
||||
Log.d(TAG, "User " + user.id + " is currently locked; requesting unlock");
|
||||
|
@@ -587,7 +587,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
void updatePreferencesOrFinish(boolean isRecreatingActivity) {
|
||||
Intent intent = getActivity().getIntent();
|
||||
int quality = -1;
|
||||
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
|
||||
if (StorageManager.isFileEncrypted()) {
|
||||
quality = intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, -1);
|
||||
} else {
|
||||
// For non-file encrypted devices we need to show encryption interstitial, so always
|
||||
|
@@ -148,7 +148,7 @@ public class ScreenLockPreferenceDetailsUtils {
|
||||
// able to complete the operation due to the lack of (old) encryption key.
|
||||
if (mProfileChallengeUserId != UserHandle.USER_NULL
|
||||
&& !mLockPatternUtils.isSeparateProfileChallengeEnabled(mProfileChallengeUserId)
|
||||
&& StorageManager.isFileEncryptedNativeOnly()) {
|
||||
&& StorageManager.isFileEncrypted()) {
|
||||
if (mUm.isQuietModeEnabled(UserHandle.of(mProfileChallengeUserId))) {
|
||||
return UnlaunchableAppActivity.createInQuietModeDialogIntent(
|
||||
mProfileChallengeUserId);
|
||||
|
@@ -247,7 +247,7 @@ public class SetupFingerprintEnrollIntroductionTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void testLockPattern() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
|
||||
mController.create().postCreate(null).resume();
|
||||
|
||||
|
@@ -146,7 +146,7 @@ public class ChooseLockGenericTest {
|
||||
|
||||
@Test
|
||||
public void updatePreferencesOrFinish_passwordTypeSetPinNotFbe_shouldNotStartChooseLock() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
Intent intent = new Intent().putExtra(
|
||||
LockPatternUtils.PASSWORD_TYPE_KEY,
|
||||
DevicePolicyManager.PASSWORD_QUALITY_NUMERIC);
|
||||
@@ -159,7 +159,7 @@ public class ChooseLockGenericTest {
|
||||
|
||||
@Test
|
||||
public void updatePreferencesOrFinish_footerPreferenceAddedHighComplexityText() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
Intent intent = new Intent()
|
||||
.putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name")
|
||||
.putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_HIGH);
|
||||
@@ -175,7 +175,7 @@ public class ChooseLockGenericTest {
|
||||
|
||||
@Test
|
||||
public void updatePreferencesOrFinish_footerPreferenceAddedMediumComplexityText() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
Intent intent = new Intent()
|
||||
.putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name")
|
||||
.putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_MEDIUM);
|
||||
@@ -191,7 +191,7 @@ public class ChooseLockGenericTest {
|
||||
|
||||
@Test
|
||||
public void updatePreferencesOrFinish_footerPreferenceAddedLowComplexityText() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
Intent intent = new Intent()
|
||||
.putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name")
|
||||
.putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_LOW);
|
||||
@@ -207,7 +207,7 @@ public class ChooseLockGenericTest {
|
||||
|
||||
@Test
|
||||
public void updatePreferencesOrFinish_footerPreferenceAddedNoneComplexityText() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
Intent intent = new Intent()
|
||||
.putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name")
|
||||
.putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_NONE);
|
||||
@@ -389,7 +389,7 @@ public class ChooseLockGenericTest {
|
||||
|
||||
@Test
|
||||
public void updatePreferencesOrFinish_ComplexityIsReadFromDPM() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
ShadowLockPatternUtils.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_HIGH);
|
||||
|
||||
initActivity(null);
|
||||
@@ -405,7 +405,7 @@ public class ChooseLockGenericTest {
|
||||
|
||||
@Test
|
||||
public void updatePreferencesOrFinish_ComplexityIsMergedWithDPM() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
ShadowLockPatternUtils.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_HIGH);
|
||||
Intent intent = new Intent()
|
||||
.putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name")
|
||||
@@ -425,7 +425,7 @@ public class ChooseLockGenericTest {
|
||||
|
||||
@Test
|
||||
public void updatePreferencesOrFinish_ComplexityIsMergedWithDPM_AppIsHigher() {
|
||||
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
|
||||
ShadowStorageManager.setIsFileEncrypted(false);
|
||||
ShadowLockPatternUtils.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_LOW);
|
||||
Intent intent = new Intent()
|
||||
.putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name")
|
||||
|
@@ -30,7 +30,7 @@ public class ShadowStorageManager {
|
||||
|
||||
private static boolean sIsUnmountCalled;
|
||||
private static boolean sIsForgetCalled;
|
||||
private static boolean sIsFileEncryptedNativeOrEmulated = true;
|
||||
private static boolean sIsFileEncrypted = true;
|
||||
|
||||
public static boolean isUnmountCalled() {
|
||||
return sIsUnmountCalled;
|
||||
@@ -44,7 +44,7 @@ public class ShadowStorageManager {
|
||||
public static void reset() {
|
||||
sIsUnmountCalled = false;
|
||||
sIsForgetCalled = false;
|
||||
sIsFileEncryptedNativeOrEmulated = true;
|
||||
sIsFileEncrypted = true;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
@@ -73,12 +73,12 @@ public class ShadowStorageManager {
|
||||
}
|
||||
|
||||
@Implementation
|
||||
protected static boolean isFileEncryptedNativeOrEmulated() {
|
||||
return sIsFileEncryptedNativeOrEmulated;
|
||||
protected static boolean isFileEncrypted() {
|
||||
return sIsFileEncrypted;
|
||||
}
|
||||
|
||||
public static void setIsFileEncryptedNativeOrEmulated(boolean encrypted) {
|
||||
sIsFileEncryptedNativeOrEmulated = encrypted;
|
||||
public static void setIsFileEncrypted(boolean encrypted) {
|
||||
sIsFileEncrypted = encrypted;
|
||||
}
|
||||
|
||||
private VolumeInfo createVolumeInfo(String volumeId) {
|
||||
|
Reference in New Issue
Block a user