Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dummy service for AUDIT(154) #2156

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions play-services-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ android {
dependencies {
api project(':play-services-base')
api project(':play-services-phenotype')

annotationProcessor project(':safe-parcel-processor')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.audit;

parcelable LogAuditRecordsRequest;
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -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<LogAuditRecordsRequest> CREATOR = findCreator(LogAuditRecordsRequest.class);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,12 @@
</intent-filter>
</service>

<service android:name="com.google.android.gms.audit.internal.AuditApiService">
<intent-filter>
<action android:name="com.google.android.gms.audit.service.START" />
</intent-filter>
</service>

<service android:name="org.microg.gms.DummyService">
<intent-filter>
<action android:name="com.google.android.contextmanager.service.ContextManagerService.START" />
Expand All @@ -847,7 +853,6 @@
<action android:name="com.google.android.gms.appusage.service.START" />
<action android:name="com.google.android.gms.asterism.service.START" />
<action android:name="com.google.android.gms.audiomodem.service.AudioModemService.START" />
<action android:name="com.google.android.gms.audit.service.START" />
<action android:name="com.google.android.gms.auth.account.authapi.START" />
<action android:name="com.google.android.gms.auth.account.authenticator.auto.service.START" />
<action android:name="com.google.android.gms.auth.account.authenticator.chromeos.START" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
}

}
Loading