diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index 5b1589552..741eea217 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -16,6 +16,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; +import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; @@ -179,6 +180,10 @@ public class K9 extends Application { */ private static SharedPreferences sDatabaseVersionCache; + /** + * {@code true} if this is a debuggable build. + */ + private static boolean sIsDebuggable; private static boolean mAnimations = true; @@ -543,6 +548,8 @@ public class K9 extends Application { galleryBuggy = checkForBuggyGallery(); + sIsDebuggable = ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0); + checkCachedDatabaseVersion(); Preferences prefs = Preferences.getPreferences(this); @@ -667,7 +674,7 @@ 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 (!DEBUG && sIsDebuggable && 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.");