5,606,530 Members 33,152 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
perditi0nspam
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 3
Join Date: Dec 2012
Default [Q] Disabling soft and hard power/reset in android

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
 
Masrepus
Old
#2  
Masrepus's Avatar
Senior Member
Thanks Meter 55
Posts: 586
Join Date: Feb 2013
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
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 3
Join Date: Dec 2012
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
Old
#4  
Member
Thanks Meter 21
Posts: 88
Join Date: Sep 2013
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
Old
#5  
Masrepus's Avatar
Senior Member
Thanks Meter 55
Posts: 586
Join Date: Feb 2013
Quote:
Originally Posted by perditi0nspam View Post
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 ----------

Quote:
Originally Posted by EmptinessFiller View Post
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
Old
#6  
Junior Member - OP
Thanks Meter 0
Posts: 3
Join Date: Dec 2012
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
Old
#7  
Masrepus's Avatar
Senior Member
Thanks Meter 55
Posts: 586
Join Date: Feb 2013
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Speed up the ROM or Kernel Build Process

Creating a kernel, ROM, or any other development projectrequires knowledge and tools. While … more

Google Glass Now Open to Anyone… with $1500 to Spend (Update: Not Anymore)

Google Glass, which recently received its official update … more

Android 4.4.2 OTA Now Available for the Verizon Droid DNA

A couple of days ago, we talked about how the Android 4.4.2 upgrade for the HTC … more