Clone dependency tree from original play-services libraries

This commit is contained in:
inotia00 2022-07-18 09:52:19 +09:00
commit 2a866c7f8b
12 changed files with 297 additions and 14 deletions

View file

@ -0,0 +1,3 @@
package com.mgoogle.android.gms.phenotype;
parcelable DogfoodsToken;

View file

@ -0,0 +1,3 @@
package com.mgoogle.android.gms.phenotype;
parcelable ExperimentTokens;

View file

@ -0,0 +1,3 @@
package com.mgoogle.android.gms.phenotype;
parcelable Flag;

View file

@ -0,0 +1,3 @@
package com.mgoogle.android.gms.phenotype;
parcelable FlagOverrides;

View file

@ -0,0 +1,3 @@
package com.mgoogle.android.gms.phenotype;
parcelable RegistrationInfo;

View file

@ -9,10 +9,10 @@ import org.microg.safeparcel.AutoSafeParcelable;
public class Configuration extends AutoSafeParcelable {
@Field(2)
public int field2;
public int flagType;
@Field(3)
public Flag[] field3;
public Flag[] flags;
@Field(4)
public String[] field4;
public String[] names;
public static final Creator<Configuration> CREATOR = new AutoCreator<>(Configuration.class);
}

View file

@ -0,0 +1,12 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.mgoogle.android.gms.phenotype;
import org.microg.safeparcel.AutoSafeParcelable;
public class DogfoodsToken extends AutoSafeParcelable {
public static final Creator<DogfoodsToken> CREATOR = new AutoCreator<>(DogfoodsToken.class);
}

View file

@ -0,0 +1,30 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.mgoogle.android.gms.phenotype;
import org.microg.safeparcel.AutoSafeParcelable;
public class ExperimentTokens extends AutoSafeParcelable {
@Field(2)
public String field2;
@Field(3)
public byte[] direct;
@Field(4)
public byte[][] gaia;
@Field(5)
public byte[][] pseudo;
@Field(6)
public byte[][] always;
@Field(7)
public byte[][] other;
@Field(8)
public int[] weak;
@Field(9)
public byte[][] directs;
@Field(10)
public int[] genericDimensions;
public static final Creator<ExperimentTokens> CREATOR = new AutoCreator<>(ExperimentTokens.class);
}

View file

@ -8,5 +8,95 @@ package com.mgoogle.android.gms.phenotype;
import org.microg.safeparcel.AutoSafeParcelable;
public class Flag extends AutoSafeParcelable {
@Field(2)
public String name;
@Field(3)
private long longValue;
@Field(4)
private boolean boolValue;
@Field(5)
private double doubleValue;
@Field(6)
private String stringValue;
@Field(7)
private byte[] bytesValue;
@Field(8)
public int dataType;
@Field(9)
public int flagType;
private Flag() {
}
public Flag(String name, long longValue, int flagType) {
this.name = name;
this.longValue = longValue;
this.dataType = DATA_TYPE_LONG;
this.flagType = flagType;
}
public Flag(String name, boolean boolValue, int flagType) {
this.name = name;
this.boolValue = boolValue;
this.dataType = DATA_TYPE_BOOL;
this.flagType = flagType;
}
public Flag(String name, double doubleValue, int flagType) {
this.name = name;
this.doubleValue = doubleValue;
this.dataType = DATA_TYPE_DOUBLE;
this.flagType = flagType;
}
public Flag(String name, String stringValue, int flagType) {
this.name = name;
this.stringValue = stringValue;
this.dataType = DATA_TYPE_STRING;
this.flagType = flagType;
}
public Flag(String name, byte[] bytesValue, int flagType) {
this.name = name;
this.bytesValue = bytesValue;
this.dataType = DATA_TYPE_BYTES;
this.flagType = flagType;
}
public long getLong() {
if (dataType == DATA_TYPE_LONG)
return longValue;
throw new IllegalArgumentException("Not a long type");
}
public boolean getBool() {
if (dataType == DATA_TYPE_BOOL)
return boolValue;
throw new IllegalArgumentException("Not a boolean type");
}
public double getDouble() {
if (dataType == DATA_TYPE_DOUBLE)
return doubleValue;
throw new IllegalArgumentException("Not a double type");
}
public String getString() {
if (dataType == DATA_TYPE_STRING)
return stringValue;
throw new IllegalArgumentException("Not a String type");
}
public byte[] getBytes() {
if (dataType == DATA_TYPE_BYTES)
return bytesValue;
throw new IllegalArgumentException("Not a bytes type");
}
public static final int DATA_TYPE_LONG = 1;
public static final int DATA_TYPE_BOOL = 2;
public static final int DATA_TYPE_DOUBLE = 3;
public static final int DATA_TYPE_STRING = 4;
public static final int DATA_TYPE_BYTES = 5;
public static final Creator<Flag> CREATOR = new AutoCreator<>(Flag.class);
}

