mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-11 20:50:19 -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
5fd0894c31
commit
fc77bf6029
@ -16,6 +16,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
@ -179,6 +180,10 @@ public class K9 extends Application {
|
|||||||
*/
|
*/
|
||||||
private static SharedPreferences sDatabaseVersionCache;
|
private static SharedPreferences sDatabaseVersionCache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code true} if this is a debuggable build.
|
||||||
|
*/
|
||||||
|
private static boolean sIsDebuggable;
|
||||||
|
|
||||||
private static boolean mAnimations = true;
|
private static boolean mAnimations = true;
|
||||||
|
|
||||||
@ -543,6 +548,8 @@ public class K9 extends Application {
|
|||||||
|
|
||||||
galleryBuggy = checkForBuggyGallery();
|
galleryBuggy = checkForBuggyGallery();
|
||||||
|
|
||||||
|
sIsDebuggable = ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
|
||||||
|
|
||||||
checkCachedDatabaseVersion();
|
checkCachedDatabaseVersion();
|
||||||
|
|
||||||
Preferences prefs = Preferences.getPreferences(this);
|
Preferences prefs = Preferences.getPreferences(this);
|
||||||
@ -667,7 +674,7 @@ public class K9 extends Application {
|
|||||||
public static void loadPrefs(Preferences prefs) {
|
public static void loadPrefs(Preferences prefs) {
|
||||||
SharedPreferences sprefs = prefs.getPreferences();
|
SharedPreferences sprefs = prefs.getPreferences();
|
||||||
DEBUG = sprefs.getBoolean("enableDebugLogging", false);
|
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.
|
// If the debugger is attached, we're probably (surprise surprise) debugging something.
|
||||||
DEBUG = true;
|
DEBUG = true;
|
||||||
Log.i(K9.LOG_TAG, "Debugger attached; enabling debug logging.");
|
Log.i(K9.LOG_TAG, "Debugger attached; enabling debug logging.");
|
||||||
|
Loading…
Reference in New Issue
Block a user