[Scummvm-cvs-logs] scummvm master -> 0def54a60d8a5c6e63bb5db238bbadf388dede97

digitall dgturner at iee.org
Fri Feb 21 17:33:47 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0def54a60d ANDROID: Fix runtime failure on earlier versions of Android.


Commit: 0def54a60d8a5c6e63bb5db238bbadf388dede97
    https://github.com/scummvm/scummvm/commit/0def54a60d8a5c6e63bb5db238bbadf388dede97
Author: D G Turner (digitall at scummvm.org)
Date: 2014-02-21T08:29:23-08:00

Commit Message:
ANDROID: Fix runtime failure on earlier versions of Android.

getAxisValue() is only present from Android 3.1 onwards and
usage causes a runtime failure on earlier versions of Android.

This bug was introduced by a50ede20 with addition of OUYA support.

This solution is as recommended on the Android developer portal.

Changed paths:
    backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java



diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
index 7022153..eef5d19 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMEvents.java
@@ -1,5 +1,6 @@
 package org.scummvm.scummvm;
 
+import android.os.Build;
 import android.os.Handler;
 import android.os.Message;
 import android.content.Context;
@@ -69,13 +70,16 @@ public class ScummVMEvents implements
 	}
 
 	public boolean onGenericMotionEvent(final MotionEvent e) {
-		if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
-			_scummvm.pushEvent(JE_JOYSTICK, e.getAction(),
-					   (int)(e.getAxisValue(MotionEvent.AXIS_X)*100),
-					   (int)(e.getAxisValue(MotionEvent.AXIS_Y)*100),
-					   0, 0);
-			return true;
-		}
+    	// Make sure we're running on Android 3.1 or higher to use getAxisValue() 
+    	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
+			if((e.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
+				_scummvm.pushEvent(JE_JOYSTICK, e.getAction(),
+						   (int)(e.getAxisValue(MotionEvent.AXIS_X)*100),
+						   (int)(e.getAxisValue(MotionEvent.AXIS_Y)*100),
+						   0, 0);
+				return true;
+			}
+    	}
 
 		return false;
 	}






More information about the Scummvm-git-logs mailing list