summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml8
-rw-r--r--res/anim/crypt_keeper_exit.xml33
-rw-r--r--res/layout-xlarge-land/crypt_keeper_password_entry.xml88
-rw-r--r--res/layout-xlarge/crypt_keeper_password_entry.xml85
-rw-r--r--res/layout/crypt_keeper_status.xml5
-rw-r--r--res/values/styles.xml12
-rw-r--r--src/com/android/settings/CryptKeeper.java25
7 files changed, 155 insertions, 101 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f822ff652..809e92a24 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1071,7 +1071,7 @@
<activity android:name=".CryptKeeper"
android:immersive="true"
android:launchMode="singleTop"
- android:theme="@android:style/Theme.Holo.NoActionBar"
+ android:theme="@style/CryptKeeperTheme"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter android:priority="10">
<action android:name="android.intent.action.MAIN" />
@@ -1080,6 +1080,12 @@
</intent-filter>
</activity>
+ <activity android:name=".CryptKeeper$Blank"
+ android:immersive="true"
+ android:launchMode="singleTop"
+ android:theme="@style/CryptKeeperBlankTheme"
+ />
+
<!-- Pseudo-activity used to provide an intent-filter entry point to encryption settings -->
<activity android:name="Settings$CryptKeeperSettingsActivity"
android:theme="@android:style/Theme.Holo"
diff --git a/res/anim/crypt_keeper_exit.xml b/res/anim/crypt_keeper_exit.xml
new file mode 100644
index 000000000..3ab34e9a1
--- /dev/null
+++ b/res/anim/crypt_keeper_exit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+ android:interpolator="@android:anim/accelerate_interpolator"
+>
+
+ <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"
+ />
+
+</set>
+
diff --git a/res/layout-xlarge-land/crypt_keeper_password_entry.xml b/res/layout-xlarge-land/crypt_keeper_password_entry.xml
index 76d2278a6..ffbdf8946 100644
--- a/res/layout-xlarge-land/crypt_keeper_password_entry.xml
+++ b/res/layout-xlarge-land/crypt_keeper_password_entry.xml
@@ -20,51 +20,53 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="horizontal"
+ android:orientation="vertical"
>
- <LinearLayout
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:layout_width="0dip"
- android:orientation="vertical"
- android:gravity="center_vertical"
- >
- <include layout="@layout/crypt_keeper_status" />
- </LinearLayout>
-
- <!-- right side: password -->
- <LinearLayout
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_weight="1"
- android:gravity="center">
- <!-- Password entry field -->
- <EditText android:id="@+id/passwordEntry"
- 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"
- android:textSize="24sp"
- android:layout_marginTop="120dip"
- android:layout_marginBottom="5dip"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="#ffffffff"
- android:editable="false"
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ >
+ <!-- left side: status -->
+ <include layout="@layout/crypt_keeper_status"
+ 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"
/>
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
- android:layout_width="450dip"
- android:layout_height="230dip"
- android:background="#00000000"
- android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
- android:visibility="visible"
- />
-
- </LinearLayout>
-
+ <!-- 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: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"
+ />
+
+ </RelativeLayout>
+
+ <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#00000000"
+ android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
+ android:visibility="visible"
+ />
+
</LinearLayout> \ No newline at end of file
diff --git a/res/layout-xlarge/crypt_keeper_password_entry.xml b/res/layout-xlarge/crypt_keeper_password_entry.xml
index 4dce67adf..b67eed034 100644
--- a/res/layout-xlarge/crypt_keeper_password_entry.xml
+++ b/res/layout-xlarge/crypt_keeper_password_entry.xml
@@ -17,52 +17,49 @@
*/
-->
-<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"
+ android:gravity="center_horizontal"
>
- <LinearLayout
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:orientation="vertical"
- android:gravity="center_vertical"
- >
- <include layout="@layout/crypt_keeper_status" />
- </LinearLayout>
-
- <!-- right side: password -->
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:gravity="center">
- <!-- Password entry field -->
- <EditText android:id="@+id/passwordEntry"
- 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"
- android:textSize="24sp"
- android:layout_marginTop="120dip"
- android:layout_marginBottom="5dip"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="#ffffffff"
- android:editable="false"
- />
+ <!-- left side: status -->
+ <include layout="@layout/crypt_keeper_status"
+ 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"
+ />
- <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
- android:layout_width="450dip"
- android:layout_height="230dip"
- android:background="#00000000"
- android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
- android:visibility="visible"
- />
-
- </LinearLayout>
-
-</LinearLayout> \ No newline at end of file
+ <!-- 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"
+ />
+
+ <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"
+ />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/res/layout/crypt_keeper_status.xml b/res/layout/crypt_keeper_status.xml
index ba2584f5b..d106c6945 100644
--- a/res/layout/crypt_keeper_status.xml
+++ b/res/layout/crypt_keeper_status.xml
@@ -23,10 +23,7 @@
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginLeft="140dip"
- android:layout_marginTop="20dip"
- android:gravity="left"
- >
+>
<com.android.internal.widget.DigitalClock android:id="@+id/time"
android:layout_width="wrap_content"
diff --git a/res/values/styles.xml b/res/values/styles.xml
index a49cd0a04..8a11a6502 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -120,4 +120,16 @@
<item name="android:windowNoTitle">true</item>
<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>
</resources>
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 3917b76e6..5afc3f614 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -57,6 +57,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
private static final int COOL_DOWN_ATTEMPTS = 10;
private static final int COOL_DOWN_INTERVAL = 30; // 30 seconds
+ // This activity is used to fade the screen to black after the password is entered.
+ public static class Blank extends Activity {
+ }
private Handler mHandler = new Handler() {
@Override
@@ -103,7 +106,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
}
};
- private int mFailedAttempts = 0;
private int mCooldown;
@Override
@@ -143,7 +145,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
// is encrypted.
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
+ PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG);
wakeLock.acquire();
@@ -192,15 +194,20 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
IMountService service = getMountService();
try {
- service.decryptStorage(password);
-
- if (mFailedAttempts == 0) {
- // Success. Do something here within 2 seconds
-
- } else if (mFailedAttempts == MAX_FAILED_ATTEMPTS) {
+ int failedAttempts = service.decryptStorage(password);
+
+ if (failedAttempts == 0) {
+ // The password was entered successfully. Start the Blank activity
+ // so this activity animates to black before the devices starts. Note
+ // It has 1 second to complete the animation or it will be frozen
+ // until the boot animation comes back up.
+ Intent intent = new Intent(this, Blank.class);
+ finish();
+ startActivity(intent);
+ } else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
- } else if ((mFailedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
+ } else if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
mCooldown = COOL_DOWN_INTERVAL;
EditText passwordEntry = (EditText) findViewById(R.id.passwordEntry);
passwordEntry.setEnabled(false);