java.lang.Object | |
↳ | android.os.StrictMode.ThreadPolicy.Builder |
Creates ThreadPolicy instances. Methods whose names start
with detect
specify what problems we should look
for. Methods whose names start with penalty
specify what
we should do when we detect a problem.
You can call as many detect
and penalty
methods as you like. Currently order is insignificant: all
penalties apply to all detected problems.
For example, detect everything and log anything that's found:
StrictMode.VmPolicy policy = new StrictMode.VmPolicy.Builder() .detectAll() .penaltyLog() .build(); StrictMode.setVmPolicy(policy);
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a Builder that detects nothing and has no
violations.
| |||||||||||
Initialize a Builder from an existing ThreadPolicy.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct the ThreadPolicy instance.
| |||||||||||
Detect everything that's potentially suspect.
| |||||||||||
Enable detection of disk reads.
| |||||||||||
Enable detection of disk writes.
| |||||||||||
Enable detection of network operations.
| |||||||||||
Crash the whole process on violation.
| |||||||||||
Show an annoying dialog to the developer on detected
violations, rate-limited to be only a little annoying.
| |||||||||||
Enable detected violations log a stacktrace and timing data
to the
DropBox on policy
violation. | |||||||||||
Log detected violations to the system log.
| |||||||||||
Disable the detection of everything.
| |||||||||||
Disable detection of disk reads.
| |||||||||||
Disable detection of disk writes.
| |||||||||||
Disable detection of network operations.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Create a Builder that detects nothing and has no
violations. (but note that build()
will default
to enabling penaltyLog()
if no other penalties
are specified)
Initialize a Builder from an existing ThreadPolicy.
Construct the ThreadPolicy instance.
Note: if no penalties are enabled before calling
build
, penaltyLog()
is implicitly
set.
Detect everything that's potentially suspect.
As of the Gingerbread release this includes network and disk operations but will likely expand in future releases.
Enable detection of disk reads.
Enable detection of disk writes.
Enable detection of network operations.
Crash the whole process on violation. This penalty runs at the end of all enabled penalties so you'll still get see logging or other violations before the process dies.
Show an annoying dialog to the developer on detected violations, rate-limited to be only a little annoying.
Enable detected violations log a stacktrace and timing data
to the DropBox
on policy
violation. Intended mostly for platform integrators doing
beta user field data collection.
Log detected violations to the system log.
Disable the detection of everything.
Disable detection of disk reads.
Disable detection of disk writes.
Disable detection of network operations.