From a9bc41f5ecea991d06b88ce861a412288303e9dd Mon Sep 17 00:00:00 2001 From: Andy Stadler Date: Tue, 28 Sep 2010 20:15:54 -0700 Subject: [PATCH] Show server name instead of account name The format string "The server %s requires that you allow it to remotely control some security features of your phone." was being displayed with the account name instead of the server name. Bug: 3011124 Change-Id: I1aadb5790297777831dd69f04ea89641240b7b87 --- .../email/activity/setup/AccountSecurity.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/com/android/email/activity/setup/AccountSecurity.java b/src/com/android/email/activity/setup/AccountSecurity.java index 68bdbc498..e184c9fc1 100644 --- a/src/com/android/email/activity/setup/AccountSecurity.java +++ b/src/com/android/email/activity/setup/AccountSecurity.java @@ -19,6 +19,7 @@ package com.android.email.activity.setup; import com.android.email.R; import com.android.email.SecurityPolicy; import com.android.email.provider.EmailContent.Account; +import com.android.email.provider.EmailContent.HostAuth; import android.app.Activity; import android.app.admin.DevicePolicyManager; @@ -71,16 +72,21 @@ public class AccountSecurity extends Activity { if (account.mSecurityFlags != 0) { // This account wants to control security if (!security.isActiveAdmin()) { - // try to become active - must happen here in this activity, to get result - Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); - intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, - security.getAdminComponent()); - intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, - this.getString(R.string.account_security_policy_explanation_fmt, - account.getDisplayName())); - startActivityForResult(intent, REQUEST_ENABLE); - // keep this activity on stack to process result - return; + // retrieve name of server for the format string + HostAuth hostAuth = + HostAuth.restoreHostAuthWithId(this, account.mHostAuthKeyRecv); + if (hostAuth != null) { + // try to become active - must happen here in activity, to get result + Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); + intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, + security.getAdminComponent()); + intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, + this.getString(R.string.account_security_policy_explanation_fmt, + hostAuth.mAddress)); + startActivityForResult(intent, REQUEST_ENABLE); + // keep this activity on stack to process result + return; + } } else { // already active - try to set actual policies, finish, and return setActivePolicies();