Show OwnerInfo on CryptKeeper screen
Depends on framework change from
https://googleplex-android-review.git.corp.google.com/#/c/435138/
Bug 13526708
Change-Id: I16189b629b5515ec5175e05155ba4ec0c27d22fb
diff --git a/res/layout/crypt_keeper_status.xml b/res/layout/crypt_keeper_status.xml
index c7264be..39e64b0 100644
--- a/res/layout/crypt_keeper_status.xml
+++ b/res/layout/crypt_keeper_status.xml
@@ -37,4 +37,17 @@
android:text="@string/enter_password"
android:drawableLeft="@*android:drawable/ic_lock_idle_lock"
/>
+ <TextView
+ android:id="@+id/owner_info"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dip"
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:marqueeRepeatLimit ="marquee_forever"
+ android:scrollHorizontally="true"
+ android:gravity="center"
+ android:textSize="16sp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ />
</LinearLayout>
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 8050c47..1efe98f 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -367,23 +367,39 @@
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
- final IMountService service = getMountService();
- int type = StorageManager.CRYPT_TYPE_PASSWORD;
- try {
- type = service.getPasswordType();
- } catch (Exception e) {
- Log.e(TAG, "Error while getting type - showing default dialog" + e);
- }
+ new AsyncTask<Void, Void, Void>() {
+ int type = StorageManager.CRYPT_TYPE_PASSWORD;
+ String owner_info;
- if(type == StorageManager.CRYPT_TYPE_PIN) {
- setContentView(R.layout.crypt_keeper_pin_entry);
- } else if (type == StorageManager.CRYPT_TYPE_PATTERN) {
- setContentView(R.layout.crypt_keeper_pattern_entry);
- setBackFunctionality(false);
- } else {
- setContentView(R.layout.crypt_keeper_password_entry);
- }
- passwordEntryInit();
+ @Override
+ public Void doInBackground(Void... v) {
+ try {
+ final IMountService service = getMountService();
+ type = service.getPasswordType();
+ owner_info = service.getField("OwnerInfo");
+ } catch (Exception e) {
+ Log.e(TAG, "Error calling mount service " + e);
+ }
+
+ return null;
+ }
+
+ @Override
+ public void onPostExecute(java.lang.Void v) {
+ if(type == StorageManager.CRYPT_TYPE_PIN) {
+ setContentView(R.layout.crypt_keeper_pin_entry);
+ } else if (type == StorageManager.CRYPT_TYPE_PATTERN) {
+ setContentView(R.layout.crypt_keeper_pattern_entry);
+ setBackFunctionality(false);
+ } else {
+ setContentView(R.layout.crypt_keeper_password_entry);
+ }
+
+ final TextView status = (TextView) findViewById(R.id.owner_info);
+ status.setText(owner_info);
+ passwordEntryInit();
+ }
+ }.execute();
} else if (!mValidationRequested) {
// We're supposed to be encrypted, but no validation has been done.
new ValidationTask().execute((Void[]) null);