Where is atrace.c located? - android

I am trying to write a script to get frame rate data using systrace.
I know that systrace calls atrace. But I can't find out where atrace.c is located. Is it within the sdk or within the kernel? Either way it does not exist in msm kernel or the latest android sdk.
Google's git repo shows it is here
https://android.googlesource.com/platform/system/extras/+/android-sdk-support_r11/atrace/atrace.c
Yet I haven't cloned that repo.
So I am not sure where systrace is calling atrace from
the adb shell command that I am running is
$>atrace gfx

It's part of the platform code. The latest version is here. Note that it changed from .c to .cpp.

Related

Is there a way to execute adb commands programatically in C++? This C++ part of code is built using ndk build in android studio. There

I referred to this link - Use CreateProcess to execute ADB command. The approach used in the above link requires Windows.h file which is contained in windows SDk. Since i am executing Android Studio in Mac i will not be able to get the include file. I am not sure whether the above mentioned approach can be performed using Android Studio in Mac.
You can use system or popen methods to start an adb process.

Modify build in terminal command

I want to modify this build in terminal command of android
screenrecord
Is there a way to replace the command once I compiled it or do I have to compile a full custom android version
If it is possible to replace it how would I do this?
I don't think this is the correct site to all this question. However if you're on Ubuntu, take a look at http://packages.ubuntu.com/search?keywords=gcc-arm-linux-gnueabi
screenrecord uses non-public APIs, so you can't build it with the NDK. You need to have a full build tree to get the necessary headers and libraries. Once built, though, you should be able to run it on a device with the same version of Android (i.e. if you have a 4.4 tree, it should work on any 4.4 device), but that's not guaranteed.
Note that screenrecord has been updated from the version you linked; the Android 5.0 version is here.

Adding driver to android devices kernel

I would like to use a PCAN with my device.
I have the program for it, and an otg cable, but i need to install the driver first.
And i found a linux driver on the manufacturers site.
I downloaded the kernel source, arm toolchain, and read a few sites about building and compiling but i havent find anything about adding driver.
So my question is, how can i add or install this driver on android?
The device is galaxy tab 10.1 P7510.
Thanks for your help.
Right, what you need to do is this:
Unzip the tarball source
Go into the respective directory of the source - cd peak-linux-driver-7.7/ as quoted by the above PDF
cd peak-linux-driver-x.y
make clean
make su -c “make install”
When the build completes, issue this command
/sbin/modprobe pcan
However, having stated this, I do not see any reference to building with Android, so it looks like a fair bit of messing around with the source to get this to actually work on Android.
From what I can ascertain, this is more orientated towards the desktop PC only...
As is mentioned in a later comment clarifying this answer; the kernel would need to be recompiled from source as an arm v7 or v8 target.
The part not mentioned was that it would also have to be statically linked to avoid requiring glibc in Android or bionic lib c in your computer.

How can I compile Dalvik to run it locally on Linux?

What are the minimal steps necessary (including retrieving the source code) to compile and run just the Dalvik virtual machine on Linux?
Actually , I got Dalvik working on my elementary OS installation.
First download the Android AOSP source tree using https://source.android.com/source/downloading.html. Wait for it to download (2 hours for me cloning only the current commits and Marshmallow branch)
After running build/envsetup.sh while in the source tree run lunch full_x86-eng. Then type make -jN (replace N with number of cores).
WAIT. This took me about 1 hour on an AMD-4500M laptop. Newer ccomputers may be as low as half and hour and older ones might take half a day.
Change directory to !!AOSP-PATH!!/out/host/linux-x86/bin/ and run export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/obj/lib/ or
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib
or export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib64
TRY ALL OF THESE
and then
./dalvikvm --32. If you try to run without the --32 option it will crash (don't know why)
Working Marshmallow Dalvik. To get the GUI apps working you will need to do some more porting and coding which is another project which I am working on.
Took me half a day to figure this out.
References
http://milk.com/kodebase/dalvik-docs-mirror/docs/hello-world.html
Use sabayon Linux. This is a distro that can natively run Android programs and all Linux ones too.
Actually, that's rather android running on Dalvik and the underlying system is already linux.
I guess running a bare Dalvik VM on a desktop linux box is just a matter of getting the sources and compile it.
The GUI stuff is something else.
You are not the only one with this idea, and that is great in internet society terms.
This is probably what you are looking for: http://www.android-x86.org/.
Those guys ported android over to x86.
It still works as an OS, so I'm not sure if you can run Linux and Android(Linux) together without using VirtualBox.
Dalvik runs on Android. The authors of Dalvik are only worrying about it running on Android, as far as we are aware.
Various groups have indicated they are working on getting Dalvik outside of Android. You are probably best off finding and talking to them.
In other words, there are no official instructions of the type you seek.
Sorry!
Getting apps designed for Android to run on Linux is going to be tricky. However, it is possible to run a Dalvik VM on Linux. In fact, this GitHub project has a pre-compiled binary of Dalvik VM for Linux, ready to use! Check the associated blog post for information about how the binary was compiled and how to use it.
Learn to program Java \ C \ C++ and other frameworks
Modify the Android source (I think app_process or something) so it shows a windows on the Linux desktop (learn X11 / Wayland APIs)
Below is a simpile base for you to start with
www.android-x86.org/getsourcecode
Getting Android-x86 source code
First, follow this page to configure your build environment. Then
mkdir android-x86
cd android-x86
repo init -u git.android-x86.org/manifest -b $branch
repo sync
Where $branch is any branch name described in the previous section. This will point the projects created or modified by android-x86 to our git server. All the other projects still point to AOSP.
We also have a git mirror server on SourceForge.net. To use it, you only need to change the repo init command to
repo init -u git.code.sf.net/p/android-x86/manifest -b $branch

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error:
/c/Users/Andrew Rabon/bin/repo: line
23: exec: python: not found
I've downloaded repo and put it in ~/bin like it says, and I've installed Python. I wonder what the issue could be.
For reference, I'm using msysgit on Windows Vista, I understand msysgit is limited, but I hope it can at least pull the android source.
I ended up creating a VirtualBox vm with Ubuntu installed. Followed the directions on the source code site and then zipped up the source and copied it over via file share to my windows machine. It's a bulky solution but it's the most straightforward as you don't have to deal with cryptic scripting issues.
I imagine that you could make msysgit and repo work with some tweaking,
In particular, I think there is an advantage in using Cygwin. It seems to have superior handling of case sensistive file names. This might be irrelevant for the main Android code base, but I know for a fact that it is necessary for the Linux kernel.
You cannot build Android on Windows. However, you should be able to use repo to pull the source code. I've done this. I imagine you must be using Cygwin. You'll need Python 2.4 (according to Get Source) and make sure you don't have any other Python installations on Windows or Cygwin that are overriding it. Check your version using the python interactive shell.

Categories

Resources