am 13d62049: More CryptKeeper UI work.

* commit '13d62049f7c96c47356f23eaee7f0997612fdf9f':
  More CryptKeeper UI work.
This commit is contained in:
Andy Stadler
2011-01-31 20:01:16 -08:00
committed by Android Git Automerger
21 changed files with 218 additions and 115 deletions

View File

@@ -1079,7 +1079,7 @@
<activity android:name=".CryptKeeper"
android:immersive="true"
android:launchMode="singleTop"
android:theme="@style/CryptKeeperTheme"
android:theme="@android:style/Theme.Holo.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter android:priority="10">
<action android:name="android.intent.action.MAIN" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

View File

@@ -16,57 +16,67 @@
** limitations under the License.
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="206dip"
>
<!-- left side: status -->
<include layout="@layout/crypt_keeper_status"
<ImageView android:id="@+id/encroid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="102dip"
android:layout_marginTop="20dip"
android:gravity="left"
android:paddingTop="50dip"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/encroid_resignin"
/>
<TextView android:id="@+id/passwordLabel"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/encroid"
android:layout_marginTop="37dip"
android:paddingRight="17dip"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/crypt_keeper_enter_password"
/>
<!-- Password entry field -->
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
android:layout_width="450dip"
android:layout_marginRight="155dip"
android:layout_alignParentRight="true"
android:layout_width="320dip"
android:layout_toRightOf="@+id/passwordLabel"
android:layout_marginTop="26dip"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
android:gravity="center"
android:layout_gravity="center"
android:textSize="24sp"
android:layout_marginTop="120dip"
android:layout_marginBottom="5dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffffff"
android:editable="false"
/>
<TextView android:id="@+id/status"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/passwordLabel"
android:layout_below="@+id/passwordEntry"
android:paddingTop="8dip"
android:singleLine="true"
android:textSize="17sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:drawableLeft="@*android:drawable/ic_lock_idle_lock"
android:visibility="gone"
/>
</RelativeLayout>
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#00000000"
android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
android:visibility="visible"
/>
</LinearLayout>
</RelativeLayout>

View File

@@ -16,42 +16,59 @@
** limitations under the License.
*/
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
>
<!-- left side: status -->
<include layout="@layout/crypt_keeper_status"
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="134dip"
android:paddingTop="50dip"
android:layout_alignParentTop="true"
android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
/>
android:layout_marginTop="318dip"
>
<ImageView android:id="@+id/encroid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="@drawable/encroid_resignin"
/>
<!-- Password entry field -->
<EditText android:id="@+id/passwordEntry"
android:layout_above="@id/keyboard"
android:layout_height="wrap_content"
android:layout_width="450dip"
android:singleLine="true"
android:textStyle="normal"
android:inputType="textPassword"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:textSize="24sp"
android:layout_marginTop="120dip"
android:layout_marginBottom="5dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffffff"
android:editable="false"
/>
<TextView android:id="@+id/passwordLabel"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/encroid"
android:layout_marginTop="37dip"
android:paddingRight="17dip"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/crypt_keeper_enter_password"
/>
<!-- Password entry field -->
<EditText android:id="@+id/passwordEntry"
android:layout_height="wrap_content"
android:layout_width="320dip"
android:layout_toRightOf="@+id/passwordLabel"
android:layout_marginTop="26dip"
android:singleLine="true"
android:inputType="textPassword"
android:textAppearance="?android:attr/textAppearanceMedium"
android:editable="false"
/>
<TextView android:id="@+id/status"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/passwordLabel"
android:layout_below="@+id/passwordEntry"
android:paddingTop="8dip"
android:singleLine="true"
android:textSize="17sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:drawableLeft="@*android:drawable/ic_lock_idle_lock"
android:visibility="gone"
/>
</RelativeLayout>
<com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
android:layout_width="match_parent"

View File

