Don't use implicit events

Bug: 10189773
Change-Id: I4579f2e465bd23b8ab4cdf291bfbe80cf6518328
This commit is contained in:
Paul Westbrook 2013-08-28 14:31:09 -07:00
parent 2ad2f0d145
commit e4ac06080b
5 changed files with 21 additions and 10 deletions

View File

@ -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);

View File

@ -24,6 +24,7 @@
<attr name="accountType" format="string"/>
<attr name="serviceClass" format="string"/>
<attr name="intent" format="string"/>
<attr name="intentPackage" format="string"/>
<attr name="port" format="integer"/>
<attr name="portSsl" format="integer"/>
<attr name="defaultSsl" format="boolean"/>

View File

@ -807,7 +807,8 @@
<string name="account_manager_type_pop3" translatable="false">com.android.email</string>
<string name="account_manager_type_imap" translatable="false">com.android.email</string>
<string name="account_manager_type_legacy_imap" translatable="false">com.android.email</string>
<string name="intent_exchange" translatable="false">com.android.email.EXCHANGE_INTENT</string>
<string name="intent_exchange_action" translatable="false">com.android.email.EXCHANGE_INTENT</string>
<string name="intent_exchange_package" translatable="false">com.android.exchange</string>
<string name="intent_account_manager_entry" translatable="false">com.android.email.activity.setup.ACCOUNT_MANAGER_ENTRY</string>
<string name="authority_email_provider" translatable="false">com.android.email.provider</string>
<string name="protocol_legacy_imap" translatable="false">imap</string>

View File

@ -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"

View File

@ -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<? extends Service> 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);