summaryrefslogtreecommitdiffstats
path: root/src/com/android/email/service
diff options
context:
space:
mode:
authorMartin Hibdon <mhibdon@google.com>2014-07-24 15:26:47 -0700
committerMartin Hibdon <mhibdon@google.com>2014-07-24 15:46:15 -0700
commit74dc106ae9ff3d3a92425b68ea28ee2a0b258e57 (patch)
treec10c4abaf2cf65d237dc2bed389c3f0eda9577f8 /src/com/android/email/service
parentae028b6c70f6412f8734859b0a2462bcbb0546d7 (diff)
downloadandroid_packages_apps_Email-74dc106ae9ff3d3a92425b68ea28ee2a0b258e57.tar.gz
android_packages_apps_Email-74dc106ae9ff3d3a92425b68ea28ee2a0b258e57.tar.bz2
android_packages_apps_Email-74dc106ae9ff3d3a92425b68ea28ee2a0b258e57.zip
Disable Eas Authenticator if Exchange is not installed
b/16541219 Change-Id: Ibc2a9608278762e6af4f7c429b08ad38935bfcae
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 54dcdd826..2fec5819b 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;
@@ -708,4 +710,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);
+ }
+
}