summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Hibdon <mhibdon@google.com>2014-10-02 13:20:30 -0700
committerMartin Hibdon <mhibdon@google.com>2014-10-02 15:29:04 -0700
commit065bc58e1c3052d658109d8ad1321bf57edf3d23 (patch)
treeede50fa16a409c8eba4e34184e2aa8d1b304d7d8 /src
parent40038a7f263c5463f8a0c08ffa21111b3e483694 (diff)
downloadandroid_packages_apps_Exchange-065bc58e1c3052d658109d8ad1321bf57edf3d23.tar.gz
android_packages_apps_Exchange-065bc58e1c3052d658109d8ad1321bf57edf3d23.tar.bz2
android_packages_apps_Exchange-065bc58e1c3052d658109d8ad1321bf57edf3d23.zip
Persist debug state in Exchange
Prior to this, any time Exchange went down it would lose its debug state, and could only be restored by the user going back to the debug screen and toggling something. Change-Id: I8960ee1afe9f27922249a6a94948a767dd56d49a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/exchange/service/EasService.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/exchange/service/EasService.java b/src/com/android/exchange/service/EasService.java
index 73f3265d..2db804a7 100644
--- a/src/com/android/exchange/service/EasService.java
+++ b/src/com/android/exchange/service/EasService.java
@@ -20,6 +20,7 @@ import android.app.Service;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -68,6 +69,10 @@ public class EasService extends Service {
private static final String TAG = Eas.LOG_TAG;
+ private static final String PREFERENCES_FILE = "ExchangePrefs";
+ private static final String PROTOCOL_LOGGING_PREF = "ProtocolLogging";
+ private static final String FILE_LOGGING_PREF = "FileLogging";
+
public static final String EXTRA_START_PING = "START_PING";
public static final String EXTRA_PING_ACCOUNT = "PING_ACCOUNT";
@@ -217,7 +222,11 @@ public class EasService extends Service {
// be turned off.
sProtocolLogging = ((flags & EmailServiceProxy.DEBUG_EXCHANGE_BIT) != 0);
sFileLogging = ((flags & EmailServiceProxy.DEBUG_FILE_BIT) != 0);
- LogUtils.d(TAG, "IEmailService.setLogging %d", flags);
+ SharedPreferences sharedPrefs = EasService.this.getSharedPreferences(PREFERENCES_FILE,
+ Context.MODE_PRIVATE);
+ sharedPrefs.edit().putBoolean(PROTOCOL_LOGGING_PREF, sProtocolLogging).apply();
+ sharedPrefs.edit().putBoolean(FILE_LOGGING_PREF, sFileLogging).apply();
+ LogUtils.d(TAG, "IEmailService.setLogging %d, storing to shared pref", flags);
}
@Override
@@ -283,8 +292,6 @@ public class EasService extends Service {
public EasService() {
super();
mSynchronizer = new PingSyncSynchronizer(this);
- sProtocolLogging = false;
- sFileLogging = false;
}
@Override
@@ -298,7 +305,10 @@ public class EasService extends Service {
CalendarContract.AUTHORITY,
ContactsContract.AUTHORITY
};
-
+ SharedPreferences sharedPrefs = EasService.this.getSharedPreferences(PREFERENCES_FILE,
+ Context.MODE_PRIVATE);
+ sProtocolLogging = sharedPrefs.getBoolean(PROTOCOL_LOGGING_PREF, false);
+ sFileLogging = sharedPrefs.getBoolean(FILE_LOGGING_PREF, false);
// Restart push for all accounts that need it. Because this requires DB loads, we do it in
// an AsyncTask, and we startService to ensure that we stick around long enough for the
// task to complete. The task will stop the service if necessary after it's done.