[Q] Disabling soft and hard power/reset in android

Search This thread

perditi0nspam

New member
Dec 21, 2012
4
0
Hi all,

I found similar questions on different forums yet they usually asked regarding solutions in API. I'd prefer to ask the question allowing for a broader spectrum of solutions.

I was wondering whether or not it's possible through code to disable any kind of powering off, including resetting, for the duration of a certain activity. It would be greatly preferable if it didn't involve having to use a rooted phone. The solution needn't involve an exact method via the API but rather an algorithm such as putting the phone in a loop of some sort so that powering down isn't possible until the end of the procedure. During this time the application is waiting to receive a communication from a server which dictates that it's fine to continue regular activity (including returning functionality of power options) .

Any creative ideas :confused:
 

Masrepus

Senior Member
Feb 12, 2013
767
99
Hm u mean resetting like holding down power button for force restart? This can't be aborted by an app, as it just shuts down with i call it 'brute force'. So it will shut your activity down as well.
But for the normal power off via the menu, i could imagine you could prevent that by letting the phone do massive cpu operations, as if my old phone had a really hard lag, the power off via power menu didn't work. But it really must be some massive massive task, as it has to make the whole phone lag terribly and this must be done in the first half second after giving the commamd to shut down... So i dont think this is really to implement without blocking the command on root level

---------------------------------
Phone : My new Nexus 4!
OS:
Pure KitKat 4.4.2 stock, no root, no mods (but only for the first time ;D)
---------------------------------

Gesendet von Tapatalk
 

perditi0nspam

New member
Dec 21, 2012
4
0
I'd imagine that anti theft solutions implement something similar to locking down a phone until a release code is supplied. What's the point of geolocating it if a thief can just turn it off?
 

EmptinessFiller

Senior Member
Sep 15, 2013
88
20
You can try to show an Window via WindowManager to hide the Dialog which is shown when you long press your power button.. Maybe it work.
But normally you can't do that. If you do too much CPU work Android will just force close your App with that ANR Message (App Not Responsing)
 

Masrepus

Senior Member
Feb 12, 2013
767
99
I'd imagine that anti theft solutions implement something similar to locking down a phone until a release code is supplied. What's the point of geolocating it if a thief can just turn it off?

No, antitheft solutions only prevent the thief to access the phone, but they dont pervent it from being shut down

---------------------------------
Phone : My new Nexus 4!
OS:
Pure KitKat 4.4.2 stock, no root, no mods (but only for the first time ;D)
---------------------------------

Gesendet von Tapatalk

---------- Post added at 11:01 AM ---------- Previous post was at 11:00 AM ----------

You can try to show an Window via WindowManager to hide the Dialog which is shown when you long press your power button.. Maybe it work.
But normally you can't do that. If you do too much CPU work Android will just force close your App with that ANR Message (App Not Responsing)

I think that wont work neither as the dialog is shown on top of everything, even on top of the window you try to open

---------------------------------
Phone : My new Nexus 4!
OS:
Pure KitKat 4.4.2 stock, no root, no mods (but only for the first time ;D)
---------------------------------

Gesendet von Tapatalk
 

perditi0nspam

New member
Dec 21, 2012
4
0
First of all, thanks for the prompt responses :)

A differnet forum suggested the following (a few years ago):

"
So guys i have successfully disabled power off menu of Motorola Atrix 4G (MB860-Froyo)while asleep (screen off and locked) now power button only wakes mobile and does not show power menu.

Use any file explorer with text file editor and go to /system/usr/keylayout/ -- where following files modified shown below. The flag of all POWER enteries changed from WAKE TO WAKE_DROPPED and restart mobile --- hurrrrrrah done: -

cpcap-key.kl
key 107 POWER WAKE_DROPPED

evfwd.kl
key 116 POWER WAKE_DROPPED

qwerty.kl
key 116 POWER WAKE_DROPPED


usb_keyboard_102_en.us.kl
key 116 POWER WAKE_DROPPED
"

Any idea if that would disable both hardware and software resets for a set period of time? Would it require root?
 

Masrepus

Senior Member
Feb 12, 2013
767
99
Hm yeah should work
You obviously will need root as you are changing system files.

---------------------------------
Phone : My new Nexus 4!
OS:
Pure KitKat 4.4.2 stock, no root, no mods (but only for the first time ;D)
---------------------------------

Gesendet von Tapatalk