godot/platform/android/java
lawnjelly 512f8ebb93 Fix some keyboards not working with Android
Fixes #17004

Currently the keydown and keyup messages are handled with method like this:

if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK
|| (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD
|| (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
// joystick input
}
else
{
// keyboard input
}

The constant for SOURCE_DPAD is 513
10 0000 0001

and the constant for SOURCE_KEYBOARD is 257
1 0000 0001

However, rather confusingly, for many keyboards the source sent by android is 769
11 0000 0001

Thus the keyboard is passing the check as being a DPAD and being processed as a joystick rather than keyboard. This PR handles the specific case of 769, allowing input from physical keyboards.
2019-06-21 12:57:33 +01:00
..
aidl/com/android/vending/billing
gradle/wrapper Fix lint error/warning while building android template 2018-12-18 17:26:33 +09:00
res Fix lint error/warning while building android template 2018-12-18 17:26:33 +09:00
src Fix some keyboards not working with Android 2019-06-21 12:57:33 +01:00
AndroidManifest.xml Fix typos with codespell 2019-05-19 13:10:35 +02:00
build.gradle Rename wrong field. 2019-04-24 17:01:20 -03:00
gradle.properties update gradle-android buildtool for master 2017-07-30 11:30:20 +07:00
gradlew Fix lint error/warning while building android template 2018-12-18 17:26:33 +09:00
gradlew.bat Git: Explicitly list binary files as such to avoid EOL change 2019-05-25 10:43:48 +02:00
README.md Fix lint error/warning while building android template 2018-12-18 17:26:33 +09:00

Third party libraries

Google's vending library

Overwrite all files under com/google/android/vending

Modify some files to avoid compile error and lint warning

com/google/android/vending/licensing/util/Base64.java

@@ -338,7 +338,8 @@ public class Base64 {
                        e += 4;
                }
 
-               assert (e == outBuff.length);
+               if (BuildConfig.DEBUG && e != outBuff.length)
+                       throw new RuntimeException();
                return outBuff;
        }

com/google/android/vending/licensing/LicenseChecker.java

@@ -29,8 +29,8 @@ import android.os.RemoteException;
 import android.provider.Settings.Secure;
 import android.util.Log;
 
-import com.android.vending.licensing.ILicenseResultListener;
-import com.android.vending.licensing.ILicensingService;
+import com.google.android.vending.licensing.ILicenseResultListener;
+import com.google.android.vending.licensing.ILicensingService;
 import com.google.android.vending.licensing.util.Base64;
 import com.google.android.vending.licensing.util.Base64DecoderException;
@@ -287,13 +287,15 @@ public class LicenseChecker implements ServiceConnection {
     if (logResponse) {
-        String android_id = Secure.getString(mContext.getContentResolver(),
-                            Secure.ANDROID_ID);
+        String android_id = Secure.ANDROID_ID;
         Date date = new Date();