From 071ebb1e4871431e7edf7f679afd02e594ea5af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 27 Aug 2019 13:21:15 +0200 Subject: Android: Fix another regression with Secure.ANDROID_ID Regression from #24145, which was missed in #28146. --- platform/android/java/README.md | 47 ---------------------- platform/android/java/THIRDPARTY.md | 43 ++++++++++++++++++++ .../downloader/impl/DownloaderService.java | 3 +- .../android/vending/licensing/LicenseChecker.java | 3 +- 4 files changed, 47 insertions(+), 49 deletions(-) delete mode 100644 platform/android/java/README.md create mode 100644 platform/android/java/THIRDPARTY.md diff --git a/platform/android/java/README.md b/platform/android/java/README.md deleted file mode 100644 index 58d2b10706..0000000000 --- a/platform/android/java/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Third party libraries - - -## Google's vending library - -- Upstream: https://github.com/google/play-licensing/tree/master/lvl_library/src/main/java/com/google/android/vending -- Version: git (eb57657, 2018) with modifications -- License: Apache 2.0 - -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(); -``` diff --git a/platform/android/java/THIRDPARTY.md b/platform/android/java/THIRDPARTY.md new file mode 100644 index 0000000000..74ef24839b --- /dev/null +++ b/platform/android/java/THIRDPARTY.md @@ -0,0 +1,43 @@ +# Third-party libraries + +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 + +- Upstream: https://github.com/google/play-licensing/tree/master/lvl_library/src/main/java/com/google/android/vending +- Version: git (eb57657, 2018) with modifications +- License: Apache 2.0 + +Overwrite all files under `com/google/android/vending`. + +Modify those files to avoid compile error and lint warning: + +- `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; +``` diff --git a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java index 25a561ccd4..219e72c7d6 100644 --- a/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java +++ b/platform/android/java/src/com/google/android/vending/expansion/downloader/impl/DownloaderService.java @@ -746,7 +746,8 @@ public abstract class DownloaderService extends CustomIntentService implements I public void run() { setServiceRunning(true); mNotification.onDownloadStateChanged(IDownloaderClient.STATE_FETCHING_URL); - String deviceId = Secure.ANDROID_ID; + String deviceId = Secure.getString(mContext.getContentResolver(), + Secure.ANDROID_ID); final APKExpansionPolicy aep = new APKExpansionPolicy(mContext, new AESObfuscator(getSALT(), mContext.getPackageName(), deviceId)); diff --git a/platform/android/java/src/com/google/android/vending/licensing/LicenseChecker.java b/platform/android/java/src/com/google/android/vending/licensing/LicenseChecker.java index 38aab9f4f5..8fc8ae86a2 100644 --- a/platform/android/java/src/com/google/android/vending/licensing/LicenseChecker.java +++ b/platform/android/java/src/com/google/android/vending/licensing/LicenseChecker.java @@ -287,7 +287,8 @@ public class LicenseChecker implements ServiceConnection { } if (logResponse) { - String android_id = Secure.ANDROID_ID; + String android_id = Secure.getString(mContext.getContentResolver(), + Secure.ANDROID_ID); Date date = new Date(); Log.d(TAG, "Server Failure: " + stringError); Log.d(TAG, "Android ID: " + android_id); -- cgit v1.2.3