1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Enable K9.DEBUG if a debugger is attached.

Allows debugging to be enabled from the get-go on fresh installs before we can get to the preference screen.
This commit is contained in:
Andrew Chen 2012-12-21 18:00:42 -08:00
parent c63a756500
commit b0171c69aa

View File

@ -20,6 +20,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Debug;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
@ -646,6 +647,11 @@ public class K9 extends Application {
public static void loadPrefs(Preferences prefs) {
SharedPreferences sprefs = prefs.getPreferences();
DEBUG = sprefs.getBoolean("enableDebugLogging", false);
if (!DEBUG && Debug.isDebuggerConnected()) {
// If the debugger is attached, we're probably (surprise surprise) debugging something.
DEBUG = true;
Log.i(K9.LOG_TAG, "Debugger attached; enabling debug logging.");
}
DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false);
mAnimations = sprefs.getBoolean("animations", true);
mGesturesEnabled = sprefs.getBoolean("gesturesEnabled", false);