am 39f1e040
: More UI tweaks and fixes.
* commit '39f1e04079976d3d10fdd8e5dd36c833bab8a371': More UI tweaks and fixes.
This commit is contained in:
@@ -587,12 +587,12 @@
|
|||||||
<string name="crypt_keeper_encrypt_summary">Requires you to set a device unlock pin or password</string>
|
<string name="crypt_keeper_encrypt_summary">Requires you to set a device unlock pin or password</string>
|
||||||
<string name="crypt_keeper_confirm_title">Confirm encrypt</string>
|
<string name="crypt_keeper_confirm_title">Confirm encrypt</string>
|
||||||
|
|
||||||
<string name="crypt_keeper_desc">Device encryption will convert user data to an ecrypted state, including your accounts, system data, downloaded applications and data, photos, movies, musics, etc.\n\nEncyrption cannot be undone without performing a factory data reset, which would then erase all data.\n\nYou must set up a device lock pin or password to proceed.\n\nThis operation may take up to an hour and may not be interrupted. You must have a fully charged battery and plug in the device to initiate encryption. Running out of power during encryption will cause data loss.</string>
|
<string name="crypt_keeper_desc">You can encrypt your accounts, settings, downloaded applications and their data, media, and other files. Once you encrypt your tablet, you can\'t unencrypt it except by performing a factory data reset, erasing all the data on your tablet.\n\nEncryption takes up to an hour. 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>
|
||||||
|
|
||||||
<string name="crypt_keeper_button_text" product="tablet">Encrypt tablet</string>
|
<string name="crypt_keeper_button_text" product="tablet">Encrypt tablet</string>
|
||||||
<string name="crypt_keeper_button_text" product="default">Encrypt phone</string>
|
<string name="crypt_keeper_button_text" product="default">Encrypt phone</string>
|
||||||
|
|
||||||
<string name="crypt_keeper_final_desc">Encrypt user data? This operation is not reversible and may not be interrupted without loos of data! Encryption may take up to an hour.</string>
|
<string name="crypt_keeper_final_desc">Encrypt user data? This operation is not reversible and may not be interrupted without loss of data! Encryption may take up to an hour.</string>
|
||||||
|
|
||||||
<string name="crypt_keeper_setup_title">Encrypting</string>
|
<string name="crypt_keeper_setup_title">Encrypting</string>
|
||||||
|
|
||||||
|
@@ -76,8 +76,8 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
Log.w(TAG, "Error parsing progress: " + e.toString());
|
Log.w(TAG, "Error parsing progress: " + e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the status every 1 second
|
// Check the status every 5 second
|
||||||
sendEmptyMessageDelayed(0, 1000);
|
sendEmptyMessageDelayed(UPDATE_PROGRESS, 5000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COOLDOWN:
|
case COOLDOWN:
|
||||||
@@ -128,6 +128,12 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
setContentView(R.layout.crypt_keeper_password_entry);
|
setContentView(R.layout.crypt_keeper_password_entry);
|
||||||
passwordEntryInit();
|
passwordEntryInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable the status bar
|
||||||
|
StatusBarManager sbm = (StatusBarManager) getSystemService(Context.STATUS_BAR_SERVICE);
|
||||||
|
sbm.disable(StatusBarManager.DISABLE_EXPAND | StatusBarManager.DISABLE_NOTIFICATION_ICONS
|
||||||
|
| StatusBarManager.DISABLE_NOTIFICATION_ALERTS
|
||||||
|
| StatusBarManager.DISABLE_SYSTEM_INFO | StatusBarManager.DISABLE_NAVIGATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void encryptionProgressInit() {
|
private void encryptionProgressInit() {
|
||||||
@@ -151,12 +157,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
String dateFormatString = getString(com.android.internal.R.string.full_wday_month_day_no_year);
|
String dateFormatString = getString(com.android.internal.R.string.full_wday_month_day_no_year);
|
||||||
TextView date = (TextView) findViewById(R.id.date);
|
TextView date = (TextView) findViewById(R.id.date);
|
||||||
date.setText(DateFormat.format(dateFormatString, new Date()));
|
date.setText(DateFormat.format(dateFormatString, new Date()));
|
||||||
|
|
||||||
// Disable the status bar
|
|
||||||
StatusBarManager sbm = (StatusBarManager) getSystemService(Context.STATUS_BAR_SERVICE);
|
|
||||||
sbm.disable(StatusBarManager.DISABLE_EXPAND | StatusBarManager.DISABLE_NOTIFICATION_ICONS
|
|
||||||
| StatusBarManager.DISABLE_NOTIFICATION_ALERTS
|
|
||||||
| StatusBarManager.DISABLE_SYSTEM_INFO | StatusBarManager.DISABLE_NAVIGATION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMountService getMountService() {
|
private IMountService getMountService() {
|
||||||
@@ -184,12 +184,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
try {
|
try {
|
||||||
service.decryptStorage(password);
|
service.decryptStorage(password);
|
||||||
|
|
||||||
// For now the only way to get here is for the password to be
|
if (mFailedAttempts == 0) {
|
||||||
// wrong.
|
// Success. Do something here within 2 seconds
|
||||||
|
|
||||||
mFailedAttempts++;
|
} else if (mFailedAttempts == MAX_FAILED_ATTEMPTS) {
|
||||||
|
|
||||||
if (mFailedAttempts == MAX_FAILED_ATTEMPTS) {
|
|
||||||
// Factory reset the device.
|
// Factory reset the device.
|
||||||
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
|
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
|
||||||
} else if ((mFailedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
|
} else if ((mFailedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
|
||||||
|
@@ -17,9 +17,14 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.os.BatteryManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
@@ -45,6 +50,72 @@ public class CryptKeeperSettings extends Fragment {
|
|||||||
|
|
||||||
private View mContentView;
|
private View mContentView;
|
||||||
private Button mInitiateButton;
|
private Button mInitiateButton;
|
||||||
|
private IntentFilter mIntentFilter;
|
||||||
|
|
||||||
|
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (action.equals(Intent.ACTION_BATTERY_CHANGED)) {
|
||||||
|
int level = intent.getIntExtra("level", 0);
|
||||||
|
int status = intent.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN);
|
||||||
|
|
||||||
|
if (status == BatteryManager.BATTERY_STATUS_CHARGING && level >= 80) {
|
||||||
|
mInitiateButton.setEnabled(true);
|
||||||
|
} else {
|
||||||
|
mInitiateButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the user clicks to begin the reset sequence, we next require a
|
||||||
|
* keyguard confirmation if the user has currently enabled one. If there
|
||||||
|
* is no keyguard available, we prompt the user to set a password.
|
||||||
|
*/
|
||||||
|
private Button.OnClickListener mInitiateListener = new Button.OnClickListener() {
|
||||||
|
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (!runKeyguardConfirmation(KEYGUARD_REQUEST)) {
|
||||||
|
// TODO remove with proper flow
|
||||||
|
new AlertDialog.Builder(getActivity())
|
||||||
|
.setTitle("No password set")
|
||||||
|
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||||
|
.setMessage("Before you enable encryption you must set a device password.")
|
||||||
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
|
.create()
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
|
||||||
|
mContentView = inflater.inflate(R.layout.crypt_keeper_settings, null);
|
||||||
|
|
||||||
|
mIntentFilter = new IntentFilter();
|
||||||
|
mIntentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
|
||||||
|
|
||||||
|
mInitiateButton = (Button) mContentView.findViewById(R.id.initiate_encrypt);
|
||||||
|
mInitiateButton.setOnClickListener(mInitiateListener);
|
||||||
|
mInitiateButton.setEnabled(false);
|
||||||
|
|
||||||
|
return mContentView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
getActivity().registerReceiver(mIntentReceiver, mIntentFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
getActivity().unregisterReceiver(mIntentReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keyguard validation is run using the standard {@link ConfirmLockPattern}
|
* Keyguard validation is run using the standard {@link ConfirmLockPattern}
|
||||||
@@ -73,8 +144,6 @@ public class CryptKeeperSettings extends Fragment {
|
|||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
String password = data.getStringExtra("password");
|
String password = data.getStringExtra("password");
|
||||||
showFinalConfirmation(password);
|
showFinalConfirmation(password);
|
||||||
} else {
|
|
||||||
establishInitialState();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,45 +154,5 @@ public class CryptKeeperSettings extends Fragment {
|
|||||||
preference.getExtras().putString("password", password);
|
preference.getExtras().putString("password", password);
|
||||||
((PreferenceActivity) getActivity()).onPreferenceStartFragment(null, preference);
|
((PreferenceActivity) getActivity()).onPreferenceStartFragment(null, preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If the user clicks to begin the reset sequence, we next require a
|
|
||||||
* keyguard confirmation if the user has currently enabled one. If there
|
|
||||||
* is no keyguard available, we simply go to the final confirmation prompt.
|
|
||||||
*/
|
|
||||||
private Button.OnClickListener mInitiateListener = new Button.OnClickListener() {
|
|
||||||
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (!runKeyguardConfirmation(KEYGUARD_REQUEST)) {
|
|
||||||
// TODO: Need to request a password
|
|
||||||
// showFinalConfirmation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In its initial state, the activity presents a button for the user to
|
|
||||||
* click in order to initiate a confirmation sequence. This method is
|
|
||||||
* called from various other points in the code to reset the activity to
|
|
||||||
* this base state.
|
|
||||||
*
|
|
||||||
* <p>Reinflating views from resources is expensive and prevents us from
|
|
||||||
* caching widget pointers, so we use a single-inflate pattern: we lazy-
|
|
||||||
* inflate each view, caching all of the widget pointers we'll need at the
|
|
||||||
* time, then simply reuse the inflated views directly whenever we need
|
|
||||||
* to change contents.
|
|
||||||
*/
|
|
||||||
private void establishInitialState() {
|
|
||||||
mInitiateButton = (Button) mContentView.findViewById(R.id.initiate_encrypt);
|
|
||||||
mInitiateButton.setOnClickListener(mInitiateListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
|
|
||||||
mContentView = inflater.inflate(R.layout.crypt_keeper_settings, null);
|
|
||||||
|
|
||||||
establishInitialState();
|
|
||||||
return mContentView;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user