Loading core/java/android/os/StrictMode.java +68 −68 Original line number Diff line number Diff line Loading @@ -365,7 +365,7 @@ public final class StrictMode { public static final int NETWORK_POLICY_REJECT = 2; /** * Detect explicit calls to {@link Runtime#gc()}. * Detects explicit calls to {@link Runtime#gc()}. */ @ChangeId @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) Loading Loading @@ -501,7 +501,7 @@ public final class StrictMode { private Executor mExecutor; /** * Create a Builder that detects nothing and has no violations. (but note that {@link * Creates a Builder that detects nothing and has no violations. (but note that {@link * #build} will default to enabling {@link #penaltyLog} if no other penalties are * specified) */ Loading @@ -509,7 +509,7 @@ public final class StrictMode { mMask = 0; } /** Initialize a Builder from an existing ThreadPolicy. */ /** Initializes a Builder from an existing ThreadPolicy. */ public Builder(ThreadPolicy policy) { mMask = policy.mask; mListener = policy.mListener; Loading @@ -517,7 +517,7 @@ public final class StrictMode { } /** * Detect everything that's potentially suspect. * Detects everything that's potentially suspect. * * <p>As of the Gingerbread release this includes network and disk operations but will * likely expand in future releases. Loading @@ -544,52 +544,52 @@ public final class StrictMode { return this; } /** Disable the detection of everything. */ /** Disables the detection of everything. */ public @NonNull Builder permitAll() { return disable(DETECT_THREAD_ALL); } /** Enable detection of network operations. */ /** Enables detection of network operations. */ public @NonNull Builder detectNetwork() { return enable(DETECT_THREAD_NETWORK); } /** Disable detection of network operations. */ /** Disables detection of network operations. */ public @NonNull Builder permitNetwork() { return disable(DETECT_THREAD_NETWORK); } /** Enable detection of disk reads. */ /** Enables detection of disk reads. */ public @NonNull Builder detectDiskReads() { return enable(DETECT_THREAD_DISK_READ); } /** Disable detection of disk reads. */ /** Disables detection of disk reads. */ public @NonNull Builder permitDiskReads() { return disable(DETECT_THREAD_DISK_READ); } /** Enable detection of slow calls. */ /** Enables detection of slow calls. */ public @NonNull Builder detectCustomSlowCalls() { return enable(DETECT_THREAD_CUSTOM); } /** Disable detection of slow calls. */ /** Disables detection of slow calls. */ public @NonNull Builder permitCustomSlowCalls() { return disable(DETECT_THREAD_CUSTOM); } /** Disable detection of mismatches between defined resource types and getter calls. */ /** Disables detection of mismatches between defined resource types and getter calls. */ public @NonNull Builder permitResourceMismatches() { return disable(DETECT_THREAD_RESOURCE_MISMATCH); } /** Detect unbuffered input/output operations. */ /** Detects unbuffered input/output operations. */ public @NonNull Builder detectUnbufferedIo() { return enable(DETECT_THREAD_UNBUFFERED_IO); } /** Disable detection of unbuffered input/output operations. */ /** Disables detection of unbuffered input/output operations. */ public @NonNull Builder permitUnbufferedIo() { return disable(DETECT_THREAD_UNBUFFERED_IO); } Loading @@ -610,32 +610,32 @@ public final class StrictMode { return enable(DETECT_THREAD_RESOURCE_MISMATCH); } /** Enable detection of disk writes. */ /** Enables detection of disk writes. */ public @NonNull Builder detectDiskWrites() { return enable(DETECT_THREAD_DISK_WRITE); } /** Disable detection of disk writes. */ /** Disables detection of disk writes. */ public @NonNull Builder permitDiskWrites() { return disable(DETECT_THREAD_DISK_WRITE); } /** * Detect calls to {@link Runtime#gc()}. * Detects calls to {@link Runtime#gc()}. */ public @NonNull Builder detectExplicitGc() { return enable(DETECT_THREAD_EXPLICIT_GC); } /** * Disable detection of calls to {@link Runtime#gc()}. * Disables detection of calls to {@link Runtime#gc()}. */ public @NonNull Builder permitExplicitGc() { return disable(DETECT_THREAD_EXPLICIT_GC); } /** * Show an annoying dialog to the developer on detected violations, rate-limited to be * Shows an annoying dialog to the developer on detected violations, rate-limited to be * only a little annoying. */ public @NonNull Builder penaltyDialog() { Loading @@ -643,7 +643,7 @@ public final class StrictMode { } /** * Crash the whole process on violation. This penalty runs at the end of all enabled * Crashes 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. * Loading @@ -655,7 +655,7 @@ public final class StrictMode { } /** * Crash the whole process on any network usage. Unlike {@link #penaltyDeath}, this * Crashes the whole process on any network usage. Unlike {@link #penaltyDeath}, this * penalty runs <em>before</em> anything else. You must still have called {@link * #detectNetwork} to enable this. * Loading @@ -665,18 +665,18 @@ public final class StrictMode { return enable(PENALTY_DEATH_ON_NETWORK); } /** Flash the screen during a violation. */ /** Flashes the screen during a violation. */ public @NonNull Builder penaltyFlashScreen() { return enable(PENALTY_FLASH); } /** Log detected violations to the system log. */ /** Logs detected violations to the system log. */ public @NonNull Builder penaltyLog() { return enable(PENALTY_LOG); } /** * Enable detected violations log a stacktrace and timing data to the {@link * Enables detected violations log a stacktrace and timing data to the {@link * android.os.DropBoxManager DropBox} on policy violation. Intended mostly for platform * integrators doing beta user field data collection. */ Loading @@ -685,7 +685,7 @@ public final class StrictMode { } /** * Call #{@link OnThreadViolationListener#onThreadViolation(Violation)} on specified * Calls #{@link OnThreadViolationListener#onThreadViolation(Violation)} on specified * executor every violation. */ public @NonNull Builder penaltyListener( Loading Loading @@ -715,7 +715,7 @@ public final class StrictMode { } /** * Construct the ThreadPolicy instance. * Constructs the ThreadPolicy instance. * * <p>Note: if no penalties are enabled before calling <code>build</code>, {@link * #penaltyLog} is implicitly set. Loading Loading @@ -805,7 +805,7 @@ public final class StrictMode { mMask = 0; } /** Build upon an existing VmPolicy. */ /** Builds upon an existing VmPolicy. */ public Builder(VmPolicy base) { mMask = base.mask; mClassInstanceLimitNeedCow = true; Loading @@ -815,7 +815,7 @@ public final class StrictMode { } /** * Set an upper bound on how many instances of a class can be in memory at once. Helps * Sets an upper bound on how many instances of a class can be in memory at once. Helps * to prevent object leaks. */ public @NonNull Builder setClassInstanceLimit(Class klass, int instanceLimit) { Loading @@ -838,7 +838,7 @@ public final class StrictMode { return this; } /** Detect leaks of {@link android.app.Activity} subclasses. */ /** Detects leaks of {@link android.app.Activity} subclasses. */ public @NonNull Builder detectActivityLeaks() { return enable(DETECT_VM_ACTIVITY_LEAKS); } Loading @@ -852,7 +852,7 @@ public final class StrictMode { } /** * Detect reflective usage of APIs that are not part of the public Android SDK. * Detects reflective usage of APIs that are not part of the public Android SDK. * * <p>Note that any non-SDK APIs that this processes accesses before this detection is * enabled may not be detected. To ensure that all such API accesses are detected, Loading @@ -863,7 +863,7 @@ public final class StrictMode { } /** * Permit reflective usage of APIs that are not part of the public Android SDK. Note * Permits reflective usage of APIs that are not part of the public Android SDK. Note * that this <b>only</b> affects {@code StrictMode}, the underlying runtime may * continue to restrict or warn on access to methods that are not part of the * public SDK. Loading @@ -873,7 +873,7 @@ public final class StrictMode { } /** * Detect everything that's potentially suspect. * Detects everything that's potentially suspect. * * <p>In the Honeycomb release this includes leaks of SQLite cursors, Activities, and * other closable objects but will likely expand in future releases. Loading Loading @@ -924,8 +924,8 @@ public final class StrictMode { } /** * Detect when an {@link android.database.sqlite.SQLiteCursor} or other SQLite object is * finalized without having been closed. * Detects when an {@link android.database.sqlite.SQLiteCursor} or other SQLite * object is finalized without having been closed. * * <p>You always want to explicitly close your SQLite cursors to avoid unnecessary * database contention and temporary memory leaks. Loading @@ -935,8 +935,8 @@ public final class StrictMode { } /** * Detect when an {@link java.io.Closeable} or other object with an explicit termination * method is finalized without having been closed. * Detects when an {@link java.io.Closeable} or other object with an explicit * termination method is finalized without having been closed. * * <p>You always want to explicitly close such objects to avoid unnecessary resources * leaks. Loading @@ -946,16 +946,16 @@ public final class StrictMode { } /** * Detect when a {@link BroadcastReceiver} or {@link ServiceConnection} is leaked during * {@link Context} teardown. * Detects when a {@link BroadcastReceiver} or {@link ServiceConnection} is leaked * during {@link Context} teardown. */ public @NonNull Builder detectLeakedRegistrationObjects() { return enable(DETECT_VM_REGISTRATION_LEAKS); } /** * Detect when the calling application exposes a {@code file://} {@link android.net.Uri} * to another app. * Detects when the calling application exposes a {@code file://} * {@link android.net.Uri} to another app. * * <p>This exposure is discouraged since the receiving app may not have access to the * shared path. For example, the receiving app may not have requested the {@link Loading @@ -973,9 +973,9 @@ public final class StrictMode { } /** * Detect any network traffic from the calling app which is not wrapped in SSL/TLS. This * can help you detect places that your app is inadvertently sending cleartext data * across the network. * Detects any network traffic from the calling app which is not wrapped in SSL/TLS. * This can help you detect places that your app is inadvertently sending cleartext * data across the network. * * <p>Using {@link #penaltyDeath()} or {@link #penaltyDeathOnCleartextNetwork()} will * block further traffic on that socket to prevent accidental data leakage, in addition Loading @@ -992,7 +992,7 @@ public final class StrictMode { } /** * Detect when the calling application sends a {@code content://} {@link * Detects when the calling application sends a {@code content://} {@link * android.net.Uri} to another app without setting {@link * Intent#FLAG_GRANT_READ_URI_PERMISSION} or {@link * Intent#FLAG_GRANT_WRITE_URI_PERMISSION}. Loading @@ -1008,7 +1008,7 @@ public final class StrictMode { } /** * Detect any sockets in the calling app which have not been tagged using {@link * Detects any sockets in the calling app which have not been tagged using {@link * TrafficStats}. Tagging sockets can help you investigate network usage inside your * app, such as a narrowing down heavy usage to a specific library or component. * Loading @@ -1028,7 +1028,7 @@ public final class StrictMode { } /** * Detect any implicit reliance on Direct Boot automatic filtering * Detects any implicit reliance on Direct Boot automatic filtering * of {@link PackageManager} values. Violations are only triggered * when implicit calls are made while the user is locked. * <p> Loading @@ -1051,7 +1051,7 @@ public final class StrictMode { } /** * Detect access to filesystem paths stored in credential protected * Detects access to filesystem paths stored in credential protected * storage areas while the user is locked. * <p> * When a user is locked, credential protected storage is Loading @@ -1072,7 +1072,7 @@ public final class StrictMode { } /** * Detect attempts to invoke a method on a {@link Context} that is not suited for such * Detects attempts to invoke a method on a {@link Context} that is not suited for such * operation. * <p>An example of this is trying to obtain an instance of UI service (e.g. * {@link android.view.WindowManager}) from a non-visual {@link Context}. This is not Loading @@ -1086,7 +1086,7 @@ public final class StrictMode { } /** * Disable detection of incorrect context use. * Disables detection of incorrect context use. * * @see #detectIncorrectContextUse() * Loading @@ -1098,7 +1098,7 @@ public final class StrictMode { } /** * Detect when your app sends an unsafe {@link Intent}. * Detects when your app sends an unsafe {@link Intent}. * <p> * Violations may indicate security vulnerabilities in the design of * your app, where a malicious app could trick you into granting Loading Loading @@ -1139,7 +1139,7 @@ public final class StrictMode { } /** * Permit your app to launch any {@link Intent} which originated * Permits your app to launch any {@link Intent} which originated * from outside your app. * <p> * Disabling this check is <em>strongly discouraged</em>, as Loading Loading @@ -1214,13 +1214,13 @@ public final class StrictMode { return enable(PENALTY_DEATH_ON_FILE_URI_EXPOSURE); } /** Log detected violations to the system log. */ /** Logs detected violations to the system log. */ public @NonNull Builder penaltyLog() { return enable(PENALTY_LOG); } /** * Enable detected violations log a stacktrace and timing data to the {@link * Enables detected violations log a stacktrace and timing data to the {@link * android.os.DropBoxManager DropBox} on policy violation. Intended mostly for platform * integrators doing beta user field data collection. */ Loading @@ -1229,7 +1229,7 @@ public final class StrictMode { } /** * Call #{@link OnVmViolationListener#onVmViolation(Violation)} on every violation. * Calls #{@link OnVmViolationListener#onVmViolation(Violation)} on every violation. */ public @NonNull Builder penaltyListener( @NonNull Executor executor, @NonNull OnVmViolationListener listener) { Loading Loading @@ -1258,7 +1258,7 @@ public final class StrictMode { } /** * Construct the VmPolicy instance. * Constructs the VmPolicy instance. * * <p>Note: if no penalties are enabled before calling <code>build</code>, {@link * #penaltyLog} is implicitly set. Loading Loading @@ -1474,7 +1474,7 @@ public final class StrictMode { } /** * Determine if the given app is "bundled" as part of the system image. These bundled apps are * Determines if the given app is "bundled" as part of the system image. These bundled apps are * developed in lock-step with the OS, and they aren't updated outside of an OTA, so we want to * chase any {@link StrictMode} regressions by enabling detection when running on {@link * Build#IS_USERDEBUG} or {@link Build#IS_ENG} builds. Loading Loading @@ -1512,7 +1512,7 @@ public final class StrictMode { } /** * Initialize default {@link ThreadPolicy} for the current thread. * Initializes default {@link ThreadPolicy} for the current thread. * * @hide */ Loading Loading @@ -1547,7 +1547,7 @@ public final class StrictMode { } /** * Initialize default {@link VmPolicy} for the current VM. * Initializes default {@link VmPolicy} for the current VM. * * @hide */ Loading Loading @@ -2244,7 +2244,7 @@ public final class StrictMode { } /** * Enable the recommended StrictMode defaults, with violations just being logged. * Enables 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 * and unclosed resources. This is simply a wrapper around {@link #setVmPolicy} and {@link Loading Loading @@ -2545,7 +2545,7 @@ public final class StrictMode { private static final SparseLongArray sRealLastVmViolationTime = new SparseLongArray(); /** * Clamp the given map by removing elements with timestamp older than the given retainSince. * Clamps the given map by removing elements with timestamp older than the given retainSince. */ private static void clampViolationTimeMap(final @NonNull SparseLongArray violationTime, final long retainSince) { Loading Loading @@ -2812,7 +2812,7 @@ public final class StrictMode { }; /** * Enter a named critical span (e.g. an animation) * Enters a named critical span (e.g. an animation) * * <p>The name is an arbitary label (or tag) that will be applied to any strictmode violation * that happens while this span is active. You must call finish() on the span when done. Loading Loading @@ -3056,7 +3056,7 @@ public final class StrictMode { /** If this is a instance count violation, the number of instances in memory, else -1. */ public long numInstances = -1; /** Create an instance of ViolationInfo initialized from an exception. */ /** Creates an instance of ViolationInfo initialized from an exception. */ ViolationInfo(Violation tr, int penaltyMask) { this.mViolation = tr; this.mPenaltyMask = penaltyMask; Loading Loading @@ -3131,8 +3131,8 @@ public final class StrictMode { } /** * Add a {@link Throwable} from the current process that caused the underlying violation. We * only preserve the stack trace elements. * Adds a {@link Throwable} from the current process that caused the underlying violation. * We only preserve the stack trace elements. * * @hide */ Loading Loading @@ -3160,14 +3160,14 @@ public final class StrictMode { return result; } /** Create an instance of ViolationInfo initialized from a Parcel. */ /** Creates an instance of ViolationInfo initialized from a Parcel. */ @UnsupportedAppUsage public ViolationInfo(Parcel in) { this(in, false); } /** * Create an instance of ViolationInfo initialized from a Parcel. * Creates an instance of ViolationInfo initialized from a Parcel. * * @param unsetGatheringBit if true, the caller is the root caller and the gathering penalty * should be removed. Loading Loading @@ -3203,7 +3203,7 @@ public final class StrictMode { tags = in.readStringArray(); } /** Save a ViolationInfo instance to a parcel. */ /** Saves a ViolationInfo instance to a parcel. */ @Override public void writeToParcel(Parcel dest, int flags) { dest.writeSerializable(mViolation); Loading Loading @@ -3248,7 +3248,7 @@ public final class StrictMode { } } /** Dump a ViolationInfo instance to a Printer. */ /** Dumps a ViolationInfo instance to a Printer. */ public void dump(Printer pw, String prefix) { pw.println(prefix + "stackTrace: " + getStackTrace()); pw.println(prefix + "penalty: " + mPenaltyMask); Loading Loading
core/java/android/os/StrictMode.java +68 −68 Original line number Diff line number Diff line Loading @@ -365,7 +365,7 @@ public final class StrictMode { public static final int NETWORK_POLICY_REJECT = 2; /** * Detect explicit calls to {@link Runtime#gc()}. * Detects explicit calls to {@link Runtime#gc()}. */ @ChangeId @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) Loading Loading @@ -501,7 +501,7 @@ public final class StrictMode { private Executor mExecutor; /** * Create a Builder that detects nothing and has no violations. (but note that {@link * Creates a Builder that detects nothing and has no violations. (but note that {@link * #build} will default to enabling {@link #penaltyLog} if no other penalties are * specified) */ Loading @@ -509,7 +509,7 @@ public final class StrictMode { mMask = 0; } /** Initialize a Builder from an existing ThreadPolicy. */ /** Initializes a Builder from an existing ThreadPolicy. */ public Builder(ThreadPolicy policy) { mMask = policy.mask; mListener = policy.mListener; Loading @@ -517,7 +517,7 @@ public final class StrictMode { } /** * Detect everything that's potentially suspect. * Detects everything that's potentially suspect. * * <p>As of the Gingerbread release this includes network and disk operations but will * likely expand in future releases. Loading @@ -544,52 +544,52 @@ public final class StrictMode { return this; } /** Disable the detection of everything. */ /** Disables the detection of everything. */ public @NonNull Builder permitAll() { return disable(DETECT_THREAD_ALL); } /** Enable detection of network operations. */ /** Enables detection of network operations. */ public @NonNull Builder detectNetwork() { return enable(DETECT_THREAD_NETWORK); } /** Disable detection of network operations. */ /** Disables detection of network operations. */ public @NonNull Builder permitNetwork() { return disable(DETECT_THREAD_NETWORK); } /** Enable detection of disk reads. */ /** Enables detection of disk reads. */ public @NonNull Builder detectDiskReads() { return enable(DETECT_THREAD_DISK_READ); } /** Disable detection of disk reads. */ /** Disables detection of disk reads. */ public @NonNull Builder permitDiskReads() { return disable(DETECT_THREAD_DISK_READ); } /** Enable detection of slow calls. */ /** Enables detection of slow calls. */ public @NonNull Builder detectCustomSlowCalls() { return enable(DETECT_THREAD_CUSTOM); } /** Disable detection of slow calls. */ /** Disables detection of slow calls. */ public @NonNull Builder permitCustomSlowCalls() { return disable(DETECT_THREAD_CUSTOM); } /** Disable detection of mismatches between defined resource types and getter calls. */ /** Disables detection of mismatches between defined resource types and getter calls. */ public @NonNull Builder permitResourceMismatches() { return disable(DETECT_THREAD_RESOURCE_MISMATCH); } /** Detect unbuffered input/output operations. */ /** Detects unbuffered input/output operations. */ public @NonNull Builder detectUnbufferedIo() { return enable(DETECT_THREAD_UNBUFFERED_IO); } /** Disable detection of unbuffered input/output operations. */ /** Disables detection of unbuffered input/output operations. */ public @NonNull Builder permitUnbufferedIo() { return disable(DETECT_THREAD_UNBUFFERED_IO); } Loading @@ -610,32 +610,32 @@ public final class StrictMode { return enable(DETECT_THREAD_RESOURCE_MISMATCH); } /** Enable detection of disk writes. */ /** Enables detection of disk writes. */ public @NonNull Builder detectDiskWrites() { return enable(DETECT_THREAD_DISK_WRITE); } /** Disable detection of disk writes. */ /** Disables detection of disk writes. */ public @NonNull Builder permitDiskWrites() { return disable(DETECT_THREAD_DISK_WRITE); } /** * Detect calls to {@link Runtime#gc()}. * Detects calls to {@link Runtime#gc()}. */ public @NonNull Builder detectExplicitGc() { return enable(DETECT_THREAD_EXPLICIT_GC); } /** * Disable detection of calls to {@link Runtime#gc()}. * Disables detection of calls to {@link Runtime#gc()}. */ public @NonNull Builder permitExplicitGc() { return disable(DETECT_THREAD_EXPLICIT_GC); } /** * Show an annoying dialog to the developer on detected violations, rate-limited to be * Shows an annoying dialog to the developer on detected violations, rate-limited to be * only a little annoying. */ public @NonNull Builder penaltyDialog() { Loading @@ -643,7 +643,7 @@ public final class StrictMode { } /** * Crash the whole process on violation. This penalty runs at the end of all enabled * Crashes 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. * Loading @@ -655,7 +655,7 @@ public final class StrictMode { } /** * Crash the whole process on any network usage. Unlike {@link #penaltyDeath}, this * Crashes the whole process on any network usage. Unlike {@link #penaltyDeath}, this * penalty runs <em>before</em> anything else. You must still have called {@link * #detectNetwork} to enable this. * Loading @@ -665,18 +665,18 @@ public final class StrictMode { return enable(PENALTY_DEATH_ON_NETWORK); } /** Flash the screen during a violation. */ /** Flashes the screen during a violation. */ public @NonNull Builder penaltyFlashScreen() { return enable(PENALTY_FLASH); } /** Log detected violations to the system log. */ /** Logs detected violations to the system log. */ public @NonNull Builder penaltyLog() { return enable(PENALTY_LOG); } /** * Enable detected violations log a stacktrace and timing data to the {@link * Enables detected violations log a stacktrace and timing data to the {@link * android.os.DropBoxManager DropBox} on policy violation. Intended mostly for platform * integrators doing beta user field data collection. */ Loading @@ -685,7 +685,7 @@ public final class StrictMode { } /** * Call #{@link OnThreadViolationListener#onThreadViolation(Violation)} on specified * Calls #{@link OnThreadViolationListener#onThreadViolation(Violation)} on specified * executor every violation. */ public @NonNull Builder penaltyListener( Loading Loading @@ -715,7 +715,7 @@ public final class StrictMode { } /** * Construct the ThreadPolicy instance. * Constructs the ThreadPolicy instance. * * <p>Note: if no penalties are enabled before calling <code>build</code>, {@link * #penaltyLog} is implicitly set. Loading Loading @@ -805,7 +805,7 @@ public final class StrictMode { mMask = 0; } /** Build upon an existing VmPolicy. */ /** Builds upon an existing VmPolicy. */ public Builder(VmPolicy base) { mMask = base.mask; mClassInstanceLimitNeedCow = true; Loading @@ -815,7 +815,7 @@ public final class StrictMode { } /** * Set an upper bound on how many instances of a class can be in memory at once. Helps * Sets an upper bound on how many instances of a class can be in memory at once. Helps * to prevent object leaks. */ public @NonNull Builder setClassInstanceLimit(Class klass, int instanceLimit) { Loading @@ -838,7 +838,7 @@ public final class StrictMode { return this; } /** Detect leaks of {@link android.app.Activity} subclasses. */ /** Detects leaks of {@link android.app.Activity} subclasses. */ public @NonNull Builder detectActivityLeaks() { return enable(DETECT_VM_ACTIVITY_LEAKS); } Loading @@ -852,7 +852,7 @@ public final class StrictMode { } /** * Detect reflective usage of APIs that are not part of the public Android SDK. * Detects reflective usage of APIs that are not part of the public Android SDK. * * <p>Note that any non-SDK APIs that this processes accesses before this detection is * enabled may not be detected. To ensure that all such API accesses are detected, Loading @@ -863,7 +863,7 @@ public final class StrictMode { } /** * Permit reflective usage of APIs that are not part of the public Android SDK. Note * Permits reflective usage of APIs that are not part of the public Android SDK. Note * that this <b>only</b> affects {@code StrictMode}, the underlying runtime may * continue to restrict or warn on access to methods that are not part of the * public SDK. Loading @@ -873,7 +873,7 @@ public final class StrictMode { } /** * Detect everything that's potentially suspect. * Detects everything that's potentially suspect. * * <p>In the Honeycomb release this includes leaks of SQLite cursors, Activities, and * other closable objects but will likely expand in future releases. Loading Loading @@ -924,8 +924,8 @@ public final class StrictMode { } /** * Detect when an {@link android.database.sqlite.SQLiteCursor} or other SQLite object is * finalized without having been closed. * Detects when an {@link android.database.sqlite.SQLiteCursor} or other SQLite * object is finalized without having been closed. * * <p>You always want to explicitly close your SQLite cursors to avoid unnecessary * database contention and temporary memory leaks. Loading @@ -935,8 +935,8 @@ public final class StrictMode { } /** * Detect when an {@link java.io.Closeable} or other object with an explicit termination * method is finalized without having been closed. * Detects when an {@link java.io.Closeable} or other object with an explicit * termination method is finalized without having been closed. * * <p>You always want to explicitly close such objects to avoid unnecessary resources * leaks. Loading @@ -946,16 +946,16 @@ public final class StrictMode { } /** * Detect when a {@link BroadcastReceiver} or {@link ServiceConnection} is leaked during * {@link Context} teardown. * Detects when a {@link BroadcastReceiver} or {@link ServiceConnection} is leaked * during {@link Context} teardown. */ public @NonNull Builder detectLeakedRegistrationObjects() { return enable(DETECT_VM_REGISTRATION_LEAKS); } /** * Detect when the calling application exposes a {@code file://} {@link android.net.Uri} * to another app. * Detects when the calling application exposes a {@code file://} * {@link android.net.Uri} to another app. * * <p>This exposure is discouraged since the receiving app may not have access to the * shared path. For example, the receiving app may not have requested the {@link Loading @@ -973,9 +973,9 @@ public final class StrictMode { } /** * Detect any network traffic from the calling app which is not wrapped in SSL/TLS. This * can help you detect places that your app is inadvertently sending cleartext data * across the network. * Detects any network traffic from the calling app which is not wrapped in SSL/TLS. * This can help you detect places that your app is inadvertently sending cleartext * data across the network. * * <p>Using {@link #penaltyDeath()} or {@link #penaltyDeathOnCleartextNetwork()} will * block further traffic on that socket to prevent accidental data leakage, in addition Loading @@ -992,7 +992,7 @@ public final class StrictMode { } /** * Detect when the calling application sends a {@code content://} {@link * Detects when the calling application sends a {@code content://} {@link * android.net.Uri} to another app without setting {@link * Intent#FLAG_GRANT_READ_URI_PERMISSION} or {@link * Intent#FLAG_GRANT_WRITE_URI_PERMISSION}. Loading @@ -1008,7 +1008,7 @@ public final class StrictMode { } /** * Detect any sockets in the calling app which have not been tagged using {@link * Detects any sockets in the calling app which have not been tagged using {@link * TrafficStats}. Tagging sockets can help you investigate network usage inside your * app, such as a narrowing down heavy usage to a specific library or component. * Loading @@ -1028,7 +1028,7 @@ public final class StrictMode { } /** * Detect any implicit reliance on Direct Boot automatic filtering * Detects any implicit reliance on Direct Boot automatic filtering * of {@link PackageManager} values. Violations are only triggered * when implicit calls are made while the user is locked. * <p> Loading @@ -1051,7 +1051,7 @@ public final class StrictMode { } /** * Detect access to filesystem paths stored in credential protected * Detects access to filesystem paths stored in credential protected * storage areas while the user is locked. * <p> * When a user is locked, credential protected storage is Loading @@ -1072,7 +1072,7 @@ public final class StrictMode { } /** * Detect attempts to invoke a method on a {@link Context} that is not suited for such * Detects attempts to invoke a method on a {@link Context} that is not suited for such * operation. * <p>An example of this is trying to obtain an instance of UI service (e.g. * {@link android.view.WindowManager}) from a non-visual {@link Context}. This is not Loading @@ -1086,7 +1086,7 @@ public final class StrictMode { } /** * Disable detection of incorrect context use. * Disables detection of incorrect context use. * * @see #detectIncorrectContextUse() * Loading @@ -1098,7 +1098,7 @@ public final class StrictMode { } /** * Detect when your app sends an unsafe {@link Intent}. * Detects when your app sends an unsafe {@link Intent}. * <p> * Violations may indicate security vulnerabilities in the design of * your app, where a malicious app could trick you into granting Loading Loading @@ -1139,7 +1139,7 @@ public final class StrictMode { } /** * Permit your app to launch any {@link Intent} which originated * Permits your app to launch any {@link Intent} which originated * from outside your app. * <p> * Disabling this check is <em>strongly discouraged</em>, as Loading Loading @@ -1214,13 +1214,13 @@ public final class StrictMode { return enable(PENALTY_DEATH_ON_FILE_URI_EXPOSURE); } /** Log detected violations to the system log. */ /** Logs detected violations to the system log. */ public @NonNull Builder penaltyLog() { return enable(PENALTY_LOG); } /** * Enable detected violations log a stacktrace and timing data to the {@link * Enables detected violations log a stacktrace and timing data to the {@link * android.os.DropBoxManager DropBox} on policy violation. Intended mostly for platform * integrators doing beta user field data collection. */ Loading @@ -1229,7 +1229,7 @@ public final class StrictMode { } /** * Call #{@link OnVmViolationListener#onVmViolation(Violation)} on every violation. * Calls #{@link OnVmViolationListener#onVmViolation(Violation)} on every violation. */ public @NonNull Builder penaltyListener( @NonNull Executor executor, @NonNull OnVmViolationListener listener) { Loading Loading @@ -1258,7 +1258,7 @@ public final class StrictMode { } /** * Construct the VmPolicy instance. * Constructs the VmPolicy instance. * * <p>Note: if no penalties are enabled before calling <code>build</code>, {@link * #penaltyLog} is implicitly set. Loading Loading @@ -1474,7 +1474,7 @@ public final class StrictMode { } /** * Determine if the given app is "bundled" as part of the system image. These bundled apps are * Determines if the given app is "bundled" as part of the system image. These bundled apps are * developed in lock-step with the OS, and they aren't updated outside of an OTA, so we want to * chase any {@link StrictMode} regressions by enabling detection when running on {@link * Build#IS_USERDEBUG} or {@link Build#IS_ENG} builds. Loading Loading @@ -1512,7 +1512,7 @@ public final class StrictMode { } /** * Initialize default {@link ThreadPolicy} for the current thread. * Initializes default {@link ThreadPolicy} for the current thread. * * @hide */ Loading Loading @@ -1547,7 +1547,7 @@ public final class StrictMode { } /** * Initialize default {@link VmPolicy} for the current VM. * Initializes default {@link VmPolicy} for the current VM. * * @hide */ Loading Loading @@ -2244,7 +2244,7 @@ public final class StrictMode { } /** * Enable the recommended StrictMode defaults, with violations just being logged. * Enables 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 * and unclosed resources. This is simply a wrapper around {@link #setVmPolicy} and {@link Loading Loading @@ -2545,7 +2545,7 @@ public final class StrictMode { private static final SparseLongArray sRealLastVmViolationTime = new SparseLongArray(); /** * Clamp the given map by removing elements with timestamp older than the given retainSince. * Clamps the given map by removing elements with timestamp older than the given retainSince. */ private static void clampViolationTimeMap(final @NonNull SparseLongArray violationTime, final long retainSince) { Loading Loading @@ -2812,7 +2812,7 @@ public final class StrictMode { }; /** * Enter a named critical span (e.g. an animation) * Enters a named critical span (e.g. an animation) * * <p>The name is an arbitary label (or tag) that will be applied to any strictmode violation * that happens while this span is active. You must call finish() on the span when done. Loading Loading @@ -3056,7 +3056,7 @@ public final class StrictMode { /** If this is a instance count violation, the number of instances in memory, else -1. */ public long numInstances = -1; /** Create an instance of ViolationInfo initialized from an exception. */ /** Creates an instance of ViolationInfo initialized from an exception. */ ViolationInfo(Violation tr, int penaltyMask) { this.mViolation = tr; this.mPenaltyMask = penaltyMask; Loading Loading @@ -3131,8 +3131,8 @@ public final class StrictMode { } /** * Add a {@link Throwable} from the current process that caused the underlying violation. We * only preserve the stack trace elements. * Adds a {@link Throwable} from the current process that caused the underlying violation. * We only preserve the stack trace elements. * * @hide */ Loading Loading @@ -3160,14 +3160,14 @@ public final class StrictMode { return result; } /** Create an instance of ViolationInfo initialized from a Parcel. */ /** Creates an instance of ViolationInfo initialized from a Parcel. */ @UnsupportedAppUsage public ViolationInfo(Parcel in) { this(in, false); } /** * Create an instance of ViolationInfo initialized from a Parcel. * Creates an instance of ViolationInfo initialized from a Parcel. * * @param unsetGatheringBit if true, the caller is the root caller and the gathering penalty * should be removed. Loading Loading @@ -3203,7 +3203,7 @@ public final class StrictMode { tags = in.readStringArray(); } /** Save a ViolationInfo instance to a parcel. */ /** Saves a ViolationInfo instance to a parcel. */ @Override public void writeToParcel(Parcel dest, int flags) { dest.writeSerializable(mViolation); Loading Loading @@ -3248,7 +3248,7 @@ public final class StrictMode { } } /** Dump a ViolationInfo instance to a Printer. */ /** Dumps a ViolationInfo instance to a Printer. */ public void dump(Printer pw, String prefix) { pw.println(prefix + "stackTrace: " + getStackTrace()); pw.println(prefix + "penalty: " + mPenaltyMask); Loading