yashsingh1/xdaforums huggingface dataset:
[Android Software Development] OldMid:
Hey [MENTION=6037748]Zackptg5[/MENTION], Ive been making a module that is kinda based entirely around this Volume key thing, not gonna give anything away just yet, but it requires a lot of choices to be made using the volume keys. Based on what the script above shows, the key inputs are tested for everytime you want to get an input, with the keytest function, then the choose port function is decided on that.

From the above code, for my device, the keytest would recognise the newer method and do that one the first time around, but whenever an input is required a second time, it would revert to the legacy ,ethod. Time consuming. So what I did was store tje exit status of the keytest function as a variable keytest_status, and always make a check against that variable whenever an input is needed.

For those with a modern keytest method, this would solve the function reverting to the legacy one. Check the attached file for a better description. I'm still working away so if i find anything else I'll let you know:good:

Also added a couple functions for size benefits etc
[Android Software Development] Zackptg5:
Not quite sure what you mean but the keytest function is only run once when the script is initially run to determine whether the new or old choose function should be used. It also looks like you based yours on v4a (the one in the OP here has been reworked a bit to make it easier/more efficient). Also changed it up a bit to make it easier for you, let me know if this does what you want
[Android Software Development] OldMid:
No attachement:laugh: What I meant was that it would to the legacy key programming function every second time an input was needed, and the normal one every first time.

It would:

Initial key programming

detect modern version and continue

if an input is required it would switch back to legacy method

switch back to modern when another input is needed

switch back to legacy again

repeat until no more inputs are needed and script is finished running. But this may also be because I'm using the old logic:silly:
[Android Software Development] Zackptg5:
Oh, that may be because of the old logic. Does that happen with the one I attached on the last post?
[Android Software Development] OldMid:
I don't see anything attached
[Android Software Development] Zackptg5:
Sorry, forgot that xda doesn't like .sh files
[Android Software Development] OldMid:
Yeah it fixes it:good:
[Android Software Development] Oki:
HMMM... It doesn't work for me. I am trying to create a ZIP file to do some updates into the system requiring basic A/B selections. I am trying to implement this in a basic TWRP ZIP module. Have you managed to include it in a flashable ZIP file without Magisk? I could adapt V4A FX installer, but I don't want this to be a Unity module since it doesn't install anything. For some reason removing that unity thing is creating all the problem. Any clue?
[Android Software Development] Zackptg5:
I'll need to see it to find what the problem is. You can pm me if you don't want it public yet
[Android Software Development] Oki:
I solved it using only the keycheck program. getevent was not working fine for me. You can download and inspect my code here.

This is my version:

#!/sbin/sh
ui_print() {
echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD
}

keytest() {
$KEYCHECK
KEYCODE=$?
if [ "$KEYCODE" = 42 ] ; then
return 0
else
return 1
fi
}

customkey() {
# Calling it first time detects previous input. Calling it second time will do what we want
$KEYCHECK
#$KEYCHECK
SEL=$?
if [ "$1" == "UP" ]; then
UP=$SEL
elif [ "$1" == "DOWN" ]; then
DOWN=$SEL
elif [ $SEL -eq $UP ]; then
return 0
elif [ $SEL -eq $DOWN ]; then
return 1
else
ui_print " Vol key not detected!"
abort " Use name change method in TWRP"
fi
}

##### THE PARTY STARTS HERE ########

# INITIAL CLEANUP
cd /tmp
rm -rf $INSTALLER 2>/dev/null
mkdir -p $INSTALLER

# extract files
ui_print "Extracting files."
cd $INSTALLER
unzip -o "$ZIP"
chmod 777 $KEYCHECK

ui_print " "
ui_print " #########################################"
ui_print " PROGRAM NAME"
ui_print " #########################################"
ui_print " "
ui_print " Welcome message"
ui_print " "
ui_print " Press Vol Up to continue..."
if keytest; then
FUNCTION=keytest
else
FUNCTION=customkey
ui_print " - Device detected! but using custom key method"
ui_print " "
ui_print " - Vol Key Programming -"
ui_print " Press Vol Up Again..."
$FUNCTION "UP"
ui_print " Press Vol Down..."
$FUNCTION "DOWN"
fi

