Merge "Improvements to enable encryption steps" into honeycomb
This commit is contained in:
@@ -19,18 +19,28 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
>
|
>
|
||||||
|
|
||||||
<TextView
|
<ScrollView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dip"
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="12dp"
|
android:layout_marginRight="16dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="16dp"
|
||||||
android:textSize="20sp"
|
android:layout_weight="1"
|
||||||
android:text="@string/crypt_keeper_final_desc" />
|
>
|
||||||
|
<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"
|
<Button android:id="@+id/execute_encrypt"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="40dip"
|
android:layout_marginTop="16dip"
|
||||||
|
android:layout_marginBottom="16dip"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/crypt_keeper_button_text"
|
android:text="@string/crypt_keeper_button_text"
|
||||||
|
@@ -21,31 +21,58 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="16dp"
|
||||||
android:layout_marginRight="12dp"
|
android:layout_marginRight="16dp"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="16dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
>
|
>
|
||||||
|
<LinearLayout
|
||||||
<TextView
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="vertical"
|
||||||
android:textSize="18sp"
|
>
|
||||||
android:text="@string/crypt_keeper_desc"
|
<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>
|
</ScrollView>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/initiate_encrypt"
|
android:id="@+id/initiate_encrypt"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="20dip"
|
android:layout_marginTop="16dip"
|
||||||
android:layout_marginBottom="12dip"
|
android:layout_marginBottom="16dip"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/crypt_keeper_button_text"
|
android:text="@string/crypt_keeper_button_text"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -582,22 +582,26 @@
|
|||||||
<!-- In the security screen, the header title for settings related to Passwords-->
|
<!-- In the security screen, the header title for settings related to Passwords-->
|
||||||
<string name="security_passwords_title">Passwords</string>
|
<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>
|
<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>
|
<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>
|
<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">
|
<string name="crypt_keeper_encrypt_summary" product="tablet">
|
||||||
Require a numeric PIN or password to decrypt your tablet each time you
|
Require a numeric PIN or password to decrypt your tablet each time you
|
||||||
power it on</string>
|
power it on</string>
|
||||||
|
<!-- Summary of the preferences item to control encryption, when encryption is inactive -->
|
||||||
<string name="crypt_keeper_encrypt_summary" product="default">
|
<string name="crypt_keeper_encrypt_summary" product="default">
|
||||||
Require a numeric PIN or password to decrypt your phone each time you
|
Require a numeric PIN or password to decrypt your phone each time you
|
||||||
power it on</string>
|
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_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">
|
<string name="crypt_keeper_desc" product="tablet">
|
||||||
You can encrypt your accounts, settings, downloaded applications and their data,
|
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
|
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
|
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
|
until encryption is complete. If you interrupt the encryption process, you will lose
|
||||||
some or all of your data.</string>
|
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">
|
<string name="crypt_keeper_desc" product="default">
|
||||||
You can encrypt your accounts, settings, downloaded applications and their data,
|
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
|
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
|
until encryption is complete. If you interrupt the encryption process, you will lose
|
||||||
some or all of your data.</string>
|
some or all of your data.</string>
|
||||||
|
|
||||||
|
<!-- Button text to start encryption process -->
|
||||||
<string name="crypt_keeper_button_text" product="tablet">Encrypt tablet</string>
|
<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>
|
<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>
|
<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>
|
<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">
|
<string name="crypt_keeper_final_desc" product="tablet">
|
||||||
Encrypt tablet? This operation is irreversible and if you interrupt it,
|
Encrypt tablet? This operation is irreversible and if you interrupt it, you will lose data.
|
||||||
you will lose data! Encryption takes an hour or more.</string>
|
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">
|
<string name="crypt_keeper_final_desc" product="default">
|
||||||
Encrypt phone? This operation is irreversible and if you interrupt it,
|
Encrypt phone? This operation is irreversible and if you interrupt it, you will lose data.
|
||||||
you will lose data! Encryption takes an hour or more.</string>
|
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_title">Encrypting</string>
|
||||||
|
|
||||||
<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>
|
<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>
|
<string name="crypt_keeper_cooldown">Try again in ^1 seconds.</string>
|
||||||
|
|
||||||
<!-- Unlock Picker Settings --><skip />
|
<!-- Unlock Picker Settings --><skip />
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
@@ -49,8 +51,18 @@ public class CryptKeeperSettings extends Fragment {
|
|||||||
|
|
||||||
private static final int KEYGUARD_REQUEST = 55;
|
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 View mContentView;
|
||||||
private Button mInitiateButton;
|
private Button mInitiateButton;
|
||||||
|
private View mPowerWarning;
|
||||||
|
private View mBatteryWarning;
|
||||||
private IntentFilter mIntentFilter;
|
private IntentFilter mIntentFilter;
|
||||||
|
|
||||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||||
@@ -60,12 +72,12 @@ public class CryptKeeperSettings extends Fragment {
|
|||||||
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
|
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
|
||||||
int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
|
int level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0);
|
||||||
int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
|
int plugged = intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0);
|
||||||
|
boolean levelOk = level >= MIN_BATTERY_LEVEL;
|
||||||
if (plugged == BatteryManager.BATTERY_PLUGGED_AC && level >= 80) {
|
boolean pluggedOk = plugged == BatteryManager.BATTERY_PLUGGED_AC;
|
||||||
mInitiateButton.setEnabled(true);
|
// Update UI elements based on power/battery status
|
||||||
} else {
|
mInitiateButton.setEnabled(levelOk && pluggedOk);
|
||||||
mInitiateButton.setEnabled(false);
|
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.setOnClickListener(mInitiateListener);
|
||||||
mInitiateButton.setEnabled(false);
|
mInitiateButton.setEnabled(false);
|
||||||
|
|
||||||
|
mPowerWarning = mContentView.findViewById(R.id.warning_unplugged);
|
||||||
|
mBatteryWarning = mContentView.findViewById(R.id.warning_low_charge);
|
||||||
|
|
||||||
return mContentView;
|
return mContentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,6 +161,12 @@ public class CryptKeeperSettings extends Fragment {
|
|||||||
* @return true if confirmation launched
|
* @return true if confirmation launched
|
||||||
*/
|
*/
|
||||||
private boolean runKeyguardConfirmation(int request) {
|
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();
|
Resources res = getActivity().getResources();
|
||||||
return new ChooseLockSettingsHelper(getActivity(), this)
|
return new ChooseLockSettingsHelper(getActivity(), this)
|
||||||
.launchConfirmationActivity(request,
|
.launchConfirmationActivity(request,
|
||||||
|
Reference in New Issue
Block a user