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

View file

@ -30,7 +30,7 @@ public class CheckinManager {
public static synchronized LastCheckinInfo checkin(Context context) throws IOException { public static synchronized LastCheckinInfo checkin(Context context) throws IOException {
LastCheckinInfo info = LastCheckinInfo.read(context); LastCheckinInfo info = LastCheckinInfo.read(context);
if (info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL) return null; 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)); 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_DIGEST = "digest";
public static final String PREF_LAST_CHECKIN = "lastCheckin"; public static final String PREF_LAST_CHECKIN = "lastCheckin";
public static final String PREF_SECURITY_TOKEN = "securityToken"; public static final String PREF_SECURITY_TOKEN = "securityToken";
public static final String INITIAL_DIGEST = "1-da39a3ee5e6b4b0d3255bfef95601890afd80709";
public long lastCheckin; public long lastCheckin;
public long androidId; public long androidId;
public long securityToken; public long securityToken;
@ -34,7 +35,7 @@ public class LastCheckinInfo {
LastCheckinInfo info = new LastCheckinInfo(); LastCheckinInfo info = new LastCheckinInfo();
SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE); SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE);
info.androidId = preferences.getLong(PREF_ANDROID_ID, 0); 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.lastCheckin = preferences.getLong(PREF_LAST_CHECKIN, 0);
info.securityToken = preferences.getLong(PREF_SECURITY_TOKEN, 0); info.securityToken = preferences.getLong(PREF_SECURITY_TOKEN, 0);
return info; return info;

View file

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

View file

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