# QUESTION 1 ##########
ui_print " - Continue?"
ui_print " Vol UP = YES, Vol DN = NO"
if ! $FUNCTION ; then
ui_print " "
ui_print " - Loser...."
exit 0
fi

# QUESTION 2 ##########
ui_print " "
ui_print " - Do you like this script?"
ui_print " Vol UP: YES / Vol DN: NO"
if $FUNCTION ; then
ui_print " - THANKS!!!!!"
else
ui_print " - I'm so sorry."
fi

# MORE QUESTIONS... ##########

Thanks!
[Android Software Development] Zackptg5:
I prefer the getevent one because it doesn't involve any binaries but it is more finicky than the keycheck method. Since your mod is for arm devices, keycheck should be fine. The keytest stuff all looks good except that in the keytest function, you probably would want it to be

if [ $KEYCODE -eq 42 ]; then

since it's integer comparison. You could keep as string the way you have it but you would need a '==' rather than a '='

Also, the keytest function doesn't program volume down key at all (it's typically 21). I just always use the custom key logic just in case there's that one weird device
[Android Software Development] Oki:
I totally agree. I don't want to load the TWRP Zip with unnecessary tools. My problem was that for some reason the getevent method was colliding with some libraries in the implementation for my device, an Axon 7. So I decided to go this way. I would like to convert it to pure getevent method.

Regarding the comparison, you are right, I will have to change that. The link is the very first working version of the tool and there is a lot of code cleanup required. The tool I have developed is a TWRP Zip module that splits a vendor partition from system or userdata, so developers could create treblerized roms for legacy devices. I have an Axon 7, released with Android M, and we have now unofficial Android P, LOS 16.0 and a couple of treble roms supporting a lot of GSI. My objective is to make it as general and compatible as I could.

