Udostępnij za pośrednictwem


AppOpsManager.UnsafeCheckOp(String, Int32, String) Method

Definition

Check whether an application might be able to perform an operation.

[Android.Runtime.Register("unsafeCheckOp", "(Ljava/lang/String;ILjava/lang/String;)I", "GetUnsafeCheckOp_Ljava_lang_String_ILjava_lang_String_Handler", ApiSince=29)]
public virtual Android.App.AppOpsManagerMode UnsafeCheckOp(string op, int uid, string packageName);
[<Android.Runtime.Register("unsafeCheckOp", "(Ljava/lang/String;ILjava/lang/String;)I", "GetUnsafeCheckOp_Ljava_lang_String_ILjava_lang_String_Handler", ApiSince=29)>]
abstract member UnsafeCheckOp : string * int * string -> Android.App.AppOpsManagerMode
override this.UnsafeCheckOp : string * int * string -> Android.App.AppOpsManagerMode

Parameters

op
String

The operation to check. One of the OPSTR_* constants.

uid
Int32

The user id of the application attempting to perform the operation.

packageName
String

The name of the application attempting to perform the operation.

Returns

Returns #MODE_ALLOWED if the operation is allowed, or #MODE_IGNORED if it is not allowed and should be silently ignored (without causing the app to crash).

Attributes

Remarks

Check whether an application might be able to perform an operation.

For platform versions before android.os.Build.VERSION_CODES#BAKLAVA, this is <em>not</em> a security check; you must use #noteOp(String, int, String, String, String) or #startOp(String, int, String, String, String) for your actual security checks. This function can just be used for a quick check to see if an operation has been disabled for the application, as an early reject of some work.

For platform versions equal to or after android.os.Build.VERSION_CODES#BAKLAVA, this is no longer an unsafe check, and it does the same security check as #noteOp(String, int, String, String, String) and #startOp(String, int, String, String, String). However, it's preferred to use #checkOp(String, int, String), since the word "unsafe" in the name of this API is no longer accurate.

This API does not modify the time stamp or other data about the operation.

This member is deprecated. Use #checkOp(String, int, String)

Java documentation for android.app.AppOpsManager.unsafeCheckOp(java.lang.String, int, java.lang.String).

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.

Applies to