diff options
Diffstat (limited to 'platform/android/java')
4 files changed, 61 insertions, 33 deletions
diff --git a/platform/android/java/THIRDPARTY.md b/platform/android/java/THIRDPARTY.md index 74ef24839b..16ec45fb30 100644 --- a/platform/android/java/THIRDPARTY.md +++ b/platform/android/java/THIRDPARTY.md @@ -3,41 +3,16 @@ This file list third-party libraries used in the Android source folder, with their provenance and, when relevant, modifications made to those files. -## Google's vending library +## Google's licensing library -- Upstream: https://github.com/google/play-licensing/tree/master/lvl_library/src/main/java/com/google/android/vending +- Upstream: https://github.com/google/play-licensing/tree/master/lvl_library/ - Version: git (eb57657, 2018) with modifications - License: Apache 2.0 -Overwrite all files under `com/google/android/vending`. +Overwrite all files under: -Modify those files to avoid compile error and lint warning: +- `aidl/com/android/vending/licensing` +- `src/com/google/android/vending/licensing` -- `com/google/android/vending/licensing/util/Base64.java` - -```diff -@@ -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` - -```diff -@@ -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; -``` +Some files have been modified to silence linter errors or fix downstream issues. +See the `patches/com.google.android.vending.licensing.patch` file. diff --git a/platform/android/java/patches/com.google.android.vending.licensing.patch b/platform/android/java/patches/com.google.android.vending.licensing.patch new file mode 100644 index 0000000000..9f8e5b8eab --- /dev/null +++ b/platform/android/java/patches/com.google.android.vending.licensing.patch @@ -0,0 +1,42 @@ +diff --git a/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java b/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java +index 7c42bfc28..feb579af0 100644 +--- a/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java ++++ b/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java +@@ -45,6 +45,9 @@ public class PreferenceObfuscator { + public void putString(String key, String value) { + if (mEditor == null) { + mEditor = mPreferences.edit(); ++ // -- GODOT start -- ++ mEditor.apply(); ++ // -- GODOT end -- + } + String obfuscatedValue = mObfuscator.obfuscate(value, key); + mEditor.putString(key, obfuscatedValue); +diff --git a/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java b/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java +index a0d2779af..a8bf65f9c 100644 +--- a/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java ++++ b/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java +@@ -31,6 +31,10 @@ package com.google.android.vending.licensing.util; + * @version 1.3 + */ + ++// -- GODOT start -- ++import com.godot.game.BuildConfig; ++// -- GODOT end -- ++ + /** + * Base64 converter class. This code is not a full-blown MIME encoder; + * it simply converts binary data to base64 data and back. +@@ -341,7 +345,11 @@ public class Base64 { + e += 4; + } + +- assert (e == outBuff.length); ++ // -- GODOT start -- ++ //assert (e == outBuff.length); ++ if (BuildConfig.DEBUG && e != outBuff.length) ++ throw new RuntimeException(); ++ // -- GODOT end -- + return outBuff; + } + diff --git a/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java b/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java index 7c42bfc28a..feb579af04 100644 --- a/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java +++ b/platform/android/java/src/com/google/android/vending/licensing/PreferenceObfuscator.java @@ -45,6 +45,9 @@ public class PreferenceObfuscator { public void putString(String key, String value) { if (mEditor == null) { mEditor = mPreferences.edit(); + // -- GODOT start -- + mEditor.apply(); + // -- GODOT end -- } String obfuscatedValue = mObfuscator.obfuscate(value, key); mEditor.putString(key, obfuscatedValue); diff --git a/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java b/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java index a0d2779af2..a8bf65f9ca 100644 --- a/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java +++ b/platform/android/java/src/com/google/android/vending/licensing/util/Base64.java @@ -31,6 +31,10 @@ package com.google.android.vending.licensing.util; * @version 1.3 */ +// -- GODOT start -- +import com.godot.game.BuildConfig; +// -- GODOT end -- + /** * Base64 converter class. This code is not a full-blown MIME encoder; * it simply converts binary data to base64 data and back. @@ -341,7 +345,11 @@ public class Base64 { e += 4; } - assert (e == outBuff.length); + // -- GODOT start -- + //assert (e == outBuff.length); + if (BuildConfig.DEBUG && e != outBuff.length) + throw new RuntimeException(); + // -- GODOT end -- return outBuff; } |