[Q] Disabling soft and hard power/reset in android - Java for Android App Development

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

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

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?

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)

perditi0nspam said:
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?
Click to expand...
Click to collapse
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 ----------
EmptinessFiller said:
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)
Click to expand...
Click to collapse
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

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?

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

Related

[Q] How to Disable Button to increase reliability?

How do I disable the back and option button in Samsung Galaxy S4 on unrooted device?
I also realize that by doing this, the soft button (back, option and home) will resurface on the screen that will make the screen no longer a 4.99".
But this back button has been bothering me for a while now, especially when showing some stuff on my phone to friends, where I or others 'accidentally' touch it and change the screens to other things that i might not want to share with them.
Thanks.
As far I know you can't do that, be careful with management of your phone,I don't have problem with that keys
Enviado desde mi SGS4 usando Tapatalk 4
i wouldn't mess with that if i were you
Sent from my GT-I9500 using Tapatalk 4
jezzica87 said:
How do I disable the back and option button in Samsung Galaxy S4 on unrooted device?
I also realize that by doing this, the soft button (back, option and home) will resurface on the screen that will make the screen no longer a 4.99".
But this back button has been bothering me for a while now, especially when showing some stuff on my phone to friends, where I or others 'accidentally' touch it and change the screens to other things that i might not want to share with them.
Thanks.
Click to expand...
Click to collapse
You need to root for sure- and probably modify some files...
Remember it IS possible should be... Though depends even on what ROM you use.
On unrooted device answer definetly one - you can NOT.
Impossible on an unrooted device so you might have to flash cf root in odin first.
I've done it on an S2 & S3 before so no reason why it wouldn't work on the S4 as well.
To enable the on-screen navigation buttons:
Use a file explorer (like Root Explorer) to navigate to
/system/build.prop
and open the file with a text editor. Add the line
qemu.hw.mainkeys=0
at the end of the file. Save and close. Reboot. Done.
http://brandtkrueger.wordpress.com/...ation-buttons-on-the-galaxy-s3-requires-root/
Sent from my GT-I9505 using xda premium
If you easily accidentally touch the soft button then what can prevent you to not accidentally touch the onscreen button?
Sent from my GT-I9500
My thoughts exactly. It will make the problem 10 times worse I'm sure.

Nexus 4 KitKat 4.4 Issues

