"long press of home button" configuration - Android Software/Hacking General [Developers Only]

Hi,
i searched a lot about this and didn't found an answer about this.
i'm using the LockerPro application as a lock screen but this means that the "long press of home button" can be still activated when i'm in the lockscreen.
in default Android phone the OS disable a lot of things when it is in lock screen mod for example the "long press of home button" that usually lead to
show the "history application" / "running application" list but this is disabled in lockscreen mode.
i'm assuming that if the OS is doing some API calls we can do the same or if the OS is registered in some policy we could do an application that will have the same policy that the lockscreen mod uses.
so, I wanted to know how the OS manage to do this and disable those so i could build an application on rooted phone that will do the same ?

I have started to dig more and found that the place that handle the "long home press" is :
"platform_frameworks_base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java" that is acctually located in the "android.policy.odex" file that is in the "system\framework\".
there is the following code:
private void handleLongPressOnHome() {
if (mLongPressOnHomeBehavior != LONG_PRESS_HOME_NOTHING) {
mHomeConsumed = true;
performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) {
toggleRecentApps();
} else if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_ASSIST) {
launchAssistAction();
}
}
}
Click to expand...
Click to collapse
so i can add a code that before that will update the "mLongPressOnHomeBehavior" from external place (i.e: file) and according to the value in the file we could change
the configuration of the "mLongPressOnHomeBehavior" and override the original behavior. if file doesn't exist then all goes as usual and if file exist read the overwritten value and act according to it...
any other suggestions on how to apply this with more ease ? is there any environment variables that we can set and get globally between the OS and the Applications ?

update:
for now just to see that it is working i have change the dalvik code to return void and don't preform anything and using this guid:
http://www.jordanhotmann.com/2011/08/how-to-change-default-orientation-of.html
I have generated a new android.policy.odex file to my system and it worked perfectly...
now i need to inject code that will read from a conf file what will be the operation of the "long pressed button" so an external application (with root) could dynamically
choose when to enable or disable the "long home press" functionality
will update soon and with Galaxy S4 + S3 latest versions new android.policy.odex for you all to enjoy ...
Regards,
LaBBa

Related

Display doesn't dim {SOLVED}

Something went wrong with my Vox. It doesn't longer completely dim the display after a given timeout. What could be the problem?
Search this forum maybe?
http://forum.xda-developers.com/showthread.php?t=303778
agentdr8 said:
Search this forum maybe?
http://forum.xda-developers.com/showthread.php?t=303778
Click to expand...
Click to collapse
Thanks for the hint but I couldn't figure out which keys to edit or create. Could you please show me an overview of your keys in "HKEY_Current_User > ControlPanel > Power"?
Thank you in advance.
I found the full version of the tutorial and it worked: http://titourhea.free.fr/site/faq.php?lng=fr&pg=312
Thanks to all
What do they mean with:
"HKEY_Current_User, ControlPanel, Power, faire : Values, Display (cliquer dessus), Value Data par défaut = 60"
Do they mean setting value "Default" in HKCU/ControlPanel/Power ?
(in my case it is unset)
Or do they mean setting value "Display" in HKCU/ControlPanel/Power ?
(in my case "Display" does not exist)
Depending on which registry editor you use, it'll have different means of editing the values for that key's default value.
So if it were arranged as a tree, it would look like this:
Code:
HKCU
\\
ControlPanel
\\
Power <== *** under here, you'd edit its (Default) (or hit Values softkey in PHM) ***
\\
LockLevel <== this is a sub-key of the Power key, which has it's own values
\\
Display <== if this existed, it would be here, as another sub-key of Power
I have still not under stood. I am using resco registry editor but : what to change in what I have somethin " Locklevel" under Power.. nothin else. what to change in this. I am using HTC VOX
jsbutran said:
I have still not under stood. I am using resco registry editor but : what to change in what I have somethin " Locklevel" under Power.. nothin else. what to change in this. I am using HTC VOX
Click to expand...
Click to collapse
I do not understand either:
so you do have to create a value under "Power" that is called "Display" (if - as with my Vox - it is not there) and under that you can enter 60,30 or whatever?
TIA
Here's how I did it using Resco's Registry Editor.
Navigate to HKCU>ControlPanel>Power
There you will find:
Code:
..
LockLevel
(Default)
Display
Click on "Display". Now you will see "DWORD Data". Enter "30" there (stands for seconds).
PS. You DO NOT need to create any new keys, string values or whatever.
In my case after some readings from various forums i've found out my problem was caused by installing the tcpmp player. It created the "display" value in the first place. So the best way is to simply delete the "display" value.
After that on the tcpmp player options > settings > advanced - select the options for " no backlight keepalive for video" and home screen timeout for music".
This solution has worked for me. I just have to manually change the display timeout settings to "never" before playing anything on the player.

