Controling Power - G1 Android Development

Hello all fellow developers. I have a question.
Does anyone know how or if it is possible to control the phones power through a custom app? Meaning...is there a line of code that I can execute that will turn off the phone, set the phone to standby mode, and to reboot the phone?
Let me know asap plz. Thank you!!

I know for a fact that reboot can be done via code, because the DroidSans tweak tools has that option. You can try to reach out to those devs if you want.

You could use Gscript as well. Thats what I use to reboot my phone. Not sure about powering down though.

Related

[Q] I don't know how to make it work.

First of all, hello everybody on this community.
I'd been reading on internet how to fix this issue, but no clue at all.
My english is not so good so I'll try to be as clear as possible.
My mother gave me a HTC Inspired 4G, it has many apps and stuffs. It was working fine but it has a lot of apps that I wouldn't be using so (here comes the stupidest idea) I decided to reset it from insight (at that moment I didn't know about the power and volume shortcut).
After I did it, it reset itself then after everything seems normal, I unlocked the screen and then the whole screen turned to black. I could still see the time, date and also open the upper menu, but when I pressed Menu or any button, it just vibrate and nothing happens. Also I got a few errors like xxxx stopped working.
I can manage it to open Config menu, but I can't do much, I tryied to add my wifi connection but when I press the white space to put the password, then keyboard wont display. Also when it used to get stuck on Rethink Possible, but after plug in the cellphone to my laptop I could pass it. Now I removed the microsd and won't need to be plug it for that.
So right now, I can't download anything, I don't know how to fix it or return it the way it used to be.
I don't know anything about root and all those stuffs.
But I learn fast, so any link, tutorial, tips or guidance for these issues, I'll make good use of it.
What I have to do in order to make it work.
Thank you very much in advance.
Do you know what software version you are running, whether the phone is unlocked or rooted, or any other details?
It says 2.3.3 if that what you mean, also I don't know exactly what rooted means but if I'm not mistaken, my cellphone is rooted.
When I turned on by pressing volume and power buttons, I get some kind of options like fastboot and so on, also when I choose Recovery, I get something called Ace Hack Kit, I don't know what's for. I see many options but I can't figure it out which one would help me with this.
It's obvious something been done on this cellphone but I though since I reseted it, everything would be deleted.
Shaagan said:
It says 2.3.3 if that what you mean, also I don't know exactly what rooted means but if I'm not mistaken, my cellphone is rooted.
When I turned on by pressing volume and power buttons, I get some kind of options like fastboot and so on, also when I choose Recovery, I get something called Ace Hack Kit, I don't know what's for. I see many options but I can't figure it out which one would help me with this.
It's obvious something been done on this cellphone but I though since I reseted it, everything would be deleted.
Click to expand...
Click to collapse
What do those options say exactly when you press power and volume?

[Q] Can I Do These Things When Rooted?