So I followed the instructions to go from ParanoidAndroid to Stock, and I chose to stock to 4.4... now I'm having issues.. strange ones.
1) The Home Key doesn't do anything.
2) The lockscreen is non-existent
3) When I press and hold the power button, all I get is "Power Off".. no other options.
4) I don't get notifications, and when I pull down the notifications menu, none of the functions work (User settings, Date & Time, etc.)
5) If I use the "stock launcher", I continuously get "Launcher has crashed" error,never goes away.
Any help with any of this? I've been trying to fix it for hours.
Thanks in advance, guys..
SinkyChan17 said:
So I followed the instructions to go from ParanoidAndroid to Stock, and I chose to stock to 4.4... now I'm having issues.. strange ones.
1) The Home Key doesn't do anything.
2) The lockscreen is non-existent
3) When I press and hold the power button, all I get is "Power Off".. no other options.
4) I don't get notifications, and when I pull down the notifications menu, none of the functions work (User settings, Date & Time, etc.)
5) If I use the "stock launcher", I continuously get "Launcher has crashed" error,never goes away.
Any help with any of this? I've been trying to fix it for hours.
Thanks in advance, guys..
Click to expand...
Click to collapse
Which instructions did you followed? Try this one here. Never gives any problem to me. :good:
arffrhn said:
Which instructions did you followed? Try this one here. Never gives any problem to me. :good:
Click to expand...
Click to collapse
I followed those ones,actually... I even tried following them a second time but I did skip clearing my device... I want to now, but my Device won't show it's internal storage on my PC So I can't back it up..
SinkyChan17 said:
I followed those ones,actually... I even tried following them a second time but I did skip clearing my device... I want to now, but my Device won't show it's internal storage on my PC So I can't back it up..
Click to expand...
Click to collapse
Make sure it is connected as MTP. Try uninstall and reinstall the drivers. I had a hard time finding the drivers before as I am using 64bit win7. Drivers I found before had some troubles as it was not signed..so I can't use in on 64bit os. If all else fails..use airdroid to transfer your files. Good luck.
SinkyChan17 said:
So I followed the instructions to go from ParanoidAndroid to Stock, and I chose to stock to 4.4... now I'm having issues.. strange ones.
1) The Home Key doesn't do anything.
2) The lockscreen is non-existent
3) When I press and hold the power button, all I get is "Power Off".. no other options.
4) I don't get notifications, and when I pull down the notifications menu, none of the functions work (User settings, Date & Time, etc.)
5) If I use the "stock launcher", I continuously get "Launcher has crashed" error,never goes away.
Any help with any of this? I've been trying to fix it for hours.
Thanks in advance, guys..
Click to expand...
Click to collapse
I am not having any of those problems...to install i just ran the flash all script in the zip file of occam
The only issue im having is that when i increase the volume while playing music and try to slide the volume bar on the screen, it doesnt work.
The slider doesnt move nor does the volume increase. Even while using the buttons, the volume increases but the on screen volume bar doesnt move
SinkyChan17 said:
So I followed the instructions to go from ParanoidAndroid to Stock, and I chose to stock to 4.4... now I'm having issues.. strange ones.
1) The Home Key doesn't do anything.
2) The lockscreen is non-existent
3) When I press and hold the power button, all I get is "Power Off".. no other options.
4) I don't get notifications, and when I pull down the notifications menu, none of the functions work (User settings, Date & Time, etc.)
5) If I use the "stock launcher", I continuously get "Launcher has crashed" error,never goes away.
Any help with any of this? I've been trying to fix it for hours.
Thanks in advance, guys..
Click to expand...
Click to collapse
I'm having all of the same issues, I just side loaded the official OTA zip file....Any one know how to fix this?
SinkyChan17 said:
So I followed the instructions to go from ParanoidAndroid to Stock, and I chose to stock to 4.4... now I'm having issues.. strange ones.
1) The Home Key doesn't do anything.
2) The lockscreen is non-existent
3) When I press and hold the power button, all I get is "Power Off".. no other options.
4) I don't get notifications, and when I pull down the notifications menu, none of the functions work (User settings, Date & Time, etc.)
5) If I use the "stock launcher", I continuously get "Launcher has crashed" error,never goes away.
Any help with any of this? I've been trying to fix it for hours.
Thanks in advance, guys..
Click to expand...
Click to collapse
Same issues here. I flashed it via fastboot. Used the "flash-all.bat" script, but took out the "-w" option so it wouldn't wipe my data.
I'm having the exact same issues but going from stock 4.3 to 4.4 ota when the notification showed up saying I was good to go. Never been rooted at all.
My opinion on this update
well my opinion on this update is that it seems as though it was rushed and for some reason they didnt include the google experience launcher... like why would you announce and then not release
BigwinWork said:
well my opinion on this update is that it seems as though it was rushed and for some reason they didnt include the google experience launcher... like why would you announce and then not release
Click to expand...
Click to collapse
Google have never announced the Google launcher.
Google have never said they will release the launcher for devices other than the Nexus 5.
Google have never called it Google Experience Launcher.
It doesn't take any effort to make it work on the N4.
Update
Here's an update: One other issue I had was my phone would not work if someone called me. I could call out, but calls to my phone went to voicemail. I decided to put Android 4.3 back on...but then the thing got stuck at the Nexus X screen. I flashed a couple of times, but nothing. The one thing I didn't want to do was lose my data...just a pain. One thing I did while dealing with the 4.4 issues, was copy over my data.
I had to end up re-flashing everything losing my data. I basically used option "D" from this thread: http://forum.xda-developers.com/showpost.php?p=34552123&postcount=1
I would think there is a way to fix the 4.4 problems, however, not having my phone work really wasn't an option. I could deal with the home button, notifications, etc...
Oh...about 10 minutes after I was finally back in 4.3, I get a notification that 4.4 was downloading. A bit later I was able to install using the OTA and it worked! Now I'm on 4.4. I haven't rooted it, and I'm pretty sure I've lost CWM, but after spending 3 hours or so dealing with this...even getting the "red" light at one point, I think I'll call it a day. Just thought I'd update for others.
SinkyChan17 said:
So I followed the instructions to go from ParanoidAndroid to Stock, and I chose to stock to 4.4... now I'm having issues.. strange ones.
1) The Home Key doesn't do anything.
2) The lockscreen is non-existent
3) When I press and hold the power button, all I get is "Power Off".. no other options.
4) I don't get notifications, and when I pull down the notifications menu, none of the functions work (User settings, Date & Time, etc.)
5) If I use the "stock launcher", I continuously get "Launcher has crashed" error,never goes away.
Any help with any of this? I've been trying to fix it for hours.
Thanks in advance, guys..
Click to expand...
Click to collapse
Im having the exact same issue but I installed the official OTA update. Will probably try flashing like you did. Haven't seen this issue posted anywhere else.
Over the air update also gave same symptoms (and a couple more)
Dear All,
I got the update pushed over the air automatically and clicked to update thinking all was going to be fine
I am having all the symptoms listed, and I can add 2 more for the sake of completeness (and to highlight the annoyance):
1-When clicking on links from Google Now results or any app other than Chrome (I do not have other browsers installed), Chrome gets launched (or switched to), but it reloads the last open tab instead of loading the link.
2-The double finger down swipe to access the profile is not working (and I did not find a way to access it, since clicking on the little profile icon in the empty notification screen I get with the single finger swipe down, also does not work, it does not even click).
For some reason, until I rebooted Email did not work (it kept sitting in "checking" the inbox, but was not able to get messages).
Really bummed that this happened with an updated pushed by Google on my Nexus4. Will try to follow recipes to back-up my data.
I am new to forum/android: is there a direct way to submit feedback to Google team? Does it make sense to try to do so? It would be nice to know what caused the problem and I'd be happy to send debugging input for them.
I guess next time I'll wait on the fence a bit before updating the operating system.
Thanks,
Gabriele
Maybe you guys need to do factory reset after the update. I know it's quite a hassle as all your data will be gone. Just backup whatever things you need and reset it.
Clean install here. Never had any issues and kitkat works great even on dalvik.
Sent from my Nexus 4 using xda premium
Google support solution
Dear arffrhn and all,
I finally managed, after a lot of frustration to talk with Google support (had to go through Google Play Help center, and pursue "apps" help to get to click on a "Call us" button, and they called me to a landline in Europe within 15 seconds).
Once I got transferred to hardware support, Eveline mention how she believed the issue was with some "glitch" during the update... she told me that in many cases a cache partition clear would be enough, but if that did not work, a factory reset should do it.
She guided me through the first process:
Clear cache partition.
1. Hold power button for 2 seconds and select 'Power Off'
2. Press and hold the Volume Up and the Volume Down and Power keys at the same time for about 10 seconds.
3. An image of an Android lying on its back will appear.
4. Press the Volume Down key twice until "Recovery mode" appears on the screen.
5. Press the Power key to restart in "Recovery mode."
6. An image of an Android with a red triangle will appear.
7. While holding down the Power key, tap the Volume Up key.
8. The Android System Recovery screen will appear. Release all keys.
9. Use the Volume keys to scroll to wipe data cache partition and press the Power key to select.
10. The phone will restart.
Click to expand...
Click to collapse
Unfortunately this was not enough to fix my problem... still same symptoms.
So she offered to help me back-up my data, I had already used AirDroid to back up all the files, apps, pics, videos etc so I preferred to stay on the line and proceed with the factory reset in case that would not work.
Here are the steps:
Factory data reset.
Please note that performing a factory data reset on your device will return your phone or tablet to its original state. I'd recommend backing up and saving any photos, videos, music, or other items you might have stored on your device's local memory. If you have a device with an SD card (for instance, a Samsung Galaxy S 4 Google Play edition), your media content (photos, music, etc.) stored there will not be deleted.
To perform a factory reset:
Go to Settings > Backup & reset.
- Press Factory data reset
- Press Reset
After you perform the factory reset, you'll need to sign into your device with the same primary Google account you were using before in order to sync your purchased apps and other content.
If you're unable to get to your Settings menu, follow the steps below:
1. Power down your device
2. Press and hold both volume keys and the power button to enter Bootloader mode
3. Press the volume keys to cycle to the Recovery mode option
4. Press the power button to select Recovery mode
5. From the Recovery mode screen, press and hold the Power button then press the Volume up button.
6. Use the volume buttons to select wipe data/factory reset.
7. Select Yes -- delete all user data.
8. The factory data reset process will now start. Once its finished, select 'Reboot system now.'
Click to expand...
Click to collapse
I was able to access my Settings menu, so I did not need to follow all the steps, but just do the data/factory reset.
The phone came back up asking usual personalization questions, and it all was fixed... now I have to spend a few hours getting back my apps, data, settings, etc... but my problem was solved without having to re-flash or anything like that.
I filed a feedback about the abysmal situation of the Google Play help center and asked the two support people I spoke with to raise the issue internally... when I selected the natural line of help (device, technical support) after a couple of screens I got to a blank "Select device" screen that was a dead end. I had to go though apps support that only offered phone support... but in the end it worked.
Hope sharing this will help others! Not sure whether I should peek into the Google Experience Laucher eventually... back to work for now!
Cheers,
Gabriele
PS
The steps quoted above were sent by Eveline after our conversation was over, in case I needed to use them again. She mentioned that if I were to have more problems they could look into a potential hardware failure of my almost our of warranty Nexus 4.
arffrhn said:
Maybe you guys need to do factory reset after the update. I know it's quite a hassle as all your data will be gone. Just backup whatever things you need and reset it.
Clean install here. Never had any issues and kitkat works great even on dalvik.
Sent from my Nexus 4 using xda premium
Click to expand...
Click to collapse
gbenelli said:
Dear arffrhn and all,
Click to expand...
Click to collapse
Glad to see it works.