Thanks Again!
[Android Software Development] ianmacd:
Actually, a single '=' is fine for string comparison, and is actually the only string comparison operator accepted by the [ and test commands of POSIX-compliant shells.
[Android Software Development] Zackptg5:
Thanks for the correction, guess a single '=' could work. However, Android shell isn't posix compliant. It's its own beast :/
[Android Software Development] ianmacd:
The Android shell nowadays is mksh, and yes, you're right, it isn't terribly POSIX-compliant, even when started with -o posix.

Just be aware that the '==' comparison operator doesn't work in some shells in combination with single brackets, whereas the single '=' always will. zsh, for example:

$ zsh -c '[ x = y ]'
$ zsh -c '[ x == y ]'
zsh:1: = not found

The single '=' predates '==' by quite a margin. The double '==' is best reserved for the double bracket command: [[

Anyway, I don't want to go too far off-topic. It's just that shells are an area of particular interest to me.

Thanks for starting this thread, by the way. I now user a modified version of this code in the installer of my S9/S9+ kernel, APGK, to allow the user to interactively select certain features at install-time. The only gotcha is that I have to manually mount /system to gain access to the getevent binary.

I prefer to pipe the output through awk and output only the penultimate field:

local key=$( getevent -lqc 1 | awk '{ print $(NF-1) }' )

And since the S9/S9+ also has a Bixby button, I add a line of code to return something more legible than the raw keycode when this is pressed:

[ $key = 02bf ] && key=KEY_BIXBY

Perhaps these details will be of some use to someone.
[Android Software Development] Zackptg5:
Good to know. I link this to the OP, thanks!
[Android Software Development] :
Sorry to revive an old thread but I need some help guys. I'm converting GSI's to flashable zips and for my custom stock rom installation, I want Xposed to be installed with Vol+ and not installed(updater-script continues) with Vol-. Also, i'll be using just the old method with keycheck. Any pointers on how I would accomplish that? Thanks much
[Android Software Development] Ziona:
Del
[Android Software Development] Miustone:
Optimization details:

Added double quotes around variables to handle potential issues with spaces in filenames.

Replaced the use of backticks with the $(command) syntax for command substitution.

Used the -q option with grep to suppress output and replaced /dev/null redirection.

Removed unnecessary calls to cat.

Simplified comparisons by directly using the variable values.

Removed redundant blank lines and unnecessary ui_print statements.

# Get option from zip name if applicable
case $(basename "$ZIP") in
*[nN][eE][wW]*) NEW=true;;
*[oO][lL][dD]*) NEW=false;;
esac

# Change this path to wherever the keycheck binary is located in your installer
KEYCHECK="$INSTALLER/keycheck"
chmod 755 "$KEYCHECK"

keytest() {
ui_print "- Vol Key Test -"
ui_print " Press a Vol Key:"
/system/bin/getevent -lc 1 2>&1 | /system/bin/grep -q "VOLUME.* DOWN" > "$INSTALLER/events"
return $?
}

choose() {
ui_print "- Vol Key Programming -"
ui_print " Press Vol Up Again:"
$KEYCHECK
$KEYCHECK
SEL=$?
if [ "$1" == "UP" ]; then
UP=$SEL
elif [ "$1" == "DOWN" ]; then
DOWN=$SEL
elif [ "$SEL" -eq "$UP" ]; then
return 0
elif [ "$SEL" -eq "$DOWN" ]; then
return 1
else
ui_print " Vol key not detected!"
abort " Use name change method in TWRP"
fi
}

ui_print " "

if [ -z "$NEW" ]; then
if keytest; then
FUNCTION=choose
else
FUNCTION=chooseold
ui_print " ! Legacy device detected! Using old keycheck method"
ui_print " "
$FUNCTION "UP"
$FUNCTION "DOWN"
fi
ui_print " "
ui_print "- Select Option -"
ui_print " Choose which option you want installed:"
ui_print " Vol Up = New, Vol Down = Old"
if $FUNCTION; then
NEW=true
else
NEW=false
fi
else
ui_print " Option specified in zipname!"
fi

ui_print " "

if "$NEW"; then
# insert stuff for new here
else
# insert stuff for old here
fi

This is untested but since i am investigating into a new AROMA Replacement this might be interesting as alternative. I will play around with it later...
[Android Software Development] Technology geek:
any update?
[Google Pixel ROMs, Kernels, Recoveries, & Other De] Freak07:
Hello guys and girls,

As some of you already know Android 8.1 suffers from a severe Multi-Touch Issue. This issues makes the smartphone randomly jumping between the two touching points on the screen when touching with two or more fingers.

The issue is known to google since the preview of 8.1. It isn´t only affecting pixel but most probably all devices running 8.1. The issue is also present on P.

An issue got created here: https://issuetracker.google.com/issues/70344455

There is a fix since mid march in review on google gerrit. But that didn´t make it into the april release, obviously.

To visualize the issue refer to the following videos:

https://youtu.be/wgYN5GwIgIc

https://youtu.be/2Vv584tvVyg

https://www.youtube.com/watch?v=4dnIk_5qdK8&feature=youtu.be

This is especially bad for gamers. With the recent release of PUBG this issues seems dramatic to some, less to others.

I´m no gamer but I noticed the issue on the google foto app.

This issue has nothing to do with the corners badly reacting to touches, or touch sensitivity etc.

So but now to the fix. It seems the issues is only related to resampling but not to touching specific points of the screen ( not related to crossing x and y axis).

That also explains why the issue wasn´t happening when using the touch tracking tool in dev settings but on various multi touch test apps.

The fix is on google gerrit currently under review here:

https://android-review.googlesource.com/c/platform/frameworks/native/+/640605

https://android-review.googlesource.com/c/platform/frameworks/native/+/640606

Last week I compiled myself a DU build with the changes included and I couldn´t trigger the issue at all. I found no other side effects caused by the two patches.

For now I decided to provide a Magisk Module which replaces the changed libs that fixes the issue.

I compiled the libs while doing my april build of DU. The magisk module can be found on the link a little bit down.

The download is here:

https://www.androidfilehost.com/?fid=890129502657595755

A few disclaimers here.

1. That fix should in theory work for most 8.1 devices, including the likes of pixel 1st gen, pixel 2nd gen, one plus, xiaomi which suffer from this severe issue.

2. I didn´t fix this, I just compiled the libs with the fix found on google gerrit.

3. Rom devs you are very welcome to include this fix. I found no ill consequences as of yet but I can understand google taking it slow and reviewing it longer. Maybe they will find a better fix, but as of now this is the best thing we have.

Donations:

Donations are not mandatory but very welcome.

If you like my work: http://paypal.me/freak07
[Google Pixel ROMs, Kernels, Recoveries, & Other De] MpandAUS:
This made my phone bootloop. Have you got uninstaller for this module?
[Google Pixel ROMs, Kernels, Recoveries, & Other De] :
See the second paragraph from here. Also, really no point in using this anymore anyways since this patch was merged into aosp in May. :D
[One (M7) Q&A, Help & Troubleshooting] XRED1:
A friend gave me his HTC ONE M7 to fix, he had a bootloop problem.

I tried unlocking bootloader, getting a custom recovery and installing a rom (with flashing boot.img in fastboot), but they all bootloop.

I tried to install RUUs, exe's give me error 170/171/155 or crash and zip files give me "FAILED (remote: 02 data length is too large)" or they just freeze Command Prompt and close.

Phone is now relocked and S-ON, on Windows 7 (cause fastboot didnt find device on win10 for some reason) and I use a USB Port 2.0 just in case.

I have to mention that its my first time working on a HTC device, and I might not know what RUU to take or I miss something, the last one I tried was:

i.imgur.com/lkUR356.png

also getvar:

(bootloader) version: 0.5

(bootloader) version-bootloader: 1.61.0000

(bootloader) version-baseband: 4T.35.3218.16

(bootloader) version-cpld: None

(bootloader) version-microp: None

(bootloader) version-main:

(bootloader) version-misc: PVT SHIP S-ON

(bootloader) meid: 00000000000000

(bootloader) product: m7_ul

(bootloader) platform: HBOOT-8064

(bootloader) modelid: PN0710000

(bootloader) cidnum: HTC__032

(bootloader) battery-status: good

(bootloader) battery-voltage: 4318mV

(bootloader) partition-layout: Generic

(bootloader) security: on

(bootloader) build-mode: SHIP

(bootloader) boot-mode: FASTBOOT

(bootloader) commitno-bootloader: dirty-0e2a13e5

(bootloader) hbootpreupdate: 11

(bootloader) gencheckpt: 0
[One (M7) Q&A, Help & Troubleshooting] alray:
Use the 7.19.401.51 ruu, the same from your screenshot. You must use the fastboot version linked at post #1 of that thread otherwise you'll get the data length error.
[One (M7) Q&A, Help & Troubleshooting] XRED1:
Thank you for your time, I spent a lot of time on it and I was too tired to see that I need that fastboot version.

Phone works now. Thanks again.
[Essential Phone ROMs, Kernels, Recoveries, & Other] Freak07:
Hello guys and girls,

As some of you already know Android 8.1 suffers from a severe Multi-Touch Issue. This issues makes the smartphone randomly jumping between the two touching points on the screen when touching with two or more fingers.

The issue is known to google since the preview of 8.1. It isn´t only affecting pixel but most probably all devices running 8.1. The issue is also present on P.

An issue got created here: https://issuetracker.google.com/issues/70344455

There is a fix since mid march in review on google gerrit. But that didn´t make it into the april release, obviously.

To visualize the issue refer to the following videos:

https://youtu.be/wgYN5GwIgIc

https://youtu.be/2Vv584tvVyg

https://www.youtube.com/watch?v=4dnIk_5qdK8&feature=youtu.be

This is especially bad for gamers. With the recent release of PUBG this issues seems dramatic to some, less to others.

I´m no gamer but I noticed the issue on the google foto app.

This issue has nothing to do with the corners badly reacting to touches, or touch sensitivity etc.

So but now to the fix. It seems the issues is only related to resampling but not to touching specific points of the screen ( not related to crossing x and y axis).

That also explains why the issue wasn´t happening when using the touch tracking tool in dev settings but on various multi touch test apps.

The fix is on google gerrit currently under review here:

https://android-review.googlesource.com/c/platform/frameworks/native/+/640605

https://android-review.googlesource.com/c/platform/frameworks/native/+/640606

Last week I compiled myself a DU build with the changes included and I couldn´t trigger the issue at all. I found no other side effects caused by the two patches.

For now I decided to provide a Magisk Module which replaces the changed libs that fixes the issue.

I compiled the libs while doing my april build of DU. The magisk module can be found on the link a little bit down.

The download is here:

https://www.androidfilehost.com/?fid=890129502657595755

A few disclaimers here.

1. That fix should in theory work for most 8.1 devices, including the likes of pixel 1st gen, pixel 2nd gen, one plus, xiaomi which suffer from this severe issue.

1a. It works only for AOSP/LOS based roms on the essential phone. It seems like stock isn´t close enough to aosp.

2. I didn´t fix this, I just compiled the libs with the fix found on google gerrit.

3. Rom devs you are very welcome to include this fix. I found no ill consequences as of yet but I can understand google taking it slow and reviewing it longer. Maybe they will find a better fix, but as of now this is the best thing we have.

Donations:

Donations are not mandatory but very welcome.

If you like my work: http://paypal.me/freak07
[Essential Phone ROMs, Kernels, Recoveries, & Other] Freak07:
this was confirmed working on the xda portal post by [MENTION=4657791]crixley[/MENTION] for the essential phone running a custom aosp/los based rom.

Big thanks to you!
[Essential Phone ROMs, Kernels, Recoveries, & Other] crixley:
Huge difference, including touch latency! I'm super pumped about it.
[Essential Phone ROMs, Kernels, Recoveries, & Other] podupuis:
Work perfectly!!! Thank you so much!
[Essential Phone ROMs, Kernels, Recoveries, & Other] xorwin:
Guys, does it work? For me I ended up in bootloop
[Essential Phone ROMs, Kernels, Recoveries, & Other] wind711:
Omg you're right it actually causes my phone to not boot. I wiped my entire phone thinking it was some kind of module conflict and now it still wont boot.
[Essential Phone ROMs, Kernels, Recoveries, & Other] Jank4AU:
I bootlooped too. Flashing the stock boot image fixed it and my phone booted right to Android.
[Essential Phone ROMs, Kernels, Recoveries, & Other] wind711:
Once I flashed the stock boot image I lost magisk so that wouldn't work.
[Essential Phone ROMs, Kernels, Recoveries, & Other] Jank4AU:
I wasn't worried about losing Magisk. I was trying to get my phone to boot.

[MENTION=4657791]crixley[/MENTION] what did you do to get it to work? For three of us it results in a bootloop.
[Essential Phone ROMs, Kernels, Recoveries, & Other] crixley:
I'm not on stock rom, that might be it. Should have been clear on that
[Essential Phone ROMs, Kernels, Recoveries, & Other] Jank4AU:
Yeah, I'm on stock so you're probably right, that might be it.
[Essential Phone ROMs, Kernels, Recoveries, & Other] MoistPicklez:
Thank you soo much [MENTION=3428502]Freak07[/MENTION] !
[Essential Phone ROMs, Kernels, Recoveries, & Other] tomzefi:
I installed with with magisk app as a module. Booted perfect
[Essential Phone ROMs, Kernels, Recoveries, & Other] Jank4AU:
Are you on stock or custom ROM?
[Essential Phone ROMs, Kernels, Recoveries, & Other] tomzefi:
Should have mentioned that. I am on resurrection remix and rooted.
[Essential Phone ROMs, Kernels, Recoveries, & Other] OhayouBaka:
Confirmed that it also bootloops on stock ROM, if you have ElementalX Kernel installed.
[Essential Phone ROMs, Kernels, Recoveries, & Other] Freak07:
It seems that the stock rom isn’t close enough to aosp so this fix will only work on custom roms!
[Essential Phone ROMs, Kernels, Recoveries, & Other] Freak07:
I edited the OP accordingly to the stock rom issue.

In the meantime can one of you guys on the stock rom do me a favour and check if you have libinputflinger.so and libinput.so located in system/lib and system/lib64 or if the libs are somewhere in vendor for you?
[Essential Phone ROMs, Kernels, Recoveries, & Other] hypnz:
They exist both files.
[Essential Phone ROMs, Kernels, Recoveries, & Other] Freak07:
It should be 4 files overall. libinput.so and libinputflinger.so have to be in system/lib and additionally in system/lib64.

but if they are in system and not in system/vendor then I have no way of fixing it atm I fear.
[Essential Phone ROMs, Kernels, Recoveries, & Other] hypnz:
No snt at system/vendor.
[Essential Phone ROMs, Kernels, Recoveries, & Other] Freak07:
Then I fear this mod is only working on aosp/los based custom roms.
[Essential Phone ROMs, Kernels, Recoveries, & Other] jamesst20:
Confirmed here, bootloop aswell on stock rom. Used this mod to uninstall the mod from TWRP https://xdaforums.com/showpost.php?p=72542167&postcount=242

Logcat: https://pastebin.com/raw/RAfJA58g
[Essential Phone ROMs, Kernels, Recoveries, & Other] Freak07:
See my reply on the pixel 2 xl thread :)
[Essential Phone ROMs, Kernels, Recoveries, & Other] Hadookie:
Can't use this mod since I'm on stock rom but thank you for your work.
[Essential Phone ROMs, Kernels, Recoveries, & Other] anvi93:
Deleted!
[Essential Phone ROMs, Kernels, Recoveries, & Other] Eun-Hjzjined:
Off topic slightly... [MENTION=3428502]Freak07[/MENTION]

