mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
Only enable debug logging when running a debuggable build
There have been some complaints from Android developers that get flooded by K-9's log messages when debugging their own apps. Oops :)
This commit is contained in:
parent
0cff0c0fed
commit
6a6bb95ad4
@ -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.");
|
||||
|
Loading…
Reference in New Issue
Block a user