How to disable power button when the screen is locked

It would be awesome if sombody posts how to do it with rooted Nexus 4 and without any additional apps. I mean to do it on true *nix-way - console :laugh:
Many people need it for security reason, I guess. I digged the file at /system/usr/keylayouts, but cant find what I need to do.
Below are the lines from logcat when long press the power button on locked screen and "power menu" appears.
Code:
W/ViewRootImpl( 1385): Dropping event due to no window focus: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_POWER, scanCode=116, metaState=0, flags=0
x8, repeatCount=3, eventTime=11458677, downTime=11458075, deviceId=1, source=0x101 }
How do you mean disable power button? It's hardware?
Why would you want to do that. How would you get back to your lock screen?
Sent from my SAMSUNG-SGH-I727
I think OP want disable power off menu when phone is locked
RolF2 you're totally right.
Sorry guys, I wasn't clear enough.
I want to disable the power menu button when the screen is locked to prevent "some thief" to switch the phone off.
And in other cases it should work as it does now.
UPD: I know Gravity Box can do it. But my phone has ART running which denies to serve Xposed.
I mean the phone is rooted, encrypted, the password is changed with "vdc changepw", bootloader is re-locked, cerberus is installed and now such kind of little thing (power menu) ruins the full security ))).
I dunno the under workings of how to disable the power menu in the lockscreen but there are some ROMs that have it built in into settings. AICP, Beanstalk, Cataclysm, and Purity have this option. I'm a Purity user and it works well. Cerberus don't work when the phone's off. LoL.
Sent from my Nexus 4 using Tapatalk
Cerberus don't work when the phone's off. LoL.
Click to expand...
Click to collapse
You've got the exact reason of my Q.
P.S. I prefer stock ROM.
Any update/news of a code that can be used to disable the power menu from the kernel level?
That would be great.
DZeros said:
Any update/news of a code that can be used to disable the power menu from the kernel level?
That would be great.
Click to expand...
Click to collapse
Nope. Still waiting for help.
im interested in that too!
I think you're a bit paranoid
Mashed_Potatoes said:
I think you're a bit paranoid
Click to expand...
Click to collapse
To say "a bit paranoid" is to say nothing in my case. )))
But without jokes, this feature is very needed. As one of us said it here before: Cerberus won't work when the phone is switched off.