[Q]First application

Hi guys, i want to do a very simple app for WP7.
It's my first app, so i'm very noob
I put a butto, and i want that when i click on it, it opens a picture.
How i can do that?
There is a guide for noob like me?
you might probably wanna check the guide from Microsoft student..
Please try this out an see if it works. This is using a default empty silverlight project.
In the designer (MainPage.xaml), add a button and an Image element using the XAML:
<Button Name="testButton" Width="140" Height="100" VerticalAlignment="Top" Click="testButton_Click">Open</Button>
<Image Name="imageElement" Width="300" Height="300"></Image>
This should be added inside the Grid Element named "ContentPanel"
Next add the image to your project by right clicking your project in the solution explorer and selecting:
Add -> Existing Item -> And add an image called "test-image.png"
Click on the added image, in the Properties box, set Build Action -> Copy Always
In the code-behind file (MainPage.xaml.cs), add the reference to the library BitmapImage by adding "using System.Windows.Media.Imaging;" to the top of the file.
Add a click event handler for the button using the code:
private void testButton_Click(object sender, RoutedEventArgs e)
{
Uri imageUri = new Uri("/[ProjectName];component/test-image.png", UriKind.Relative);
BitmapImage testImageBitmap = new BitmapImage(imageUri);
this.imageElement.Source = testImageBitmap;
}
But make sure to replace [ProjectName] with the name of your windows phone project.

[ROOT] Remap Bixby Button with simple, double and long press

