From 90cfad323a14936d8d3f354a585ff01f107a592b Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Wed, 20 Sep 2023 00:27:25 -0700 Subject: [PATCH] add messages further --- README.md | 2 +- lib/driver.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8748cf62d..63977e1fa 100644 --- a/README.md +++ b/README.md @@ -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'. diff --git a/lib/driver.js b/lib/driver.js index f54829010..e5a3e0ca8 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -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); @@ -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