[Q] Scheduled Shutdown

Hi,
I recently got fed up with forgetting to power off my nook. So I figured out I could use Tasker to shut it down at night when it is idle, etc., but I while I was testing it I realized that when my Nook is shut down, it shows the last state of the screen before having been shut down. It is quite annoying, especially that I cannot find a workaround, since Tasker cannot unlock the locked screen.
So, my question is, that does somebody know whether there is a shell command to power off the Nook like when you press the power off button?
Or any other suggestions would also be great.
In my experience letting the nook go into standby for 8-12 hours before using it again uses less battery than shutting down completely and rebooting it.
OB
Sent from my SPH-D710VMUB using Tapatalk 2
I use Quick Boot v4.2, Plus version which has an additional command useful for phones: Hot Boot. Free version is good enough for NST:
http://play.google.com/store/apps/details?id=com.siriusapplications.quickboot
I use a WiFi shutdown timer on my phone though, as sleep function on shoutcast radio.
P.S. As mentioned before in my apps listings thread for standby & screen blanking I use Screen Off FX:
http://play.google.com/store/apps/details?id=jp.co.kixx.tool.offwidget
Well, maybe I wasn't making myself clear enough. The most important part here is automation. So while screen off fx is awesome, I can't really use it in this situation since my screen is already locked when I want to turn my Nook off.
The thing I am searching for is a command or an app that could shut down my Nook (even when my screen is locked) in a way that it shows the usual "Your Nook has turned off completely" picture. (Every app that I tried has made the Nook show the screen that is has shown before having been shut down.) And I would like to do all of that automated, probably with Tasker.
Sagittarius0 said:
Well, maybe I wasn't making myself clear enough. The most important part here is automation. So while screen off fx is awesome, I can't really use it in this situation since my screen is already locked when I want to turn my Nook off.
Click to expand...
Click to collapse
The way I would do it is unlock the screen, overlay an image of whatever you want to be shown using a scene, and then shutdown.
To unlock the screen, try Simulating the "n" button command with tasker to unlock the screen before shutting down. (assuming slide to unlock is disabled):
Procedure for simulating button:
In your Tasker task, Create a new Run Shell Action. (Found in the "Script" category)
In the command section, put the following:
Code:
sendevent /dev/input/event1 1 102 1
sendevent /dev/input/event1 0 0 0
sendevent /dev/input/event1 1 102 0
sendevent /dev/input/event1 0 0 0
This will send a press and a release event of the n button.
​
Check the Use Root Option.
NOTE: If this is the first time you've used root with tasker, the root confirmation dialog will appear. Make sure to check the always allow option so that it doesn't pop up again.
Just For Reference:
If you would want to use other buttons do the following:
Replace 102 with:
Power Button: 116
Replace event1 with event0 AND 102 with:
Top Left Page Button: 412
Bottom Left Page Button: 139
Top Right Page Button: 407
Bottom Right Page Button: 158
Good Luck!
Absolutely woderful!
This is exactly how I wanted to do it. :victory:
It works perfectly, thank you very much.
Pushing stuff into /dev/input is lower level than it need be.
You'll be working with scan codes there.
In a shell this sends a press of the power button (using a KEYCODE)
Code:
input keyevent 26
Shutdown is easy enough (with one small hitch).
Simply send a android.intent.action.ACTION_REQUEST_SHUTDOWN
The problem is that this is a privileged intent and can only be sent by system apps.
System apps are those that have the system signature.
You can do that by re-signing your system.
You need to have android.permission.SHUTDOWN in the manifest.
You can do that by re-signing your system.
Click to expand...
Click to collapse
Well, how can I do that?
And does this command you mentioned have the same efect as reboot -p?
Sagittarius0 said:
Absolutely woderful!
This is exactly how I wanted to do it. :victory:
It works perfectly, thank you very much.
Click to expand...
Click to collapse
Glad I could help! :good:
Renate NST said:
Pushing stuff into /dev/input is lower level than it need be.
You'll be working with scan codes there.
In a shell this sends a press of the power button (using a KEYCODE)
Code:
input keyevent 26
Click to expand...
Click to collapse
Ok, good to know. I just went for the scan codes because I knew how to quickly get them from shell getevents.
Sagittarius0 said:
Well, how can I do that?
And does this command you mentioned have the same efect as reboot -p?
Click to expand...
Click to collapse
If all your looking for is to do a shutdown or reboot, and are already using a Tasker task, the action Misc > Reboot has the ability to shutdown or do a reboot. My guess is that it does exactly what Renate NST is telling you to do - send a shutdown intent - behind the scenes. Granted, I don't know, and I don't have Tasker installed on my nook so I can't confirm that it will actually work, I have just used Tasker on other devices and it seems to work fine.
Just seems like the easiest, cleanest way would be to keep all the actions under one roof.
cuff21 said:
I don't have Tasker installed on my nook so I can't confirm that it will actually work
Click to expand...
Click to collapse
It does work seamlessly.
cuff21 said:
My guess is that it does exactly what Renate NST is telling you to do - send a shutdown intent - behind the scenes.
Click to expand...
Click to collapse
Hmm, I don't know. A regular root and su won't work.
You'd either have to have a system-signed app or hack the permission system.
There is no clear info on the difference between an Android shutdown and a Linux shutdown.
Given the choice, I'd go for the Android shutdown.
Renate NST said:
Hmm, I don't know. A regular root and su won't work.
You'd either have to have a system-signed app or hack the permission system.
Click to expand...
Click to collapse
Well I had a stack overflow link that shows a way to do it, but I can't post links yet. Either way, apparently there is a way with only root. The code from the link was:
Code:
try {
Process proc = Runtime.getRuntime()
.exec(new String[]{ "su", "-c", "reboot -p" });
proc.waitFor();
} catch (Exception ex) {
ex.printStackTrace();
}

