Re: UIAutomator shell command from Android app

2,896 views
Skip to first unread message

Guang Zhu

unread,
Mar 28, 2013, 8:36:07 PM3/28/13
to adt...@googlegroups.com
Hi Saurabh,

This will not work: when you run from shell, UI test assumes the identity of `shell` user, which is why it has permission to perform UI inspection and event injection; when you run from your app, UI test assumes the identity of the user allocated for your app package, and it does not have such permissions.

Thanks,
Guang

On Thu, Mar 28, 2013 at 3:05 AM, Saurabh Rupainwar <saurabh....@gmail.com> wrote:
Can i run the uiautomator command "adb shell uiautomator runtest LaunchSettings.jar -c com.uia.example.my.LaunchSettings" from an android application (for example on a button click) when I have already pushed the jar at /data/local/tmp/ location ?

I have tried doing this from code but nothing is happening, while running the command from shell works perfectly fine.

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Guang Zhu
Android Test Engineering
Google Inc.

Please keep all discussions on related Google Groups, no direct emails. Thanks!

Matt Russell

unread,
Aug 1, 2013, 2:54:14 PM8/1/13
to adt...@googlegroups.com
Sorry to revive an old topic, but I noticed that the  permission required is RETRIVE_WINDOW_CONTENT which can be granted for accessibility services. Is it possible to write an accessibility service that is able to "kick off" a uiautomator test?

I gave this a quick try and got past the first permission, but ran into a violation of android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY which despite writing use-permission in my manifest did not provide a work around.

Any additional insight into this? (4.2.2 image)

ahmed ibrahem

unread,
Aug 9, 2013, 11:11:04 AM8/9/13
to adt...@googlegroups.com
Hi Matt,

Did you solve the android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY problem??
Because i'm stuck at the same problem now!
any help will be highly appreciated!

Thanks,

Ahmed

ahmed ibrahem

unread,
Aug 11, 2013, 5:34:20 AM8/11/13
to adt...@googlegroups.com
Did you solve the ACCESS_CONTENT_PROVIDERS_EXTERNALLY permission problem ??? 


On Thursday, August 1, 2013 7:54:14 PM UTC+1, Matt Russell wrote:

Matt Russell

unread,
Aug 16, 2013, 2:54:49 PM8/16/13
to adt...@googlegroups.com

Unfortunately, no. I didn't spend too long trying to get it to work though. You could try doing an adb loop back though from a call within your accessibility service.

You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/3XCMqxCIuJ8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.

vineela reddy

unread,
Feb 11, 2014, 7:51:37 AM2/11/14
to adt...@googlegroups.com
Hi Saurabh,
 
You can add adb shell command in the code also, It is working fine.You can add Runtime.getRuntime().exec("uiautomator runtest   LaunchSettings.jar -c com.uia.example.my.LaunchSettings") in the Java code.Otherwise share your code. I will check once.
 
Thanks,
Vineela

On Thursday, March 28, 2013 3:35:31 PM UTC+5:30, Saurabh Rupainwar wrote:

vineela reddy

unread,
Feb 11, 2014, 8:02:23 AM2/11/14
to adt...@googlegroups.com

On Thursday, March 28, 2013 3:35:31 PM UTC+5:30, Saurabh Rupainwar wrote:
Can i run the uiautomator command "adb shell uiautomator runtest LaunchSettings.jar -c com.uia.example.my.LaunchSettings" from an android application (for example on a button click) when I have already pushed the jar at /data/local/tmp/ location ?

I have tried doing this from code but nothing is happening, while running the command from shell works perfectly fine.
You can add adb shell command in the Application using Runtime.getRuntime().exec("uiautomator runtest LaunchSettings.jar -c com.uia.example.my.LaunchSettings").It is working fine my side.

jayanth

unread,
Feb 12, 2014, 5:40:21 AM2/12/14
to adt...@googlegroups.com
hi,
i am using the code "Runtime.getRuntime().exec("uiautomator runtest SettingsTest.jar -c com.example.tests.SettingsTest");" to run the ui automator from the android application. Still i get the below exception

02-12 10:15:17.125: I/System.out(1787): INSTRUMENTATION_RESULT: longMsg=Permission Denial: Do not have permission in call getContentProviderExternal() from pid=1843, uid=10048 requires android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
I am trying to run the application on an emulator with api level 17 /19 . In both the cases i get the same error.

Can someone comment if you have solved this issue.

thanks

Bharathiraja R

unread,
Oct 30, 2014, 1:01:01 PM10/30/14
to adt...@googlegroups.com
Is it really working for you??
i'm getting runtimeexception..
Can you please help me to execute..

Horia Mihail Goran

unread,
Nov 10, 2014, 3:36:34 AM11/10/14
to adt...@googlegroups.com
I'm having this problem as well
Reply all
Reply to author
Forward
0 new messages