I am trying to build an app which involves formatting usb drives, changing the partition scheme and creating partitions.
After a lot of research I found that Android SDK does not provide tools or ways to access the information needed to do such tasks even with root.
So is there any C/C++ library which I could use? Or is there a better way?
Related
I downloaded android device open source from Samsung OSRC.
It was composed with Platform.tar.gz and Kernel.tar.gz
It seems to do with building AOSP, found mk files.
I'm curious whether it can be used(directly or indirectly) to build newer android version for device and whether I have to build new kernel based on this files.
Thank you.
If you want to build for a newer Android version, you do not need to build another kernel. Just use the kernel provided by Samsung for your device (or the prebuilt kernel from your phone).
When porting a device to a newer Android version you need to adjust the init configuration (init.rc files from your product configuration located in device/<vendor>/<your_device>), but not the kernel specific parts of your init.rc files.
You also need to add the hardware specific vendor binaries to your resulting flash image. Therefore you can extract these libraries from your device. Most of them are located in /system/vendor/lib, but there could be also some libraries in /system/lib and all subdirectories.
It is also possible that some vendor binaries does not work within another software stack. Possible reasons are incompatible HAL interfaces and incompatible libraries. The solution for these cases can be very different and should be evaluated individually.
If you are facing such issues you can have a look at the CyanogenMod sources for a hint. There you can find lots of ports. Best place to look is the product configuration of the particular device. You can also look into another of my answers regarding this topic.
I'm looking for a way to perform profiling (memory, cpu..) on my tested app (right now only Android profiling is needed).
Currently, I can only do this manually, by opening Android Studio and using its built-in profiling tools whenever I perform a test.
I was wondering if there was any way to integrate these tools into the Appium automation script, in order to scale-out the profiling to many devices and many test variations, and to save precious time.
Alternatively, if anyone knows of a similar tool that can be integrated into Appium I'd love to know about it.
For memory profiling, you can always pull down the "perflib" package in the Android Studio source. That is a more-or-less standalone package (with a couple of dependencies from within the sdktools parent package, which are standalone). The code in com.android.tools.perflib.heap is what you want, and that has all the methods to open an Android HPROF and process it.
As for other resources (CPU and whatnot), look at the viewers associated with them in Android Studio source (com.android.tools.idea.monitor), and look at the interactions with ClientData or adb commands used to fetch that data.
How to configure OpenCL environment for android platform either in windows or linux using any IDE? I want to make use of GPU using OpenCL for smartphone.
Android does not have official support for OpenCL and Google is openly hostile towards it, going to far as to remove unofficial drivers http://www.anandtech.com/show/7191/android-43-update-for-nexus-10-and-4-removes-unofficial-opencl-drivers . Even if your hardware still has OpenCL drivers you cannot distribute the app in Google Play, so it's practically useless.
For Android you are better off using Google's Renderscript (the reason why they hate OpenCL, they want their solution to be used) http://developer.android.com/guide/topics/renderscript/compute.html
You can write certain algorithms easily using Renderscript. It's basically like OpenCL but it has no concept of local memory and accessing thread id is not supported. But for things like simple image processing or particle simulation it's perfect.
If you must use OpenCL for some reason and your target hardware supports it just use adb pull to get the libOpenCL.so out of the phone, copy it to the ndk lib directory, and also place OpenCL include headers to the include path and you're good to go.
Basically, to develop OpenCL program/applications for Android, the followings are what you need:
Android SDK, Android NDK
Cygwin (if under windows)
OpenCL header file (could be downloaded from Khronos website)
OpenCL lib file. For different chip vendor, this library is located under different path. See here for details.
Develop OpenCL program in C/C++. compile with ndk-build to a shared library.
Develop your application using Android Studio. Use JNI to call your OpenCL-related functions from the native shared library.
i have the following doubt:
i have read that android os is based on linux, and i imagine it may have the same structure that ubuntu (in terms of file configurations: /root, /dev, etc).
so, is it possible to run an application written in C in android? just as it is possible to do in ubuntu? if so, how can i do that?
also, how can i get access to the root files through an android application (written in java)? and how to get access to the behavior of the os (in terms of interruptions for example)?
thanks in advance for your answers.
gus
Basic answer: Running a C app on Android isn't supported, except through the Native Development Kit (NDK).
You can't get access to the root files except by rooting a phone.
You can get access to some OS behavior through the API. Basically, if it's not part of the API, you can't access it.
The Android OS is based on Linux, but it's an OS, not a windowing server like X or a desktop environment like Gnome or KDE.
You may run C and C++ code on android using NDK. You may use also QT framework. But code is runing in virtual machine named Davlik. Android have root acount , but it is default not available for user. Therefore, access to directory is dependend for chmod.
If you would like read about access to low level in android:
http://www.phrack.org/issues.html?issue=68&id=6
And about architecture this system:
https://developer.android.com/guide/basics/what-is-android.html
You can run programs using Runtime.exec. As an example, you can see Terminal IDE which runs many different programs including ssh, vim and bash. It's also open source so you can learn from the code. You will probably have to include the executable as a resource or asset and then copy to a local directory, grant execute permissions, then run with Runtime.exec. You still have limited user permissions as your app runs under a restricted account unless the device is rooted and you request root access.
an android smartphone/tablet works with an Arm cpu, not a x85. the architecture is different.
but you CAN run a C application in android if you cross compile it for arm linux. or you can use a c compiler inside android device. people ported c compiler to android. you can try C4DROID and in android market. but you can only run compiled program in system memory because of android permissions about sd card.
I'm making a script to sync some files from my pc to my android.
How can I list all androids directories connected (via usb) to my computer?
I tried to use this http://gallery.technet.microsoft.com/scriptcenter/488836b0-84e9-4c0c-b2cf-dd19f6e70f74 but I'm having too much trouble with all this windows dependencies. Tried to use the windll.kernel32 from ctypes too, but found it just too confusing to use (the lack of examples doesn't help).
There's any way to do this without installing an Android SDK?
If you mean detecting which removable media is Android storage, you could scan all removable drives for the Android/ or .android_secure/ folders, which would suggest the device is Android. Documentation here may be useful.