Button Mapper: Remap Bixby and other buttons (no limitations if rooted)

If the Bixby button is bothering you, I present an alternative method for remapping it to whatever you want using Button Mapper. On the Note 9 specifically, there are some differences in the way Button Mapper works compared to other Bixby remappers. I am the developer of this app and intentionally made it work differently so you have a choice. Button Mapper version 0.75 or later is required for the Note 9, check links at bottom of post.
Please note that if you have rooted your Note 9, Button Mapper allows single, double and long press native Bixby remapping that works perfectly with no limitations whatsoever.
​
Advantages:
-Bixby never appears, it can be completely disabled and remapping still works
-Single press and long press actions available
-native remapping, meaning it's faster. No polling involved, it reacts to the button press input event
-far more actions and features available than other remapping apps
​
Disadvantage:
-must run adb shell command after every boot
​
The disadvantage is not that bad, because you don't need to restart your device very often. I often let my phones run for weeks without reboot.
Please don't complain about having to do the adb command after every boot. I'm simply presenting this as an alternative method for interested users who would like to put in a little extra effort to get a better experience. If this is not for you, just move on and use something else.
​
Button Mapper is free on Google Play or XDA Labs (version 0.75 or later is required for Note 9 support)
XDA Labs (latest version always available)
https://labs.xda-developers.com/store/app/flar2.homebutton
Google Play (version with Note 9 support may not be available yet)
https://play.google.com/store/apps/details?id=flar2.homebutton
I almost never reboot my device unless I have something to flash. I am very familiar with debloating my devices via ADB. I will give it a try. Thank you for offering a way for non-root users to remap the Bixby button.
This is the best app for remapping the Bixby button to something useful. Works perfectly on my Note 9 even with Bixby 2.0. People shouldn't even bother with any other app.
It takes a 30-second ADB session and you're all set. No lag, no Bixby popups. The only niggle is it needs to be restarted every reboot but that's not a big deal.
I've used BXActions but I prefer this a whole lot more. Just a cleaner experience.
Whoa.. thanks man.
This is just like I remapped the button on my rooted S8. Cant wait to try it.
I have a question though. Is it possible to run the adb from within the phone itself? I know theres a terminal app, but I believe it needs root? I can't remember.
Thanks.
Not sure what I did wrong. I was able to remap both the single press and long press, but it does the customized action as well as launch Bixby voice at the same time.
I'm happy with just disabling Bixby voice really. My device is not rooted.
Edit: Just figured out what I missed. I forgot to add "-d" to the adb command to disable Bixby assistant. Now it works perfectly. Sorry for being a dumbass. lol
MasK said:
Whoa.. thanks man.
This is just like I remapped the button on my rooted S8. Cant wait to try it.
I have a question though. Is it possible to run the adb from within the phone itself? I know theres a terminal app, but I believe it needs root? I can't remember.
Thanks.
Click to expand...
Click to collapse
It's impossible to run the command from the phone, unfortunately.
Thanks flar2!! I really appreciate all of the work that you do. This is my 3rd app that I've purchased from you, and it won't be the last! I was using bxActions, but that app pales in comparison to this button mapper. I'm just glad I stumbled across this thread. Button Mapper Pro has made my Note 9 complete, thanks again for everything you do. I look forward to what ever is next.
Hi @flar2,
In note 9, there's a system default option to control media volume using the vol buttons. See attached pic.
But when I enable vol buttons on the mapper, it results to controlling the ringtone. And even if the toggle is on for the media control, the app still overrides the action.
I see there's a pro setting to gain back the media volume.
otaconremo said:
Hi @flar2,
In note 9, there's a system default option to control media volume using the vol buttons. See attached pic.
But when I enable vol buttons on the mapper, it results to controlling the ringtone. And even if the toggle is on for the media control, the app still overrides the action.
I see there's a pro setting to gain back the media volume.
Click to expand...
Click to collapse
The app has no way of knowing about that setting, so it is ignored. You can use the default to media option in Button Mapper
Any way to get it working by pressing whilst screen is off?
poczynek said:
Any way to get it working by pressing whilst screen is off?
Click to expand...
Click to collapse
Bixby works with the screen off by default
After using bxactions for a few days, I decided to try this app instead, and it works ALOT better! Thank you OP.
I almost never reboot my phones, so the adb thing is no big deal for me.
As much as I like bxActions, I even ended up buying the pro version, I can't help but say this just works better. I made the adb command into a batch file that I can just double click so that's not much of an issue, but I do have a couple questions/requests:
Is it normal for double tap to be greyed out? Can you add an immersive toggle to the list of available commands?
One thing I liked about bxActions is the ability to change what the button does while locked/lockscreen vs unlocked, is it possible to implement that here too?
Thanks!
rejectedjs said:
As much as I like bxActions, I even ended up buying the pro version, I can't help but say this just works better. I made the adb command into a batch file that I can just double click so that's not much of an issue, but I do have a couple questions/requests:
Is it normal for double tap to be greyed out? Can you add an immersive toggle to the list of available commands?
One thing I liked about bxActions is the ability to change what the button does while locked/lockscreen vs unlocked, is it possible to implement that here too?
Thanks!
Click to expand...
Click to collapse
I'm looking into double tap. Currently it's not available for Bixby on the N9.
Note 9 lock and home
Note nine lock and home
Hey there, using this app on my Note 9 instead of bxActions. I can say its working much better but Im missing a few features. Is it possible to have a Sound/Vibrate Toggle like bxActions without going though DND mode, like on IOS? A fullscreen mode toggle action would also be really useful.
Also having different actions for buttonpresses while locked vs. unlocked would be great. Thank you!
Azizamiri796 said:
Note nine lock and home
Click to expand...
Click to collapse
cool, but how does this relate to the button mapper in any way?
@flar2:
Whenever I use USB tethering, button mapper stops working until I run the adb command again, do you know what causes this? So apparently its not only a phone reboot that deletes the adb settings but also usb tethering
destz0r said:
@flar2:
Whenever I use USB tethering, button mapper stops working until I run the adb command again, do you know what causes this? So apparently its not only a phone reboot that deletes the adb settings but also usb tethering
Click to expand...
Click to collapse
I have no idea about this
Note 9. Same to me. Phone reboot deletes the adb settings. And if i use toggle flashlight then bixby startscreen goes ON

Categories

Resources