Improvements to enable encryption steps
* Don't crash when user has pattern lock * Updated text for final confirmation screen * Show power & battery level warning text * Updated layout for both confirmation screens (cleaned up margins, removed hardcoded text sizes, made settings & confirm consistent). * Added comments for translators to all cryptkeeper strings Bug: 3383190 Bug: 3383292 Bug: 3405707 Change-Id: I1adcdd963a549eb6541662ff941d245db5563710
This commit is contained in:
@@ -19,18 +19,28 @@
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:textSize="20sp"
|
||||
android:text="@string/crypt_keeper_final_desc" />
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip"
|
||||
android:layout_marginBottom="16dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/crypt_keeper_final_desc"
|
||||
/>
|
||||
</ScrollView>
|
||||
|
||||
<Button android:id="@+id/execute_encrypt"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="40dip"
|
||||
android:layout_marginTop="16dip"
|
||||
android:layout_marginBottom="16dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/crypt_keeper_button_text"
|
||||
|
@@ -21,31 +21,58 @@
|
||||
>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/crypt_keeper_desc"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dip"
|
||||
android:layout_marginBottom="16dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:text="@string/crypt_keeper_desc"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/warning_low_charge"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/crypt_keeper_low_charge_text"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/warning_unplugged"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dip"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/crypt_keeper_unplugged_text"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
<Button
|
||||
android:id="@+id/initiate_encrypt"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="20dip"
|
||||
android:layout_marginBottom="12dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/crypt_keeper_button_text"
|
||||
android:gravity="center"
|
||||
android:id="@+id/initiate_encrypt"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="16dip"
|
||||
android:layout_marginBottom="16dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/crypt_keeper_button_text"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -582,22 +582,26 @@
|
||||
<!-- In the security screen, the header title for settings related to Passwords-->
|
||||
<string name="security_passwords_title">Passwords</string>
|
||||
|
||||
<!-- Title of the preferences category for preference items to control encryption -->
|
||||
<string name="crypt_keeper_settings_title">Encryption</string>
|
||||
|
||||
<!-- Title of the preferences item to control encryption -->
|
||||
<string name="crypt_keeper_encrypt_title" product="tablet">Encrypt tablet</string>
|
||||
<!-- Title of the preferences item to control encryption -->
|
||||
<string name="crypt_keeper_encrypt_title" product="default">Encrypt phone</string>
|
||||
|
||||
<!-- Summary of the preferences item to control encryption, when encryption is inactive -->
|
||||
<string name="crypt_keeper_encrypt_summary" product="tablet">
|
||||
Require a numeric PIN or password to decrypt your tablet each time you
|
||||
power it on</string>
|
||||
<!-- Summary of the preferences item to control encryption, when encryption is inactive -->
|
||||
<string name="crypt_keeper_encrypt_summary" product="default">
|
||||
Require a numeric PIN or password to decrypt your phone each time you
|
||||
power it on</string>
|
||||
<!-- Summary of the preferences item to control encryption, when encryption is active -->
|
||||
<string name="crypt_keeper_encrypted_summary">Encrypted</string>
|
||||
|
||||
<string name="crypt_keeper_confirm_title">Confirm encryption</string>
|
||||
|
||||
|
||||
<!-- Informational text in the first confirmation screen before starting device encryption -->
|
||||
<string name="crypt_keeper_desc" product="tablet">
|
||||
You can encrypt your accounts, settings, downloaded applications and their data,
|
||||
media, and other files. Once you encrypt your tablet, you must enter a numeric PIN
|
||||
@@ -606,6 +610,7 @@
|
||||
an hour or more. You must start with a charged battery and keep your tablet plugged in
|
||||
until encryption is complete. If you interrupt the encryption process, you will lose
|
||||
some or all of your data.</string>
|
||||
<!-- Informational text in the first confirmation screen before starting device encryption -->
|
||||
<string name="crypt_keeper_desc" product="default">
|
||||
You can encrypt your accounts, settings, downloaded applications and their data,
|
||||
media, and other files. Once you encrypt your phone, you must enter a numeric PIN or
|
||||
@@ -615,24 +620,40 @@
|
||||
until encryption is complete. If you interrupt the encryption process, you will lose
|
||||
some or all of your data.</string>
|
||||
|
||||
<!-- Button text to start encryption process -->
|
||||
<string name="crypt_keeper_button_text" product="tablet">Encrypt tablet</string>
|
||||
<!-- Button text to start encryption process -->
|
||||
<string name="crypt_keeper_button_text" product="default">Encrypt phone</string>
|
||||
|
||||
<!-- Warning string that will be displayed when encryption cannot be started -->
|
||||
<string name="crypt_keeper_low_charge_text">Please charge your battery and try again.</string>
|
||||
<!-- Warning string that will be displayed when encryption cannot be started -->
|
||||
<string name="crypt_keeper_unplugged_text">Please plug in your charger and try again.</string>
|
||||
|
||||
<!-- Title of the final confirmation screen before starting device encryption -->
|
||||
<string name="crypt_keeper_confirm_title">Confirm encryption</string>
|
||||
<!-- Warning text in the final confirmation screen before starting device encryption -->
|
||||
<string name="crypt_keeper_final_desc" product="tablet">
|
||||
Encrypt tablet? This operation is irreversible and if you interrupt it,
|
||||
you will lose data! Encryption takes an hour or more.</string>
|
||||
Encrypt tablet? This operation is irreversible and if you interrupt it, you will lose data.
|
||||
Encryption takes an hour or more, during which the tablet will restart several times.
|
||||
</string>
|
||||
<!-- Warning text in the final confirmation screen before starting device encryption -->
|
||||
<string name="crypt_keeper_final_desc" product="default">
|
||||
Encrypt phone? This operation is irreversible and if you interrupt it,
|
||||
you will lose data! Encryption takes an hour or more.</string>
|
||||
|
||||
Encrypt phone? This operation is irreversible and if you interrupt it, you will lose data.
|
||||
Encryption takes an hour or more, during which the phone will restart several times.
|
||||
</string>
|
||||
|
||||
<!-- Title of the progress screen while encrypting the device -->
|
||||
<string name="crypt_keeper_setup_title">Encrypting</string>
|
||||
|
||||
<string name="crypt_keeper_setup_description" product="tablet">Please wait while your tablet is being encrypted. ^1% complete.</string>
|
||||
<string name="crypt_keeper_setup_description" product="default">Please wait while your phone is being encrypted. ^1% complete.</string>
|
||||
<!-- Informational text on the progress screen while encrypting the device -->
|
||||
<string name="crypt_keeper_setup_description" product="tablet">Please wait while your tablet
|
||||
is being encrypted. ^1% complete.</string>
|
||||
<!-- Informational text on the progress screen while encrypting the device -->
|
||||
<string name="crypt_keeper_setup_description" product="default">Please wait while your phone
|
||||
is being encrypted. ^1% complete.</string>
|
||||
|
||||
<!-- Informational text on the progress screen when encrypting the device has a problem -->
|
||||
<string name="crypt_keeper_cooldown">Try again in ^1 seconds.</string>
|
||||
|
||||
<!-- Unlock Picker Settings --><skip />
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Fragment;
|
||||
@@ -49,8 +51,18 @@ public class CryptKeeperSettings extends Fragment {
|
||||
|
||||
private static final int KEYGUARD_REQUEST = 55;
|
||||
|
||||
// This is the minimum acceptable password quality. If the current password quality is
|
||||
// lower than this, encryption should not be activated.
|
||||
private static final int MIN_PASSWORD_QUALITY = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
|
||||
|
||||
// Minimum battery charge level (in percent) to launch encryption. If the battery charge is
|
||||
// lower than this, encryption should not be activated.
|
||||
private static final int MIN_BATTERY_LEVEL = 80;
|
||||
|
||||
private View mContentView;
|
||||
private Button mInitiateButton;
|
||||
private View mPowerWarning;
|
||||
private View mBatteryWarning;
|
||||
private IntentFilter mIntentFilter;
|
||||
|
||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
@@ -60,12 +72,12 @@ public class CryptKeeperSettings extends Fragment {
|
||||
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
|
||||
int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
|
||||
int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
|
||||
|
||||
if (plugged == BatteryManager.BATTERY_PLUGGED_AC && level >= 80) {
|
||||
mInitiateButton.setEnabled(true);
|
||||
} else {
|
||||
mInitiateButton.setEnabled(false);
|
||||
}
|
||||
boolean levelOk = level >= MIN_BATTERY_LEVEL;
|
||||
boolean pluggedOk = plugged == BatteryManager.BATTERY_PLUGGED_AC;
|
||||
// Update UI elements based on power/battery status
|
||||
mInitiateButton.setEnabled(levelOk && pluggedOk);
|
||||
mPowerWarning.setVisibility(pluggedOk ? View.GONE : View.VISIBLE );
|
||||
mBatteryWarning.setVisibility(levelOk ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -102,6 +114,9 @@ public class CryptKeeperSettings extends Fragment {
|
||||
mInitiateButton.setOnClickListener(mInitiateListener);
|
||||
mInitiateButton.setEnabled(false);
|
||||
|
||||
mPowerWarning = mContentView.findViewById(R.id.warning_unplugged);
|
||||
mBatteryWarning = mContentView.findViewById(R.id.warning_low_charge);
|
||||
|
||||
return mContentView;
|
||||
}
|
||||
|
||||
@@ -146,6 +161,12 @@ public class CryptKeeperSettings extends Fragment {
|
||||
* @return true if confirmation launched
|
||||
*/
|
||||
private boolean runKeyguardConfirmation(int request) {
|
||||
// 1. Confirm that we have a sufficient PIN/Password to continue
|
||||
int quality = new LockPatternUtils(getActivity()).getKeyguardStoredPasswordQuality();
|
||||
if (quality < MIN_PASSWORD_QUALITY) {
|
||||
return false;
|
||||
}
|
||||
// 2. Ask the user to confirm the current PIN/Password
|
||||
Resources res = getActivity().getResources();
|
||||
return new ChooseLockSettingsHelper(getActivity(), this)
|
||||
.launchConfirmationActivity(request,
|
||||
|
Reference in New Issue
Block a user