Merge "Ignore lock type in ChooseLockGeneric in non-FBE"

This commit is contained in:
Maurice Lam
2018-10-09 01:02:25 +00:00
committed by Android (Google) Code Review
8 changed files with 116 additions and 93 deletions

View File

@@ -22,6 +22,7 @@ import android.app.admin.DevicePolicyManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.storage.StorageManager;
import android.widget.Button;
import android.widget.TextView;
@@ -32,7 +33,6 @@ import com.android.settings.SetupWizardUtils;
import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
import com.android.settings.password.SetupChooseLockGeneric;
import com.android.settings.password.SetupSkipDialog;
import com.android.settings.password.StorageManagerWrapper;
public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction {
private static final String KEY_LOCK_SCREEN_PRESENT = "wasLockScreenPresent";
@@ -59,7 +59,7 @@ public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntrodu
protected Intent getChooseLockIntent() {
Intent intent = new Intent(this, SetupChooseLockGeneric.class);
if (StorageManagerWrapper.isFileEncryptedNativeOrEmulated()) {
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
intent.putExtra(
LockPatternUtils.PASSWORD_TYPE_KEY,
DevicePolicyManager.PASSWORD_QUALITY_NUMERIC);

View File

@@ -435,7 +435,14 @@ public class ChooseLockGeneric extends SettingsActivity {
@VisibleForTesting
void updatePreferencesOrFinish(boolean isRecreatingActivity) {
Intent intent = getActivity().getIntent();
int quality = intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, -1);
int quality = -1;
if (StorageManager.isFileEncryptedNativeOrEmulated()) {
quality = intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, -1);
} else {
// For non-file encrypted devices we need to show encryption interstitial, so always
// show the lock type picker and ignore PASSWORD_TYPE_KEY.
Log.i(TAG, "Ignoring PASSWORD_TYPE_KEY because device is not file encrypted");
}
if (quality == -1) {
// If caller didn't specify password quality, show UI and allow the user to choose.
quality = intent.getIntExtra(MINIMUM_QUALITY_KEY, -1);

View File

@@ -1,29 +0,0 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.password;
import android.os.storage.StorageManager;
/**
* Wrapper class to allow Robolectric to shadow methods introduced in newer API
*/
public class StorageManagerWrapper {
public static boolean isFileEncryptedNativeOrEmulated() {
return StorageManager.isFileEncryptedNativeOrEmulated();
}
}