mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 10:22:15 -05:00
Enable Strict Mode when a new "developer mode" is enabled and we're running on 2.3 or newer
This commit is contained in:
parent
0b3dc2840b
commit
c49a856046
@ -88,6 +88,14 @@ public class K9 extends Application
|
||||
public static final String logFile = null;
|
||||
//public static final String logFile = Environment.getExternalStorageDirectory() + "/k9mail/debug.log";
|
||||
|
||||
/**
|
||||
* If this is enabled, various development settings will be enabled
|
||||
* It should NEVER be on for Market builds
|
||||
* Right now, it just governs strictmode
|
||||
**/
|
||||
public static boolean DEVELOPER_MODE = true;
|
||||
|
||||
|
||||
/**
|
||||
* If this is enabled there will be additional logging information sent to
|
||||
* Log.d, including protocol dumps.
|
||||
@ -456,9 +464,11 @@ public class K9 extends Application
|
||||
@Override
|
||||
public void onCreate()
|
||||
{
|
||||
maybeSetupStrictMode();
|
||||
super.onCreate();
|
||||
app = this;
|
||||
|
||||
|
||||
galleryBuggy = checkForBuggyGallery();
|
||||
|
||||
Preferences prefs = Preferences.getPreferences(this);
|
||||
@ -591,6 +601,27 @@ public class K9 extends Application
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
private void maybeSetupStrictMode()
|
||||
{
|
||||
if (!K9.DEVELOPER_MODE)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Class strictMode = Class.forName("android.os.StrictMode");
|
||||
Method enableDefaults = strictMode.getMethod("enableDefaults");
|
||||
enableDefaults.invoke(strictMode);
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
// Discard , as it means we're not running on a device with strict mode
|
||||
Log.v(K9.LOG_TAG, "Failed to turn on strict mode "+e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* since Android invokes Application.onCreate() only after invoking all
|
||||
* other components' onCreate(), here is a way to notify interested
|
||||
|
Loading…
Reference in New Issue
Block a user