0

Possible Duplicate:
How to launch video icon in camera

I am trying to launch an app through adb in my Android phone. I have tried adb getevent. But it dumps so many events.

How can I make out which one I need? Is there any other way I can launch the app?

I am looking to launch video. There is no separate video apk. It is in camera apk only. I was able to launch camera through adb as:

am start -a android.intent.action.MAIN -n com.android.camera/.CameraEntry

The camcorder icon is next to snap icon in camera. I was able to control snap icon thru input keyevent 23. But unable to figure out how to launch video which is next to snap icon

Community
  • 1
  • 1
  • Related: http://stackoverflow.com/a/11455887/1068283 – Michael Hampton Jul 12 '12 at 19:29
  • @MichaelHampton the op is talking about doing it from the command line. – t0mm13b Jul 12 '12 at 19:32
  • @t0mm13b [monkeyrunner](http://developer.android.com/tools/help/monkeyrunner_concepts.html) is perfectly capable of that. It runs on the user's workstation and controls a program running on a connected Android device or emulator. Now if he's talking about running directly on the device without a connected computer, then I don't think there's a solution. – Michael Hampton Jul 12 '12 at 19:35
  • That's because monkey (on the ROM itself) is signed with rom's key when built into the ROM. – t0mm13b Jul 12 '12 at 19:36
  • actually, can monkeyrunner dictate to the monkey program, to inject it in itself into the activity in question... hmmmmm? *ponders* like shelling out and invoking the monkey, that could be a way around it... – t0mm13b Jul 12 '12 at 19:40
  • @t0mm13b monkey is not signed with the system key. It's actually not signed with anything, as it's a command line executable. It's privileges have to come either from being run under the semi-privileged "shell" userid of the ADB daemon (which is what lets sendevent work), or from cooperation of the targeted apps, or both. – Chris Stratton Jul 13 '12 at 00:58
  • @ChrisStratton Hummm not sure in that, since the source which resides in AOSP `development/cmds/monkey/Android.mk` is where it gets built and dumped into `/system/bin/monkey` within the ROM itself. So care to explain how the monkey binary is able to inject without being signed as you say? – t0mm13b Jul 13 '12 at 01:48
  • Bear in mind, if the handset does not have root so adb is secured look in `default.prop` a lá `ro.secure=1` within the ramdisk itself, thus by definition goes against what you're saying! – t0mm13b Jul 13 '12 at 01:56
  • @t0mm13b - compile it yourself, push it to /data/local (/data/local/tmp post-ICS) and try it. What is special is the userid running it, not the program. As native code it doesn't really get signed (other than as part of the whole image). Becuase it does not use setuid, being installed on the /system partition or owned by root is not required. – Chris Stratton Jul 13 '12 at 02:04
  • Ok. ran `id` on unrooted handset - got this, $ id uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1011(adb),1015(sdcard_rw),3001(net_bt_admin),3002(net_bt),3003(inet) – t0mm13b Jul 13 '12 at 02:08
  • So you're telling me that monkey is owned by shell I would guess? which can run alright but not setuid? Just for the discussion as am intrigued... :) – t0mm13b Jul 13 '12 at 02:09
  • to clarify, owner is root/group is shell as in the ownership of the monkey binary – t0mm13b Jul 13 '12 at 02:12
  • @ChrisStratton are you ignoring this? - am waiting for your answer? – t0mm13b Jul 16 '12 at 02:11
  • @t0mm13b all is answered in my previous comment. – Chris Stratton Jul 16 '12 at 04:17

1 Answers1

0

Short answer, No, that is about as far as you can get, to launch an activity in that manner but not control the UI from the adb itself.

Long answer, Android prohibits injecting events into a activity as a security thing which in fact is a good thing otherwise there'd be hundreds of malware in the wild seizing control of the handset as a result due to injecting events and causing the apps on the handset to do things without you knowing about it.

Furthermore, the usage of injecting events requires a ROM's signed key to enable the functionality.

Edit:

After commenting with @MichaelHampton about this, in theory, it could be possible to use the ROM's own monkey program to send a keystroke etc, after all, the monkey program is signed with the ROM's security key, it could be a matter of knowing what commands to invoke and pass into the monkey program, by shelling out and in turn directing it to the said activity...? Its theoretical...have not tried it nor thought some more about it..

t0mm13b
  • 34,087
  • 8
  • 78
  • 110
  • This is addressing a different question than was asked - the question asked concerns using ADB, which, unlike an app, **does** have permission to inject events. – Chris Stratton Oct 29 '13 at 20:27