StrictMode.VmPolicy.Builder Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates T:Android.OS.StrictMode+VmPolicy instances.
[Android.Runtime.Register("android/os/StrictMode$VmPolicy$Builder", DoNotGenerateAcw=true)]
public sealed class StrictMode.VmPolicy.Builder : Java.Lang.Object
[<Android.Runtime.Register("android/os/StrictMode$VmPolicy$Builder", DoNotGenerateAcw=true)>]
type StrictMode.VmPolicy.Builder = class
inherit Object
- Inheritance
- Attributes
Remarks
Android platform documentation
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
| Name | Description |
|---|---|
| StrictMode.VmPolicy.Builder() |
Initializes a new instance of the StrictMode.VmPolicy.Builder class. |
| StrictMode.VmPolicy.Builder(StrictMode+VmPolicy) |
Build upon an existing VmPolicy. |
Properties
| Name | Description |
|---|---|
| Class |
Returns the runtime class of this |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState | (Inherited from JavaObject) |
| JniPeerMembers |
Provides JNI peer-member metadata for this type. |
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
| ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
| Name | Description |
|---|---|
| Build() |
Construct the VmPolicy instance. |
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Construct(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| DetectActivityLeaks() |
Detect leaks of Activity subclasses. |
| DetectAll() |
Detect everything that's potentially suspect. |
| DetectBlockedBackgroundActivityLaunch() |
Detects when your app is blocked from launching a background activity or a PendingIntent created by your app cannot be launched. |
| DetectCleartextNetwork() |
Detects any network traffic from the calling app which is not wrapped in SSL/TLS. |
| DetectContentUriWithoutPermission() |
Detects when the calling application sends a content:// Uri to another app without setting Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION . Forgetting to include one or more of these flags when sending an intent is typically an app bug. |
| DetectCredentialProtectedWhileLocked() |
Detects access to filesystem paths stored in credential protected storage areas while the user is locked. When a user is locked, credential protected storage is unavailable, and files stored in these locations appear to not exist, which can result in subtle app bugs if they assume default behaviors or empty states. Instead, apps should store data needed while a user is locked under device protected storage areas. |
| DetectFileUriExposure() |
Detect when a |
| DetectImplicitDirectBoot() |
Detects any implicit reliance on Direct Boot automatic filtering of PackageManager values. |
| DetectImplicitUriPermissionGrant() |
Detects when URI permissions are implicitly granted to your app, a behavior that will be discontinued in Android 18 (API 38). |
| DetectIncorrectContextUse() |
Detects attempts to invoke a method on a Context that is not suited for such operation. An example of this is trying to obtain an instance of UI service (e.g. WindowManager ) from a non-visual Context . This is not allowed, since a non-visual Context is not adjusted to any visual area, and therefore can report incorrect metrics or resources. |
| DetectLeakedClosableObjects() |
Detect when an ICloseable or other object with a explict termination method is finalized without having been closed. |
| DetectLeakedRegistrationObjects() |
Detect when a BroadcastReceiver or IServiceConnection is leaked during Context teardown. |
| DetectLeakedSqlLiteObjects() |
Detect when an SQLiteCursor or other SQLite object is finalized without having been closed. |
| DetectNonSdkApiUsage() |
Detects reflective usage of APIs that are not part of the public Android SDK. 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, you should apply this policy as early as possible after process creation. |
| DetectUnsafeIntentLaunch() |
Detects when your app sends an unsafe Intent . Violations may indicate security vulnerabilities in the design of your app, where a malicious app could trick you into granting Uri permissions or launching unexported components. |
| DetectUntaggedSockets() |
Detects any sockets in the calling app which have not been tagged using 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. This currently does not detect sockets created in native code. |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DisposeUnlessReferenced() | (Inherited from JavaObject) |
| Equals(Object) | (Inherited from JavaObject) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| IgnoreBlockedBackgroundActivityLaunch() |
Stops detecting whether your app is blocked from launching a background activity or a PendingIntent created by your app cannot be launched. This disables the effect of detectBlockedBackgroundActivityLaunch() . |
| JavaFinalize() |
Obsolete.
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
| Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
| NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
| PenaltyDeath() |
Crashes the whole process on violation. |
| PenaltyDeathOnCleartextNetwork() |
Crashes the whole process when cleartext network traffic is detected. |
| PenaltyDeathOnFileUriExposure() |
Crashes the whole process when a file:// Uri is exposed beyond this app. |
| PenaltyDropBox() |
Enable detected violations log a stacktrace and timing data to the DropBoxManager on policy violation. |
| PenaltyListener(IExecutor, StrictMode+IOnVmViolationListener) |
Calls # OnVmViolationListener.onVmViolation(Violation) on every violation. |
| PenaltyLog() |
Log detected violations to the system log. |
| PermitImplicitUriPermissionGrant() |
Disables detection when implicit URI permissions are granted to the app. |
| PermitNonSdkApiUsage() |
Permits reflective usage of APIs that are not part of the public Android SDK. Note that this only affects StrictMode , the underlying runtime may continue to restrict or warn on access to methods that are not part of the public SDK. |
| PermitUnsafeIntentLaunch() |
Permits your app to launch any Intent which originated from outside your app. Disabling this check is strongly discouraged , as violations may indicate security vulnerabilities in the design of your app, where a malicious app could trick you into granting Uri permissions or launching unexported components. |
| SetClassInstanceLimit(Class, Int32) |
Set an upper bound on how many instances of a class can be in memory at once. |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
| Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IJavaPeerable.Disposed() | (Inherited from JavaObject) |
| IJavaPeerable.Finalized() | (Inherited from JavaObject) |
| IJavaPeerable.JniObjectReferenceControlBlock | (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from JavaObject) |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |