0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-12-03 00:17:24 +00:00

Merge pull request #45 from YTVanced/huawei_login_fix

Override fingerprint on devices that don't have GPlay services
This commit is contained in:
Oizaro 2020-09-17 21:37:29 +02:00 committed by GitHub
commit a3fc93dc30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 4 deletions

View file

@ -79,7 +79,8 @@
android:allowBackup="false" android:allowBackup="false"
android:extractNativeLibs="true" android:extractNativeLibs="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"> android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config">
<meta-data <meta-data
android:name="fake-signature" android:name="fake-signature"
android:value="@string/fake_signature" /> android:value="@string/fake_signature" />

View file

@ -78,7 +78,7 @@ public class CheckinClient {
public static CheckinRequest makeRequest(Build build, DeviceConfiguration deviceConfiguration, public static CheckinRequest makeRequest(Build build, DeviceConfiguration deviceConfiguration,
DeviceIdentifier deviceIdent, PhoneInfo phoneInfo, DeviceIdentifier deviceIdent, PhoneInfo phoneInfo,
LastCheckinInfo checkinInfo, Locale locale, LastCheckinInfo checkinInfo, Locale locale,
List<Account> accounts) { List<Account> accounts, boolean hasGooglePlayServices) {
CheckinRequest.Builder builder = new CheckinRequest.Builder() CheckinRequest.Builder builder = new CheckinRequest.Builder()
.accountCookie(new ArrayList<String>()) .accountCookie(new ArrayList<String>())
.androidId(checkinInfo.androidId) .androidId(checkinInfo.androidId)
@ -88,7 +88,8 @@ public class CheckinClient {
.brand(build.brand) .brand(build.brand)
.clientId("android-google") .clientId("android-google")
.device(build.device) .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) .hardware(build.hardware)
.manufacturer(build.manufacturer) .manufacturer(build.manufacturer)
.model(build.model) .model(build.model)

View file

@ -20,6 +20,8 @@ import android.accounts.Account;
import android.accounts.AccountManager; import android.accounts.AccountManager;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager;
import android.util.Log;
import org.microg.gms.auth.AuthConstants; import org.microg.gms.auth.AuthConstants;
import org.microg.gms.auth.AuthRequest; import org.microg.gms.auth.AuthRequest;
@ -33,6 +35,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CheckinManager { public class CheckinManager {
private static final String TAG = "GmsCheckinManager";
private static final long MIN_CHECKIN_INTERVAL = 3 * 60 * 60 * 1000; // 3 hours private static final long MIN_CHECKIN_INTERVAL = 3 * 60 * 60 * 1000; // 3 hours
@SuppressWarnings("MissingPermission") @SuppressWarnings("MissingPermission")
@ -57,7 +60,7 @@ public class CheckinManager {
} }
CheckinRequest request = CheckinClient.makeRequest(Utils.getBuild(context), CheckinRequest request = CheckinClient.makeRequest(Utils.getBuild(context),
new DeviceConfiguration(context), Utils.getDeviceIdentifier(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)); return handleResponse(context, CheckinClient.request(request));
} }
@ -78,4 +81,20 @@ public class CheckinManager {
return info; 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>