Android: Don't accept the volume-key events.
On Android the volume keys are by default connected to the global volume control and by accepting them we remove this feature. Meaning each application would need to re-implement this functionality. Ideally we should only accept the volume keys if they where accepted by the user to avoid overriding default behavior, but we currently don't have the infrastructure to do that. To revert back to the old behavior the env. variable QT_ANDROID_VOLUME_KEYS can be set. Task-number: QTBUG-36570 Change-Id: Ib053a40383f2de452f385b19f7795c2fc23fc4fe Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This commit is contained in:
parent
5f6cbfb070
commit
c9241a1a7b
@ -75,6 +75,7 @@ import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.System;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -806,6 +807,13 @@ public class QtActivityDelegate
|
||||
c = composed;
|
||||
}
|
||||
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP
|
||||
|| keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
|
||||
|| keyCode == KeyEvent.KEYCODE_MUTE)
|
||||
&& System.getenv("QT_ANDROID_VOLUME_KEYS") == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_lastChar = lc;
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
m_backKeyPressedSent = !m_keyboardIsVisible;
|
||||
@ -831,6 +839,13 @@ public class QtActivityDelegate
|
||||
}
|
||||
}
|
||||
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP
|
||||
|| keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
|
||||
|| keyCode == KeyEvent.KEYCODE_MUTE)
|
||||
&& System.getenv("QT_ANDROID_VOLUME_KEYS") == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && !m_backKeyPressedSent) {
|
||||
hideSoftwareKeyboard();
|
||||
setKeyboardVisibility(false, System.nanoTime());
|
||||
|
Loading…
Reference in New Issue
Block a user