diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index c09e7e2e..1ab708e7 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -79,7 +79,8 @@ android:allowBackup="false" android:extractNativeLibs="true" android:icon="@mipmap/ic_launcher" - android:label="@string/app_name"> + android:label="@string/app_name" + android:networkSecurityConfig="@xml/network_security_config"> diff --git a/play-services-core/src/main/java/org/microg/gms/checkin/CheckinClient.java b/play-services-core/src/main/java/org/microg/gms/checkin/CheckinClient.java index aff6da93..d6d4aa45 100755 --- a/play-services-core/src/main/java/org/microg/gms/checkin/CheckinClient.java +++ b/play-services-core/src/main/java/org/microg/gms/checkin/CheckinClient.java @@ -78,7 +78,7 @@ public class CheckinClient { public static CheckinRequest makeRequest(Build build, DeviceConfiguration deviceConfiguration, DeviceIdentifier deviceIdent, PhoneInfo phoneInfo, LastCheckinInfo checkinInfo, Locale locale, - List accounts) { + List accounts, boolean hasGooglePlayServices) { CheckinRequest.Builder builder = new CheckinRequest.Builder() .accountCookie(new ArrayList()) .androidId(checkinInfo.androidId) @@ -88,7 +88,8 @@ public class CheckinClient { .brand(build.brand) .clientId("android-google") .device(build.device) - .fingerprint(build.fingerprint) + //.fingerprint(build.fingerprint) + .fingerprint(hasGooglePlayServices ? build.fingerprint : "google/sdk_gphone_x86/generic_x86_arm:11/RPB3.200720.005/6705141:user/release-keys") .hardware(build.hardware) .manufacturer(build.manufacturer) .model(build.model) diff --git a/play-services-core/src/main/java/org/microg/gms/checkin/CheckinManager.java b/play-services-core/src/main/java/org/microg/gms/checkin/CheckinManager.java index df9bd9d9..1790399c 100755 --- a/play-services-core/src/main/java/org/microg/gms/checkin/CheckinManager.java +++ b/play-services-core/src/main/java/org/microg/gms/checkin/CheckinManager.java @@ -20,6 +20,8 @@ import android.accounts.Account; import android.accounts.AccountManager; import android.content.ContentResolver; import android.content.Context; +import android.content.pm.PackageManager; +import android.util.Log; import org.microg.gms.auth.AuthConstants; import org.microg.gms.auth.AuthRequest; @@ -33,6 +35,7 @@ import java.util.ArrayList; import java.util.List; public class CheckinManager { + private static final String TAG = "GmsCheckinManager"; private static final long MIN_CHECKIN_INTERVAL = 3 * 60 * 60 * 1000; // 3 hours @SuppressWarnings("MissingPermission") @@ -57,7 +60,7 @@ public class CheckinManager { } CheckinRequest request = CheckinClient.makeRequest(Utils.getBuild(context), new DeviceConfiguration(context), Utils.getDeviceIdentifier(context), - Utils.getPhoneInfo(context), info, Utils.getLocale(context), accounts); + Utils.getPhoneInfo(context), info, Utils.getLocale(context), accounts, hasGooglePlayServices(context)); return handleResponse(context, CheckinClient.request(request)); } @@ -78,4 +81,20 @@ public class CheckinManager { return info; } + + private static boolean hasGooglePlayServices(Context context) { + boolean hasGooglePlayServices = false; + try { + // We will assume that the user has Google Play services installed if context is null + if (context == null || (context != null && context.getPackageManager().getApplicationInfo("com.google.android.gms", 0).enabled)) { + hasGooglePlayServices = true; + } + } catch (PackageManager.NameNotFoundException e) { + hasGooglePlayServices = false; + } + + Log.d(TAG, "checking - has google play services: " + (hasGooglePlayServices ? "yes" : "no")); + + return hasGooglePlayServices; + } } diff --git a/play-services-core/src/main/res/xml/network_security_config.xml b/play-services-core/src/main/res/xml/network_security_config.xml new file mode 100644 index 00000000..4dac2bac --- /dev/null +++ b/play-services-core/src/main/res/xml/network_security_config.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file