I have a cheap selfie stick which connects to the phone and emulates an audio device. On normal phones, what triggers KEYCODE_VOLUME_UP, triggers KEYCODE_VOICE_ASSIST on Pixel (And presumably some other phones). I tried catching the KeyPress in a custom app like so:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_VOICE_ASSIST){
System.out.println("Handled");
return true;
}
return super.onKeyDown(keyCode, event);
}
I'm able to capture the KeyPress, but the annoying Google Assistant pops up -Even if you disable it, it pops up anyways telling us to turn it on. Is there some way I can block it so that only I handle it? Preferably without rooting