Browse Source

Android: Fix another regression with Secure.ANDROID_ID

Regression from #24145, which was missed in #28146.

(cherry picked from commit 071ebb1e4871431e7edf7f679afd02e594ea5af9)
Rémi Verschelde 6 years ago
parent
commit
76db2b4dcb

+ 11 - 15
platform/android/java/README.md → platform/android/java/THIRDPARTY.md

@@ -1,5 +1,7 @@
-# Third party libraries
+# 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
 ## Google's vending library
 
 
@@ -7,12 +9,13 @@
 - Version: git (eb57657, 2018) with modifications
 - Version: git (eb57657, 2018) with modifications
 - License: Apache 2.0
 - License: Apache 2.0
 
 
-Overwrite all files under `com/google/android/vending`
+Overwrite all files under `com/google/android/vending`.
 
 
-### Modify some files to avoid compile error and lint warning
+Modify those files to avoid compile error and lint warning:
 
 
-#### com/google/android/vending/licensing/util/Base64.java
-```
+- `com/google/android/vending/licensing/util/Base64.java`
+
+```diff
 @@ -338,7 +338,8 @@ public class Base64 {
 @@ -338,7 +338,8 @@ public class Base64 {
                         e += 4;
                         e += 4;
                 }
                 }
@@ -24,8 +27,9 @@ Overwrite all files under `com/google/android/vending`
         }
         }
 ```
 ```
 
 
-#### com/google/android/vending/licensing/LicenseChecker.java
-```
+- `com/google/android/vending/licensing/LicenseChecker.java`
+
+```diff
 @@ -29,8 +29,8 @@ import android.os.RemoteException;
 @@ -29,8 +29,8 @@ import android.os.RemoteException;
  import android.provider.Settings.Secure;
  import android.provider.Settings.Secure;
  import android.util.Log;
  import android.util.Log;
@@ -37,11 +41,3 @@ Overwrite all files under `com/google/android/vending`
  import com.google.android.vending.licensing.util.Base64;
  import com.google.android.vending.licensing.util.Base64;
  import com.google.android.vending.licensing.util.Base64DecoderException;
  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();
-```

+ 2 - 1
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() {
 		public void run() {
 			setServiceRunning(true);
 			setServiceRunning(true);
 			mNotification.onDownloadStateChanged(IDownloaderClient.STATE_FETCHING_URL);
 			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,
 			final APKExpansionPolicy aep = new APKExpansionPolicy(mContext,
 					new AESObfuscator(getSALT(), mContext.getPackageName(), deviceId));
 					new AESObfuscator(getSALT(), mContext.getPackageName(), deviceId));

+ 2 - 1
platform/android/java/src/com/google/android/vending/licensing/LicenseChecker.java

@@ -287,7 +287,8 @@ public class LicenseChecker implements ServiceConnection {
 						}
 						}
 
 
 						if (logResponse) {
 						if (logResponse) {
-							String android_id = Secure.ANDROID_ID;
+							String android_id = Secure.getString(mContext.getContentResolver(),
+									Secure.ANDROID_ID);
 							Date date = new Date();
 							Date date = new Date();
 							Log.d(TAG, "Server Failure: " + stringError);
 							Log.d(TAG, "Server Failure: " + stringError);
 							Log.d(TAG, "Android ID: " + android_id);
 							Log.d(TAG, "Android ID: " + android_id);