Override fingerprint on devices that don't have GPlay services

This commit is contained in:
xfileFIN 2020-09-17 22:24:52 +03:00
parent 6f10a7336d
commit 0ab986221f
4 changed files with 39 additions and 4 deletions

View File

@ -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">
<meta-data
android:name="fake-signature"
android:value="@string/fake_signature" />

View File

@ -78,7 +78,7 @@ public class CheckinClient {
public static CheckinRequest makeRequest(Build build, DeviceConfiguration deviceConfiguration,
DeviceIdentifier deviceIdent, PhoneInfo phoneInfo,
LastCheckinInfo checkinInfo, Locale locale,
List<Account> accounts) {
List<Account> accounts, boolean hasGooglePlayServices) {
CheckinRequest.Builder builder = new CheckinRequest.Builder()
.accountCookie(new ArrayList<String>())
.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)

View File

@ -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;
}
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<debug-overrides>
<trust-anchors>
<certificates src="user" />
<certificates src="system" />
</trust-anchors>
</debug-overrides>
</network-security-config>