Hi all,
For reasons that are explained here: http://forum.xda-developers.com/showthread.php?p=46338664#post46338664 , I am wanting to try a couple of ideas for controlling/modifying the power on/off function of my phone (Sony Xperia Z). I never wanted to root this phone but now it seems like I'm going to have to to give me any fighting chance of getting around the issue I'm currently in.
Anyway, what I need to know is if any of the following things will be possible if I were to root my device:
--- Disable power button from waking screen or doing anything else, and preferably set a combination of keys to be what lights-up the screen, (e.g. nothing will happen on the phone unless for example the volume up key, then volume down key, then power button are pressed in that order). Then, if this is achievable, would it be possible to keep my mobile internet data turned on, while disabling people from calling me, (so that my phone won't ring at all)
--- Edit the power off function on my device so that instead of just turning off, it reboots instead. (However in saying this I would want this function hidden, as in, I want there to be a button that says 'Power Off', but instead of just powering-off, it does a reboot instead).
--- If the above is not possible, is there some sort of light 'sleep' mode that my phone can be put into so that it appears off, however can be automated to turn back on at a set time. (I understand that Android's can't be woken when shut-down because they literally are completely shut down and can't run any apps, but maybe there's a way to have it in a sort of 'sleep' mode where it can be automated to turn on at a set time?)
--- Any other option that will either A) make someone think my phone is turned off when it's actually still on, or B) allow my phone to turn back on automatically at a set time, or do a reboot instead of shut down when 'power off' is chosen.
Any help on this would be amazing, thanks guys
MHarris333 said:
Hi all,
For reasons that are explained here: http://forum.xda-developers.com/showthread.php?p=46338664#post46338664 , I am wanting to try a couple of ideas for controlling/modifying the power on/off function of my phone (Sony Xperia Z). I never wanted to root this phone but now it seems like I'm going to have to to give me any fighting chance of getting around the issue I'm currently in.
Anyway, what I need to know is if any of the following things will be possible if I were to root my device:
--- Disable power button from waking screen or doing anything else, and preferably set a combination of keys to be what lights-up the screen, (e.g. nothing will happen on the phone unless for example the volume up key, then volume down key, then power button are pressed in that order). Then, if this is achievable, would it be possible to keep my mobile internet data turned on, while disabling people from calling me, (so that my phone won't ring at all)
--- Edit the power off function on my device so that instead of just turning off, it reboots instead. (However in saying this I would want this function hidden, as in, I want there to be a button that says 'Power Off', but instead of just powering-off, it does a reboot instead).
--- If the above is not possible, is there some sort of light 'sleep' mode that my phone can be put into so that it appears off, however can be automated to turn back on at a set time. (I understand that Android's can't be woken when shut-down because they literally are completely shut down and can't run any apps, but maybe there's a way to have it in a sort of 'sleep' mode where it can be automated to turn on at a set time?)
--- Any other option that will either A) make someone think my phone is turned off when it's actually still on, or B) allow my phone to turn back on automatically at a set time, or do a reboot instead of shut down when 'power off' is chosen.
Any help on this would be amazing, thanks guys
Click to expand...
Click to collapse
YEP, as far as I know you can do all this AFTER you root your phone.. BUT you'll have to do a lot of in-depth MODIFICATION of your system's files (like framework-res.apk, android.policy.jar, services.jar, framework.jar, framework2.jar, etc.)...
Now when I say "modification", I mean that you will have to do a lot of smali and xml editing, etc. you might also have to write a couple of init.d scripts too.. its because the modifications you want to make on your phone are integrated deep inside your phone's framework.. so yeah
Root it, and install xposed framework and you can do all you say and more without any modifications yourself
Sent from my C6903 using xda premium
Install exposed and some modules like xblast exposed tweakbox these help modification without decompilation happy modding
Sent from my Xperia Live with Walkman using xda app-developers app
gregbradley said:
Root it, and install xposed framework and you can do all you say and more without any modifications yourself
Sent from my C6903 using xda premium
Click to expand...
Click to collapse
So you think I can do all this stuff without having to get into complicated things like code/scripts and all that? I am relatively tech-savy but my coding skills aren't tip-top to say the least
*UPDATE*
UPDATE:
I have now rooted the device, so is there anyone that can give me some step-by-step instructions on how to do either of these options?
(I've also gotten the Xposed Framework)
Thanks,
Mike
Just download the modules and activate reboot then edit what you want
Sent from my Xperia Live with Walkman using xda app-developers app

[Q] Can't access setting, app lock!

Hi all first post here but got help many times from lurking on here.
a child of a family friend, quite a smart 10 year old was messing with my phone (i know bad mistake) he just usually takes photos plays games etc. Anyway i went to use my phone and all seemed fine until i tried to go in the settings and it askes for a password, no idea what this password is and he says he does not know as it was an accident.
The app is called "app lock" trying to uninstall it also askes for a password, its just my settings i cant access or that app. Now i would reset my phone by going in the bootloader as i cant get to settings but i cant access bootloader by holding volume down key because i have fastboot on and cant turn it off in settings now.
Now once i flashed my phone using the official ice cream sandwich release, but i cant do that now to get rid of it because my phone wont communicate with my pc, got 3 new usb cables, no connection, tried different comps etc etc, everything i could find, although i can charge through the connection and access my files, just nothing else like htc sync.
So phone is still useable but cant change any settings at all now, cant even access wigits
I love my desire s and don't want to change it, as i love it and got no money available! imo its the sexiest looking phone still
So what i am asking is is there another way to remove this app?
Hope this is in the correcnt section, feel free to flame me if not.
Thanks for the help guys.
Are u rooted r s-off? If so u could use some kind of root explorer app and mount system rw then delete the app and reboot, that should get rid of it. Or if ur willing to factory reset in bootloader, just pull battery out for 20 seconds n put back in then press n hold vol down + power, that should get u there even tho fastboot is enabled in settings.
hi thanks for the quick reply, im not rooted because of the usb problems with my phone, i wish i was, ive tried many times. Ill try the thing with the battery and get back to you, thanks for that buddy.
desires4life said:
hi thanks for the quick reply, im not rooted because of the usb problems with my phone, i wish i was, ive tried many times. Ill try the thing with the battery and get back to you, thanks for that buddy.
Click to expand...
Click to collapse
Dont seem to be having success with the battery thing, maybe its just me, im quite a noob with android, im an ios defector and im so glad i did.
Should get u to bootloader, just tried myself with fastboot enabled. Make sure when u put battery back in that u press and hold volume down then press and hold power button (both same time) bootloader should come up.
U know the app lock, is it an app u downloded from playstore? If it is u could open playstore app and uninstall it there.
jmcclue your a staar, got it sorted now. thanks you most kindly!

[Q] Are Reboot Utilities safe?

Whenever I turn off or reboot my phone from the ROM's power menu the system takes a second or two to close apps and then turns off. While the reboot utilities turn off the OS the moment I press the reboot/power off option on the menu.
Are these utilities safe to use as they seem be like yanking the power cord off of a running device?
(I'm on 5.0 preview and the power menu is limited to just Power Off for now, and I'd like convenient options to go to recovery/bootloader, but not at the cost of corrupting OS files, thanks)
thanks so much people, but don't everybody speak at once.
the_rebel said:
thanks so much people, but don't everybody speak at once.
Click to expand...
Click to collapse
That's a sure fire way to get an answer.
It kinda worked.
the_rebel said:
It kinda worked.
Click to expand...
Click to collapse
Not really. I didn't give you a useful answer. I didn't know the answer the first time I read the thread. You're right that it needs to unmount the filesystems cleanly when shutting down, but whether that's what is happening when you shut down via the power menu that causes the delay I don't know
I use the "reboot" command all the time though, and I haven't lost any data yet
Yeah it usually works safe enough, but I vaguely remember an year or so back on my N4 it created some problem, and I stopped using any abrupt reboots. Stopping to use those was easy on custom ROMs anyway.
The logic is sound. If there's some file activity going on, an abrupt reboot will cause file system corruption - hell we use safely remove on USB drives too, this is a whole computer.

How to access my 'reset' phone again?

Hi,
the title is not the best but I don't know how else to describe it.
I have my old Sony Xperia X Compact with the stock rom laying around and wanted to use it again after a long time.
Sadly I forgot the screen unlock pattern and tried it 30 times till the phones reset itself, to get a fresh start. Well, at least that's what I hoped but now, when I start the phone, I cannot start fresh. It asks for an email and password for a previously synced account, I can't for the life of me remember. I am not even sure I had an account configured cause the last time that phone was used I factory reset it and just used it for some testing.
I tried to get into the recovery menu by turning the phone off and pressing volume down + power or volume up + power during the start but it just doesn't work. The phone either vibrates a couple of times and does nothing or boots normally when I don't hold down the buttons long enough.
It also doesn't show up when hooking it up to my PC and using adb devices.
I searched online but I can't find anything on how to access a phone that was reset this way.
I would appreciate some help.
Cheers
sp flash tools
Let it do by authorized service center: requires you can prove that the phone belongs to you. With an invoice, for example.
xXx yYy said:
Let it do by authorized service center: requires you can prove that the phone belongs to you. With an invoice, for example.
Click to expand...
Click to collapse
Thanks for the suggestion but that's not really something I am willing to do.
If I can't get it working with adb or something similar and it doesn't look like I can, it will just go into the trash.
Really sad cause until today the hardware and especially the original battery is good enough to work as a daily driver.

Categories

Resources