/**@class android.app.AppOpsManager @extends java.lang.Object API for interacting with "application operation" tracking. <p>This API is not generally intended for third party application developers; most features are only available to system applications. */ var AppOpsManager = { /** Mode in which app op history is completely disabled. @hide */ HISTORICAL_MODE_DISABLED : "0", /** Mode in which app op history is enabled and app ops performed by apps would be tracked. This is the mode in which the feature is completely enabled. @hide */ HISTORICAL_MODE_ENABLED_ACTIVE : "1", /** Mode in which app op history is enabled but app ops performed by apps would not be tracked and the only way to add ops to the history is via explicit calls to dedicated APIs. This mode is useful for testing to allow full control of the historical content. @hide */ HISTORICAL_MODE_ENABLED_PASSIVE : "2", /** Result from {@link #checkOp}, {@link #noteOp}, {@link #startOp}: the given caller is allowed to perform the given operation. */ MODE_ALLOWED : "0", /** Result from {@link #checkOp}, {@link #noteOp}, {@link #startOp}: the given caller is not allowed to perform the given operation, and this attempt should <em>silently fail</em> (it should not cause the app to crash). */ MODE_IGNORED : "1", /** Result from {@link #checkOpNoThrow}, {@link #noteOpNoThrow}, {@link #startOpNoThrow}: the given caller is not allowed to perform the given operation, and this attempt should cause it to have a fatal error, typically a {@link SecurityException}. */ MODE_ERRORED : "2", /** Result from {@link #checkOp}, {@link #noteOp}, {@link #startOp}: the given caller should use its default security check. This mode is not normally used; it should only be used with appop permissions, and callers must explicitly check for it and deal with it. */ MODE_DEFAULT : "3", /** Special mode that means "allow only when app is in foreground." This is <b>not</b> returned from {@link #unsafeCheckOp}, {@link #noteOp}, {@link #startOp}. Rather, {@link #unsafeCheckOp} will always return {@link #MODE_ALLOWED} (because it is always possible for it to be ultimately allowed, depending on the app's background state), and {@link #noteOp} and {@link #startOp} will return {@link #MODE_ALLOWED} when the app being checked is currently in the foreground, otherwise {@link #MODE_IGNORED}. <p>The only place you will this normally see this value is through {@link #unsafeCheckOpRaw}, which returns the actual raw mode of the op. Note that because you can't know the current state of the app being checked (and it can change at any point), you can only treat the result here as an indication that it will vary between {@link #MODE_ALLOWED} and {@link #MODE_IGNORED} depending on changes in the background state of the app. You thus must always use {@link #noteOp} or {@link #startOp} to do the actual check for access to the op.</p> */ MODE_FOREGROUND : "4", /** Flag for {@link #startWatchingMode(String, String, int, android.app.AppOpsManager.OnOpChangedListener)}: Also get reports if the foreground state of an op's uid changes. This only works when watching a particular op, not when watching a package. */ WATCH_FOREGROUND_CHANGES : "1", /** @hide */ MODE_NAMES : "null", /** Uid state: The UID is a foreground persistent app. The lower the UID state the more important the UID is for the user. @hide */ UID_STATE_PERSISTENT : "100", /** Uid state: The UID is top foreground app. The lower the UID state the more important the UID is for the user. @hide */ UID_STATE_TOP : "200", /** Uid state: The UID is running a foreground service of location type. The lower the UID state the more important the UID is for the user. @hide */ UID_STATE_FOREGROUND_SERVICE_LOCATION : "300", /** Uid state: The UID is running a foreground service. The lower the UID state the more important the UID is for the user. @hide */ UID_STATE_FOREGROUND_SERVICE : "400", /** The max, which is min priority, UID state for which any app op would be considered as performed in the foreground. @hide */ UID_STATE_MAX_LAST_NON_RESTRICTED : "400", /** Uid state: The UID is a foreground app. The lower the UID state the more important the UID is for the user. @hide */ UID_STATE_FOREGROUND : "500", /** Uid state: The UID is a background app. The lower the UID state the more important the UID is for the user. @hide */ UID_STATE_BACKGROUND : "600", /** Uid state: The UID is a cached app. The lower the UID state the more important the UID is for the user. @hide */ UID_STATE_CACHED : "700", /** Uid state: The UID state with the highest priority. @hide */ MAX_PRIORITY_UID_STATE : "100", /** Uid state: The UID state with the lowest priority. @hide */ MIN_PRIORITY_UID_STATE : "700", /**@hide Note: Keep these sorted */ UID_STATES : "null", /** Flag: non proxy operations. These are operations performed on behalf of the app itself and not on behalf of another one. @hide */ OP_FLAG_SELF : "1", /** Flag: trusted proxy operations. These are operations performed on behalf of another app by a trusted app. Which is work a trusted app blames on another app. @hide */ OP_FLAG_TRUSTED_PROXY : "2", /** Flag: untrusted proxy operations. These are operations performed on behalf of another app by an untrusted app. Which is work an untrusted app blames on another app. @hide */ OP_FLAG_UNTRUSTED_PROXY : "4", /** Flag: trusted proxied operations. These are operations performed by a trusted other app on behalf of an app. Which is work an app was blamed for by a trusted app. @hide */ OP_FLAG_TRUSTED_PROXIED : "8", /** Flag: untrusted proxied operations. These are operations performed by an untrusted other app on behalf of an app. Which is work an app was blamed for by an untrusted app. @hide */ OP_FLAG_UNTRUSTED_PROXIED : "16", /** Flags: all operations. These include operations matched by {@link #OP_FLAG_SELF}, {@link #OP_FLAG_TRUSTED_PROXIED}, {@link #OP_FLAG_UNTRUSTED_PROXIED}, {@link #OP_FLAG_TRUSTED_PROXIED}, {@link #OP_FLAG_UNTRUSTED_PROXIED}. @hide */ OP_FLAGS_ALL : "31", /** Flags: all trusted operations which is ones either the app did {@link #OP_FLAG_SELF}, or it was blamed for by a trusted app {@link #OP_FLAG_TRUSTED_PROXIED}, or ones the app if untrusted blamed on other apps {@link #OP_FLAG_UNTRUSTED_PROXY}. @hide */ OP_FLAGS_ALL_TRUSTED : "13", /**@hide No operation specified. */ OP_NONE : "-1", /**@hide Access to coarse location information. */ OP_COARSE_LOCATION : "0", /**@hide Access to fine location information. */ OP_FINE_LOCATION : "1", /**@hide Causing GPS to run. */ OP_GPS : "2", /**@hide */ OP_VIBRATE : "3", /**@hide */ OP_READ_CONTACTS : "4", /**@hide */ OP_WRITE_CONTACTS : "5", /**@hide */ OP_READ_CALL_LOG : "6", /**@hide */ OP_WRITE_CALL_LOG : "7", /**@hide */ OP_READ_CALENDAR : "8", /**@hide */ OP_WRITE_CALENDAR : "9", /**@hide */ OP_WIFI_SCAN : "10", /**@hide */ OP_POST_NOTIFICATION : "11", /**@hide */ OP_NEIGHBORING_CELLS : "12", /**@hide */ OP_CALL_PHONE : "13", /**@hide */ OP_READ_SMS : "14", /**@hide */ OP_WRITE_SMS : "15", /**@hide */ OP_RECEIVE_SMS : "16", /**@hide */ OP_RECEIVE_EMERGECY_SMS : "17", /**@hide */ OP_RECEIVE_MMS : "18", /**@hide */ OP_RECEIVE_WAP_PUSH : "19", /**@hide */ OP_SEND_SMS : "20", /**@hide */ OP_READ_ICC_SMS : "21", /**@hide */ OP_WRITE_ICC_SMS : "22", /**@hide */ OP_WRITE_SETTINGS : "23", /**@hide Required to draw on top of other apps. */ OP_SYSTEM_ALERT_WINDOW : "24", /**@hide */ OP_ACCESS_NOTIFICATIONS : "25", /**@hide */ OP_CAMERA : "26", /**@hide */ OP_RECORD_AUDIO : "27", /**@hide */ OP_PLAY_AUDIO : "28", /**@hide */ OP_READ_CLIPBOARD : "29", /**@hide */ OP_WRITE_CLIPBOARD : "30", /**@hide */ OP_TAKE_MEDIA_BUTTONS : "31", /**@hide */ OP_TAKE_AUDIO_FOCUS : "32", /**@hide */ OP_AUDIO_MASTER_VOLUME : "33", /**@hide */ OP_AUDIO_VOICE_VOLUME : "34", /**@hide */ OP_AUDIO_RING_VOLUME : "35", /**@hide */ OP_AUDIO_MEDIA_VOLUME : "36", /**@hide */ OP_AUDIO_ALARM_VOLUME : "37", /**@hide */ OP_AUDIO_NOTIFICATION_VOLUME : "38", /**@hide */ OP_AUDIO_BLUETOOTH_VOLUME : "39", /**@hide */ OP_WAKE_LOCK : "40", /**@hide Continually monitoring location data. */ OP_MONITOR_LOCATION : "41", /**@hide Continually monitoring location data with a relatively high power request. */ OP_MONITOR_HIGH_POWER_LOCATION : "42", /**@hide Retrieve current usage stats via {@link UsageStatsManager}. */ OP_GET_USAGE_STATS : "43", /**@hide */ OP_MUTE_MICROPHONE : "44", /**@hide */ OP_TOAST_WINDOW : "45", /**@hide Capture the device's display contents and/or audio */ OP_PROJECT_MEDIA : "46", /**@hide Activate a VPN connection without user intervention. */ OP_ACTIVATE_VPN : "47", /**@hide Access the WallpaperManagerAPI to write wallpapers. */ OP_WRITE_WALLPAPER : "48", /**@hide Received the assist structure from an app. */ OP_ASSIST_STRUCTURE : "49", /**@hide Received a screenshot from assist. */ OP_ASSIST_SCREENSHOT : "50", /**@hide Read the phone state. */ OP_READ_PHONE_STATE : "51", /**@hide Add voicemail messages to the voicemail content provider. */ OP_ADD_VOICEMAIL : "52", /**@hide Access APIs for SIP calling over VOIP or WiFi. */ OP_USE_SIP : "53", /**@hide Intercept outgoing calls. */ OP_PROCESS_OUTGOING_CALLS : "54", /**@hide User the fingerprint API. */ OP_USE_FINGERPRINT : "55", /**@hide Access to body sensors such as heart rate, etc. */ OP_BODY_SENSORS : "56", /**@hide Read previously received cell broadcast messages. */ OP_READ_CELL_BROADCASTS : "57", /**@hide Inject mock location into the system. */ OP_MOCK_LOCATION : "58", /**@hide Read external storage. */ OP_READ_EXTERNAL_STORAGE : "59", /**@hide Write external storage. */ OP_WRITE_EXTERNAL_STORAGE : "60", /**@hide Turned on the screen. */ OP_TURN_SCREEN_ON : "61", /**@hide Get device accounts. */ OP_GET_ACCOUNTS : "62", /**@hide Control whether an application is allowed to run in the background. */ OP_RUN_IN_BACKGROUND : "63", /**@hide */ OP_AUDIO_ACCESSIBILITY_VOLUME : "64", /**@hide Read the phone number. */ OP_READ_PHONE_NUMBERS : "65", /**@hide Request package installs through package installer */ OP_REQUEST_INSTALL_PACKAGES : "66", /**@hide Enter picture-in-picture. */ OP_PICTURE_IN_PICTURE : "67", /**@hide Instant app start foreground service. */ OP_INSTANT_APP_START_FOREGROUND : "68", /**@hide Answer incoming phone calls */ OP_ANSWER_PHONE_CALLS : "69", /**@hide Run jobs when in background */ OP_RUN_ANY_IN_BACKGROUND : "70", /**@hide Change Wi-Fi connectivity state */ OP_CHANGE_WIFI_STATE : "71", /**@hide Request package deletion through package installer */ OP_REQUEST_DELETE_PACKAGES : "72", /**@hide Bind an accessibility service. */ OP_BIND_ACCESSIBILITY_SERVICE : "73", /**@hide Continue handover of a call from another app */ OP_ACCEPT_HANDOVER : "74", /**@hide Create and Manage IPsec Tunnels */ OP_MANAGE_IPSEC_TUNNELS : "75", /**@hide Any app start foreground service. */ OP_START_FOREGROUND : "76", /**@hide */ OP_BLUETOOTH_SCAN : "77", /**@hide Use the BiometricPrompt/BiometricManager APIs. */ OP_USE_BIOMETRIC : "78", /**@hide Physical activity recognition. */ OP_ACTIVITY_RECOGNITION : "79", /**@hide Financial app sms read. */ OP_SMS_FINANCIAL_TRANSACTIONS : "80", /**@hide Read media of audio type. */ OP_READ_MEDIA_AUDIO : "81", /**@hide Write media of audio type. */ OP_WRITE_MEDIA_AUDIO : "82", /**@hide Read media of video type. */ OP_READ_MEDIA_VIDEO : "83", /**@hide Write media of video type. */ OP_WRITE_MEDIA_VIDEO : "84", /**@hide Read media of image type. */ OP_READ_MEDIA_IMAGES : "85", /**@hide Write media of image type. */ OP_WRITE_MEDIA_IMAGES : "86", /**@hide Has a legacy (non-isolated) view of storage. */ OP_LEGACY_STORAGE : "87", /**@hide Accessing accessibility features */ OP_ACCESS_ACCESSIBILITY : "88", /**@hide Read the device identifiers (IMEI / MEID, IMSI, SIM / Build serial) */ OP_READ_DEVICE_IDENTIFIERS : "89", /**@hide */ _NUM_OP : "90", /**Access to coarse location information. */ OPSTR_COARSE_LOCATION : "android:coarse_location", /**Access to fine location information. */ OPSTR_FINE_LOCATION : "android:fine_location", /**Continually monitoring location data. */ OPSTR_MONITOR_LOCATION : "android:monitor_location", /**Continually monitoring location data with a relatively high power request. */ OPSTR_MONITOR_HIGH_POWER_LOCATION : "android:monitor_location_high_power", /**Access to {@link android.app.usage.UsageStatsManager}. */ OPSTR_GET_USAGE_STATS : "android:get_usage_stats", /**Activate a VPN connection without user intervention. @hide */ OPSTR_ACTIVATE_VPN : "android:activate_vpn", /**Allows an application to read the user's contacts data. */ OPSTR_READ_CONTACTS : "android:read_contacts", /**Allows an application to write to the user's contacts data. */ OPSTR_WRITE_CONTACTS : "android:write_contacts", /**Allows an application to read the user's call log. */ OPSTR_READ_CALL_LOG : "android:read_call_log", /**Allows an application to write to the user's call log. */ OPSTR_WRITE_CALL_LOG : "android:write_call_log", /**Allows an application to read the user's calendar data. */ OPSTR_READ_CALENDAR : "android:read_calendar", /**Allows an application to write to the user's calendar data. */ OPSTR_WRITE_CALENDAR : "android:write_calendar", /**Allows an application to initiate a phone call. */ OPSTR_CALL_PHONE : "android:call_phone", /**Allows an application to read SMS messages. */ OPSTR_READ_SMS : "android:read_sms", /**Allows an application to receive SMS messages. */ OPSTR_RECEIVE_SMS : "android:receive_sms", /**Allows an application to receive MMS messages. */ OPSTR_RECEIVE_MMS : "android:receive_mms", /**Allows an application to receive WAP push messages. */ OPSTR_RECEIVE_WAP_PUSH : "android:receive_wap_push", /**Allows an application to send SMS messages. */ OPSTR_SEND_SMS : "android:send_sms", /**Required to be able to access the camera device. */ OPSTR_CAMERA : "android:camera", /**Required to be able to access the microphone device. */ OPSTR_RECORD_AUDIO : "android:record_audio", /**Required to access phone state related information. */ OPSTR_READ_PHONE_STATE : "android:read_phone_state", /**Required to access phone state related information. */ OPSTR_ADD_VOICEMAIL : "android:add_voicemail", /**Access APIs for SIP calling over VOIP or WiFi */ OPSTR_USE_SIP : "android:use_sip", /**Access APIs for diverting outgoing calls */ OPSTR_PROCESS_OUTGOING_CALLS : "android:process_outgoing_calls", /**Use the fingerprint API. */ OPSTR_USE_FINGERPRINT : "android:use_fingerprint", /**Access to body sensors such as heart rate, etc. */ OPSTR_BODY_SENSORS : "android:body_sensors", /**Read previously received cell broadcast messages. */ OPSTR_READ_CELL_BROADCASTS : "android:read_cell_broadcasts", /**Inject mock location into the system. */ OPSTR_MOCK_LOCATION : "android:mock_location", /**Read external storage. */ OPSTR_READ_EXTERNAL_STORAGE : "android:read_external_storage", /**Write external storage. */ OPSTR_WRITE_EXTERNAL_STORAGE : "android:write_external_storage", /**Required to draw on top of other apps. */ OPSTR_SYSTEM_ALERT_WINDOW : "android:system_alert_window", /**Required to write/modify/update system settingss. */ OPSTR_WRITE_SETTINGS : "android:write_settings", /**@hide Get device accounts. */ OPSTR_GET_ACCOUNTS : "android:get_accounts", /***/ OPSTR_READ_PHONE_NUMBERS : "android:read_phone_numbers", /**Access to picture-in-picture. */ OPSTR_PICTURE_IN_PICTURE : "android:picture_in_picture", /**@hide */ OPSTR_INSTANT_APP_START_FOREGROUND : "android:instant_app_start_foreground", /**Answer incoming phone calls */ OPSTR_ANSWER_PHONE_CALLS : "android:answer_phone_calls", /** Accept call handover @hide */ OPSTR_ACCEPT_HANDOVER : "android:accept_handover", /**@hide */ OPSTR_GPS : "android:gps", /**@hide */ OPSTR_VIBRATE : "android:vibrate", /**@hide */ OPSTR_WIFI_SCAN : "android:wifi_scan", /**@hide */ OPSTR_POST_NOTIFICATION : "android:post_notification", /**@hide */ OPSTR_NEIGHBORING_CELLS : "android:neighboring_cells", /**@hide */ OPSTR_WRITE_SMS : "android:write_sms", /**@hide */ OPSTR_RECEIVE_EMERGENCY_BROADCAST : "android:receive_emergency_broadcast", /**@hide */ OPSTR_READ_ICC_SMS : "android:read_icc_sms", /**@hide */ OPSTR_WRITE_ICC_SMS : "android:write_icc_sms", /**@hide */ OPSTR_ACCESS_NOTIFICATIONS : "android:access_notifications", /**@hide */ OPSTR_PLAY_AUDIO : "android:play_audio", /**@hide */ OPSTR_READ_CLIPBOARD : "android:read_clipboard", /**@hide */ OPSTR_WRITE_CLIPBOARD : "android:write_clipboard", /**@hide */ OPSTR_TAKE_MEDIA_BUTTONS : "android:take_media_buttons", /**@hide */ OPSTR_TAKE_AUDIO_FOCUS : "android:take_audio_focus", /**@hide */ OPSTR_AUDIO_MASTER_VOLUME : "android:audio_master_volume", /**@hide */ OPSTR_AUDIO_VOICE_VOLUME : "android:audio_voice_volume", /**@hide */ OPSTR_AUDIO_RING_VOLUME : "android:audio_ring_volume", /**@hide */ OPSTR_AUDIO_MEDIA_VOLUME : "android:audio_media_volume", /**@hide */ OPSTR_AUDIO_ALARM_VOLUME : "android:audio_alarm_volume", /**@hide */ OPSTR_AUDIO_NOTIFICATION_VOLUME : "android:audio_notification_volume", /**@hide */ OPSTR_AUDIO_BLUETOOTH_VOLUME : "android:audio_bluetooth_volume", /**@hide */ OPSTR_WAKE_LOCK : "android:wake_lock", /**@hide */ OPSTR_MUTE_MICROPHONE : "android:mute_microphone", /**@hide */ OPSTR_TOAST_WINDOW : "android:toast_window", /**@hide */ OPSTR_PROJECT_MEDIA : "android:project_media", /**@hide */ OPSTR_WRITE_WALLPAPER : "android:write_wallpaper", /**@hide */ OPSTR_ASSIST_STRUCTURE : "android:assist_structure", /**@hide */ OPSTR_ASSIST_SCREENSHOT : "android:assist_screenshot", /**@hide */ OPSTR_TURN_SCREEN_ON : "android:turn_screen_on", /**@hide */ OPSTR_RUN_IN_BACKGROUND : "android:run_in_background", /**@hide */ OPSTR_AUDIO_ACCESSIBILITY_VOLUME : "android:audio_accessibility_volume", /**@hide */ OPSTR_REQUEST_INSTALL_PACKAGES : "android:request_install_packages", /**@hide */ OPSTR_RUN_ANY_IN_BACKGROUND : "android:run_any_in_background", /**@hide */ OPSTR_CHANGE_WIFI_STATE : "android:change_wifi_state", /**@hide */ OPSTR_REQUEST_DELETE_PACKAGES : "android:request_delete_packages", /**@hide */ OPSTR_BIND_ACCESSIBILITY_SERVICE : "android:bind_accessibility_service", /**@hide */ OPSTR_MANAGE_IPSEC_TUNNELS : "android:manage_ipsec_tunnels", /**@hide */ OPSTR_START_FOREGROUND : "android:start_foreground", /**@hide */ OPSTR_BLUETOOTH_SCAN : "android:bluetooth_scan", /**@hide Use the BiometricPrompt/BiometricManager APIs. */ OPSTR_USE_BIOMETRIC : "android:use_biometric", /**@hide Recognize physical activity. */ OPSTR_ACTIVITY_RECOGNITION : "android:activity_recognition", /**@hide Financial app read sms. */ OPSTR_SMS_FINANCIAL_TRANSACTIONS : "android:sms_financial_transactions", /**@hide Read media of audio type. */ OPSTR_READ_MEDIA_AUDIO : "android:read_media_audio", /**@hide Write media of audio type. */ OPSTR_WRITE_MEDIA_AUDIO : "android:write_media_audio", /**@hide Read media of video type. */ OPSTR_READ_MEDIA_VIDEO : "android:read_media_video", /**@hide Write media of video type. */ OPSTR_WRITE_MEDIA_VIDEO : "android:write_media_video", /**@hide Read media of image type. */ OPSTR_READ_MEDIA_IMAGES : "android:read_media_images", /**@hide Write media of image type. */ OPSTR_WRITE_MEDIA_IMAGES : "android:write_media_images", /**@hide Has a legacy (non-isolated) view of storage. */ OPSTR_LEGACY_STORAGE : "android:legacy_storage", /**@hide Interact with accessibility. */ OPSTR_ACCESS_ACCESSIBILITY : "android:access_accessibility", /**@hide Read device identifiers */ OPSTR_READ_DEVICE_IDENTIFIERS : "android:read_device_identifiers", /**@hide */ KEY_HISTORICAL_OPS : "historical_ops", /**Resolves the first unrestricted state given an app op. Location is special as we want to allow its access only if a dedicated location foreground service is running. For other ops we consider any foreground service as a foreground state. @param {Number} op The op to resolve. @return {Number} The last restricted UID state. @hide */ resolveFirstUnrestrictedUidState : function( ) {}, /**Resolves the last restricted state given an app op. Location is special as we want to allow its access only if a dedicated location foreground service is running. For other ops we consider any foreground service as a foreground state. @param {Number} op The op to resolve. @return {Number} The last restricted UID state. @hide */ resolveLastRestrictedUidState : function( ) {}, /** @hide */ getUidStateName : function( ) {}, /** @hide */ getFlagName : function( ) {}, /** @hide */ keyToString : function( ) {}, /** @hide */ makeKey : function( ) {}, /** @hide */ extractUidStateFromKey : function( ) {}, /** @hide */ extractFlagsFromKey : function( ) {}, /** @hide */ flagsToString : function( ) {}, /**Retrieve the op switch that controls the given operation. @hide */ opToSwitch : function( ) {}, /**Retrieve a non-localized name for the operation, for debugging output. @hide */ opToName : function( ) {}, /**Retrieve a non-localized public name for the operation. @hide */ opToPublicName : function( ) {}, /** @hide */ strDebugOpToOp : function( ) {}, /**Retrieve the permission associated with an operation, or null if there is not one. @hide */ opToPermission : function( ) {}, /**Retrieve the permission associated with an operation, or null if there is not one. @param {String} op The operation name. @hide */ opToPermission : function( ) {}, /**Retrieve the user restriction associated with an operation, or null if there is not one. @hide */ opToRestriction : function( ) {}, /**Retrieve the app op code for a permission, or null if there is not one. This API is intended to be used for mapping runtime or appop permissions to the corresponding app op. @hide */ permissionToOpCode : function( ) {}, /**Retrieve whether the op allows the system (and system ui) to bypass the user restriction. @hide */ opAllowSystemBypassRestriction : function( ) {}, /**Retrieve the default mode for the operation. @hide */ opToDefaultMode : function( ) {}, /**Retrieve the default mode for the app op. @param {String} appOp The app op name @return {Number} the default mode for the app op @hide */ opToDefaultMode : function( ) {}, /**Retrieve the human readable mode. @hide */ modeToName : function( ) {}, /**Retrieve whether the op allows itself to be reset. @hide */ opAllowsReset : function( ) {}, /**Retrieve current operation state for all applications. The mode of the ops returned are set for the package but may not reflect their effective state due to UID policy or because it's controlled by a different master op. Use {@link #unsafeCheckOp(String, int, String)}} or {@link #noteOp(String, int, String)} if the effective mode is needed. @param {Object {java.lang.String[]}} ops The set of operations you are interested in, or null if you want all of them. @hide */ getPackagesForOps : function( ) {}, /**Retrieve current operation state for all applications. The mode of the ops returned are set for the package but may not reflect their effective state due to UID policy or because it's controlled by a different master op. Use {@link #unsafeCheckOp(String, int, String)}} or {@link #noteOp(String, int, String)} if the effective mode is needed. @param {Object {int[]}} ops The set of operations you are interested in, or null if you want all of them. @hide */ getPackagesForOps : function( ) {}, /**Retrieve current operation state for one application. The mode of the ops returned are set for the package but may not reflect their effective state due to UID policy or because it's controlled by a different master op. Use {@link #unsafeCheckOp(String, int, String)}} or {@link #noteOp(String, int, String)} if the effective mode is needed. @param {Number} uid The uid of the application of interest. @param {String} packageName The name of the application of interest. @param {Object {int[]}} ops The set of operations you are interested in, or null if you want all of them. @deprecated The int op codes are not stable and you should use the string based op names which are stable and namespaced. Use {@link #getOpsForPackage(int, String, String...)})}. @hide @removed */ getOpsForPackage : function( ) {}, /**Retrieve current operation state for one application. The UID and the package must match. The mode of the ops returned are set for the package but may not reflect their effective state due to UID policy or because it's controlled by a different master op. Use {@link #unsafeCheckOp(String, int, String)}} or {@link #noteOp(String, int, String)} if the effective mode is needed. @param {Number} uid The uid of the application of interest. @param {String} packageName The name of the application of interest. @param {Object {java.lang.String[]}} ops The set of operations you are interested in, or null if you want all of them. @hide */ getOpsForPackage : function( ) {}, /**Retrieve historical app op stats for a period. @param {Object {AppOpsManager.HistoricalOpsRequest}} request A request object describing the data being queried for. @param {Object {Executor}} executor Executor on which to run the callback. If <code>null</code> the callback is executed on the default executor running on the main thread. @param {Object {java.util.function.Consumer}} callback Callback on which to deliver the result. @throws IllegalArgumentException If any of the argument contracts is violated. @hide */ getHistoricalOps : function( ) {}, /**Retrieve historical app op stats for a period. <p> This method queries only the on disk state and the returned ops are raw, which is their times are relative to the history start as opposed to the epoch start. @param {Object {AppOpsManager.HistoricalOpsRequest}} request A request object describing the data being queried for. @param {Object {Executor}} executor Executor on which to run the callback. If <code>null</code> the callback is executed on the default executor running on the main thread. @param {Object {java.util.function.Consumer}} callback Callback on which to deliver the result. @throws IllegalArgumentException If any of the argument contracts is violated. @hide */ getHistoricalOpsFromDiskRaw : function( ) {}, /**Reloads the non historical state to allow testing the read/write path. @hide */ reloadNonHistoricalState : function( ) {}, /**Sets given app op in the specified mode for app ops in the UID. This applies to all apps currently in the UID or installed in this UID in the future. @param {Number} code The app op. @param {Number} uid The UID for which to set the app. @param {Number} mode The app op mode to set. @hide */ setUidMode : function( ) {}, /**Sets given app op in the specified mode for app ops in the UID. This applies to all apps currently in the UID or installed in this UID in the future. @param {String} appOp The app op. @param {Number} uid The UID for which to set the app. @param {Number} mode The app op mode to set. @hide */ setUidMode : function( ) {}, /** @hide */ setUserRestriction : function( ) {}, /** @hide */ setUserRestriction : function( ) {}, /** @hide */ setUserRestrictionForUser : function( ) {}, /** @hide */ setMode : function( ) {}, /**Change the operating mode for the given op in the given app package. You must pass in both the uid and name of the application whose mode is being modified; if these do not match, the modification will not be applied. @param {String} op The operation to modify. One of the OPSTR_* constants. @param {Number} uid The user id of the application whose mode will be changed. @param {String} packageName The name of the application package name whose mode will be changed. @hide */ setMode : function( ) {}, /**Set a non-persisted restriction on an audio operation at a stream-level. Restrictions are temporary additional constraints imposed on top of the persisted rules defined by {@link #setMode}. @param {Number} code The operation to restrict. @param {Number} usage The {@link android.media.AudioAttributes} usage value. @param {Number} mode The restriction mode (MODE_IGNORED,MODE_ERRORED) or MODE_ALLOWED to unrestrict. @param {Object {java.lang.String[]}} exceptionPackages Optional list of packages to exclude from the restriction. @hide */ setRestriction : function( ) {}, /** @hide */ resetAllModes : function( ) {}, /**Gets the app op name associated with a given permission. The app op name is one of the public constants defined in this class such as {@link #OPSTR_COARSE_LOCATION}. This API is intended to be used for mapping runtime permissions to the corresponding app op. @param {String} permission The permission. @return {String} The app op associated with the permission or null. */ permissionToOp : function( ) {}, /**Monitor for changes to the operating mode for the given op in the given app package. You can watch op changes only for your UID. @param {String} op The operation to monitor, one of OPSTR_*. @param {String} packageName The name of the application to monitor. @param {Object {AppOpsManager.OnOpChangedListener}} callback Where to report changes. */ startWatchingMode : function( ) {}, /**Monitor for changes to the operating mode for the given op in the given app package. You can watch op changes only for your UID. @param {String} op The operation to monitor, one of OPSTR_*. @param {String} packageName The name of the application to monitor. @param {Number} flags Option flags: any combination of {@link #WATCH_FOREGROUND_CHANGES} or 0. @param {Object {AppOpsManager.OnOpChangedListener}} callback Where to report changes. */ startWatchingMode : function( ) {}, /**Monitor for changes to the operating mode for the given op in the given app package. <p> If you don't hold the {@link android.Manifest.permission#WATCH_APPOPS} permission you can watch changes only for your UID. @param {Number} op The operation to monitor, one of OP_*. @param {String} packageName The name of the application to monitor. @param {Object {AppOpsManager.OnOpChangedListener}} callback Where to report changes. @hide */ startWatchingMode : function( ) {}, /**Monitor for changes to the operating mode for the given op in the given app package. <p> If you don't hold the {@link android.Manifest.permission#WATCH_APPOPS} permission you can watch changes only for your UID. @param {Number} op The operation to monitor, one of OP_*. @param {String} packageName The name of the application to monitor. @param {Number} flags Option flags: any combination of {@link #WATCH_FOREGROUND_CHANGES} or 0. @param {Object {AppOpsManager.OnOpChangedListener}} callback Where to report changes. @hide */ startWatchingMode : function( ) {}, /**Stop monitoring that was previously started with {@link #startWatchingMode}. All monitoring associated with this callback will be removed. */ stopWatchingMode : function( ) {}, /**Start watching for changes to the active state of app ops. An app op may be long running and it has a clear start and stop delimiters. If an op is being started or stopped by any package you will get a callback. To change the watched ops for a registered callback you need to unregister and register it again. <p> If you don't hold the {@link android.Manifest.permission#WATCH_APPOPS} permission you can watch changes only for your UID. @param {Object {int[]}} ops The ops to watch. @param {Object {AppOpsManager.OnOpActiveChangedListener}} callback Where to report changes. @see #isOperationActive(int, int, String) @see #stopWatchingActive(OnOpActiveChangedListener) @see #startOp(int, int, String) @see #finishOp(int, int, String) @hide */ startWatchingActive : function( ) {}, /**Stop watching for changes to the active state of an app op. An app op may be long running and it has a clear start and stop delimiters. Unregistering a non-registered callback has no effect. @see #isOperationActive#(int, int, String) @see #startWatchingActive(int[], OnOpActiveChangedListener) @see #startOp(int, int, String) @see #finishOp(int, int, String) @hide */ stopWatchingActive : function( ) {}, /**Start watching for noted app ops. An app op may be immediate or long running. Immediate ops are noted while long running ones are started and stopped. This method allows registering a listener to be notified when an app op is noted. If an op is being noted by any package you will get a callback. To change the watched ops for a registered callback you need to unregister and register it again. <p> If you don't hold the {@link android.Manifest.permission#WATCH_APPOPS} permission you can watch changes only for your UID. @param {Object {int[]}} ops The ops to watch. @param {Object {AppOpsManager.OnOpNotedListener}} callback Where to report changes. @see #startWatchingActive(int[], OnOpActiveChangedListener) @see #stopWatchingNoted(OnOpNotedListener) @see #noteOp(String, int, String) @hide */ startWatchingNoted : function( ) {}, /**Stop watching for noted app ops. An app op may be immediate or long running. Unregistering a non-registered callback has no effect. @see #startWatchingNoted(int[], OnOpNotedListener) @see #noteOp(String, int, String) @hide */ stopWatchingNoted : function( ) {}, /**{@hide} */ strOpToOp : function( ) {}, /**Do a quick check for whether an application might be able to perform an operation. This is <em>not</em> a security check; you must use {@link #noteOp(String, int, String)} or {@link #startOp(String, int, String)} for your actual security checks, which also ensure that the given uid and package name are consistent. 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. This does not modify the time stamp or other data about the operation. <p>Important things this will not do (which you need to ultimate use {@link #noteOp(String, int, String)} or {@link #startOp(String, int, String)} to cover):</p> <ul> <li>Verifying the uid and package are consistent, so callers can't spoof their identity.</li> <li>Taking into account the current foreground/background state of the app; apps whose mode varies by this state will always be reported as {@link #MODE_ALLOWED}.</li> </ul> @param {String} op The operation to check. One of the OPSTR_* constants. @param {Number} uid The user id of the application attempting to perform the operation. @param {String} packageName The name of the application attempting to perform the operation. @return {Number} Returns {@link #MODE_ALLOWED} if the operation is allowed, or {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without causing the app to crash). @throws SecurityException If the app has been configured to crash on this op. */ unsafeCheckOp : function( ) {}, /** @deprecated Renamed to {@link #unsafeCheckOp(String, int, String)}. */ checkOp : function( ) {}, /**Like {@link #checkOp} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. */ unsafeCheckOpNoThrow : function( ) {}, /** @deprecated Renamed to {@link #unsafeCheckOpNoThrow(String, int, String)}. */ checkOpNoThrow : function( ) {}, /**Like {@link #checkOp} but returns the <em>raw</em> mode associated with the op. Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}. */ unsafeCheckOpRaw : function( ) {}, /**Like {@link #unsafeCheckOpNoThrow(String, int, String)} but returns the <em>raw</em> mode associated with the op. Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}. */ unsafeCheckOpRawNoThrow : function( ) {}, /**Make note of an application performing an operation. Note that you must pass in both the uid and name of the application to be checked; this function will verify that these two match, and if not, return {@link #MODE_IGNORED}. If this call succeeds, the last execution time of the operation for this app will be updated to the current time. @param {String} op The operation to note. One of the OPSTR_* constants. @param {Number} uid The user id of the application attempting to perform the operation. @param {String} packageName The name of the application attempting to perform the operation. @return {Number} Returns {@link #MODE_ALLOWED} if the operation is allowed, or {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without causing the app to crash). @throws SecurityException If the app has been configured to crash on this op. */ noteOp : function( ) {}, /**Like {@link #noteOp} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. */ noteOpNoThrow : function( ) {}, /**Make note of an application performing an operation on behalf of another application when handling an IPC. Note that you must pass the package name of the application that is being proxied while its UID will be inferred from the IPC state; this function will verify that the calling uid and proxied package name match, and if not, return {@link #MODE_IGNORED}. If this call succeeds, the last execution time of the operation for the proxied app and your app will be updated to the current time. @param {String} op The operation to note. One of the OPSTR_* constants. @param {String} proxiedPackageName The name of the application calling into the proxy application. @return {Number} Returns {@link #MODE_ALLOWED} if the operation is allowed, or {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without causing the app to crash). @throws SecurityException If the app has been configured to crash on this op. */ noteProxyOp : function( ) {}, /**Like {@link #noteProxyOp(String, String)} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. <p>This API requires the package with the {@code proxiedPackageName} to belongs to {@link Binder#getCallingUid()}. */ noteProxyOpNoThrow : function( ) {}, /**Like {@link #noteProxyOpNoThrow(String, String)} but allows to specify the proxied uid. <p>This API requires package with the {@code proxiedPackageName} to belong to {@code proxiedUid}. @param {String} op The op to note @param {String} proxiedPackageName The package to note the op for or {@code null} if the op should be noted for the "android" package @param {Number} proxiedUid The uid the package belongs to */ noteProxyOpNoThrow : function( ) {}, /**Report that an application has started executing a long-running operation. Note that you must pass in both the uid and name of the application to be checked; this function will verify that these two match, and if not, return {@link #MODE_IGNORED}. If this call succeeds, the last execution time of the operation for this app will be updated to the current time and the operation will be marked as "running". In this case you must later call {@link #finishOp(String, int, String)} to report when the application is no longer performing the operation. @param {String} op The operation to start. One of the OPSTR_* constants. @param {Number} uid The user id of the application attempting to perform the operation. @param {String} packageName The name of the application attempting to perform the operation. @return {Number} Returns {@link #MODE_ALLOWED} if the operation is allowed, or {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without causing the app to crash). @throws SecurityException If the app has been configured to crash on this op. */ startOp : function( ) {}, /**Like {@link #startOp} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. */ startOpNoThrow : function( ) {}, /**Report that an application is no longer performing an operation that had previously been started with {@link #startOp(String, int, String)}. There is no validation of input or result; the parameters supplied here must be the exact same ones previously passed in when starting the operation. */ finishOp : function( ) {}, /**Do a quick check for whether an application might be able to perform an operation. This is <em>not</em> a security check; you must use {@link #noteOp(int, int, String)} or {@link #startOp(int, int, String)} for your actual security checks, which also ensure that the given uid and package name are consistent. 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. This does not modify the time stamp or other data about the operation. <p>Important things this will not do (which you need to ultimate use {@link #noteOp(int, int, String)} or {@link #startOp(int, int, String)} to cover):</p> <ul> <li>Verifying the uid and package are consistent, so callers can't spoof their identity.</li> <li>Taking into account the current foreground/background state of the app; apps whose mode varies by this state will always be reported as {@link #MODE_ALLOWED}.</li> </ul> @param {Number} op The operation to check. One of the OP_* constants. @param {Number} uid The user id of the application attempting to perform the operation. @param {String} packageName The name of the application attempting to perform the operation. @return {Number} Returns {@link #MODE_ALLOWED} if the operation is allowed, or {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without causing the app to crash). @throws SecurityException If the app has been configured to crash on this op. @hide */ checkOp : function( ) {}, /**Like {@link #checkOp} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. @hide */ checkOpNoThrow : function( ) {}, /**Do a quick check to validate if a package name belongs to a UID. @throws SecurityException if the package name doesn't belong to the given UID, or if ownership cannot be verified. */ checkPackage : function( ) {}, /**Like {@link #checkOp} but at a stream-level for audio operations. @hide */ checkAudioOp : function( ) {}, /**Like {@link #checkAudioOp} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. @hide */ checkAudioOpNoThrow : function( ) {}, /**Make note of an application performing an operation. Note that you must pass in both the uid and name of the application to be checked; this function will verify that these two match, and if not, return {@link #MODE_IGNORED}. If this call succeeds, the last execution time of the operation for this app will be updated to the current time. @param {Number} op The operation to note. One of the OP_* constants. @param {Number} uid The user id of the application attempting to perform the operation. @param {String} packageName The name of the application attempting to perform the operation. @return {Number} Returns {@link #MODE_ALLOWED} if the operation is allowed, or {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without causing the app to crash). @throws SecurityException If the app has been configured to crash on this op. @hide */ noteOp : function( ) {}, /**Make note of an application performing an operation on behalf of another application when handling an IPC. Note that you must pass the package name of the application that is being proxied while its UID will be inferred from the IPC state; this function will verify that the calling uid and proxied package name match, and if not, return {@link #MODE_IGNORED}. If this call succeeds, the last execution time of the operation for the proxied app and your app will be updated to the current time. @param {Number} op The operation to note. One of the OPSTR_* constants. @param {String} proxiedPackageName The name of the application calling into the proxy application. @return {Number} Returns {@link #MODE_ALLOWED} if the operation is allowed, or {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without causing the app to crash). @throws SecurityException If the proxy or proxied app has been configured to crash on this op. @hide */ noteProxyOp : function( ) {}, /**Like {@link #noteProxyOp(int, String)} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. @hide */ noteProxyOpNoThrow : function( ) {}, /**Like {@link #noteProxyOp(int, String)} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. <p>This API requires the package with {@code proxiedPackageName} to belongs to {@link Binder#getCallingUid()}. @hide */ noteProxyOpNoThrow : function( ) {}, /**Like {@link #noteOp} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. @hide */ noteOpNoThrow : function( ) {}, /** @hide */ noteOp : function( ) {}, /** @hide */ getToken : function( ) {}, /** @hide */ startOp : function( ) {}, /**Report that an application has started executing a long-running operation. Note that you must pass in both the uid and name of the application to be checked; this function will verify that these two match, and if not, return {@link #MODE_IGNORED}. If this call succeeds, the last execution time of the operation for this app will be updated to the current time and the operation will be marked as "running". In this case you must later call {@link #finishOp(int, int, String)} to report when the application is no longer performing the operation. @param {Number} op The operation to start. One of the OP_* constants. @param {Number} uid The user id of the application attempting to perform the operation. @param {String} packageName The name of the application attempting to perform the operation. @return {Number} Returns {@link #MODE_ALLOWED} if the operation is allowed, or {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without causing the app to crash). @throws SecurityException If the app has been configured to crash on this op. @hide */ startOp : function( ) {}, /**Report that an application has started executing a long-running operation. Similar to {@link #startOp(String, int, String) except that if the mode is {@link #MODE_DEFAULT} the operation should succeed since the caller has performed its standard permission checks which passed and would perform the protected operation for this mode. @param {Number} op The operation to start. One of the OP_* constants. @param {Number} uid The user id of the application attempting to perform the operation. @param {String} packageName The name of the application attempting to perform the operation. @param {Boolean} startIfModeDefault Whether to start if mode is {@link #MODE_DEFAULT}. @param startIfModeDefault Whether to start if mode is {@link #MODE_DEFAULT}. @throws SecurityException If the app has been configured to crash on this op or the package is not in the passed in UID. @hide */ startOp : function( ) {}, /**Like {@link #startOp} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. @hide */ startOpNoThrow : function( ) {}, /**Like {@link #startOp(int, int, String, boolean)} but instead of throwing a {@link SecurityException} it returns {@link #MODE_ERRORED}. @param {Number} op The operation to start. One of the OP_* constants. @param {Number} uid The user id of the application attempting to perform the operation. @param {String} packageName The name of the application attempting to perform the operation. @param {Boolean} startIfModeDefault Whether to start if mode is {@link #MODE_DEFAULT}. @param startIfModeDefault Whether to start if mode is {@link #MODE_DEFAULT}. @hide */ startOpNoThrow : function( ) {}, /**Report that an application is no longer performing an operation that had previously been started with {@link #startOp(int, int, String)}. There is no validation of input or result; the parameters supplied here must be the exact same ones previously passed in when starting the operation. @hide */ finishOp : function( ) {}, /** @hide */ finishOp : function( ) {}, /**Checks whether the given op for a UID and package is active. <p> If you don't hold the {@link android.Manifest.permission#WATCH_APPOPS} permission you can query only for your UID. @see #startWatchingActive(int[], OnOpActiveChangedListener) @see #stopWatchingMode(OnOpChangedListener) @see #finishOp(int) @see #startOp(int) @hide */ isOperationActive : function( ) {}, /**Configures the app ops persistence for testing. @param {Number} mode The mode in which the historical registry operates. @param {Number} baseSnapshotInterval The base interval on which we would be persisting a snapshot of the historical data. The history is recursive where every subsequent step encompasses {@code compressionStep} longer interval with {@code compressionStep} distance between snapshots. @param {Number} compressionStep The compression step in every iteration. @see #HISTORICAL_MODE_DISABLED @see #HISTORICAL_MODE_ENABLED_ACTIVE @see #HISTORICAL_MODE_ENABLED_PASSIVE @hide */ setHistoryParameters : function( ) {}, /**Offsets the history by the given duration. @param {Number} offsetMillis The offset duration. @hide */ offsetHistory : function( ) {}, /**Adds ops to the history directly. This could be useful for testing especially when the historical registry operates in {@link #HISTORICAL_MODE_ENABLED_PASSIVE} mode. @param {Object {AppOpsManager.HistoricalOps}} ops The ops to add to the history. @see #setHistoryParameters(int, long, int) @see #HISTORICAL_MODE_ENABLED_PASSIVE @hide */ addHistoricalOps : function( ) {}, /**Resets the app ops persistence for testing. @see #setHistoryParameters(int, long, int) @hide */ resetHistoryParameters : function( ) {}, /**Clears all app ops history. @hide */ clearHistory : function( ) {}, /**Returns all supported operation names. @hide */ getOpStrs : function( ) {}, /** @return {Number} number of App ops @hide */ getNumOps : function( ) {}, /** @hide */ uidStateToString : function( ) {}, /** @hide */ parseHistoricalMode : function( ) {}, /** @hide */ historicalModeToString : function( ) {}, };