diff --git a/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java b/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java index e97e7401e..447eb6c22 100644 --- a/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java +++ b/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java @@ -94,10 +94,6 @@ public class EmailServiceProxy extends ServiceProxy implements IEmailService { isRemote = true; } - public EmailServiceProxy(Context _context, String _action) { - this(_context, new Intent(_action)); - } - @Override public void onConnected(IBinder binder) { mService = IEmailService.Stub.asInterface(binder); diff --git a/res/values/attrs.xml b/res/values/attrs.xml index d2011aac8..a438b1bcf 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -24,6 +24,7 @@ + diff --git a/res/values/strings.xml b/res/values/strings.xml index 2bf5e9b47..22f7d991e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -807,7 +807,8 @@ com.android.email com.android.email com.android.email - com.android.email.EXCHANGE_INTENT + com.android.email.EXCHANGE_INTENT + com.android.exchange com.android.email.activity.setup.ACCOUNT_MANAGER_ENTRY com.android.email.provider imap diff --git a/res/xml/services.xml b/res/xml/services.xml index a1780e585..096f81a4c 100644 --- a/res/xml/services.xml +++ b/res/xml/services.xml @@ -88,7 +88,8 @@ email:protocol="@string/protocol_eas" email:name="Exchange" email:accountType="@string/account_manager_type_exchange" - email:intent="com.android.email.EXCHANGE_INTENT" + email:intent="@string/intent_exchange_action" + email:intentPackage="@string/intent_exchange_package" email:port="80" email:portSsl="443" email:syncIntervalStrings="@array/account_settings_check_frequency_entries_push" diff --git a/src/com/android/email/service/EmailServiceUtils.java b/src/com/android/email/service/EmailServiceUtils.java index 7f7edd48d..74e0152a8 100644 --- a/src/com/android/email/service/EmailServiceUtils.java +++ b/src/com/android/email/service/EmailServiceUtils.java @@ -75,7 +75,8 @@ public class EmailServiceUtils { public static void startService(Context context, String protocol) { EmailServiceInfo info = getServiceInfo(context, protocol); if (info != null && info.intentAction != null) { - context.startService(new Intent(info.intentAction)); + final Intent serviceIntent = getServiceIntent(info); + context.startService(serviceIntent); } } @@ -85,7 +86,8 @@ public class EmailServiceUtils { public static void startRemoteServices(Context context) { for (EmailServiceInfo info: getServiceInfoList(context)) { if (info.intentAction != null) { - context.startService(new Intent(info.intentAction)); + final Intent serviceIntent = getServiceIntent(info); + context.startService(serviceIntent); } } } @@ -128,7 +130,14 @@ public class EmailServiceUtils { EmailServiceInfo info = getServiceInfo(context, protocol); if (info == null) return false; if (info.klass != null) return true; - return new EmailServiceProxy(context, info.intentAction).test(); + final Intent serviceIntent = getServiceIntent(info); + return new EmailServiceProxy(context, serviceIntent).test(); + } + + private static Intent getServiceIntent(EmailServiceInfo info) { + final Intent serviceIntent = new Intent(info.intentAction); + serviceIntent.setPackage(info.intentPackage); + return serviceIntent; } /** @@ -151,6 +160,7 @@ public class EmailServiceUtils { public String accountType; Class klass; String intentAction; + String intentPackage; public int port; public int portSsl; public boolean defaultSsl; @@ -205,7 +215,8 @@ public class EmailServiceUtils { if (info.klass != null) { return new EmailServiceProxy(context, info.klass); } else { - return new EmailServiceProxy(context, info.intentAction); + final Intent serviceIntent = getServiceIntent(info); + return new EmailServiceProxy(context, serviceIntent); } } @@ -456,6 +467,7 @@ public class EmailServiceUtils { info.hide = ta.getBoolean(R.styleable.EmailServiceInfo_hide, false); final String klass = ta.getString(R.styleable.EmailServiceInfo_serviceClass); info.intentAction = ta.getString(R.styleable.EmailServiceInfo_intent); + info.intentPackage = ta.getString(R.styleable.EmailServiceInfo_intentPackage); info.defaultSsl = ta.getBoolean(R.styleable.EmailServiceInfo_defaultSsl, false); info.port = ta.getInteger(R.styleable.EmailServiceInfo_port, 0); info.portSsl = ta.getInteger(R.styleable.EmailServiceInfo_portSsl, 0);