@@ -14,24 +14,33 @@
limitations under the License.
-->
<LinearLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="154dip"
android:paddingLeft="128dip"
android:paddingRight="128dip"
android:paddingBottom="0dip"
android:orientation="vertical"
android:background="@drawable/encryption_bg_waiting"
android:paddingBottom="16dip"
>
<ImageView
android:id="@+id/encroid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:paddingRight="65dip"
android:src="@drawable/encroid_waiting"
/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="48dip"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dip"
android:textSize="30dip"
android:textColor="#ff99cc00"
@@ -44,6 +53,7 @@
android:id="@+id/top_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
>
<ProgressBar
android:id="@+id/progress_bar"
@@ -56,13 +66,37 @@
<TextView
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_below="@+id/top_divider"
android:paddingLeft="152dip"
android:paddingTop="21dip"
android:textSize="18dip"
android:textColor="#ffffffff"
android:text="@string/crypt_keeper_setup_description"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
</LinearLayout>
<!-- Divider -->
<RelativeLayout
android:id="@+id/bottom_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="152dip"
android:layout_above="@+id/factory_reset"
android:visibility="gone"
>
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
/>
</RelativeLayout>
<Button
android:id="@+id/factory_reset"
android:layout_width="208dip"
android:layout_height="48dip"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="80dip"
android:text="@string/master_clear_button_text"
android:visibility="gone"
/>
</RelativeLayout>

View File

@@ -5,29 +5,28 @@
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
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.
-->
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical"
>
<scale
android:fromXScale="1.0"
android:toXScale="0.0"
android:fromYScale="1.0"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false"
android:duration="500"
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/encroid_progress"
/>
</set>
</LinearLayout>

View File

@@ -111,7 +111,6 @@
<!-- Title for a notification shown. -->
<string name="sdcard_setting" product="default">SD card</string>
<!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="battery_info_status_label">Battery status:</string>
<!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
@@ -141,7 +140,6 @@
<!-- Battery Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="battery_info_screen_on">Screen ON time:</string>
<!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="battery_info_status_unknown">Unknown</string>
<!-- Battery Info screen. Value for a status item. Used for diagnostic info screens, precise translation isn't needed -->
@@ -493,7 +491,6 @@
<!-- Main Settings screen settings summary text for the "Wireless controls" setting -->
<string name="radio_controls_summary">Manage Wi-Fi, Bluetooth, airplane mode, mobile networks, &amp; VPNs</string>
<!-- mobile network settings screen, setting check box title -->
<string name="roaming">Data roaming</string>
<!-- mobile network settings screen, setting option summary text when check box is selected -->
@@ -659,9 +656,29 @@
<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 -->
<!-- Informational text on the password entry screen when password entry fails-->
<string name="crypt_keeper_cooldown">Try again in ^1 seconds.</string>
<!-- Informational text on the password entry screen prompting the user for their password -->
<string name="crypt_keeper_enter_password">Enter your password</string>
<!-- Title of the encryption screen when encrypting the device failed -->
<string name="crypt_keeper_failed_title">Encryption failed</string>
<!-- Informational text when encryption fails -->
<string name="crypt_keeper_failed_summary" product="tablet">
Encryption was interrupted and can\'t complete. You must perform a factory data reset (erasing
all your data) before you can resume using your tablet. You can try encrypting your tablet
again after the reset is complete.
</string>
<!-- Informational text when encryption fails -->
<string name="crypt_keeper_failed_summary" product="default">
Encryption was interrupted and can\'t complete. You must perform a factory data reset (erasing
all your data) before you can resume using your phone. You can try encrypting your phone
again after the reset is complete.
</string>
<!-- Unlock Picker Settings --><skip />
<!-- Security Picker --><skip />
@@ -1160,7 +1177,6 @@
<!-- Default access point SSID used for tethering -->
<string name="wifi_tether_configure_ssid_default">AndroidHotspot</string>
<!-- Do not translate. Used for diagnostic screens, precise translation is not necessary
Wi-Fi Testing on the diagnostic screen-->
<string name="testing_wifi_info" translatable="false">Wifi information</string>

View File

@@ -121,18 +121,10 @@
<item name="android:windowIsFloating">true</item>
</style>
<style name="CryptKeeperTheme" parent="@android:style/Theme.Holo.NoActionBar">
<item name="android:windowAnimationStyle">@style/CryptKeeperAnimation</item>
</style>
<style name="CryptKeeperBlankTheme" parent="@android:style/Theme.Holo.NoActionBar">
<item name="android:background">#ff000000</item>
</style>
<style name="CryptKeeperAnimation">
<item name="android:windowExitAnimation">@anim/crypt_keeper_exit</item>
</style>
<style name="SecurityPreferenceButtonContainer" parent="@android:style/Holo.SegmentedButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>

View File

