appium-android-driver
Version:
Android UiAutomator and Chrome support for Appium
61 lines • 3.03 kB
TypeScript
import type { AndroidDriver } from '../driver';
declare const PM_ACTION: Readonly<{
readonly GRANT: "grant";
readonly REVOKE: "revoke";
}>;
declare const APPOPS_ACTION: Readonly<{
readonly ALLOW: "allow";
readonly DENY: "deny";
readonly IGNORE: "ignore";
readonly DEFAULT: "default";
}>;
declare const PERMISSION_TARGET: Readonly<{
readonly PM: "pm";
readonly APPOPS: "appops";
}>;
declare const PERMISSIONS_TYPE: Readonly<{
readonly DENIED: "denied";
readonly GRANTED: "granted";
readonly REQUESTED: "requested";
}>;
/**
* Changes permissions for an Android application.
*
* @param permissions If `target` is set to 'pm':
* The full name of the permission to be changed
* or a list of permissions. Check https://developer.android.com/reference/android/Manifest.permission
* to get the full list of standard Android permission names. Mandatory argument.
* If 'all' magic string is passed then the chosen action is going to be applied to all
* permissions requested/granted by 'appPackage'.
* If `target` is set to 'appops':
* The full name of the appops permission to be changed
* or a list of permissions. Check AppOpsManager.java sources to get the full list of
* available appops permission names. Mandatory argument.
* Examples: 'ACTIVITY_RECOGNITION', 'SMS_FINANCIAL_TRANSACTIONS', 'READ_SMS', 'ACCESS_NOTIFICATIONS'.
* The 'all' magic string is unsupported.
* @param appPackage The application package to set change permissions on. Defaults to the
* package name under test.
* @param action One of `PM_ACTION` values if `target` is set to 'pm', otherwise
* one of `APPOPS_ACTION` values.
* @param target Either 'pm' or 'appops'. The 'appops' one requires
* 'adb_shell' server security option to be enabled. Defaults to 'pm'.
* @returns Promise that resolves when permissions are changed.
* @throws {errors.InvalidArgumentError} If permissions argument is missing, empty, or invalid.
*/
export declare function mobileChangePermissions(this: AndroidDriver, permissions: string | string[], appPackage?: string, action?: PMAction | AppOpsAction, target?: PermissionTarget): Promise<void>;
/**
* Gets permissions for an Android application.
*
* @param type One of possible permission types to get. Defaults to 'requested'.
* @param appPackage The application package to get permissions for.
* Defaults to the package name under test.
* @returns Promise that resolves to an array of permission names.
* @throws {errors.InvalidArgumentError} If the permission type is unknown.
*/
export declare function mobileGetPermissions(this: AndroidDriver, type?: PermissionsType, appPackage?: string): Promise<string[]>;
type PMAction = typeof PM_ACTION[keyof typeof PM_ACTION];
type AppOpsAction = typeof APPOPS_ACTION[keyof typeof APPOPS_ACTION];
type PermissionTarget = typeof PERMISSION_TARGET[keyof typeof PERMISSION_TARGET];
type PermissionsType = typeof PERMISSIONS_TYPE[keyof typeof PERMISSIONS_TYPE];
export {};
//# sourceMappingURL=permissions.d.ts.map