diff --git a/play-services-api/build.gradle b/play-services-api/build.gradle index 08fa064398..11c3911317 100644 --- a/play-services-api/build.gradle +++ b/play-services-api/build.gradle @@ -41,4 +41,6 @@ android { dependencies { api project(':play-services-base') api project(':play-services-phenotype') + + annotationProcessor project(':safe-parcel-processor') } diff --git a/play-services-api/src/main/aidl/com/google/android/gms/audit/LogAuditRecordsRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/audit/LogAuditRecordsRequest.aidl new file mode 100644 index 0000000000..e2a0155ac0 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/audit/LogAuditRecordsRequest.aidl @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.audit; + +parcelable LogAuditRecordsRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/audit/internal/IAuditService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/audit/internal/IAuditService.aidl new file mode 100644 index 0000000000..7e26825e5a --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/audit/internal/IAuditService.aidl @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.audit.internal; + +import com.google.android.gms.common.api.internal.IStatusCallback; +import com.google.android.gms.audit.LogAuditRecordsRequest; + +interface IAuditService { + void logAuditRecords(in LogAuditRecordsRequest request, IStatusCallback callback); +} \ No newline at end of file diff --git a/play-services-api/src/main/java/com/google/android/gms/audit/LogAuditRecordsRequest.java b/play-services-api/src/main/java/com/google/android/gms/audit/LogAuditRecordsRequest.java new file mode 100644 index 0000000000..8042154c6a --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/audit/LogAuditRecordsRequest.java @@ -0,0 +1,53 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.audit; + +import android.os.Parcel; + +import androidx.annotation.NonNull; + +import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable; +import com.google.android.gms.common.internal.safeparcel.SafeParcelable; +import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter; + +import org.microg.gms.utils.ToStringHelper; + +@SafeParcelable.Class +public class LogAuditRecordsRequest extends AbstractSafeParcelable { + @Field(1) + public int writeMode; + @Field(2) + public int componentId; + @Field(3) + public String accountName; + @Field(4) + public byte[][] auditRecords; + @Field(5) + public byte[] traceToken; + @Field(6) + public byte[] auditToken; + + @NonNull + @Override + public String toString() { + return ToStringHelper.name("LogAuditRecordsRequest") + .field("writeMode", writeMode) + .field("componentId", componentId) + .field("accountName", accountName) + .field("auditRecords", auditRecords) + .field("traceToken", traceToken) + .field("auditToken", auditToken) + .end(); + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(LogAuditRecordsRequest.class); + +} diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/api/Status.java b/play-services-basement/src/main/java/com/google/android/gms/common/api/Status.java index af1c543ca2..b49098d9a5 100644 --- a/play-services-basement/src/main/java/com/google/android/gms/common/api/Status.java +++ b/play-services-basement/src/main/java/com/google/android/gms/common/api/Status.java @@ -40,6 +40,8 @@ public final class Status extends AbstractSafeParcelable implements Result { @PublicApi(exclude = true) public static final Status CANCELED = new Status(CommonStatusCodes.CANCELED, "Cancelled"); @PublicApi(exclude = true) + public static final Status SUCCESS_CACHE = new Status(CommonStatusCodes.SUCCESS_CACHE, "Success"); + @PublicApi(exclude = true) public static final Status SUCCESS = new Status(CommonStatusCodes.SUCCESS, "Success"); @Field(1000) diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index b1255e13a5..a8cda44c3e 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -835,6 +835,12 @@ + + + + + + @@ -847,7 +853,6 @@ - diff --git a/play-services-core/src/main/kotlin/com/google/android/gms/audit/internal/AuditApiService.kt b/play-services-core/src/main/kotlin/com/google/android/gms/audit/internal/AuditApiService.kt new file mode 100644 index 0000000000..450c7e2277 --- /dev/null +++ b/play-services-core/src/main/kotlin/com/google/android/gms/audit/internal/AuditApiService.kt @@ -0,0 +1,44 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.audit.internal + +import android.util.Log +import com.google.android.gms.audit.LogAuditRecordsRequest +import com.google.android.gms.common.ConnectionResult +import com.google.android.gms.common.api.Status +import com.google.android.gms.common.api.internal.IStatusCallback +import com.google.android.gms.common.internal.GetServiceRequest +import com.google.android.gms.common.internal.IGmsCallbacks +import org.microg.gms.BaseService +import org.microg.gms.common.GmsService + +private const val TAG = "AuditApiService" + +class AuditApiService : BaseService(TAG, GmsService.AUDIT) { + override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { + callback.onPostInitComplete(ConnectionResult.SUCCESS, AuditApiServiceImpl().asBinder(), null) + } + +} + +class AuditApiServiceImpl : IAuditService.Stub() { + + override fun logAuditRecords(request: LogAuditRecordsRequest?, callback: IStatusCallback) { + Log.d(TAG, "method 'logAuditRecords' not fully implemented, only return Status.SUCCESS") + when (request?.writeMode) { + 1 -> { + callback.onResult(Status.SUCCESS) + } + 2 -> { + callback.onResult(Status.SUCCESS_CACHE) + } + else -> { + callback.onResult(Status.SUCCESS) + } + } + } + +} \ No newline at end of file