PixelXpert
PixelXpert copied to clipboard
Increase time to kill process
https://github.com/siavash79/AOSPMods/blob/1612e691a9fb31629445c4e2e194e6b854770997/app/src/main/java/sh/siava/AOSPMods/systemui/BackToKill.java#L39
The BackToKill function uses a regular onLongClickListener, however, some apps also use the onLongClickListener for their features, which means we would rather kill the app before using the apps features. Also, the OnLongClickListener has a rather short time, which means we can easily kill an app by accident
Maybe we could use something like this:
long downTime = 0;
View.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
downTime = (Long) System.currentTimeMillis();
}
else if(event.getAction() == MotionEvent.ACTION_UP){
if(((Long) System.currentTimeMillis() - downTime) > 3000){
if(!isEnabled) return true;
Shell.cmd("am force-stop $(dumpsys window | grep mCurrentFocus | cut -d \"/\" -f1 | cut -d \" \" -f5)").submit();
return true;
}
}
return false;
}
})
Note that this code is not tested, it is just a suggestion
such a good idea! why don't you make the changes and send a PR? this way you can test the code, and also have the change registered under your own name
AND: If you know how to code, why don't you contribute more to the project?
Well, for once, I haven't coded for Android in like forever :D And actually never ever with xposed, back in the days, I just added whatever feature I wanted directly to my own CustomRom You have probably everything set up and are way faster implementing it ;)
Is this actually a good way to implement this change? This event fires only after you lifted the button after the given time, not as soon as the time has elapsed. Does this make sense or would it be better to fire as soon as the time has elapsed?
closing to due drop of the function in sdk 33