modify Android emulator - android

Is there a way to modify the Android emulator? For example, can we somehow intercept user inputs to the emulator and interpret them differently? Also, is there existing tools to do dynamic binary rewrite inside the emulator or qemu?

The emulator is emulating the hardware. You can do dynamic binary rewrites inside the emulator in exactly the same as on a device (for example, using LD_PRELOAD for native, or by changing the loader), or not at all. There is nothing that the fact it is an emulator helps you with, as there are too many layers between the emulator (hardware) and the abstraction you are trying to change. In the middle, you have the kernel, binary loader, dalvik virtual machine etc.
User input might be easier, but, again, it seems to me it will be easier to change the open source framework code that processes the input, rather than the emulator itself.
Shachar

Related

Create Android qcow2 from QEMU

I was wondering if it was possible to use QEMU to start the emulator created from the Android Virtual Device Manager in Android Studio? I know it can be started from the command line, but I'm trying to understand how it works underneath. I know the AVD creates a qcow2, but it also creates a lot of other .img files that I'm not sure how to combine into a command that can actually start it.
If I can't start it via QEMU, is it possible to create an Android qcow2 emulator image to run for device testing in the same way? I found a similar guide online (https://yzygitzh.github.io/android/2017/11/03/android-x86-qemu.html), but I haven't gotten it to work so far. I also don't know how it would perform in comparison, specifically for app testing. Would anyone have any insight on that?
Similar Research:
Android emulator is based on QEMU. Can I use KVM with it? (Kind of beats around the question, but doesn't exactly answer it)
Mount qcow2 image created by Android emulator (Discusses a bit about the Android Device Emulator files)
How to show which options are passed to QEMU when launching the android emulator? (Seems closer to partially answering the question)
https://stackoverflow.com/revisions/48310014/9 (Shows building the emulator wrapping around QEMU, but not using the emulator without the wrapper)

Why does Genymotion insist upon OpenGL support when Virtual Box doesn't, and how to work around?

I am aware of Genymotion openGL error stack overflow question.
I am attempting to run Genymotion on a Windows 10 system, but the graphics adapter is Intel G45/G43 Express Chipset WDDM1.1 and the driver supplied does not support OpenGL and Intel appear to have no interest in delivering a driver that does for Windows 10. I understand that officially this combination is not supported.
But here's the thing: I can start a Genymotion VM fine from Virtual Box, and it appears to work (almost) perfectly, as far as I can tell.
Certainly I don't see any problem with the graphics.
This must be using some (probably Virtual Box provided) software implementation of OpenGL.
However, when I try to start the same phone VM from the Genymotion console, or from the Genymotion button inside Android Studio, I get the error dialog-box in the linked question above.
My question is: Why is Genymotion insisting that there is OpenGL support from the real physical display driver? And of course, if its for a quality reason only (ie: sub-optimal user experience otherwise) is there any way to disable this check?
The reason this matters is that Android Studio does not list the Virtual Box started phone VM as somewhere an application can be run upon. I suspect that when Genymotion runs a phone VM, they set up something that the Android Studio integration needs, that simply running from Virtual Box doesn't provide.
In addition, I can't circumvent the Android Studio integration by deploying to a phone VM using the gmtool device install file.apk command bundled with Genymotion because this is a paid license feature. As you can imagine I am somewhat reluctant to purchase such a license when I know I am running in an unsupported configuration.
Purchasing new hardware also isn't an option for me in the short term.
EDIT: The justification for this question has since evaporated. Although I can't deploy using Android Studio or gmtool.exe, I have managed to deploy by using the phone web browser to fetch the .apk file. The gotcha here is that the web server must supply a Content-Length header or the download will fail. So I now have a workable solution.
{{{ Andy
I'm part of the Genymotion team. That's an interesting question. The answer is: yes, we ask for OpenGL drivers for performance reasons. Without this, the whole Android rendering would be handle by the CPU (as soft rendering) which is not fast enough to allow a real usage of the devices, with a seamless user experience, particularly since 4.3. If you run a 4.2.2 image from VirtualBox, you'll see the UI inside the window but the rendering will be very laggy.
As you maybe already noticed, running the Genymotion devices from VirtualBox works only for images up to 4.2.2 (released 3 years ago). The other image will show only a console window. And to be honest, you should more consider it as a side effect than a real feature. This behaviour could disappear on a future release for any reason. And there is no way to disable this check.
As you mentioned, this configuration is really weird and exceptional. As far as I know, we don't plan to support these kind of configuration and I don't see any real viable solution to make it work properly.
Also, to explain the problem you encountered with Android Studio. When a Genymotion device start, it gets a local IP. This IP can be used to connect it to adb. Then it is possible to interact with the device like with any other Android device. This is the tools used by your IDE (and (m)any other tools communicating with Android devices.
Usually, the Genymotion app does this for you, by connecting the newly started device to adb. But you can do it yourself by running adb connect <DEVICE_IP>:5555. Just be careful because this connection could not be permanent and you should have to run this command regularly in some situations.
I hope this answer will help.
Cheers.

How to add memmap(memory map) kernel boot parameter to a running android-x86 system

I want to add kernel boot parameter that's 'memmap' in android-x86 OS.
Note: I do not have android device, but just emulation (using my laptop act as asus tablet)
I have tried using Ubuntu's memmap addition but it did not work.
I have also tried to find custom kernels but I did not get them for the target I am looking for.
What is the best way to config kernel,
Do I need to built a new customized AOSP by setting up the memmap?
Or just using terminal emulator app, adding the parameter. If this is possible then please elaborate how to do it using terminal.
Your help is really appreciated.
There are really multiple questions here. Memmap is used to overwrite or add to the existing memory map. So if your E820 memmap table doesn't report the correct amount of memory layout, you could be on the right track.
Now, since you're running in an emulator it might just be a matter of increasing memory in some setting for the emulator. The emulator should report the correct amount of memory to the kernel. If not you will need to break the emulator in bios and figure out how memmap looks and then add memmap entries to the kernel commandline accordingly.
I can go into more details if you wish?

developing for android on android

I want to be able to develop and immediately run android apps on my device. I've played with sl4a and a bluetooth keyboard, but the app and ide weren't designed for what I want to do with them. what are my options?
clarification: I want a mobile dev env that doesn't involve any computer (other than my android device). I'd like a simple code editor, like emacs or scite ideally, and some kind of complete interpreter or compiler for the full android api that runs on the device. I'm dreaming, clearly, but how close can I get to that today?
I've gotten Vim working really well in ConnectBot on my Milestone. I needed root privileges because of where I put the files, but you might be able to find a work around without it.
See this link:
Native Vim for Android
See also my comment after the post. I've got $HOME setup on my sdcard, and a bunch of Python plugins and colorschemes in ~/.vim/ and everything just works.
Of course this requires you to be comfortable working in Vim... I've gone back and forth with it several times in the past. It is very strange, but once you pick up a few habits and figure out its odd vocabulary it is very nice to use!
I got a pure python version of Mercurial working on Android too. It was a pain, but now I can push and pull code from my repositories and keep my /sdcard/sl4a/scripts/ folders in sync with my latest changes. I documented some of what was necessary in a bug report to py4a.
Canonical just announced that they will be bringing Ubuntu to android devices. Hopefully this will help....
http://www.engadget.com/2012/02/21/ubuntus-full-desktop-os-coming-to-multi-core-android-devices/
Like FrinkTheBrave said, you can use an ide (Eclipse is perfect, because of the Android Development Tools, but you could use any other program.
If you work on Windows, and after installing the USB driver, you only need to plug your phone to the usb and hit Run (or debug), and Eclipse will copy the apk into your Android and start running. It takes less than 5 seconds.
If you work on a Mac, you don't need to install anything, just plug in the phone and it works =D.
Well, in Linux it is a bit more complicated (though not impossible, I actually work with Linux), but you can still develop there =).
Cheers
BIG BIG EDIT
I've seen today just what you asked few time ago. Here, take it: https://play.google.com/store/apps/details?id=com.aide.ui It's obviously hard to type on a smartphone, but it could do the trick on an EEEPad transformer. Have a good day
I'm not sure about developing on Android, but you can use one of the sdks available to write your code, then copy the apk onto the device via usb and install and run it.
It takes less than a minute from saving the source code to running on the target hardware.
I use the sdk at developer.android.com and eclipse on windows xp, and use AndroZip on my phone to install the sdk. simples ;-)
I've not looked into using usb debugging, but that could be even better.

Using VirtualBox for Mobile App Development?

I keep wanting to use VitualBox for Mobile App Development, but I can't seem to get the emulator to run fast enough inside the already-emulated 32-bit machine.
Is there any way around this?
Now while it doesn't seem to me like there is an answer to this question, I figured I'd ask it anyway.
P.S. I have a 64-bit machine.
This should do the trick: 4 (or more) core CPU, plenty of ram (>4GB) and install the virtual operating system on a disk other than the one your main OS uses (e.g. firewire/esata external drive).
Another virtualization software might be faster too, but that I don't know.
You could use the x86 build of android in another virtual machine instead of the emulated arm of the current SDK one... (rumor is google is going to move in that direction anyway). Last I tried this, it booted/ran much faster than the arm emulator running on a physical machine, but the mouse emulation was painfully slow, maybe they've fixed that now.
(You have to set up adb over tcp manually or with your own script so that eclipse or whatever knows about this target)

Categories

Resources