summaryrefslogtreecommitdiffstats
path: root/src/android
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2014-04-02 13:50:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-03 00:28:22 +0200
commitc9241a1a7baaef1fb5f61f28eea32ae75210e07d (patch)
treeb59ebaa0314d130ab61292caaf1cfdf33b6c88ba /src/android
parent5f6cbfb0701d0f4e87ac3656ffcbebdcd1577bde (diff)
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>
Diffstat (limited to 'src/android')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index e62b5dab82..b396dfdfa1 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -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());