-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dummy service for AUDIT(154) (#2156)
Co-authored-by: Marvin W <[email protected]>
- Loading branch information
1 parent
c28909a
commit e098483
Showing
7 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
play-services-api/src/main/aidl/com/google/android/gms/audit/LogAuditRecordsRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
13 changes: 13 additions & 0 deletions
13
play-services-api/src/main/aidl/com/google/android/gms/audit/internal/IAuditService.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
53 changes: 53 additions & 0 deletions
53
play-services-api/src/main/java/com/google/android/gms/audit/LogAuditRecordsRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
play-services-core/src/main/kotlin/com/google/android/gms/audit/internal/AuditApiService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} | ||
|
||
} |