Would you mind sharing your DU builds by any chance?
[Essential Phone ROMs, Kernels, Recoveries, & Other] jamesst20:
Flashed LineageOS, installed the mod and works perfectly. I am glad this is finally fixed.

I wonder how long it will take to Essential once the fix made its way to AOSP
[Essential Phone ROMs, Kernels, Recoveries, & Other] rignfool:
They aren't for the PH-1
[Essential Phone ROMs, Kernels, Recoveries, & Other] MoistPicklez:
Has anyone tested on AOSiP?

Edit: AOSiP and boots fine.
[Essential Phone ROMs, Kernels, Recoveries, & Other] Joylesstuna:
Thank you for letting us know.
[Essential Phone ROMs, Kernels, Recoveries, & Other] ponyamo:
Can you tell me how to install this fix? Thanks a lot.
[Essential Phone ROMs, Kernels, Recoveries, & Other] podupuis:
If you don't know how to use root and magisk... Don't install it.
[Essential Phone ROMs, Kernels, Recoveries, & Other] stryver:
So it seems pixel devices got the fix for this through the may update and we just got the security patches. Excuse me if this is dumb as I have allot to learn since I'm only starting development courses recently, but, is it possible to port the fixes over to the ph1?
[Essential Phone ROMs, Kernels, Recoveries, & Other] Obamaloominaty:
It will probably be ported over to Lineage just like the setup and camera for the pixel was. As for stock, I'd say the fix would come in June.
[Essential Phone ROMs, Kernels, Recoveries, & Other] mapleshadow:
Unfortunately, the patch failed to start my cell phone. My version is 161.

Please use it carefully. It will cause your cell phone to not start properly.
[Essential Phone ROMs, Kernels, Recoveries, & Other] crixley:
Read the first post, or even the title for that matter
[Essential Phone ROMs, Kernels, Recoveries, & Other] MoistPicklez:
Anyone tired this on AICP??
[Essential Phone ROMs, Kernels, Recoveries, & Other] mikamika83:
Just to let you know, this module breaks the game "Rules Of Survival" and couple other games. The touch stops working in the game.