Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set do not suppress accessibility services for uiautomation #468

Closed
wants to merge 4 commits into from

Conversation

KazuCocoa
Copy link
Member

Espresso driver has a couple of methods which call UiDevice.getInstance, appium/appium#4910 may happen.

This affects below methods.

  • GetAlertText/DismissAlert/AcceptAlert
  • Uiautomator by mobile command

@KazuCocoa KazuCocoa changed the title [do not merge]set do not suppress accessibility services for uiautomation set do not suppress accessibility services for uiautomation Aug 12, 2019
// The flag is necessary not to stop running accessibility service
// https://github.com/appium/appium/issues/4910
// https://developer.android.com/reference/android/app/UiAutomation.html#FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
Configurator.getInstance().uiAutomationFlags = UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably should do

                Configurator.getInstance().uiAutomationFlags = Configurator.getInstance().uiAutomationFlags | UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES;

In order to not corrupt the current flags

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also prefer to have this option configurable via capabilities to make sure it does not affect current tests

@KazuCocoa
Copy link
Member Author

Roughly tried to define a custom runner to handle -e when the server launches so that we can handle UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES in launch time, but dex error happened.
da3399f

2019-11-06 23:58:02.077 20296-20296/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: io.appium.android.apis, PID: 20296
    java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{io.appium.espressoserver.test/io.appium.espressoserver.test.helpers.AppiumAndroidJUnitRunner}: java.lang.ClassNotFoundException: Didn't find class "io.appium.espressoserver.test.helpers.AppiumAndroidJUnitRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/io.appium.espressoserver.test-SyO1i6Q-0KdJlgOyW9ikag==/base.apk", zip file "/data/app/io.appium.android.apis-_UT2k1A5_pGIrMWDHQvbMQ==/base.apk"],nativeLibraryDirectories=[/system/lib64]]
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5806)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "io.appium.espressoserver.test.helpers.AppiumAndroidJUnitRunner" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/system/framework/android.test.mock.jar", zip file "/data/app/io.appium.espressoserver.test-SyO1i6Q-0KdJlgOyW9ikag==/base.apk", zip file "/data/app/io.appium.android.apis-_UT2k1A5_pGIrMWDHQvbMQ==/base.apk"],nativeLibraryDirectories=[/system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5802)
        at android.app.ActivityThread.access$1100(ActivityThread.java:199) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

@mykola-mokhnach
Copy link
Contributor

@KazuCocoa It this PR still relevant?

@KazuCocoa
Copy link
Member Author

#559

@KazuCocoa KazuCocoa closed this Mar 29, 2020
@KazuCocoa KazuCocoa deleted the km/do-not-suppress-as branch March 29, 2020 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants