mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-01-23 09:27:31 +01:00
Add new fields to TemporaryExposureKey
This commit is contained in:
parent
5ef1144131
commit
12905d6621
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.google.android.gms.nearby.exposurenotification;
|
package com.google.android.gms.nearby.exposurenotification;
|
||||||
|
|
||||||
|
import org.microg.gms.nearby.exposurenotification.Constants;
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
import org.microg.safeparcel.AutoSafeParcelable;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -22,15 +23,24 @@ public class TemporaryExposureKey extends AutoSafeParcelable {
|
|||||||
private int transmissionRiskLevel;
|
private int transmissionRiskLevel;
|
||||||
@Field(4)
|
@Field(4)
|
||||||
private int rollingPeriod;
|
private int rollingPeriod;
|
||||||
|
@Field(5)
|
||||||
|
@ReportType
|
||||||
|
private int reportType;
|
||||||
|
@Field(6)
|
||||||
|
int daysSinceOnsetOfSymptoms;
|
||||||
|
|
||||||
|
public static final int DAYS_SINCE_ONSET_OF_SYMPTOMS_UNKNOWN = Constants.DAYS_SINCE_ONSET_OF_SYMPTOMS_UNKNOWN;
|
||||||
|
|
||||||
private TemporaryExposureKey() {
|
private TemporaryExposureKey() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TemporaryExposureKey(byte[] keyData, int rollingStartIntervalNumber, @RiskLevel int transmissionRiskLevel, int rollingPeriod) {
|
TemporaryExposureKey(byte[] keyData, int rollingStartIntervalNumber, @RiskLevel int transmissionRiskLevel, int rollingPeriod, @ReportType int reportType, int daysSinceOnsetOfSymptoms) {
|
||||||
this.keyData = (keyData == null ? new byte[0] : keyData);
|
this.keyData = (keyData == null ? new byte[0] : keyData);
|
||||||
this.rollingStartIntervalNumber = rollingStartIntervalNumber;
|
this.rollingStartIntervalNumber = rollingStartIntervalNumber;
|
||||||
this.transmissionRiskLevel = transmissionRiskLevel;
|
this.transmissionRiskLevel = transmissionRiskLevel;
|
||||||
this.rollingPeriod = rollingPeriod;
|
this.rollingPeriod = rollingPeriod;
|
||||||
|
this.reportType = reportType;
|
||||||
|
this.daysSinceOnsetOfSymptoms = daysSinceOnsetOfSymptoms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getKeyData() {
|
public byte[] getKeyData() {
|
||||||
@ -50,6 +60,15 @@ public class TemporaryExposureKey extends AutoSafeParcelable {
|
|||||||
return rollingPeriod;
|
return rollingPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReportType
|
||||||
|
public int getReportType() {
|
||||||
|
return reportType;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getDaysSinceOnsetOfSymptoms() {
|
||||||
|
return daysSinceOnsetOfSymptoms;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
@ -60,6 +79,8 @@ public class TemporaryExposureKey extends AutoSafeParcelable {
|
|||||||
if (rollingStartIntervalNumber != that.rollingStartIntervalNumber) return false;
|
if (rollingStartIntervalNumber != that.rollingStartIntervalNumber) return false;
|
||||||
if (transmissionRiskLevel != that.transmissionRiskLevel) return false;
|
if (transmissionRiskLevel != that.transmissionRiskLevel) return false;
|
||||||
if (rollingPeriod != that.rollingPeriod) return false;
|
if (rollingPeriod != that.rollingPeriod) return false;
|
||||||
|
if (reportType != that.reportType) return false;
|
||||||
|
if (daysSinceOnsetOfSymptoms != that.daysSinceOnsetOfSymptoms) return false;
|
||||||
return Arrays.equals(keyData, that.keyData);
|
return Arrays.equals(keyData, that.keyData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +90,8 @@ public class TemporaryExposureKey extends AutoSafeParcelable {
|
|||||||
result = 31 * result + rollingStartIntervalNumber;
|
result = 31 * result + rollingStartIntervalNumber;
|
||||||
result = 31 * result + transmissionRiskLevel;
|
result = 31 * result + transmissionRiskLevel;
|
||||||
result = 31 * result + rollingPeriod;
|
result = 31 * result + rollingPeriod;
|
||||||
|
result = 31 * result + reportType;
|
||||||
|
result = 31 * result + daysSinceOnsetOfSymptoms;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +102,8 @@ public class TemporaryExposureKey extends AutoSafeParcelable {
|
|||||||
", rollingStartIntervalNumber=" + rollingStartIntervalNumber +
|
", rollingStartIntervalNumber=" + rollingStartIntervalNumber +
|
||||||
", transmissionRiskLevel=" + transmissionRiskLevel +
|
", transmissionRiskLevel=" + transmissionRiskLevel +
|
||||||
", rollingPeriod=" + rollingPeriod +
|
", rollingPeriod=" + rollingPeriod +
|
||||||
|
", reportType=" + reportType +
|
||||||
|
", daysSinceOnsetOfSymptoms=" + daysSinceOnsetOfSymptoms +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +113,9 @@ public class TemporaryExposureKey extends AutoSafeParcelable {
|
|||||||
@RiskLevel
|
@RiskLevel
|
||||||
private int transmissionRiskLevel;
|
private int transmissionRiskLevel;
|
||||||
private int rollingPeriod;
|
private int rollingPeriod;
|
||||||
|
@ReportType
|
||||||
|
private int reportType;
|
||||||
|
private int daysSinceOnsetOfSymptoms = DAYS_SINCE_ONSET_OF_SYMPTOMS_UNKNOWN;
|
||||||
|
|
||||||
public TemporaryExposureKeyBuilder setKeyData(byte[] keyData) {
|
public TemporaryExposureKeyBuilder setKeyData(byte[] keyData) {
|
||||||
this.keyData = Arrays.copyOf(keyData, keyData.length);
|
this.keyData = Arrays.copyOf(keyData, keyData.length);
|
||||||
@ -109,8 +137,18 @@ public class TemporaryExposureKey extends AutoSafeParcelable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TemporaryExposureKeyBuilder setReportType(@ReportType int reportType) {
|
||||||
|
this.reportType = reportType;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TemporaryExposureKeyBuilder setDaysSinceOnsetOfSymptoms(int daysSinceOnsetOfSymptoms) {
|
||||||
|
this.daysSinceOnsetOfSymptoms = daysSinceOnsetOfSymptoms;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public TemporaryExposureKey build() {
|
public TemporaryExposureKey build() {
|
||||||
return new TemporaryExposureKey(keyData, rollingStartIntervalNumber, transmissionRiskLevel, rollingPeriod);
|
return new TemporaryExposureKey(keyData, rollingStartIntervalNumber, transmissionRiskLevel, rollingPeriod, reportType, daysSinceOnsetOfSymptoms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,4 +14,5 @@ public class Constants {
|
|||||||
public static final String EXTRA_SERVICE_STATE = "com.google.android.gms.exposurenotification.EXTRA_SERVICE_STATE";
|
public static final String EXTRA_SERVICE_STATE = "com.google.android.gms.exposurenotification.EXTRA_SERVICE_STATE";
|
||||||
public static final String EXTRA_TOKEN = "com.google.android.gms.exposurenotification.EXTRA_TOKEN";
|
public static final String EXTRA_TOKEN = "com.google.android.gms.exposurenotification.EXTRA_TOKEN";
|
||||||
public static final String TOKEN_A = "TYZWQ32170AXEUVCDW7A";
|
public static final String TOKEN_A = "TYZWQ32170AXEUVCDW7A";
|
||||||
|
public static final int DAYS_SINCE_ONSET_OF_SYMPTOMS_UNKNOWN = Integer.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user