summaryrefslogtreecommitdiffstats
path: root/src/com/android/email/service
diff options
context:
space:
mode:
authorMartin Hibdon <mhibdon@google.com>2014-07-24 23:10:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-24 22:43:15 +0000
commitaaa26e8c3f5c8b56e0a8b5b21916a188c051f737 (patch)
tree35f6aab840c101ff328d5c01850c005cc6f100ee /src/com/android/email/service
parent29180e6b36c5cebf3ac25d4a31877387bc43e44a (diff)
parent74dc106ae9ff3d3a92425b68ea28ee2a0b258e57 (diff)
downloadandroid_packages_apps_Email-aaa26e8c3f5c8b56e0a8b5b21916a188c051f737.tar.gz
android_packages_apps_Email-aaa26e8c3f5c8b56e0a8b5b21916a188c051f737.tar.bz2
android_packages_apps_Email-aaa26e8c3f5c8b56e0a8b5b21916a188c051f737.zip
Merge "Disable Eas Authenticator if Exchange is not installed" into ub-mail-master
Diffstat (limited to 'src/com/android/email/service')
-rw-r--r--src/com/android/email/service/EmailBroadcastProcessorService.java14
-rw-r--r--src/com/android/email/service/EmailServiceUtils.java11
2 files changed, 15 insertions, 10 deletions
diff --git a/src/com/android/email/service/EmailBroadcastProcessorService.java b/src/com/android/email/service/EmailBroadcastProcessorService.java
index b967121ac..5b9ed0f1f 100644
--- a/src/com/android/email/service/EmailBroadcastProcessorService.java
+++ b/src/com/android/email/service/EmailBroadcastProcessorService.java
@@ -316,8 +316,10 @@ public class EmailBroadcastProcessorService extends IntentService {
LogUtils.i(Logging.LOG_TAG, "Onetime initialization: 1");
progress = 1;
if (VendorPolicyLoader.getInstance(this).useAlternateExchangeStrings()) {
- setComponentEnabled(EasAuthenticatorServiceAlternate.class, true);
- setComponentEnabled(EasAuthenticatorService.class, false);
+ EmailServiceUtils.setComponentEnabled(this,
+ EasAuthenticatorServiceAlternate.class, true);
+ EmailServiceUtils.setComponentEnabled(this,
+ EasAuthenticatorService.class, false);
}
}
@@ -367,14 +369,6 @@ public class EmailBroadcastProcessorService extends IntentService {
}
}
- private void setComponentEnabled(Class<?> clazz, boolean enabled) {
- final ComponentName c = new ComponentName(this, clazz.getName());
- getPackageManager().setComponentEnabledSetting(c,
- enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
- : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
- PackageManager.DONT_KILL_APP);
- }
-
private void onSystemAccountChanged() {
LogUtils.i(Logging.LOG_TAG, "System accounts updated.");
reconcileAndStartServices();
diff --git a/src/com/android/email/service/EmailServiceUtils.java b/src/com/android/email/service/EmailServiceUtils.java
index d42b0ee70..cd3d9a4f7 100644
--- a/src/com/android/email/service/EmailServiceUtils.java
+++ b/src/com/android/email/service/EmailServiceUtils.java
@@ -22,6 +22,7 @@ import android.accounts.AccountManagerFuture;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Service;
+import android.content.ComponentName;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentUris;
@@ -29,6 +30,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -727,4 +729,13 @@ public class EmailServiceUtils {
return EmailServiceVersion.CURRENT;
}
}
+
+ public static void setComponentEnabled(final Context context, Class<?> clazz, boolean enabled) {
+ final ComponentName c = new ComponentName(context, clazz.getName());
+ context.getPackageManager().setComponentEnabledSetting(c,
+ enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+ : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ }
+
}