Merge "StrictMode: fix docs to actually compile and add a utility method." into gingerbread
This commit is contained in:
committed by
Android (Google) Code Review
commit
b4157a432c
@ -131667,6 +131667,17 @@
|
|||||||
visibility="public"
|
visibility="public"
|
||||||
>
|
>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="enableDefaults"
|
||||||
|
return="void"
|
||||||
|
abstract="false"
|
||||||
|
native="false"
|
||||||
|
synchronized="false"
|
||||||
|
static="true"
|
||||||
|
final="false"
|
||||||
|
deprecated="not deprecated"
|
||||||
|
visibility="public"
|
||||||
|
>
|
||||||
|
</method>
|
||||||
<method name="getThreadPolicy"
|
<method name="getThreadPolicy"
|
||||||
return="android.os.StrictMode.ThreadPolicy"
|
return="android.os.StrictMode.ThreadPolicy"
|
||||||
abstract="false"
|
abstract="false"
|
||||||
|
@ -66,7 +66,7 @@ import java.util.HashMap;
|
|||||||
* .penaltyLog()
|
* .penaltyLog()
|
||||||
* .build());
|
* .build());
|
||||||
* StrictMode.setVmPolicy(new {@link VmPolicy.Builder StrictMode.VmPolicy.Builder}()
|
* StrictMode.setVmPolicy(new {@link VmPolicy.Builder StrictMode.VmPolicy.Builder}()
|
||||||
* .detectLeakedSqlLiteCursors()
|
* .detectLeakedSqlLiteObjects()
|
||||||
* .penaltyLog()
|
* .penaltyLog()
|
||||||
* .penaltyDeath()
|
* .penaltyDeath()
|
||||||
* .build());
|
* .build());
|
||||||
@ -961,6 +961,24 @@ public final class StrictMode {
|
|||||||
return new VmPolicy(sVmPolicyMask);
|
return new VmPolicy(sVmPolicyMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the recommended StrictMode defaults, with violations just being logged.
|
||||||
|
*
|
||||||
|
* <p>This catches disk and network access on the main thread, as
|
||||||
|
* well as leaked SQLite cursors. This is simply a wrapper around
|
||||||
|
* {@link #setVmPolicy} and {@link #setThreadPolicy}.
|
||||||
|
*/
|
||||||
|
public static void enableDefaults() {
|
||||||
|
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
|
||||||
|
.detectAll()
|
||||||
|
.penaltyLog()
|
||||||
|
.build());
|
||||||
|
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
|
||||||
|
.detectLeakedSqlLiteObjects()
|
||||||
|
.penaltyLog()
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user