mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-23 11:07:51 +01:00
Start work on checkin
This commit is contained in:
parent
86121f1208
commit
3454682a86
@ -1 +1 @@
|
|||||||
Subproject commit d72e67e45d5eba2d17c1b73ee296fff91d147136
|
Subproject commit 06d1132344b4600ae00bda63d4da0acff7de42f0
|
@ -1 +1 @@
|
|||||||
Subproject commit 35713890ee761a2a5844aa1babd2a1cf737cf06e
|
Subproject commit 1b2907207fd145efab7a1653d04134574a960a7d
|
@ -37,6 +37,7 @@ dependencies {
|
|||||||
compile 'com.android.support:appcompat-v7:21.0.3'
|
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||||
|
|
||||||
compile 'de.hdodenhof:circleimageview:1.2.1'
|
compile 'de.hdodenhof:circleimageview:1.2.1'
|
||||||
|
compile 'com.squareup.wire:wire-runtime:1.6.1'
|
||||||
|
|
||||||
compile project(':GmsApi')
|
compile project(':GmsApi')
|
||||||
compile project(':UnifiedNlpLib')
|
compile project(':UnifiedNlpLib')
|
||||||
@ -63,7 +64,7 @@ android {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
manifest.srcFile 'AndroidManifest.xml'
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
java.srcDirs = ['src']
|
java.srcDirs = ['src', 'protos-src']
|
||||||
aidl.srcDirs = ['src']
|
aidl.srcDirs = ['src']
|
||||||
res.srcDirs = ['res']
|
res.srcDirs = ['res']
|
||||||
assets.srcDirs = ['assets']
|
assets.srcDirs = ['assets']
|
||||||
|
115
protos-repo/checkin.proto
Normal file
115
protos-repo/checkin.proto
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
option java_package = "org.microg.gms.checkin";
|
||||||
|
|
||||||
|
option java_outer_classname = "CheckinProto";
|
||||||
|
|
||||||
|
message CheckinRequest {
|
||||||
|
message DeviceConfig {
|
||||||
|
optional int32 touchScreen = 1; // ConfigurationInfo.reqTouchScreen
|
||||||
|
optional int32 keyboardType = 2; // ConfigurationInfo.reqKeyboardType
|
||||||
|
optional int32 navigation = 3; // ConfigurationInfo.reqNavigation
|
||||||
|
optional int32 screenLayout = 4; // ConfigurationInfo.screenLayout
|
||||||
|
optional bool hasHardKeyboard = 5; // ConfigurationInfo.reqInputFeatures & ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD
|
||||||
|
optional bool hasFiveWayNavigation = 6; // ConfigurationInfo.reqInputFeatures & ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV
|
||||||
|
optional int32 densityDpi = 7; // DisplayMetrics.densityDpi
|
||||||
|
optional int32 glEsVersion = 8; // ConfigurationInfo.reqGlEsVersion
|
||||||
|
repeated string sharedLibrary = 9; // PackageManager.getSystemSharedLibraryNames
|
||||||
|
repeated string availableFeature = 10; // PackageManager.getSystemAvailableFeatures
|
||||||
|
repeated string nativePlatform = 11; // Build.CPU_ABI (and Build.CPU_ABI2 != "unknown")
|
||||||
|
optional int32 widthPixels = 12; // DisplayMetrics.widthPixels
|
||||||
|
optional int32 heightPixels = 13; // DisplayMetrics.heightPixels
|
||||||
|
repeated string locale = 14; // Context.getAssets.getLocales
|
||||||
|
repeated string glExtension = 15; // GLES10.glGetString(GLES10.GL_EXTENSIONS)
|
||||||
|
optional int32 deviceClass = 16; // unused
|
||||||
|
optional int32 maxApkDownloadSizeMb = 17; // unused
|
||||||
|
}
|
||||||
|
message Checkin {
|
||||||
|
message Event {
|
||||||
|
optional string tag = 1;
|
||||||
|
optional string value = 2;
|
||||||
|
optional int64 timeMs = 3;
|
||||||
|
}
|
||||||
|
message Statistic {
|
||||||
|
optional string tag = 1;
|
||||||
|
optional int32 count = 2;
|
||||||
|
optional float sum = 3;
|
||||||
|
}
|
||||||
|
message Build {
|
||||||
|
optional string fingerprint = 1; // Build.FINGERPRINT
|
||||||
|
optional string hardware = 2; // Build.HARDWARE
|
||||||
|
optional string brand = 3; // Build.BRAND
|
||||||
|
optional string radio = 4; // Build.getRadioVersion()
|
||||||
|
optional string bootloader = 5; // Build.BOOTLOADER
|
||||||
|
optional string clientId = 6; // GoogleSettingsContract.Partner["client_id"]
|
||||||
|
optional int64 time = 7; // Build.TIME / 1000L
|
||||||
|
optional int32 packageVersionCode = 8; // PackageInfo.versionCode
|
||||||
|
optional string device = 9; // Build.DEVICE
|
||||||
|
optional int32 sdkVersion = 10; // Build.VERSION.SDK_INT
|
||||||
|
optional string model = 11; // Build.MODEL
|
||||||
|
optional string manufacturer = 12; // Build.MANUFACTURER
|
||||||
|
optional string product = 13; // Build.PRODUCT
|
||||||
|
optional bool otaInstalled = 14; // fileExists("/system/recovery-from-boot.p")
|
||||||
|
}
|
||||||
|
|
||||||
|
optional Build build = 1;
|
||||||
|
optional int64 lastCheckinMs = 2; // or 0
|
||||||
|
repeated Event event = 3;
|
||||||
|
repeated Statistic stat = 4;
|
||||||
|
repeated string requestedGroup = 5; // unused
|
||||||
|
optional string cellOperator = 6; // TelephonyManager.getNetworkOperator != null|empty
|
||||||
|
optional string simOperator = 7; // TelephonyManager.getSimOperator != null|empty
|
||||||
|
optional string roaming = 8; // "mobile/notmobile/unknown-roaming/notroaming/unknown"
|
||||||
|
optional int32 userNumber = 9; // UserHandle.myUserId
|
||||||
|
}
|
||||||
|
optional string imei = 1; // unused
|
||||||
|
optional int64 androidId = 2; // Gservices["android_id"] or 0
|
||||||
|
optional string digest = 3; // Gservices["digest"] or ""
|
||||||
|
optional Checkin checkin = 4;
|
||||||
|
optional string desiredBuild = 5; // unused
|
||||||
|
optional string locale = 6; // Locale.toString
|
||||||
|
optional int64 loggingId = 7; // GoogleSettingsContract.Partner["logging_id2"]
|
||||||
|
optional string marketCheckin = 8; // unused
|
||||||
|
repeated string macAddress = 9; // NetworkInfo.getExtraInfo, WifiInfo.getMacAddress (12 hex-digits)
|
||||||
|
optional string meid = 10; // TelephonyManager.getDeviceId (14 hex-digits)
|
||||||
|
repeated string accountCookie = 11; // "[<email>]" followed by "<authToken>"
|
||||||
|
optional string timeZone = 12; // TimeZone.getId
|
||||||
|
optional fixed64 securityToken = 13;
|
||||||
|
optional int32 version = 14; // 3 if securityToken != 0 OR androidId == 0
|
||||||
|
repeated string otaCert = 15; // SHA-1 of each in /system/etc/security/otacerts.zip or "--IOException--" or "--no-output--"
|
||||||
|
optional string serial = 16; // Build.SERIAL != "unknown"
|
||||||
|
optional string esn = 17; // TelephonyManager.getDeviceId (8 hex-digits)
|
||||||
|
optional DeviceConfig deviceConfiguration = 18;
|
||||||
|
repeated string macAddressType = 19; // "ethernet", "wifi"
|
||||||
|
optional int32 fragment = 20; // unknown (use 0)
|
||||||
|
optional string userName = 21; // unused
|
||||||
|
optional int32 userSerialNumber = 22; // UserManager.getUserSerialNumber (if != 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
message CheckinResponse {
|
||||||
|
message Intent {
|
||||||
|
message Extra {
|
||||||
|
optional string name = 6;
|
||||||
|
optional string value = 7;
|
||||||
|
}
|
||||||
|
optional string action = 1;
|
||||||
|
optional string dataUri = 2;
|
||||||
|
optional string mimeType = 3;
|
||||||
|
optional string javaClass = 4;
|
||||||
|
repeated Extra extra = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GservicesSetting {
|
||||||
|
optional bytes name = 1;
|
||||||
|
optional bytes value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
optional bool statsOk = 1;
|
||||||
|
repeated Intent intent = 2;
|
||||||
|
optional int64 timeMs = 3;
|
||||||
|
optional string digest = 4;
|
||||||
|
repeated GservicesSetting setting = 5;
|
||||||
|
optional bool marketOk = 6;
|
||||||
|
optional fixed64 androidId = 7;
|
||||||
|
optional fixed64 securityToken = 8;
|
||||||
|
optional bool settingsDiff = 9;
|
||||||
|
repeated string deleteSetting = 10;
|
||||||
|
}
|
1547
protos-src/org/microg/gms/checkin/CheckinRequest.java
Normal file
1547
protos-src/org/microg/gms/checkin/CheckinRequest.java
Normal file
File diff suppressed because it is too large
Load Diff
462
protos-src/org/microg/gms/checkin/CheckinResponse.java
Normal file
462
protos-src/org/microg/gms/checkin/CheckinResponse.java
Normal file
@ -0,0 +1,462 @@
|
|||||||
|
// Code generated by Wire protocol buffer compiler, do not edit.
|
||||||
|
// Source file: protos-repo/checkin.proto
|
||||||
|
package org.microg.gms.checkin;
|
||||||
|
|
||||||
|
import com.squareup.wire.Message;
|
||||||
|
import com.squareup.wire.ProtoField;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import okio.ByteString;
|
||||||
|
|
||||||
|
import static com.squareup.wire.Message.Datatype.BOOL;
|
||||||
|
import static com.squareup.wire.Message.Datatype.BYTES;
|
||||||
|
import static com.squareup.wire.Message.Datatype.FIXED64;
|
||||||
|
import static com.squareup.wire.Message.Datatype.INT64;
|
||||||
|
import static com.squareup.wire.Message.Datatype.STRING;
|
||||||
|
import static com.squareup.wire.Message.Label.REPEATED;
|
||||||
|
|
||||||
|
public final class CheckinResponse extends Message {
|
||||||
|
|
||||||
|
public static final Boolean DEFAULT_STATSOK = false;
|
||||||
|
public static final List<Intent> DEFAULT_INTENT = Collections.emptyList();
|
||||||
|
public static final Long DEFAULT_TIMEMS = 0L;
|
||||||
|
public static final String DEFAULT_DIGEST = "";
|
||||||
|
public static final List<GservicesSetting> DEFAULT_SETTING = Collections.emptyList();
|
||||||
|
public static final Boolean DEFAULT_MARKETOK = false;
|
||||||
|
public static final Long DEFAULT_ANDROIDID = 0L;
|
||||||
|
public static final Long DEFAULT_SECURITYTOKEN = 0L;
|
||||||
|
public static final Boolean DEFAULT_SETTINGSDIFF = false;
|
||||||
|
public static final List<String> DEFAULT_DELETESETTING = Collections.emptyList();
|
||||||
|
|
||||||
|
@ProtoField(tag = 1, type = BOOL)
|
||||||
|
public final Boolean statsOk;
|
||||||
|
|
||||||
|
@ProtoField(tag = 2, label = REPEATED, messageType = Intent.class)
|
||||||
|
public final List<Intent> intent;
|
||||||
|
|
||||||
|
@ProtoField(tag = 3, type = INT64)
|
||||||
|
public final Long timeMs;
|
||||||
|
|
||||||
|
@ProtoField(tag = 4, type = STRING)
|
||||||
|
public final String digest;
|
||||||
|
|
||||||
|
@ProtoField(tag = 5, label = REPEATED, messageType = GservicesSetting.class)
|
||||||
|
public final List<GservicesSetting> setting;
|
||||||
|
|
||||||
|
@ProtoField(tag = 6, type = BOOL)
|
||||||
|
public final Boolean marketOk;
|
||||||
|
|
||||||
|
@ProtoField(tag = 7, type = FIXED64)
|
||||||
|
public final Long androidId;
|
||||||
|
|
||||||
|
@ProtoField(tag = 8, type = FIXED64)
|
||||||
|
public final Long securityToken;
|
||||||
|
|
||||||
|
@ProtoField(tag = 9, type = BOOL)
|
||||||
|
public final Boolean settingsDiff;
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
this.statsOk = statsOk;
|
||||||
|
this.intent = immutableCopyOf(intent);
|
||||||
|
this.timeMs = timeMs;
|
||||||
|
this.digest = digest;
|
||||||
|
this.setting = immutableCopyOf(setting);
|
||||||
|
this.marketOk = marketOk;
|
||||||
|
this.androidId = androidId;
|
||||||
|
this.securityToken = securityToken;
|
||||||
|
this.settingsDiff = settingsDiff;
|
||||||
|
this.deleteSetting = immutableCopyOf(deleteSetting);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
setBuilder(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (other == this) return true;
|
||||||
|
if (!(other instanceof CheckinResponse)) return false;
|
||||||
|
CheckinResponse o = (CheckinResponse) other;
|
||||||
|
return equals(statsOk, o.statsOk)
|
||||||
|
&& equals(intent, o.intent)
|
||||||
|
&& equals(timeMs, o.timeMs)
|
||||||
|
&& equals(digest, o.digest)
|
||||||
|
&& equals(setting, o.setting)
|
||||||
|
&& equals(marketOk, o.marketOk)
|
||||||
|
&& equals(androidId, o.androidId)
|
||||||
|
&& equals(securityToken, o.securityToken)
|
||||||
|
&& equals(settingsDiff, o.settingsDiff)
|
||||||
|
&& equals(deleteSetting, o.deleteSetting);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = hashCode;
|
||||||
|
if (result == 0) {
|
||||||
|
result = statsOk != null ? statsOk.hashCode() : 0;
|
||||||
|
result = result * 37 + (intent != null ? intent.hashCode() : 1);
|
||||||
|
result = result * 37 + (timeMs != null ? timeMs.hashCode() : 0);
|
||||||
|
result = result * 37 + (digest != null ? digest.hashCode() : 0);
|
||||||
|
result = result * 37 + (setting != null ? setting.hashCode() : 1);
|
||||||
|
result = result * 37 + (marketOk != null ? marketOk.hashCode() : 0);
|
||||||
|
result = result * 37 + (androidId != null ? androidId.hashCode() : 0);
|
||||||
|
result = result * 37 + (securityToken != null ? securityToken.hashCode() : 0);
|
||||||
|
result = result * 37 + (settingsDiff != null ? settingsDiff.hashCode() : 0);
|
||||||
|
result = result * 37 + (deleteSetting != null ? deleteSetting.hashCode() : 1);
|
||||||
|
hashCode = result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Builder extends Message.Builder<CheckinResponse> {
|
||||||
|
|
||||||
|
public Boolean statsOk;
|
||||||
|
public List<Intent> intent;
|
||||||
|
public Long timeMs;
|
||||||
|
public String digest;
|
||||||
|
public List<GservicesSetting> setting;
|
||||||
|
public Boolean marketOk;
|
||||||
|
public Long androidId;
|
||||||
|
public Long securityToken;
|
||||||
|
public Boolean settingsDiff;
|
||||||
|
public List<String> deleteSetting;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder(CheckinResponse message) {
|
||||||
|
super(message);
|
||||||
|
if (message == null) return;
|
||||||
|
this.statsOk = message.statsOk;
|
||||||
|
this.intent = copyOf(message.intent);
|
||||||
|
this.timeMs = message.timeMs;
|
||||||
|
this.digest = message.digest;
|
||||||
|
this.setting = copyOf(message.setting);
|
||||||
|
this.marketOk = message.marketOk;
|
||||||
|
this.androidId = message.androidId;
|
||||||
|
this.securityToken = message.securityToken;
|
||||||
|
this.settingsDiff = message.settingsDiff;
|
||||||
|
this.deleteSetting = copyOf(message.deleteSetting);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder statsOk(Boolean statsOk) {
|
||||||
|
this.statsOk = statsOk;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder intent(List<Intent> intent) {
|
||||||
|
this.intent = checkForNulls(intent);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder timeMs(Long timeMs) {
|
||||||
|
this.timeMs = timeMs;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder digest(String digest) {
|
||||||
|
this.digest = digest;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setting(List<GservicesSetting> setting) {
|
||||||
|
this.setting = checkForNulls(setting);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder marketOk(Boolean marketOk) {
|
||||||
|
this.marketOk = marketOk;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder androidId(Long androidId) {
|
||||||
|
this.androidId = androidId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder securityToken(Long securityToken) {
|
||||||
|
this.securityToken = securityToken;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder settingsDiff(Boolean settingsDiff) {
|
||||||
|
this.settingsDiff = settingsDiff;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder deleteSetting(List<String> deleteSetting) {
|
||||||
|
this.deleteSetting = checkForNulls(deleteSetting);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CheckinResponse build() {
|
||||||
|
return new CheckinResponse(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Intent extends Message {
|
||||||
|
|
||||||
|
public static final String DEFAULT_ACTION = "";
|
||||||
|
public static final String DEFAULT_DATAURI = "";
|
||||||
|
public static final String DEFAULT_MIMETYPE = "";
|
||||||
|
public static final String DEFAULT_JAVACLASS = "";
|
||||||
|
public static final List<Intent.Extra> DEFAULT_EXTRA = Collections.emptyList();
|
||||||
|
|
||||||
|
@ProtoField(tag = 1, type = STRING)
|
||||||
|
public final String action;
|
||||||
|
|
||||||
|
@ProtoField(tag = 2, type = STRING)
|
||||||
|
public final String dataUri;
|
||||||
|
|
||||||
|
@ProtoField(tag = 3, type = STRING)
|
||||||
|
public final String mimeType;
|
||||||
|
|
||||||
|
@ProtoField(tag = 4, type = STRING)
|
||||||
|
public final String javaClass;
|
||||||
|
|
||||||
|
@ProtoField(tag = 5, label = REPEATED, messageType = Intent.Extra.class)
|
||||||
|
public final List<Intent.Extra> extra;
|
||||||
|
|
||||||
|
public Intent(String action, String dataUri, String mimeType, String javaClass, List<Intent.Extra> extra) {
|
||||||
|
this.action = action;
|
||||||
|
this.dataUri = dataUri;
|
||||||
|
this.mimeType = mimeType;
|
||||||
|
this.javaClass = javaClass;
|
||||||
|
this.extra = immutableCopyOf(extra);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent(Builder builder) {
|
||||||
|
this(builder.action, builder.dataUri, builder.mimeType, builder.javaClass, builder.extra);
|
||||||
|
setBuilder(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (other == this) return true;
|
||||||
|
if (!(other instanceof Intent)) return false;
|
||||||
|
Intent o = (Intent) other;
|
||||||
|
return equals(action, o.action)
|
||||||
|
&& equals(dataUri, o.dataUri)
|
||||||
|
&& equals(mimeType, o.mimeType)
|
||||||
|
&& equals(javaClass, o.javaClass)
|
||||||
|
&& equals(extra, o.extra);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = hashCode;
|
||||||
|
if (result == 0) {
|
||||||
|
result = action != null ? action.hashCode() : 0;
|
||||||
|
result = result * 37 + (dataUri != null ? dataUri.hashCode() : 0);
|
||||||
|
result = result * 37 + (mimeType != null ? mimeType.hashCode() : 0);
|
||||||
|
result = result * 37 + (javaClass != null ? javaClass.hashCode() : 0);
|
||||||
|
result = result * 37 + (extra != null ? extra.hashCode() : 1);
|
||||||
|
hashCode = result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Builder extends Message.Builder<Intent> {
|
||||||
|
|
||||||
|
public String action;
|
||||||
|
public String dataUri;
|
||||||
|
public String mimeType;
|
||||||
|
public String javaClass;
|
||||||
|
public List<Intent.Extra> extra;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder(Intent message) {
|
||||||
|
super(message);
|
||||||
|
if (message == null) return;
|
||||||
|
this.action = message.action;
|
||||||
|
this.dataUri = message.dataUri;
|
||||||
|
this.mimeType = message.mimeType;
|
||||||
|
this.javaClass = message.javaClass;
|
||||||
|
this.extra = copyOf(message.extra);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder action(String action) {
|
||||||
|
this.action = action;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder dataUri(String dataUri) {
|
||||||
|
this.dataUri = dataUri;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder mimeType(String mimeType) {
|
||||||
|
this.mimeType = mimeType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder javaClass(String javaClass) {
|
||||||
|
this.javaClass = javaClass;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder extra(List<Intent.Extra> extra) {
|
||||||
|
this.extra = checkForNulls(extra);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Intent build() {
|
||||||
|
return new Intent(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Extra extends Message {
|
||||||
|
|
||||||
|
public static final String DEFAULT_NAME = "";
|
||||||
|
public static final String DEFAULT_VALUE = "";
|
||||||
|
|
||||||
|
@ProtoField(tag = 6, type = STRING)
|
||||||
|
public final String name;
|
||||||
|
|
||||||
|
@ProtoField(tag = 7, type = STRING)
|
||||||
|
public final String value;
|
||||||
|
|
||||||
|
public Extra(String name, String value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Extra(Builder builder) {
|
||||||
|
this(builder.name, builder.value);
|
||||||
|
setBuilder(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (other == this) return true;
|
||||||
|
if (!(other instanceof Extra)) return false;
|
||||||
|
Extra o = (Extra) other;
|
||||||
|
return equals(name, o.name)
|
||||||
|
&& equals(value, o.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = hashCode;
|
||||||
|
if (result == 0) {
|
||||||
|
result = name != null ? name.hashCode() : 0;
|
||||||
|
result = result * 37 + (value != null ? value.hashCode() : 0);
|
||||||
|
hashCode = result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Builder extends Message.Builder<Extra> {
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
public String value;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder(Extra message) {
|
||||||
|
super(message);
|
||||||
|
if (message == null) return;
|
||||||
|
this.name = message.name;
|
||||||
|
this.value = message.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder name(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder value(String value) {
|
||||||
|
this.value = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Extra build() {
|
||||||
|
return new Extra(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class GservicesSetting extends Message {
|
||||||
|
|
||||||
|
public static final ByteString DEFAULT_NAME = ByteString.EMPTY;
|
||||||
|
public static final ByteString DEFAULT_VALUE = ByteString.EMPTY;
|
||||||
|
|
||||||
|
@ProtoField(tag = 1, type = BYTES)
|
||||||
|
public final ByteString name;
|
||||||
|
|
||||||
|
@ProtoField(tag = 2, type = BYTES)
|
||||||
|
public final ByteString value;
|
||||||
|
|
||||||
|
public GservicesSetting(ByteString name, ByteString value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private GservicesSetting(Builder builder) {
|
||||||
|
this(builder.name, builder.value);
|
||||||
|
setBuilder(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (other == this) return true;
|
||||||
|
if (!(other instanceof GservicesSetting)) return false;
|
||||||
|
GservicesSetting o = (GservicesSetting) other;
|
||||||
|
return equals(name, o.name)
|
||||||
|
&& equals(value, o.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = hashCode;
|
||||||
|
if (result == 0) {
|
||||||
|
result = name != null ? name.hashCode() : 0;
|
||||||
|
result = result * 37 + (value != null ? value.hashCode() : 0);
|
||||||
|
hashCode = result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Builder extends Message.Builder<GservicesSetting> {
|
||||||
|
|
||||||
|
public ByteString name;
|
||||||
|
public ByteString value;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder(GservicesSetting message) {
|
||||||
|
super(message);
|
||||||
|
if (message == null) return;
|
||||||
|
this.name = message.name;
|
||||||
|
this.value = message.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder name(ByteString name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder value(ByteString value) {
|
||||||
|
this.value = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GservicesSetting build() {
|
||||||
|
return new GservicesSetting(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -48,13 +48,16 @@ public class AuthClient {
|
|||||||
content.append("&");
|
content.append("&");
|
||||||
content.append(Uri.encode(key)).append("=").append(Uri.encode(formContent.get(key)));
|
content.append(Uri.encode(key)).append("=").append(Uri.encode(formContent.get(key)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(TAG, "-- Request --\n" + content);
|
Log.d(TAG, "-- Request --\n" + content);
|
||||||
OutputStream os = connection.getOutputStream();
|
OutputStream os = connection.getOutputStream();
|
||||||
os.write(content.toString().getBytes());
|
os.write(content.toString().getBytes());
|
||||||
os.close();
|
os.close();
|
||||||
|
|
||||||
if (connection.getResponseCode() != 200) {
|
if (connection.getResponseCode() != 200) {
|
||||||
throw new IOException(connection.getResponseMessage());
|
throw new IOException(connection.getResponseMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
String result = new String(Utils.readStreamToEnd(connection.getInputStream()));
|
String result = new String(Utils.readStreamToEnd(connection.getInputStream()));
|
||||||
Log.d(TAG, "-- Response --\n" + result);
|
Log.d(TAG, "-- Response --\n" + result);
|
||||||
return AuthResponse.parse(result);
|
return AuthResponse.parse(result);
|
||||||
|
155
src/org/microg/gms/checkin/CheckinClient.java
Normal file
155
src/org/microg/gms/checkin/CheckinClient.java
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013-2015 µg Project Team
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.microg.gms.checkin;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.squareup.wire.Wire;
|
||||||
|
|
||||||
|
import org.microg.gms.common.Build;
|
||||||
|
import org.microg.gms.common.DeviceConfiguration;
|
||||||
|
import org.microg.gms.common.DeviceIdentifier;
|
||||||
|
import org.microg.gms.common.PhoneInfo;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CheckinClient {
|
||||||
|
private static final String TAG = "GmsCheckinClient";
|
||||||
|
private static final Object TODO = null;
|
||||||
|
private static final String SERVICE_URL = "https://android.clients.google.com/checkin";
|
||||||
|
|
||||||
|
public static CheckinResponse request(CheckinRequest request) throws IOException {
|
||||||
|
HttpURLConnection connection = (HttpURLConnection) new URL(SERVICE_URL).openConnection();
|
||||||
|
connection.setRequestMethod("POST");
|
||||||
|
connection.setDoInput(true);
|
||||||
|
connection.setDoOutput(true);
|
||||||
|
connection.setRequestProperty("Content-Type", "application/x-protobuffer");
|
||||||
|
connection.setRequestProperty("User-Agent", "Android-Checkin/2.0");
|
||||||
|
|
||||||
|
Log.d(TAG, "-- Request --\n" + request);
|
||||||
|
OutputStream os = connection.getOutputStream();
|
||||||
|
os.write(request.toByteArray());
|
||||||
|
os.close();
|
||||||
|
|
||||||
|
if (connection.getResponseCode() != 200) {
|
||||||
|
throw new IOException(connection.getResponseMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
InputStream is = connection.getInputStream();
|
||||||
|
CheckinResponse response = new Wire().parseFrom(is, CheckinResponse.class);
|
||||||
|
is.close();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CheckinRequest.Checkin.Build makeBuild(Build build) {
|
||||||
|
return new CheckinRequest.Checkin.Build.Builder()
|
||||||
|
.bootloader(build.bootloader)
|
||||||
|
.brand(build.brand)
|
||||||
|
.clientId((String) TODO)
|
||||||
|
.device(build.device)
|
||||||
|
.fingerprint(build.fingerprint)
|
||||||
|
.hardware(build.hardware)
|
||||||
|
.manufacturer(build.manufacturer)
|
||||||
|
.model(build.model)
|
||||||
|
.otaInstalled(false) // TODO?
|
||||||
|
.packageVersionCode(build.sdk) // TODO?
|
||||||
|
.product(build.product)
|
||||||
|
.radio(build.radio)
|
||||||
|
.sdkVersion(build.sdk)
|
||||||
|
.time(build.time / 1000)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CheckinRequest.DeviceConfig makeDeviceConfig(DeviceConfiguration deviceConfiguration) {
|
||||||
|
return new CheckinRequest.DeviceConfig.Builder()
|
||||||
|
.availableFeature(deviceConfiguration.availableFeatures)
|
||||||
|
.densityDpi(deviceConfiguration.densityDpi)
|
||||||
|
.deviceClass(deviceConfiguration.deviceClass)
|
||||||
|
.glEsVersion(deviceConfiguration.glEsVersion)
|
||||||
|
.glExtension(deviceConfiguration.glExtensions)
|
||||||
|
.hasFiveWayNavigation(deviceConfiguration.hasFiveWayNavigation)
|
||||||
|
.hasHardKeyboard(deviceConfiguration.hasHardKeyboard)
|
||||||
|
.heightPixels(deviceConfiguration.heightPixels)
|
||||||
|
.keyboardType(deviceConfiguration.keyboardType)
|
||||||
|
.locale(deviceConfiguration.locales)
|
||||||
|
.maxApkDownloadSizeMb((Integer) TODO)
|
||||||
|
.nativePlatform(deviceConfiguration.nativePlatforms)
|
||||||
|
.navigation(deviceConfiguration.navigation)
|
||||||
|
.screenLayout(deviceConfiguration.screenLayout)
|
||||||
|
.sharedLibrary(deviceConfiguration.sharedLibraries)
|
||||||
|
.touchScreen(deviceConfiguration.touchScreen)
|
||||||
|
.widthPixels(deviceConfiguration.widthPixels)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CheckinRequest.Checkin makeCheckin(CheckinRequest.Checkin.Build build,
|
||||||
|
PhoneInfo phoneInfo, LastCheckinInfo checkinInfo) {
|
||||||
|
return new CheckinRequest.Checkin.Builder()
|
||||||
|
.build(build)
|
||||||
|
.cellOperator(phoneInfo.cellOperator)
|
||||||
|
.event((List<CheckinRequest.Checkin.Event>) TODO)
|
||||||
|
.lastCheckinMs(checkinInfo.lastCheckin)
|
||||||
|
.requestedGroup((List<String>) TODO)
|
||||||
|
.roaming(phoneInfo.roaming)
|
||||||
|
.simOperator(phoneInfo.simOperator)
|
||||||
|
.stat((List<CheckinRequest.Checkin.Statistic>) TODO)
|
||||||
|
.userNumber((Integer) TODO)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CheckinRequest makeRequest(CheckinRequest.Checkin checkin,
|
||||||
|
CheckinRequest.DeviceConfig deviceConfig,
|
||||||
|
DeviceIdentifier deviceIdent, LastCheckinInfo checkinInfo) {
|
||||||
|
return new CheckinRequest.Builder()
|
||||||
|
.accountCookie((List<String>) TODO)
|
||||||
|
.androidId(checkinInfo.androidId)
|
||||||
|
.checkin(checkin)
|
||||||
|
.desiredBuild((String) TODO)
|
||||||
|
.deviceConfiguration(deviceConfig)
|
||||||
|
.digest((String) TODO)
|
||||||
|
.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)
|
||||||
|
.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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CheckinRequest makeRequest(Build build, DeviceConfiguration deviceConfiguration,
|
||||||
|
DeviceIdentifier deviceIdent, PhoneInfo phoneInfo,
|
||||||
|
LastCheckinInfo checkinInfo) {
|
||||||
|
return makeRequest(makeCheckin(makeBuild(build), phoneInfo, checkinInfo),
|
||||||
|
makeDeviceConfig(deviceConfiguration), deviceIdent, checkinInfo);
|
||||||
|
}
|
||||||
|
}
|
23
src/org/microg/gms/checkin/LastCheckinInfo.java
Normal file
23
src/org/microg/gms/checkin/LastCheckinInfo.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013-2015 µg Project Team
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.microg.gms.checkin;
|
||||||
|
|
||||||
|
public class LastCheckinInfo {
|
||||||
|
public long lastCheckin;
|
||||||
|
public long androidId;
|
||||||
|
public long securityToken;
|
||||||
|
}
|
@ -17,7 +17,25 @@
|
|||||||
package org.microg.gms.common;
|
package org.microg.gms.common;
|
||||||
|
|
||||||
public class Build {
|
public class Build {
|
||||||
public int sdk = android.os.Build.VERSION.SDK_INT;
|
public String fingerprint = android.os.Build.FINGERPRINT;
|
||||||
public String id = android.os.Build.ID;
|
public String hardware = android.os.Build.HARDWARE;
|
||||||
|
public String brand = android.os.Build.BRAND;
|
||||||
|
public String radio = getRadio();
|
||||||
|
public String bootloader = android.os.Build.BOOTLOADER;
|
||||||
|
public long time = android.os.Build.TIME;
|
||||||
public String device = android.os.Build.DEVICE;
|
public String device = android.os.Build.DEVICE;
|
||||||
|
public int sdk = android.os.Build.VERSION.SDK_INT;
|
||||||
|
public String model = android.os.Build.MODEL;
|
||||||
|
public String manufacturer = android.os.Build.MANUFACTURER;
|
||||||
|
public String product = android.os.Build.PRODUCT;
|
||||||
|
public String id = android.os.Build.ID;
|
||||||
|
|
||||||
|
private static String getRadio() {
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
|
return android.os.Build.getRadioVersion();
|
||||||
|
} else {
|
||||||
|
//noinspection deprecation
|
||||||
|
return android.os.Build.RADIO;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
38
src/org/microg/gms/common/DeviceConfiguration.java
Normal file
38
src/org/microg/gms/common/DeviceConfiguration.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013-2015 µg Project Team
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.microg.gms.common;
|
||||||
|
|
||||||
|
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;
|
||||||
|
public boolean hasHardKeyboard;
|
||||||
|
public int heightPixels;
|
||||||
|
public int keyboardType;
|
||||||
|
public List<String> locales;
|
||||||
|
public List<String> nativePlatforms;
|
||||||
|
public int navigation;
|
||||||
|
public int screenLayout;
|
||||||
|
public List<String> sharedLibraries;
|
||||||
|
public int touchScreen;
|
||||||
|
public int widthPixels;
|
||||||
|
}
|
24
src/org/microg/gms/common/DeviceIdentifier.java
Normal file
24
src/org/microg/gms/common/DeviceIdentifier.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013-2015 µg Project Team
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.microg.gms.common;
|
||||||
|
|
||||||
|
public class DeviceIdentifier {
|
||||||
|
public String bluetoothMac;
|
||||||
|
public String wifiMac;
|
||||||
|
public String meid;
|
||||||
|
public String esn;
|
||||||
|
}
|
23
src/org/microg/gms/common/PhoneInfo.java
Normal file
23
src/org/microg/gms/common/PhoneInfo.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013-2015 µg Project Team
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.microg.gms.common;
|
||||||
|
|
||||||
|
public class PhoneInfo {
|
||||||
|
public String cellOperator;
|
||||||
|
public String roaming;
|
||||||
|
public String simOperator;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user