0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-28 06:03:00 +00:00

Fixing more checkin fields

This commit is contained in:
mar-v-in 2015-02-27 00:11:49 +01:00
parent e56aefd098
commit b9cae4df05
5 changed files with 15 additions and 19 deletions

View file

@ -21,6 +21,7 @@ import android.util.Log;
import com.squareup.wire.Wire;
import org.microg.gms.common.Build;
import org.microg.gms.common.Constants;
import org.microg.gms.common.DeviceConfiguration;
import org.microg.gms.common.DeviceIdentifier;
import org.microg.gms.common.PhoneInfo;
@ -72,7 +73,7 @@ public class CheckinClient {
.manufacturer(build.manufacturer)
.model(build.model)
.otaInstalled(false) // TODO?
.packageVersionCode(build.sdk) // TODO?
.packageVersionCode(Constants.MAX_REFERENCE_VERSION)
.product(build.product)
.radio(build.radio)
.sdkVersion(build.sdk)
@ -84,7 +85,6 @@ public class CheckinClient {
return new CheckinRequest.DeviceConfig.Builder()
.availableFeature(deviceConfiguration.availableFeatures)
.densityDpi(deviceConfiguration.densityDpi)
.deviceClass(deviceConfiguration.deviceClass)
.glEsVersion(deviceConfiguration.glEsVersion)
.glExtension(deviceConfiguration.glExtensions)
.hasFiveWayNavigation(deviceConfiguration.hasFiveWayNavigation)
@ -92,7 +92,6 @@ public class CheckinClient {
.heightPixels(deviceConfiguration.heightPixels)
.keyboardType(deviceConfiguration.keyboardType)
.locale(deviceConfiguration.locales)
.maxApkDownloadSizeMb((Integer) TODO)
.nativePlatform(deviceConfiguration.nativePlatforms)
.navigation(deviceConfiguration.navigation)
.screenLayout(deviceConfiguration.screenLayout)
@ -120,35 +119,33 @@ public class CheckinClient {
private static CheckinRequest makeRequest(CheckinRequest.Checkin checkin,
CheckinRequest.DeviceConfig deviceConfig,
DeviceIdentifier deviceIdent, LastCheckinInfo checkinInfo) {
return new CheckinRequest.Builder()
.accountCookie((List<String>) TODO)
CheckinRequest.Builder builder = new CheckinRequest.Builder()
.accountCookie(Arrays.asList("")) // TODO
.androidId(checkinInfo.androidId)
.checkin(checkin)
.desiredBuild((String) TODO)
.deviceConfiguration(deviceConfig)
.digest((String) TODO)
.digest(checkinInfo.digest)
.esn(deviceIdent.esn)
.fragment((Integer) TODO)
.locale((String) TODO)
.loggingId((Long) TODO)
.macAddress(Arrays.asList(deviceIdent.wifiMac, deviceIdent.bluetoothMac))
.macAddressType(Arrays.asList("wifi", "bt")) // TODO
.marketCheckin((String) TODO)
.macAddress(Arrays.asList(deviceIdent.wifiMac))
.macAddressType(Arrays.asList("wifi"))
.meid(deviceIdent.meid)
.otaCert((List<String>) TODO)
.securityToken(checkinInfo.securityToken)
.serial((String) TODO)
.timeZone((String) TODO)
.userName((String) TODO)
.userSerialNumber((Integer) TODO)
.version((Integer) TODO)
.build();
.version(3);
if (checkinInfo.securityToken != 0) builder.securityToken(checkinInfo.securityToken);
return builder.build();
}
public static CheckinRequest makeRequest(Build build, DeviceConfiguration deviceConfiguration,
DeviceIdentifier deviceIdent, PhoneInfo phoneInfo,
LastCheckinInfo checkinInfo) {
DeviceIdentifier deviceIdent, PhoneInfo phoneInfo,
LastCheckinInfo checkinInfo) {
return makeRequest(makeCheckin(makeBuild(build), phoneInfo, checkinInfo),
makeDeviceConfig(deviceConfiguration), deviceIdent, checkinInfo);
}

View file

@ -30,7 +30,7 @@ public class CheckinManager {
public static synchronized LastCheckinInfo checkin(Context context) throws IOException {
LastCheckinInfo info = LastCheckinInfo.read(context);
if (info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL) return null;
CheckinRequest request = CheckinClient.makeRequest(Utils.getBuild(context), null, null, null, info);
CheckinRequest request = CheckinClient.makeRequest(Utils.getBuild(context), null, null, null, info); // TODO
return handleResponse(context, CheckinClient.request(request));
}

View file

@ -25,6 +25,7 @@ public class LastCheckinInfo {
public static final String PREF_DIGEST = "digest";
public static final String PREF_LAST_CHECKIN = "lastCheckin";
public static final String PREF_SECURITY_TOKEN = "securityToken";
public static final String INITIAL_DIGEST = "1-da39a3ee5e6b4b0d3255bfef95601890afd80709";
public long lastCheckin;
public long androidId;
public long securityToken;
@ -34,7 +35,7 @@ public class LastCheckinInfo {
LastCheckinInfo info = new LastCheckinInfo();
SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE);
info.androidId = preferences.getLong(PREF_ANDROID_ID, 0);
info.digest = preferences.getString(PREF_DIGEST, null);
info.digest = preferences.getString(PREF_DIGEST, INITIAL_DIGEST);
info.lastCheckin = preferences.getLong(PREF_LAST_CHECKIN, 0);
info.securityToken = preferences.getLong(PREF_SECURITY_TOKEN, 0);
return info;

View file

@ -21,7 +21,6 @@ import java.util.List;
public class DeviceConfiguration {
public List<String> availableFeatures;
public int densityDpi;
public int deviceClass;
public int glEsVersion;
public List<String> glExtensions;
public boolean hasFiveWayNavigation;

View file

@ -17,7 +17,6 @@
package org.microg.gms.common;
public class DeviceIdentifier {
public String bluetoothMac;
public String wifiMac;
public String meid;
public String esn;