I am trying to figure out how to compile the AOSP with superuser. I was pointed to this question:
Build Android with Superuser. The instructions seem a little unclear and I also do not understand exactly what is going on. It also seems to talk about this allowing su privileges on android apps. I am not trying to get this on apps. I was trying to have root access when running some code in the main android source(specifically trying to open a socket in DisplayDevice.cpp).
I have asked a similar question here(Create a socket in android code(not in android application) getting Permission Denied). I figured that since I was put on the right track and now know that I need to compile the code as superuser, I should just ask another question.
I have added the su-binary code to my AOSP code as per instructions from the first SO question. I have also changed my init.rc, but am under the impression that I need to do something to make those changes go through as well. This is not talked about in the question. Right now when I run make su-binary I get "make: Nothing to be done for `su-binary'.". I think something was wrong here. I am using the makefile specified by m-ric. I also was not sure if I needed the Superuser.apk since I am not working with code that will be found in an Android app.
If anyone could point me in the right direction for this I would be really grateful. I am happy to provide more information if needed.
Actually, I can explain how to build Android with Superuser but I think you do not this for your task. The problem is that the process that runs the code of DisplayDevice.cpp does not belong to inet group (usually gid = 3003).
I'm not familiar with display system of Android but if you want to just experiment I would recommend you the following steps.
You need to find out the process id where your code run.
Assign to this process gid of inet group.
Right now when I run make su-binary
I get "make: Nothing to be done for `su-binary'."
An example how to change su.c can be found here: https://code.google.com/p/aosp4nexus5/wiki/AOSPforNexus5#Debugging_a_C_file
Actually only logging is added, but it is the same as changing setgid() and setuid() calls. :-)
Related
I am new to the android. I just want to understand the Wi-Fi code flow in android. I have already grasp some basic stuff about it, need some more detail about it.
This is a good starting point..
https://source.android.com/devices/tech/connect/wifi-overview
Hi thanks for the Question.
before i answer your question i wanted some calrification?
you want to learn wifi for app developement or you want understand wifi has a whole module?
if your perpose is to understand has a whole from app layer to driver.
i would suggest you to look into this
https://www.amazon.com/802-11-Wireless-Networks-Definitive-Guide-ebook/dp/B005WZ0SXW
even before you jump into code.
has far has the code is concerned
these are few things which i would suggest you to look into.
1)Wpa_supplicant is an open source project source code, which was modified by Google to join theAndroidmobile platform.
What is wpa_spplicant ?-->start from here .
practice how to use wpa supplicant from cmd line.
2)once you have got the grip on wpa_supplicant wireless network configuration form cmd line or linux terminal.
3)next will suggest you to look into android architecture the one before android N and after Treble.
4)once you are familiar with architecture,please look into state machine and how they are making state transistion form one state to other.-->in framework code from android M(easy compared to latest).
and so on .these are just few things which can help you ,but there is a lot more happening and its vast.
I'm looking to build an app that will restart my device at a specified time, then open up a couple 3rd party apps in sequence and run their feature/s.
For example: I would like to automatically restart my phone at 5am. Then have it open an antivirus app of my choice and run the scan. Then close that app and open up another app and run it's cleaner function.
I have experience coding, but I'm just starting to take a peak into android app development. So, I was wondering if this is something feasible to do.
Any advice would be appreciated!
I am not sure about the starting phone at the desired time, but I am sure you can start applications on boot using "init". Linux systems support that, and android does as well. But it completely depends on your kernel.
Read here about init.d.
Check if your phone's kernel supports init.d. Check here if your phone doesn't have init.d support.
Check Here for running a script at boot. It is quite useful for custom scripts.
Check Here for running scripts/application the application at boot
Create a script according to your needs and I think you would be able to achieve what you are looking for. <- Custom Rules
I would have commented but apparently I can not since I am new here.
I hope I was of some help. Will look into the android starting part and get back to you.
Cheers.
Background
As it turns out, it's quite an annoyance to test out in-app-billing (i've written about it here) . Each time you find a bug and need to test your app, you must have the following steps:
compile the app , preferably with the debuggable="true" flag on the manifest
sign the app with your real key you've created for the play store.
install the app on your device
run the app on your device, preferably debugging it via eclipse.
If you'd use a batch operation instead of doing all of those by yourself, it should make things easier to test such apps, and might also be useful for other apps as well.
The question
Is there any way to make the whole process fully automatic, so that with a single click of a button, it will do all of the above?
I know how to achieve 3+4 (using "adb.exe install -r *.apk" and "adb.exe shell am start -n FULL_ACTIVITY_PATH" ), but I don't know how to achieve the others.
If there is a solution that doesn't involve a third party app or plugin (like maven or Ant), it could be very nice. Of course, if that's what is available, I would like to know if it's possible to achieve via a batch file that will use them somehow.
Is there maybe a way to mimic how Eclipse does things in this regard, without being so specific on the project (maybe just the path of the project and that's it)?
Maybe you can package app by ant . You can do every thing you what int the ant code of packaging ,causing the core code is to make property configs in your app and referenced lib, such as build.xml,local.properties...,and replace channel in AndroidMainfest.xml ,so you can also replace any code in your android app,just as you want ,to change the flag of debug , because all the operation just handle local file before packaging your app,you can copy or modify any file in your app. After above process ,you get a app,then you can run other code to install the app. Recently ,I have been using the batch package method to get a lot of app for different channel .so hope it helps.
Hy everyone, I'm Korean and a little short on using english so please try to understand if I say things not appropriate.
So, my status is that I have odroid-s.
What I'm trying to do for like month or more is that I want to make android to HelloWorld.
What I want to say is that, on the odroid-s, bootloader part, kernel part is the same but the framework part(which will be android), I'll remove all the android part and replace it with just HelloWorld program. The purpose of this HelloWorld program is to display HelloWorld on the screen.
What I think I discovered is that, as I 'vimdiff' bootlogs between normal bootlog and the one that I removed all the system partition part (which is android system partition part) is that android kernel's init goes on and executes console(/bin/sh), netd(bin/netd), ... and it enables adb and it completes his work.
So my conclusion is, I need to use Linux kernel that is non-modified and modify it for odroid-s, and use that kernel for my HelloWorld program!
What I want to ask is.... Am I doing it right?? T_T
My goal right now is to make HelloWorld come out from this odroid-s device...
Please somebody help me. If anybody don't understand what I wrote plz tell me, I'll fix it.
Thx for reading....
The modifications to the linux kernel are likely to be irrelevant to your goals, so you might as well leave them in place for simplicity.
Your biggest challenge is going to be output - where do you want to send it? If you had one of the devices that has (or can have with the right kernel config) a debug serial port, then it would be really easy to write something triggered by the init script (or even use 'echo' in the script) which outputs your message on that port.
But chances are you want to put something on the screen. This is going to be overwhelmingly more complicated, and perhaps device dependent. The way the android runtime does this for actual apps is going to be way more involved than you probably want to get into.
A more practical approach might be to look at how the boot animation is done. For starters you could just replace it with a static image that says "hello world". Once you can do that, the next step would probably be to find some character generator code. Finally you might want to implement scrolling and other terminal-like features.
As an alternative approach, there are builds of more traditional linuxes for some android devices - debian or ubuntu for example. These may include console implementations capable of displaying on the device screen.
As another idea, if you are flexible about how much of android you would be willing to leave on the device, you could build a version of the android terminal emulator example, modified to be a home screen replacement. You might be able to remove a lot of android components (eventually including the default home screen). Or on a secured device (ie, most consumer devices that haven't been rooted) you could just do the home screen replacement while leaving the actual system unmodified. It wouldn't be secure against users wanting to run other things, but generally the user would interact only with your code.
Is there any neat way of accessing screenshot of android device
programatically. I am looking for some 15-20fps.
I found one code
android\generic\frameworks\base\services\surfaceflinger\tests\screencap\scr eencap.cpp,
i built the executable and put it in /data and changed the mode 777
but when i tried to execute it using adb shell it gives the below error.
# chmod 777 test-screencap
chmod 777 test-screencap
# ./test-screencap test
./test-screencap test
screen capture failed: Function not implemented
I also know that we can access fb0 but its not a right method as suggested
by android team. Is it possible to access the screen shot at the frameworks
layer. I beleive surface flinger composes individual layers and gives it to
framebuffer.Where exactly this is done ? Can a application be able to access
such codes.
There are some java apps also which use ddms to actually capture this
framebuffer data without root access. But the fps is really poor.
I beleive there should be some or the other way of doing the above job.
Please suggest me some neat way of doing it. Suggestions are welcome.
What you are trying to do is not possible if you don't have a rooted phone, there is an app out there that does what you are trying, Screenshot ER. The latest OEM's are putting it into their /system/apps now... so you may be able to use their apps, check out this article for devices that have enabled this feature. Other than that your really stuck but there are implications with screen captures enabled as this could lead apps saving screen captures and sending that info out, enabling virus type apps...
Information for others .....Through Eclipse you can get a screen capture usig the DDMS perspective. If you take a look at the Eclipse DDMS code base its actually a stand-alone app too. You might be able to use this Java code then.
AdbHelper.getFrameBuffer(AndroidDebugBridge.getSocketAddress(), this);
Take a look at droid VNC Server
This is an open source project which you can clone the source code to your private PC. (http://github.com/oNaiPs/droid-VNC-server). I am investigating how VNC can do but It's really hard to do the same.
Read framebuffer content is an good solution also. But it just work with android <3.x only. I don't know how to fix it to work on android 4.x. If you know how (after see my suggestion) please share it here. Through my researching, I see that there are a lot of people looking for this.
Hope this helps.
nguyenminhbinh1602#gmail.com.
Android Freelancer.