Skip to content

Commit

Permalink
add messages further
Browse files Browse the repository at this point in the history
  • Loading branch information
KazuCocoa committed Sep 20, 2023
1 parent cf64c2e commit 90cfad3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ appium:clearDeviceLogsOnStart | If set to `true` then UiAutomator2 deletes all t
appium:buildToolsVersion | The version of Android build tools to use. By default UiAutomator2 driver uses the most recent version of build tools installed on the machine, but sometimes it might be necessary to give it a hint (let say if there is a known bug in the most recent tools version). Example: `28.0.3`
appium:skipLogcatCapture | Being set to `true` disables automatic logcat output collection during the test run. `false` by default
appium:suppressKillServer | Being set to `true` prevents the driver from ever killing the ADB server explicitly. Could be useful if ADB is connected wirelessly. `false` by default
appium:ignoreHiddenApiPolicyError | Being set to `true` ignores a failure while changing hidden API access policies. Could be useful on some devices, where access to these policies has been locked by its vendor. `true` by default since driver version 2.30.0.
appium:ignoreHiddenApiPolicyError | Being set to `true` ignores a failure while changing hidden API access policies. Could be useful on some devices, where access to these policies has been locked by its vendor. `false` by default
appium:mockLocationApp | Sets the package identifier of the app, which is used as a system mock location provider since Appium 1.18.0+. This capability has no effect on emulators. If the value is set to `null` or an empty string, then Appium will skip the mocked location provider setup procedure. Defaults to Appium Setting package identifier (`io.appium.settings`). Termination of a mock location provider application resets the mocked location data.
appium:logcatFormat | The log print format, where `format` is one of: `brief` `process` `tag` `thread` `raw` `time` `threadtime` `long`. `threadtime` is the default value.
appium:logcatFilterSpecs | Series of `tag[:priority]` where `tag` is a log component tag (or * for all) and priority is: `V Verbose`, `D Debug`, `I Info`, `W Warn`, `E Error`, `F Fatal`, `S Silent (supress all output)`. '*' means '*:d' and `tag` by itself means `tag:v`. If not specified on the commandline, filterspec is set from ANDROID_LOG_TAGS. If no filterspec is found, filter defaults to '*:I'.
Expand Down
12 changes: 9 additions & 3 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ class AndroidUiautomator2Driver extends BaseDriver {
fullReset: false,
autoLaunch: true,
adbPort: DEFAULT_ADB_PORT,
androidInstallTimeout: 90000,
ignoreHiddenApiPolicyError: true
androidInstallTimeout: 90000
};
_.defaults(this.opts, defaultOpts);

Expand Down Expand Up @@ -367,7 +366,14 @@ class AndroidUiautomator2Driver extends BaseDriver {

if (apiLevel >= 28) { // Android P
this.log.info('Relaxing hidden api policy');
await this.adb.setHiddenApiPolicy('1', !!this.opts.ignoreHiddenApiPolicyError);
try {
await this.adb.setHiddenApiPolicy('1', !!this.opts.ignoreHiddenApiPolicyError);
} catch (err) {
this.log.errorAndThrow(`Failed to disable hidden api policy as ${err.message}. You could configure ` +
'the device properly to avoid permission denial error. https://github.com/appium/appium/issues/13802 ' +
'may help to see possible configurations, or ignoreHiddenApiPolicyError capability let you ' +
'ignore the error.');
}
}

// check if we have to enable/disable gps before running the application
Expand Down

0 comments on commit 90cfad3

Please sign in to comment.