mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-01-02 23:56:13 +01:00
Update checkin to latest version
This commit is contained in:
parent
f6dca1f162
commit
0bc422c4b1
@ -57,8 +57,8 @@ dependencies {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "22.0.0"
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
|
@ -118,7 +118,11 @@
|
||||
|
||||
<!-- Device Checkin -->
|
||||
|
||||
<service android:name="org.microg.gms.checkin.CheckinService" />
|
||||
<service android:name="org.microg.gms.checkin.CheckinService">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.checkin.BIND_TO_SERVICE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<receiver android:name="org.microg.gms.checkin.TriggerReceiver">
|
||||
<intent-filter>
|
||||
|
@ -61,6 +61,8 @@ public class CheckinManager {
|
||||
info.lastCheckin = response.timeMs;
|
||||
info.securityToken = response.securityToken;
|
||||
info.digest = response.digest;
|
||||
info.versionInfo = response.versionInfo;
|
||||
info.deviceDataVersionInfo = response.deviceDataVersionInfo;
|
||||
info.write(context);
|
||||
|
||||
ContentResolver resolver = context.getContentResolver();
|
||||
|
@ -20,14 +20,25 @@ import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.R;
|
||||
import com.google.android.gms.checkin.internal.ICheckinService;
|
||||
|
||||
import org.microg.gms.people.PeopleManager;
|
||||
|
||||
public class CheckinService extends IntentService {
|
||||
private static final String TAG = "GmsCheckinSvc";
|
||||
public static final String BIND_ACTION = "com.google.android.gms.checkin.BIND_TO_SERVICE";
|
||||
|
||||
private ICheckinService iface = new ICheckinService.Stub() {
|
||||
@Override
|
||||
public String getDeviceDataVersionInfo() throws RemoteException {
|
||||
return LastCheckinInfo.read(CheckinService.this).deviceDataVersionInfo;
|
||||
}
|
||||
};
|
||||
|
||||
public CheckinService() {
|
||||
super(TAG);
|
||||
@ -49,4 +60,13 @@ public class CheckinService extends IntentService {
|
||||
}
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
if (BIND_ACTION.equals(intent.getAction())) {
|
||||
return iface.asBinder();
|
||||
} else {
|
||||
return super.onBind(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,11 +25,15 @@ 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 PREF_VERSION_INFO = "versionInfo";
|
||||
public static final String PREF_DEVICE_DATA_VERSION_INFO = "deviceDataVersionInfo";
|
||||
public static final String INITIAL_DIGEST = "1-da39a3ee5e6b4b0d3255bfef95601890afd80709";
|
||||
public long lastCheckin;
|
||||
public long androidId;
|
||||
public long securityToken;
|
||||
public String digest;
|
||||
public String versionInfo;
|
||||
public String deviceDataVersionInfo;
|
||||
|
||||
public static LastCheckinInfo read(Context context) {
|
||||
LastCheckinInfo info = new LastCheckinInfo();
|
||||
@ -38,6 +42,8 @@ public class LastCheckinInfo {
|
||||
info.digest = preferences.getString(PREF_DIGEST, INITIAL_DIGEST);
|
||||
info.lastCheckin = preferences.getLong(PREF_LAST_CHECKIN, 0);
|
||||
info.securityToken = preferences.getLong(PREF_SECURITY_TOKEN, 0);
|
||||
info.versionInfo = preferences.getString(PREF_VERSION_INFO, "");
|
||||
info.deviceDataVersionInfo = preferences.getString(PREF_DEVICE_DATA_VERSION_INFO, "");
|
||||
return info;
|
||||
}
|
||||
|
||||
@ -47,6 +53,8 @@ public class LastCheckinInfo {
|
||||
.putString(PREF_DIGEST, digest)
|
||||
.putLong(PREF_LAST_CHECKIN, lastCheckin)
|
||||
.putLong(PREF_SECURITY_TOKEN, securityToken)
|
||||
.putString(PREF_VERSION_INFO, versionInfo)
|
||||
.putString(PREF_DEVICE_DATA_VERSION_INFO, deviceDataVersionInfo)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ public final class CheckinResponse extends Message {
|
||||
public static final Long DEFAULT_SECURITYTOKEN = 0L;
|
||||
public static final Boolean DEFAULT_SETTINGSDIFF = false;
|
||||
public static final List<String> DEFAULT_DELETESETTING = Collections.emptyList();
|
||||
public static final String DEFAULT_VERSIONINFO = "";
|
||||
public static final String DEFAULT_DEVICEDATAVERSIONINFO = "";
|
||||
|
||||
@ProtoField(tag = 1, type = BOOL)
|
||||
public final Boolean statsOk;
|
||||
@ -58,7 +60,13 @@ public final class CheckinResponse extends Message {
|
||||
@ProtoField(tag = 10, type = STRING, label = REPEATED)
|
||||
public final List<String> deleteSetting;
|
||||
|
||||
public CheckinResponse(Boolean statsOk, List<Intent> intent, Long timeMs, String digest, List<GservicesSetting> setting, Boolean marketOk, Long androidId, Long securityToken, Boolean settingsDiff, List<String> deleteSetting) {
|
||||
@ProtoField(tag = 11, type = STRING)
|
||||
public final String versionInfo;
|
||||
|
||||
@ProtoField(tag = 12, type = STRING)
|
||||
public final String deviceDataVersionInfo;
|
||||
|
||||
public CheckinResponse(Boolean statsOk, List<Intent> intent, Long timeMs, String digest, List<GservicesSetting> setting, Boolean marketOk, Long androidId, Long securityToken, Boolean settingsDiff, List<String> deleteSetting, String versionInfo, String deviceDataVersionInfo) {
|
||||
this.statsOk = statsOk;
|
||||
this.intent = immutableCopyOf(intent);
|
||||
this.timeMs = timeMs;
|
||||
@ -69,10 +77,12 @@ public final class CheckinResponse extends Message {
|
||||
this.securityToken = securityToken;
|
||||
this.settingsDiff = settingsDiff;
|
||||
this.deleteSetting = immutableCopyOf(deleteSetting);
|
||||
this.versionInfo = versionInfo;
|
||||
this.deviceDataVersionInfo = deviceDataVersionInfo;
|
||||
}
|
||||
|
||||
private CheckinResponse(Builder builder) {
|
||||
this(builder.statsOk, builder.intent, builder.timeMs, builder.digest, builder.setting, builder.marketOk, builder.androidId, builder.securityToken, builder.settingsDiff, builder.deleteSetting);
|
||||
this(builder.statsOk, builder.intent, builder.timeMs, builder.digest, builder.setting, builder.marketOk, builder.androidId, builder.securityToken, builder.settingsDiff, builder.deleteSetting, builder.versionInfo, builder.deviceDataVersionInfo);
|
||||
setBuilder(builder);
|
||||
}
|
||||
|
||||
@ -90,7 +100,9 @@ public final class CheckinResponse extends Message {
|
||||
&& equals(androidId, o.androidId)
|
||||
&& equals(securityToken, o.securityToken)
|
||||
&& equals(settingsDiff, o.settingsDiff)
|
||||
&& equals(deleteSetting, o.deleteSetting);
|
||||
&& equals(deleteSetting, o.deleteSetting)
|
||||
&& equals(versionInfo, o.versionInfo)
|
||||
&& equals(deviceDataVersionInfo, o.deviceDataVersionInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -107,6 +119,8 @@ public final class CheckinResponse extends Message {
|
||||
result = result * 37 + (securityToken != null ? securityToken.hashCode() : 0);
|
||||
result = result * 37 + (settingsDiff != null ? settingsDiff.hashCode() : 0);
|
||||
result = result * 37 + (deleteSetting != null ? deleteSetting.hashCode() : 1);
|
||||
result = result * 37 + (versionInfo != null ? versionInfo.hashCode() : 0);
|
||||
result = result * 37 + (deviceDataVersionInfo != null ? deviceDataVersionInfo.hashCode() : 0);
|
||||
hashCode = result;
|
||||
}
|
||||
return result;
|
||||
@ -124,6 +138,8 @@ public final class CheckinResponse extends Message {
|
||||
public Long securityToken;
|
||||
public Boolean settingsDiff;
|
||||
public List<String> deleteSetting;
|
||||
public String versionInfo;
|
||||
public String deviceDataVersionInfo;
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
@ -141,6 +157,8 @@ public final class CheckinResponse extends Message {
|
||||
this.securityToken = message.securityToken;
|
||||
this.settingsDiff = message.settingsDiff;
|
||||
this.deleteSetting = copyOf(message.deleteSetting);
|
||||
this.versionInfo = message.versionInfo;
|
||||
this.deviceDataVersionInfo = message.deviceDataVersionInfo;
|
||||
}
|
||||
|
||||
public Builder statsOk(Boolean statsOk) {
|
||||
@ -193,6 +211,16 @@ public final class CheckinResponse extends Message {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder versionInfo(String versionInfo) {
|
||||
this.versionInfo = versionInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder deviceDataVersionInfo(String deviceDataVersionInfo) {
|
||||
this.deviceDataVersionInfo = deviceDataVersionInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckinResponse build() {
|
||||
return new CheckinResponse(this);
|
||||
|
@ -265,6 +265,6 @@ message CheckinResponse {
|
||||
optional fixed64 securityToken = 8;
|
||||
optional bool settingsDiff = 9;
|
||||
repeated string deleteSetting = 10;
|
||||
// TODO: optional string ? = 11;
|
||||
// TODO: optional string ? = 12;
|
||||
optional string versionInfo = 11;
|
||||
optional string deviceDataVersionInfo = 12;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user