am 4c865846: Don\'t return a protocol for a null account type

* commit '4c865846856cd7530fb51e244a9971a3d5e1fcd8':
  Don't return a protocol for a null account type
This commit is contained in:
Tony Mantler 2014-08-07 22:55:27 +00:00 committed by Android Git Automerger
commit 428ebd7260

View File

@ -46,6 +46,7 @@ import android.provider.CalendarContract.SyncState;
import android.provider.ContactsContract;
import android.provider.ContactsContract.RawContacts;
import android.provider.SyncStateContract;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import com.android.email.R;
@ -651,8 +652,11 @@ public class EmailServiceUtils {
* @param accountType sync adapter service name
* @return protocol name or null
*/
public static String getProtocolFromAccountType(final Context context,
public static @Nullable String getProtocolFromAccountType(final Context context,
final String accountType) {
if (TextUtils.isEmpty(accountType)) {
return null;
}
final Map <String, EmailServiceInfo> serviceInfoMap = getServiceMap(context);
String protocol = null;
for (final EmailServiceInfo info : serviceInfoMap.values()) {