The ultimate solution for assigning an action or application to the Bixby button
I found a trick to assign the Bixby button to an action, application and more... Support a single click, double-click and hold (also works the screen off)
Here are the functions you can assign to the Bixby button
Navigates: back, home, recent apps...
Controls: sleep/wake up, show power menu, shutdown, reboot, expand notifications panel...
Rotation control.
Media controls: play/pause, next, previous, stop...
Fast scroll: scroll to top/ bottom.
Edit: copy, paste...
Universal copy, one tap copy text every where.
Settings: auto brightness, rotation, wifi, mobile data...
Start app/shortcut/activity, finish activity, previous app/next app, kill app...
Freezer: freeze/thraw app.
Input gesture, key event, text...
Shortcut panel, app drawer, freezer drawer, side bar...
Floating widget.
Swipe adjust: swipe on the edge to adjust brightness, screen filter, volume...
Gesture pointer, extends your finger.
Notification, speech, toast.
Screen filter, torch.
Conditional: if screen on, keyguard on, wifi connected/disconnected, battery level, time period, wifi connected to, app focused...
Multi action, saved multi action.
...
Disclaimer:
I AM NOT RESPONSIBLE FOR ANY DAMAGE DONE TO YOUR DEVICE IF YOU DECIDE TO USE THIS GUIDE. IT'S PRETTY SAFE THOUGH BECAUSE I HAVE HEAVILY TESTED EVERYTHING THAT I WROTE.
Required
All Samsung rom custom Android 7.0, 7.1.x , 8.0, 8.1.x
TWRP (Exynos) or TWRP (Snapdragon) optional (preferably MAGISK)
Step 1
Remap Bixby Button
As in the article :
1. Go with any root Explorer (I'm using Solid Explorer) to /system/usr/keylayout
2. Rename the Generic.kl to Generic.txt
3. Open this file with an text editor
4. Search for 703 to get following entry: # input_fw Intelligent Key for Dream key 703 WINK
5. Change it to whatever you want. I simply tried following: # input_fw Intelligent Key for Dream key 703 ASSIST
6. Rename it back to Generic.kl (otherwise you won't be able to press any hardware button after reboot)
7. Check permissions
8. Restart your device
For now, Bixby is used Google Assitant with item display on the screen
Other order :
HOME - Homebutton
POWER - Powermenu
MUSIC - Starts your favorite music player
MEDIA_PLAY_PAUSE - Play pause media
VOLUME_UP - Sets volume up
VOLUME_DOWN - Sets volume down
VOLUME_MUTE - Volume media (set default media volume in phone setting)
CAMERA - Starts camera app
APP_SWITCH - Recent apps button
ASSIST - Google Assistant (with item display on the screen)
VOICE_ASSIST - Google Assistant (fast)
QPANEL_ON_OFF - Notification area
EXPLORER - Favorite internet browser
SYSRQ - Screenshot
PAGE_UP
PAGE_DOWN
CALCULATOR
CALENDAR
CONTACTS
CALL
If you want to be able to use more features such as double-clicking, long-clicking, launching an application, adjusting the vibrator or other, leave "ASSIST" and continue the steps.
Picture with the SEARCH function :
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Source : https://forum.xda-developers.com/galaxy-s8+/how-to/root-remap-bixby-button-o-app-t3601061
Step 2
Install Xposed
Flash zip Xposed with Magisk Manager, TWRP or FlashFire.
If your phone is rooting with Magisk (best method) :
Launch Magisk Manager to search, download and install the "Xposed Framework (SDK 24)" for Android 7.0 and SDK25 is Android 7.1.x,for Oreo, SDK26 is Android 8.0 and SDK27 is Android 8.1.
or
How-to flash with TWRP :
1. Transfer the zip and apk to your phone.
2. Now boot into TWRP by pressing bixby+volume up+power on while phone is turned off
3. Go to "Install" menu of TWRP select the zip and flash the zip.
4. Restart the phone and Install the apk and run the application to verify that everything is green
or
How-to flash with FlashFire :
1. Transfer the zip and apk to your phone.
2. Install FlashFire
3. Start the application and press "+"
4. Choose "Flash ZIP or OTA" and select the zip
5. Select "Auto-Mount" and "Mount / system read / write" and validate
6. Press "Flash" and "ok" then wait until the phone restarts
7. Install the apk and run the application to verify that everything is green
Picture Xposed properly installed :
The link for the ZIP to flash (xposed) for 7.0
http://dl-xda.xposed.info/framework/sdk24/arm64/xposed-v89-sdk24-arm64.zip
The link for the ZIP to flash (xposed) for 7.1
http://dl-xda.xposed.info/framework/sdk25/arm64/xposed-v89-sdk25-arm64.zip
The link for the ZIP to flash (xposed) for 8.0
https://dl-xda.xposed.info/framework/sdk26/arm64/xposed-v90-sdk26-arm64-beta3.zip
The link for the ZIP to flash (xposed) for 8.1
https://dl-xda.xposed.info/framework/sdk27/arm64/xposed-v90-sdk27-arm64-beta3.zip
The link for the "Xposed Installer apk"
https://forum.xda-developers.com/attachment.php?attachmentid=4393082&d=1516301692
A link to uninstall Xposed in case of problem (zip to flash with TWRP):
https://dl-xda.xposed.info/framework/uninstaller/xposed-uninstaller-20180117-arm64.zip
Source Xposed Nougat :
https://forum.xda-developers.com/showthread.php?t=3034811
Step 3
Customize the Bixby Button
This module provides you Gesture control, Key control and other smart triggers. to trigger actions you want.
Next, download "Xposed edge" or "Xposed edge pro" from the Play Store and activate the "Xposed edge" module in "Xposed Installer" and then restart the phone.
1. Launch the Xposed Edge module and activate "Keys" and access it
2. Press Add and click on the Bixby button
3. Activate the newly assigned Bixby button (KEYCODE_ASSIST)
4. And with the arrow on the side assign an action for a single click, double-click and hold down
Do not forget to activate key control and the button assign
And now it will work
Bonus
Gesture for navigation with Xposed Edge:
https://www.youtube.com/watch?v=DkAGCtbJr-U&feature=youtu.be
You have the possibility to choose a side of the screen, and to assign an action with a slide in the desired direction
Device testing
Galaxy S8
Galaxy S9
Galaxy Note 8
Galaxy Note 9 (Not tested)
The sources that allowed me to realize this guide
Links to threads here :
https://forum.xda-developers.com/showthread.php?t=3034811 rovo89
https://forum.xda-developers.com/galaxy-s8+/how-to/root-remap-bixby-button-o-app-t3601061 redplate
Sorry for mistakes, I speak french
I just changed value in key layout file without Xposed. It worked flawlessly. Long press and short press both fully working.
Sent from my SM-G955F using Tapatalk
alex2003super said:
I just changed value in key layout file without Xposed. It worked flawlessly. Long press and short press both fully working.
Sent from my SM-G955F using Tapatalk
Click to expand...
Click to collapse
Xposed is used to assign advanced commands.
Image below:
I see. How safe is Xposed to install ATM (could I ever possibly need a USB jig)? Running the first original firmware released for S8+
Sent from my SM-G955F using Tapatalk
alex2003super said:
I see. How safe is Xposed to install ATM (could I ever possibly need a USB jig)? Running the first original firmware released for S8+
Sent from my SM-G955F using Tapatalk
Click to expand...
Click to collapse
I completed the article hoping to have answered the question
All this instead of just using bxactions which does the same thing?
You've blatantly copied and pasted stuff from other threads here, give credit where it is due please.
Be aware xposed at this stage is unofficial, experimental and unstable.
This can all be achieved minus double tap with other methods (need root to edit kl file tho). Don't steal people's hard work and effort and pretend it's yours, link to their threads.
wildermjs8 said:
All this instead of just using bxactions which does the same thing?
Click to expand...
Click to collapse
Quite simply because xposed edge offers much more possibility of personalizing the Bixby button
beugologist said:
You've blatantly copied and pasted stuff from other threads here, give credit where it is due please.
Be aware xposed at this stage is unofficial, experimental and unstable.
This can all be achieved minus double tap with other methods (need root to edit kl file tho). Don't steal people's hard work and effort and pretend it's yours, link to their threads.
Click to expand...
Click to collapse
Apparently, you did not read the entire guide because, at the end of each step, I put the source. So after putting the source, I did not believe it was my job. Everything I did as described above in the guide, I made a guide of all I did to be able to customize the Bixby button.
And to test other methods like Bxactions, I can tell you that there is much more possiblity of personalization with this method.
But for the Xposed case you're completely right I'll presume it still unstable.
I would add a second time the source as the end of the guide this time. So that one can see it well and that one does not say that I have spent the work of the others for mine.
obedmaleka said:
Apparently, you did not read the entire guide because, at the end of each step, I put the source. So after putting the source, I did not believe it was my job. Everything I did as described above in the guide, I made a guide of all I did to be able to customize the Bixby button.
And to test other methods like Bxactions, I can tell you that there is much more possiblity of personalization with this method.
But for the Xposed case you're completely right I'll presume it still unstable.
I would add a second time the source as the end of the guide this time. So that one can see it well and that one does not say that I have spent the work of the others for mine.
Click to expand...
Click to collapse
Cheers, didn't see that. I'm going to install xposed again at some point and test this method out myself, you're right in tasker does have a bit of overhang and chews up resources, and can have a short delay depending on your multitasking habits etc. Most likely won't use this as a method until systemless xposed is more stable or rovo releases an offical n version.
obedmaleka said:
Quite simply because xposed edge offers much more possibility of personalizing the Bixby button
Click to expand...
Click to collapse
Like what?
wildermjs8 said:
Like what?
Click to expand...
Click to collapse
There is to begin with a better reactivity of my personal feelings and
For example :
Recents apps
Menu
Sleep/wake up
Split screen
Fast scroll
Soft keyboard
Edit
Clipboard
Auto brighness
Wifi
Bluetooth
NFC
Sync
Wifi AP
Stay awake
Torch
Gesture control
Key control
Previous app
Next app
Kill app
Kill foreground app
Kill background app
Shortcuts panel
Custom panel
Apps drawer
Asjust and Succesive adjust
Multi-action(pro only)
Shell command(pro only)
And much more...
P.S. One had to look at the images
After you can stay on "Bxactions" if it suits you
beugologist said:
Cheers, didn't see that. I'm going to install xposed again at some point and test this method out myself, you're right in tasker does have a bit of overhang and chews up resources, and can have a short delay depending on your multitasking habits etc. Most likely won't use this as a method until systemless xposed is more stable or rovo releases an offical n version.
Click to expand...
Click to collapse
I can not guarantee you will not worry.
But for my part I did not have any apparent problems of instability or bug.
And from what I read it works perfectly in general on the S8.
https://forum.xda-developers.com/search/thread/3639221?query=S8
I added compatibility for android 7.1
I added Xposed Official
Xposed Update
Xposed update Nougat, Oreo and Android 8.0 and 8.1
Hey all,
Really hoping someone has a solution,
last night i manually updated the Generic.kl file via the text editor, after changing the value from WINK to VOICE_ASSIST i've lost all manual buttons?
-Have tried:
Changing it back, Duhh.. - Did not work.
Copying a fresh copy of someones elses "Generic" file. (thought i may have accidentally changed an additional value)
Factory reset.
Have now reflashed my rom.
Any other idea's? For the life of me i cant work out how to get my buttons back..
Randazd said:
Hey all,
Really hoping someone has a solution,
last night i manually updated the Generic.kl file via the text editor, after changing the value from WINK to VOICE_ASSIST i've lost all manual buttons?
-Have tried:
Changing it back, Duhh.. - Did not work.
Copying a fresh copy of someones elses "Generic" file. (thought i may have accidentally changed an additional value)
Factory reset.
Have now reflashed my rom.
Any other idea's? For the life of me i cant work out how to get my buttons back..
Click to expand...
Click to collapse
When you have finished modifying generic.kl, you have to check that in the properties of the file the attributes are "rw-r--r--" otherwise you modify them. And you reopen the file to be sure that it is still readable. It can happen that according to the text editor use, the file genreric.kl is re-coded differently after the modification.
(Personally I use Solid Explorer to realize all his)
If not simpler here is the file genric.kl modified so that you can replace it directly but you will only have to check your attributes once the file replace.
Download : View attachment Generic.zip
Another safer solution is to flash this zip file and there will be nothing to check.
Download : View attachment BixbyFlash.zip
I'm in the same boat as the other guy, I have done as you said and tried both ways you suggested but still my buttons don't work
---------- Post added at 03:29 PM ---------- Previous post was at 02:55 PM ----------
I finally fixed it. All I had to do was basically redo everything g from the beginning only correctly this time. I was so worried about my buttons not working that I gave up on the bixby key alone and was just trying to get it back to normal that I didn't even thing to just start from scratch as if it was still working . If that makes sense. I feel like I'm not making sense tho .

Anyone help me mod Silk Browser add long press back key

Sorry my english
I want mod Silk Browser TV full work for Shield TV. but Shield TV have not Menu key, and press Voice Search Shield will open Google Assistant(In Fire TV when i press Menu Key or Voice Search Key. It will open Menu of Silk).
I have ideal "long press Back Key to open Menu (call ) " use function
public boolean onKeyLongPress(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
// do some thing. i will put code showHome() in here
return true;
}
return super.onKeyLongPress(keyCode, event);
}
I create app "androidphysicalexample" use simple project bellow in eclispe and put code above in project.
https://examples.javacodegeeks.com/android/core/ui/events/android-physical-keys-example/
I use apk tool to decomplie apk androidphysicalexample to view function onKeyLongPress in file .smali then modify to .smali of Silk (i try modify to FireTvSlateActivity.smali but nothing when i long press back key )
Anyone can help me. thank
if you can help me. you can download Silk in here
https://drive.google.com/file/d/1XJCE6pt0BB--mb2n0W5K5IUg0ul8Z2Ww/view?usp=drivesdk
- and use website http://www.javadecompilers.com/apk
to decomplie to source code

Location "recent apps" button in .kl file

Hi, after determining the protocol to change the keyboard layout thanks to user birdie in this post, I remain unable to disable/remap my "recent apps" button in the navigation bar. (Another way to reach that goal would be the gravity box requires Xposed framework which is not yet compatible with my phone/firmware.)
For completeness:
Android 7.1.2
LineageOS version: 14.1-20180609-NIGHTLY-osprey
Phone: MotoG3.
In the original post referred to above, the recent button is said to be found in file
Code:
/system/usr/keylayout/synaptics_dsx.kl
However, that file does not exist (in that location) on my phone. The only two files that do exist are:
Code:
Generic.kl
AVRCP.kl
Hence I inspected both, and modified Generic.kl to
Code:
key 580 BACK VIRTUAL
key 581 HOME VIRTUAL
key 582 HOME VIRTUAL
So to be explicit, I remapped the "recent apps" button mapping, to home. However, it does not have any effect, neither after rebooting. Therefore, I have the following question:
Does anyone know in which file and under which key number the "recent apps" button is mapped, for the phone as detailed above?
Kind regards

Categories

Resources