How to use Superuser from my custom app? - Android Software Development

Ok, I've googled and forum-searched a bunch.
I'm writing a little app to help me maintain my phone how I like it (hopefully I'll get it working and release it to the hoards soon). I need to get SU access within my app.
My question is how? Or perhaps should be, is this still correct?
Some further questions. It looks like I can only make use of SU access by exec'ing a command. Not within pure Java. Is this true?
Will the permission be automatically "asked for" if I exec the su command without any other actions?
Thanks,
Gino A...

Alright, I can answer some of my own questions after experimenting last night. But, I still don't have this working.
The old post I linked to is not correct on CM6. I tried that code and the intent wasn't found.
Calling su w/out any other permission requests doesn't work. Just get a not-allowed message.
Anybody made this work and want to help a guy out? Anybody able to point me to a github of working code?
Thanks.

Ok, now I'm really confused. Been wandering through github looking at people's code. Found a few different apps that seem to just call "su -c [...]" without any thing else. WTH?

Related

Thank you!

I'm sure you guys here at XDA don't hear it enough so let me just say thanks. I've spent the last hour changing my G1 from RC30 to JF 1.51. it took most of the time figuring out that the terminal program I was using wasn't giving me root, I did some smart using of the "search" function and realized I had to use pterminal.apk. but to say the least I'm up to date with cupcake, and I have root. You might want to update the how-to thread. Now just to get it so I can run apps of my sdcard... search away!
thats good to hear people rooting their phone without having to start like 10 threads on how they did it or what they need to do.
getting it setup is a little harder then I'd hoped, I'm trying to figure out how to set it up so my terminal has root access. I thought I would still have root, however the terminal that comes with JF 1.51 is just giving me the $ sign.
what happens when you press su in the terminal??
its supposed to ask you if you wanna allow it or deny it and it goes on the whitelist program.
Thanks! I missed that step somewhere. I am unfortunately a windows users, so I don't have the know-how with linux, it's an unfortunate blite on my record. I'm trying though! lol
Denkai said:
Thanks! I missed that step somewhere. I am unfortunately a windows users, so I don't have the know-how with linux, it's an unfortunate blite on my record. I'm trying though! lol
Click to expand...
Click to collapse
i myself am a windows user also... most of the steps here are for windows, unless otherwise noted.
but yeah when you enter su in the terminal for the first time it should ask you for permission
crap, I was using the appstosd2 program and now my phone is stuck on the g1 screen... a recovery with wipe didn't help either.

did i root it right?

hey guys im new here i got my htc cdma hero a few weeks ago and i saw the thread on how to root it from the link below
http://forum.xda-developers.com/showthread.php?t=583291
now my question is if i rooted the phone corretly should
i have some new file on my programs folder?
and what does rooting actually do?
i know this questions been asnwerd before but i cant find a straight up asnwer about it for the htc cdma hero.
open up terminal emulator and type "su" then hit enter and tell us what happens
even easer way, look on your programs list, is there a program there called superuser permissions? if so your rooted
im having a problem everything that i do seems to be doing good but im not getting any new app on my phone or anything diffrent.
can anyone help me please with remote assist or something i would really appriciate it.
"and what does rooting actually do?"
Thats why new people seeing this forum that have no experience should first read as much as you can before continuing...This type of stuff may break your cellphone, and if you dont even know what does root and what is done for, then just dont do it, its easier and safier!
Dont take me wrong but this is an important warning.

Froyo ROM