View file

@ -0,0 +1,12 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.mgoogle.android.gms.phenotype;
import org.microg.safeparcel.AutoSafeParcelable;
public class FlagOverrides extends AutoSafeParcelable {
public static final Creator<FlagOverrides> CREATOR = new AutoCreator<>(FlagOverrides.class);
}

View file

@ -0,0 +1,27 @@
/*
* SPDX-FileCopyrightText: 2021 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.mgoogle.android.gms.phenotype;
import org.microg.safeparcel.AutoSafeParcelable;
public class RegistrationInfo extends AutoSafeParcelable {
@Field(1)
public String field1;
@Field(2)
public int field2;
@Field(3)
public String[] field3;
@Field(4)
public byte[] field4;
@Field(5)
public boolean field5;
@Field(6)
public int[] field6;
@Field(7)
public String field7;
public static final Creator<RegistrationInfo> CREATOR = new AutoCreator<>(RegistrationInfo.class);
}

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-FileCopyrightText: 2020 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
@ -10,14 +10,14 @@ import android.util.Log
import com.google.android.gms.common.api.Status
import com.google.android.gms.common.internal.GetServiceRequest
import com.google.android.gms.common.internal.IGmsCallbacks
import com.mgoogle.android.gms.phenotype.Configurations
import com.mgoogle.android.gms.phenotype.*
import com.mgoogle.android.gms.phenotype.internal.IPhenotypeCallbacks
import com.mgoogle.android.gms.phenotype.internal.IPhenotypeService
import org.microg.gms.BaseService
import org.microg.gms.common.GmsService
import org.microg.gms.utils.warnOnTransactionIssues
private const val TAG = "GmsPhenotypeSvc"
private const val TAG = "PhenotypeService"
class PhenotypeService : BaseService(TAG, GmsService.PHENOTYPE) {
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest?, service: GmsService?) {
@ -28,20 +28,117 @@ class PhenotypeService : BaseService(TAG, GmsService.PHENOTYPE) {
class PhenotypeServiceImpl : IPhenotypeService.Stub() {
override fun register(callbacks: IPhenotypeCallbacks, p1: String?, p2: Int, p3: Array<out String>?, p4: ByteArray?) {
Log.d(TAG, "register($p1, $p2, $p3, $p4)")
callbacks.onRegister(Status.SUCCESS)
callbacks.onRegistered(Status.SUCCESS)
}
override fun register2(callbacks: IPhenotypeCallbacks, p1: String?, p2: Int, p3: Array<out String>?, p4: IntArray?, p5: ByteArray?) {
Log.d(TAG, "register2($p1, $p2, $p3, $p4, $p5)")
callbacks.onRegister(Status.SUCCESS)
override fun weakRegister(callbacks: IPhenotypeCallbacks, p1: String?, p2: Int, p3: Array<out String>?, p4: IntArray?, p5: ByteArray?) {
Log.d(TAG, "weakRegister($p1, $p2, $p3, $p4, $p5)")
callbacks.onWeakRegistered(Status.SUCCESS)
}
override fun getConfigurationSnapshot(callbacks: IPhenotypeCallbacks, p1: String?, p2: String?, p3: String?) {
Log.d(TAG, "getConfigurationSnapshot($p1, $p2, $p3)")
callbacks.onConfigurations(Status.SUCCESS, Configurations().apply {
override fun unregister(callbacks: IPhenotypeCallbacks, p1: String?) {
Log.d(TAG, "unregister($p1)")
callbacks.onUnregistered(Status.SUCCESS)
}
override fun getConfigurationSnapshot(callbacks: IPhenotypeCallbacks, p1: String?, p2: String?) {
Log.d(TAG, "getConfigurationSnapshot($p1, $p2)")
callbacks.onConfiguration(Status.SUCCESS, Configurations().apply {
field4 = emptyArray()
})
}
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = warnOnTransactionIssues(code, reply, flags) { super.onTransact(code, data, reply, flags) }
override fun commitToConfiguration(callbacks: IPhenotypeCallbacks, p1: String?) {
Log.d(TAG, "commitToConfiguration($p1)")
callbacks.onCommitedToConfiguration(Status.SUCCESS)
}
override fun getExperimentTokens(callbacks: IPhenotypeCallbacks, p1: String?, logSourceName: String?) {
Log.d(TAG, "getExperimentTokens($p1, $logSourceName)")
callbacks.onExperimentTokens(Status.SUCCESS, ExperimentTokens())
}
override fun getDogfoodsToken(callbacks: IPhenotypeCallbacks) {
Log.d(TAG, "getDogfoodsToken()")
callbacks.onDogfoodsToken(Status.SUCCESS, DogfoodsToken())
}
override fun setDogfoodsToken(callbacks: IPhenotypeCallbacks, p1: ByteArray?) {
Log.d(TAG, "setDogfoodsToken($p1)")
callbacks.onDogfoodsTokenSet(Status.SUCCESS)
}
override fun getFlag(callbacks: IPhenotypeCallbacks, packageName: String?, name: String?, type: Int) {
Log.d(TAG, "setDogfoodsToken($packageName, $name, $type)")
callbacks.onFlag(Status.SUCCESS, null)
}
override fun getCommitedConfiguration(callbacks: IPhenotypeCallbacks, p1: String?) {
Log.d(TAG, "getCommitedConfiguration($p1)")
callbacks.onCommittedConfiguration(Status.SUCCESS, Configurations().apply {
field4 = emptyArray()
})
}
override fun getConfigurationSnapshot2(callbacks: IPhenotypeCallbacks, p1: String?, p2: String?, p3: String?) {
Log.d(TAG, "getConfigurationSnapshot2($p1, $p2, $p3)")
callbacks.onConfiguration(Status.SUCCESS, Configurations().apply {
field4 = emptyArray()
})
}
override fun syncAfterOperation(callbacks: IPhenotypeCallbacks, p1: String?, p2: Long) {
Log.d(TAG, "syncAfterOperation($p1, $p2)")
callbacks.onSyncFinished(Status.SUCCESS, p2)
}
override fun registerSync(callbacks: IPhenotypeCallbacks, p1: String?, p2: Int, p3: Array<out String>?, p4: ByteArray?, p5: String?, p6: String?) {
Log.d(TAG, "registerSync($p1, $p2, $p3, $p4, $p5, $p6)")
callbacks.onConfiguration(Status.SUCCESS, Configurations().apply {
field4 = emptyArray()
})
}
override fun setFlagOverrides(callbacks: IPhenotypeCallbacks, packageName: String?, user: String?, flagName: String?, flagType: Int, flagDataType: Int, flagValue: String?) {
Log.d(TAG, "setFlagOverrides($packageName, $user, $flagName, $flagDataType, $flagType, $flagDataType, $flagValue)")
callbacks.onFlagOverridesSet(Status.SUCCESS)
}
override fun deleteFlagOverrides(callbacks: IPhenotypeCallbacks, packageName: String?, user: String?, flagName: String?) {
Log.d(TAG, "deleteFlagOverrides($packageName, $user, $flagName)")
callbacks.onFlagOverrides(Status.SUCCESS, FlagOverrides())
}
override fun listFlagOverrides(callbacks: IPhenotypeCallbacks, packageName: String?, user: String?, flagName: String?) {
Log.d(TAG, "listFlagOverrides($packageName, $user, $flagName)")
callbacks.onFlagOverrides(Status.SUCCESS, FlagOverrides())
}
override fun clearFlagOverrides(callbacks: IPhenotypeCallbacks, packageName: String?, user: String?) {
Log.d(TAG, "clearFlagOverrides($packageName, $user)")
callbacks.onFlagOverridesSet(Status.SUCCESS)
}
override fun bulkRegister(callbacks: IPhenotypeCallbacks, infos: Array<out RegistrationInfo>?) {
Log.d(TAG, "bulkRegister($infos)")
callbacks.onRegistered(Status.SUCCESS)
}
override fun setAppSpecificProperties(callbacks: IPhenotypeCallbacks, p1: String?, p2: ByteArray?) {
Log.d(TAG, "setAppSpecificProperties($p1, $p2)")
callbacks.onAppSpecificPropertiesSet(Status.SUCCESS)
}
override fun getServingVersion(callbacks: IPhenotypeCallbacks) {
Log.d(TAG, "getServingVersion()")
callbacks.onServingVersion(Status.SUCCESS, 1)
}
override fun getExperimentTokens2(callbacks: IPhenotypeCallbacks, p1: String?, p2: String?, p3: String?, p4: String?) {
Log.d(TAG, "getExperimentTokens2($p1, $p2, $p3, $p4)")
callbacks.onExperimentTokens(Status.SUCCESS, ExperimentTokens())
}
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
warnOnTransactionIssues(code, reply, flags) { super.onTransact(code, data, reply, flags) }
}