@@ -35,16 +35,16 @@ import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.storage.IMountService;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import java.util.Date;
public class CryptKeeper extends Activity implements TextView.OnEditorActionListener {
private static final String TAG = "CryptKeeper";
@@ -59,6 +59,11 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
// This activity is used to fade the screen to black after the password is entered.
public static class Blank extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.crypt_keeper_blank);
}
}
private Handler mHandler = new Handler() {
@@ -105,9 +110,12 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
// Disable the status bar
StatusBarManager sbm = (StatusBarManager) getSystemService(Context.STATUS_BAR_SERVICE);
sbm.disable(StatusBarManager.DISABLE_EXPAND | StatusBarManager.DISABLE_NOTIFICATION_ICONS
sbm.disable(StatusBarManager.DISABLE_EXPAND
| StatusBarManager.DISABLE_NOTIFICATION_ICONS
| StatusBarManager.DISABLE_NOTIFICATION_ALERTS
| StatusBarManager.DISABLE_SYSTEM_INFO | StatusBarManager.DISABLE_NAVIGATION);
| StatusBarManager.DISABLE_SYSTEM_INFO
| StatusBarManager.DISABLE_NAVIGATION
| StatusBarManager.DISABLE_BACK);
}
@Override
@@ -139,9 +147,38 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
updateProgress();
}
private void showFactoryReset() {
// Hide the encryption-bot to make room for the "factory reset" button
findViewById(R.id.encroid).setVisibility(View.GONE);
// Show the reset button, failure text, and a divider
Button button = (Button) findViewById(R.id.factory_reset);
button.setVisibility(View.VISIBLE);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
}
});
TextView tv = (TextView) findViewById(R.id.title);
tv.setText(R.string.crypt_keeper_failed_title);
tv = (TextView) findViewById(R.id.status);
tv.setText(R.string.crypt_keeper_failed_summary);
View view = findViewById(R.id.bottom_divider);
view.setVisibility(View.VISIBLE);
}
private void updateProgress() {
String state = SystemProperties.get("vold.encrypt_progress");
if ("error_partially_encrypted".equals(state)) {
showFactoryReset();
return;
}
int progress = 0;
try {
progress = Integer.parseInt(state);
@@ -160,16 +197,18 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
private void cooldown() {
TextView tv = (TextView) findViewById(R.id.status);
if (mCooldown <= 0) {
// Re-enable the password entry
EditText passwordEntry = (EditText) findViewById(R.id.passwordEntry);
passwordEntry.setEnabled(true);
tv.setText(R.string.try_again);
tv.setVisibility(View.GONE);
} else {
CharSequence tempalte = getText(R.string.crypt_keeper_cooldown);
tv.setText(TextUtils.expandTemplate(tempalte, Integer.toString(mCooldown)));
CharSequence template = getText(R.string.crypt_keeper_cooldown);
tv.setText(TextUtils.expandTemplate(template, Integer.toString(mCooldown)));
tv.setVisibility(View.VISIBLE);
mCooldown--;
mHandler.removeMessages(COOLDOWN);
@@ -186,14 +225,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
PasswordEntryKeyboardHelper keyboardHelper = new PasswordEntryKeyboardHelper(this,
keyboardView, passwordEntry, false);
keyboardHelper.setKeyboardMode(PasswordEntryKeyboardHelper.KEYBOARD_MODE_ALPHA);
passwordEntry.setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_lock_idle_lock,
0, 0, 0);
String dateFormatString = getString(com.android.internal.R.string.full_wday_month_day_no_year);
TextView date = (TextView) findViewById(R.id.date);
date.setText(DateFormat.format(dateFormatString, new Date()));
}
private IMountService getMountService() {
@@ -240,6 +271,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
} else {
TextView tv = (TextView) findViewById(R.id.status);
tv.setText(R.string.try_again);
tv.setVisibility(View.VISIBLE);
}
} catch (Exception e) {
Log.e(TAG, "Error while decrypting...", e);

View File

@@ -41,6 +41,8 @@ public class CryptKeeperConfirm extends Fragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.crypt_keeper_blank);
if (Utils.isMonkeyRunning()) {
finish();
}
@@ -50,7 +52,8 @@ public class CryptKeeperConfirm extends Fragment {
| StatusBarManager.DISABLE_NOTIFICATION_ICONS
| StatusBarManager.DISABLE_NOTIFICATION_ALERTS
| StatusBarManager.DISABLE_SYSTEM_INFO
| StatusBarManager.DISABLE_NAVIGATION);
| StatusBarManager.DISABLE_NAVIGATION
| StatusBarManager.DISABLE_BACK);
// Post a delayed message in 700 milliseconds to enable encryption.
// NOTE: The animation on this activity is set for 500 milliseconds