Hi there,
I made a preliminary port of Froyo for the Liquid.
It needs the Donut radio rom, so it won't work on LiquidE.
You can test it on an Eclair radio, but usb and GSM/3G won't work.
IHMO, It works fine for daily use (I do use it daily.), current known bugs:
-Random lines appearing on the screen on refresh
-No wifi
-Wiping data kills radio
-No tethering
-Unsigned
Hint: to enable App2SD to all apps (by default, only some apps accept it), do
Code:
pm setInstallLocation 2
This will install all apps to SD, you can move them back to phone.
Please use http://code.google.com/p/acer-liquid-froyo/issues/list as bugtracker
(Donate link in my sig also works for my Liquiid's work )
Here's the downlink link:
http://code.google.com/p/acer-liquid-froyo/downloads/detail?name=Froyo.zip
Update:
Full: http://www.megaupload.com/?d=S9P799GO
Update: http://www.megaupload.com/?d=UPAF7YD8
-880MHz
-ramzswap
-USB OTG (seems not fully working)
-working iptables (droidwall works)
-usbnet (tethering kind of works)
-changed H264 resolution limit to 720p
To get tethering working, do echo 1 > /sys/class/usb_composite/rndis/enable
Then go in the appropriate menu and tick the usb tethering option.
The results are random, I don't know why yet. The released sources might help understanding that.
How can I enable apps2sd? Where have I to insert code? I'm a noob and don't understand, I need a step by step sequence.
Thanks.
akira.pwr said:
How can I enable apps2sd? Where have I to insert code? I'm a noob and don't understand, I need a step by step sequence.
Thanks.
Click to expand...
Click to collapse
Install connectbot
Launch it on the "local" protocol, do
su
(the su manager will ask for permission, allow it)
pm setInstallLocation 2
And it's done.
Ok, i'm doing it, it create a partition for apps?
After doing what you posted above, all apps go in my sd automatically?
Connectbot asked me a nickname, i put su, then un screen i writed pm setInstallLocation 2, then i saw the word "killed", is normal?
Superuser never asked me permissions.
Edit: retried more times and finally su requested permissions, i allowed but after insert the code, i read "killed"...
akira.pwr said:
Ok, i'm doing it, it create a partition for apps?
Click to expand...
Click to collapse
Apps go to the normal vfat partition
After doing what you posted above, all apps go in my sd automatically?
Click to expand...
Click to collapse
It should
Connectbot asked me a nickname, i put su, then un screen i writed pm setInstallLocation 2, then i saw the word "killed", is normal?
Superuser never asked me permissions.
Edit: retried more times and finally su requested permissions, i allowed but after insert the code, i read "killed"...
Click to expand...
Click to collapse
You must put su on the console, not as a nickname, the nickname doesn't mean anything.
sorry, but i'm not good, i don't understand how to do it, i put code, but when i put "2", i read proces denied. I give up...
akira.pwr said:
sorry, but i'm not good, i don't understand how to do it, i put code, but when i put "2", i read proces denied. I give up...
Click to expand...
Click to collapse
Giving up is always a lot easier than to keep on trying, \0/(stole the emote from phh lol)
rafyvitto said:
Giving up is always a lot easier than to keep on trying, \0/(stole the emote from phh lol)
Click to expand...
Click to collapse
But i'm a real noob, i tried and retried, but connectbot tells me action denied, any suggestion? When/where have i do su? It never ask me permission.
akira.pwr said:
But i'm a real noob, i tried and retried, but connectbot tells me action denied, any suggestion? When/where have i do su? It never ask me permission.
Click to expand...
Click to collapse
Weird..check on malex recovery to see if your device is rooted, without root you cant run superuser command's, but since your running phhfroyo it should come already rooted...

[Q] Root without z4Root or SuperOneClick? How does it work?

Hey guys, as always, thanks in advance.
I've been playing with the Galaxy Tab for a week or two, and it is fantastic. I was able to easily root it by downloading z4Root, and running that. Now I have a slightly different request. Is there a way to manually get root on the device without the use of programs like z4Root or SuperOneClick?
My assumption is that these programs are running an elaborate series of commands, and it is usually just simpler for most of us to download an existing root exploit, than to do it manually. What I'm looking for, is a way to automate the entire process of rooting a device from Sprint, removing the preinstalled Bloatware, making a few settings changes, and installing a few applications. I want to do this with no need for any interaction on the Galaxy (other than turning on USB debugging and plugging it in), including running z4Root and clicking the buttons.
I'm writing a batch file to send all the adb commands necessary, as I've done on previous Android devices. Say for instance I want to install this on 50 different devices, I'd prefer to not have to run z4Root on each of them by hand. On a previous Android tablet I was able to do something like this:
Code:
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
adb shell cat /system/bin/sh > /system/bin/su
adb shell chmod 4755 /system/bin/su
adb shell reboot
But that doesn't work on the Galaxy obviously. I'm just wondering if there is something similar. Basically, can someone explain to me how the z4Root exploit works? What exactly is going on under the hood? I suspect though, that it may require significantly more complicated logic that could/should be done in a simple batch file.
Here is what I'm looking to have when I'm done:
The Galaxy Tab will be used for an in-house, single purpose app. (Meaning, I don't need custom UI, phone calling hacks, etc).
The app I will be running does not actually need root itself to run even, meaning after I remove the bloatware and change a few settings, I don't even care if I KEEP Root access after things are set up.
I would like to avoid (if possible) adding any more programs/apps/files to the phone than necessary, meaning I'd prefer to not leave a "SuperUser" app in the menu if possible. And I want to find something that won't have a lot of licensing restrictions to my use.
I'm sorry that sounds complicated, and I tend to drone on, giving far more information than is actually needed. In short, lets just start with- "How does z4Root work?" Thanks again as always guys. I appreciate the help.
DavidThompson256 said:
In short, lets just start with- "How does z4Root work?" Thanks again as always guys. I appreciate the help.
Click to expand...
Click to collapse
In essence, it uses the "RageAgainstTheCage" exploit
You may find this tutorial that I wrote for the Toshiba AC100 useful, as I'm pretty certain most of it applies to the Tab.
Regards,
Dave
EDIT- or you can just follow this thread instead which does much the same thing, but is Tab specific!
Ah, yes, I just finished reading that thread, and it had EXACTLY what I needed! I feel kind of dumb because that other thread was posted WHILE I was in the process of typing up my post. I guess I just type slow
Anyway, I'm willing to call this one closed already. I was able to find everything I need in blacklevel's post over here.
Thanks for the help.

Strace command

Hi, first of all, sorry if this is the wrong place to post this, I tried on the development section but I couldn't so here it is the thing;
First of all, I'm using the default rom(AQH3) with root. The point is that I have used other phones, and I have been using strace command as any other linux command, on the android terminal or via adb. However, I recently bought a S8 but it seems it does not include this command in the rom by default. BusyBox does not incluide it either, so the only aproach left was to copy the strace binary from my previous phone to the S8...i do thinks that's not a good idea but at the moment that's the best I can do. Sometimes it works good, but with some apps I can't use it because the information i get is useless; It gives me all the time
Code:
restart_syscall(<... resuming interrupted restart_syscall ...>)
Which is not really usefull...What could I do to use strace on my S8 properly? Maybe I'm missing something, or is there a way to download a 'official' strace binary for this rom/phone? It seems to me that Samsung does not provide you this utility but maybe I'm wrong. I searched everywhere but I found nothing.
Thanks everybody for your time and your help!
You need strace built (preferably staticly) for the right architecture for it to follow the system calls correctly. Ive actually had plans to build one for a while, will share if I do
partcyborg said:
You need strace built (preferably staticly) for the right architecture for it to follow the system calls correctly. Ive actually had plans to build one for a while, will share if I do
Click to expand...
Click to collapse
So you think the problem is that the strace I'm using is for armv7 and so S8 has armv8 does not work properly? I was thinking that maybe the problem was S8 android/kernel version

Categories

Resources