From f6ec0efb639ebf8d09903c44892ea8644ac44eb3 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Wed, 5 May 2021 23:34:56 +0200 Subject: [PATCH] Add FACS Cache dummy --- .../gms/facs/cache/FacsCacheCallOptions.aidl | 3 ++ .../ForceSettingsCacheRefreshResult.aidl | 3 ++ .../GetActivityControlsSettingsResult.aidl | 3 ++ .../cache/ReadDeviceLevelSettingsResult.aidl | 3 ++ .../UpdateActivityControlsSettingsResult.aidl | 3 ++ .../cache/internal/IFacsCacheCallbacks.aidl | 15 ++++++ .../cache/internal/IFacsCacheService.aidl | 12 +++++ .../gms/facs/cache/FacsCacheCallOptions.java | 17 ++++++ .../ForceSettingsCacheRefreshResult.java | 13 +++++ .../GetActivityControlsSettingsResult.java | 13 +++++ .../cache/ReadDeviceLevelSettingsResult.java | 13 +++++ .../UpdateActivityControlsSettingsResult.java | 13 +++++ .../src/main/AndroidManifest.xml | 7 +++ .../org/microg/gms/udc/FacsCacheService.kt | 52 +++++++++++++++++++ 14 files changed, 170 insertions(+) create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/facs/cache/FacsCacheCallOptions.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/facs/cache/ForceSettingsCacheRefreshResult.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/facs/cache/GetActivityControlsSettingsResult.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/facs/cache/ReadDeviceLevelSettingsResult.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/facs/cache/UpdateActivityControlsSettingsResult.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/facs/cache/internal/IFacsCacheCallbacks.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/facs/cache/internal/IFacsCacheService.aidl create mode 100644 play-services-api/src/main/java/com/google/android/gms/facs/cache/FacsCacheCallOptions.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/facs/cache/ForceSettingsCacheRefreshResult.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/facs/cache/GetActivityControlsSettingsResult.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/facs/cache/ReadDeviceLevelSettingsResult.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/facs/cache/UpdateActivityControlsSettingsResult.java create mode 100644 play-services-core/src/main/kotlin/org/microg/gms/udc/FacsCacheService.kt diff --git a/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/FacsCacheCallOptions.aidl b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/FacsCacheCallOptions.aidl new file mode 100644 index 00000000..72a9af06 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/FacsCacheCallOptions.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.facs.cache; + +parcelable FacsCacheCallOptions; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/ForceSettingsCacheRefreshResult.aidl b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/ForceSettingsCacheRefreshResult.aidl new file mode 100644 index 00000000..5bac21a7 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/ForceSettingsCacheRefreshResult.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.facs.cache; + +parcelable ForceSettingsCacheRefreshResult; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/GetActivityControlsSettingsResult.aidl b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/GetActivityControlsSettingsResult.aidl new file mode 100644 index 00000000..627417d4 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/GetActivityControlsSettingsResult.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.facs.cache; + +parcelable GetActivityControlsSettingsResult; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/ReadDeviceLevelSettingsResult.aidl b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/ReadDeviceLevelSettingsResult.aidl new file mode 100644 index 00000000..936f2ee5 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/ReadDeviceLevelSettingsResult.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.facs.cache; + +parcelable ReadDeviceLevelSettingsResult; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/UpdateActivityControlsSettingsResult.aidl b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/UpdateActivityControlsSettingsResult.aidl new file mode 100644 index 00000000..051f9e0f --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/UpdateActivityControlsSettingsResult.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.facs.cache; + +parcelable UpdateActivityControlsSettingsResult; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/internal/IFacsCacheCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/internal/IFacsCacheCallbacks.aidl new file mode 100644 index 00000000..ecea95ab --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/internal/IFacsCacheCallbacks.aidl @@ -0,0 +1,15 @@ +package com.google.android.gms.facs.cache.internal; + +import com.google.android.gms.common.api.Status; +import com.google.android.gms.facs.cache.ForceSettingsCacheRefreshResult; +import com.google.android.gms.facs.cache.GetActivityControlsSettingsResult; +import com.google.android.gms.facs.cache.ReadDeviceLevelSettingsResult; +import com.google.android.gms.facs.cache.UpdateActivityControlsSettingsResult; + +interface IFacsCacheCallbacks { + void onForceSettingsCacheRefreshResult(in Status status, in ForceSettingsCacheRefreshResult result) = 0; + void onUpdateActivityControlsSettingsResult(in Status status, in UpdateActivityControlsSettingsResult result) = 1; + void onGetActivityControlsSettingsResult(in Status status, in GetActivityControlsSettingsResult result) = 2; + void onWriteDeviceLevelSettingsResult(in Status status) = 3; + void onReadDeviceLevelSettingsResult(in Status status, in ReadDeviceLevelSettingsResult result) = 4; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/internal/IFacsCacheService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/internal/IFacsCacheService.aidl new file mode 100644 index 00000000..534c9de4 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/facs/cache/internal/IFacsCacheService.aidl @@ -0,0 +1,12 @@ +package com.google.android.gms.facs.cache.internal; + +import com.google.android.gms.facs.cache.FacsCacheCallOptions; +import com.google.android.gms.facs.cache.internal.IFacsCacheCallbacks; + +interface IFacsCacheService { + void forceSettingsCacheRefresh(IFacsCacheCallbacks callbacks, in FacsCacheCallOptions options) = 0; + void updateActivityControlsSettings(IFacsCacheCallbacks callbacks, in byte[] bytes, in FacsCacheCallOptions options) = 1; + void getActivityControlsSettings(IFacsCacheCallbacks callbacks, in FacsCacheCallOptions options) = 2; + void readDeviceLevelSettings(IFacsCacheCallbacks callbacks) = 3; + void writeDeviceLevelSettings(IFacsCacheCallbacks callbacks, in byte[] bytes) = 4; +} diff --git a/play-services-api/src/main/java/com/google/android/gms/facs/cache/FacsCacheCallOptions.java b/play-services-api/src/main/java/com/google/android/gms/facs/cache/FacsCacheCallOptions.java new file mode 100644 index 00000000..c74383e4 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/facs/cache/FacsCacheCallOptions.java @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.facs.cache; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class FacsCacheCallOptions extends AutoSafeParcelable { + @Field(1) + public String instanceId; + @Field(2) + public long version; + + public static final Creator CREATOR = new AutoCreator<>(FacsCacheCallOptions.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/facs/cache/ForceSettingsCacheRefreshResult.java b/play-services-api/src/main/java/com/google/android/gms/facs/cache/ForceSettingsCacheRefreshResult.java new file mode 100644 index 00000000..18f2177b --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/facs/cache/ForceSettingsCacheRefreshResult.java @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.facs.cache; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ForceSettingsCacheRefreshResult extends AutoSafeParcelable { + + public static final Creator CREATOR = new AutoCreator<>(ForceSettingsCacheRefreshResult.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/facs/cache/GetActivityControlsSettingsResult.java b/play-services-api/src/main/java/com/google/android/gms/facs/cache/GetActivityControlsSettingsResult.java new file mode 100644 index 00000000..6be6139a --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/facs/cache/GetActivityControlsSettingsResult.java @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.facs.cache; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class GetActivityControlsSettingsResult extends AutoSafeParcelable { + + public static final Creator CREATOR = new AutoCreator<>(GetActivityControlsSettingsResult.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/facs/cache/ReadDeviceLevelSettingsResult.java b/play-services-api/src/main/java/com/google/android/gms/facs/cache/ReadDeviceLevelSettingsResult.java new file mode 100644 index 00000000..b89f861a --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/facs/cache/ReadDeviceLevelSettingsResult.java @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.facs.cache; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ReadDeviceLevelSettingsResult extends AutoSafeParcelable { + + public static final Creator CREATOR = new AutoCreator<>(ReadDeviceLevelSettingsResult.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/facs/cache/UpdateActivityControlsSettingsResult.java b/play-services-api/src/main/java/com/google/android/gms/facs/cache/UpdateActivityControlsSettingsResult.java new file mode 100644 index 00000000..4ef2c91d --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/facs/cache/UpdateActivityControlsSettingsResult.java @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.facs.cache; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class UpdateActivityControlsSettingsResult extends AutoSafeParcelable { + + public static final Creator CREATOR = new AutoCreator<>(UpdateActivityControlsSettingsResult.class); +} diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 2fdb92f1..1cbecd77 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -699,6 +699,12 @@ + + + + + + @@ -729,6 +735,7 @@ + diff --git a/play-services-core/src/main/kotlin/org/microg/gms/udc/FacsCacheService.kt b/play-services-core/src/main/kotlin/org/microg/gms/udc/FacsCacheService.kt new file mode 100644 index 00000000..c12b37bf --- /dev/null +++ b/play-services-core/src/main/kotlin/org/microg/gms/udc/FacsCacheService.kt @@ -0,0 +1,52 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.udc + +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.google.android.gms.facs.cache.FacsCacheCallOptions +import com.google.android.gms.facs.cache.internal.IFacsCacheCallbacks +import com.google.android.gms.facs.cache.internal.IFacsCacheService +import org.microg.gms.BaseService +import org.microg.gms.common.GmsService + +private const val TAG = "GmsFacsCache" + +class FacsCacheService : BaseService(TAG, GmsService.FACS_CACHE) { + override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest?, service: GmsService?) { + callback.onPostInitComplete(0, FacsCacheServiceImpl().asBinder(), null) + } +} + +class FacsCacheServiceImpl : IFacsCacheService.Stub() { + override fun forceSettingsCacheRefresh(callbacks: IFacsCacheCallbacks, options: FacsCacheCallOptions) { + Log.d(TAG, "forceSettingsCacheRefresh") + callbacks.onForceSettingsCacheRefreshResult(Status.CANCELED, null) + } + + override fun updateActivityControlsSettings(callbacks: IFacsCacheCallbacks, bytes: ByteArray, options: FacsCacheCallOptions) { + Log.d(TAG, "updateActivityControlsSettings") + callbacks.onUpdateActivityControlsSettingsResult(Status.CANCELED, null) + } + + override fun getActivityControlsSettings(callbacks: IFacsCacheCallbacks, options: FacsCacheCallOptions) { + Log.d(TAG, "getActivityControlsSettings") + callbacks.onGetActivityControlsSettingsResult(Status.CANCELED, null) + } + + override fun readDeviceLevelSettings(callbacks: IFacsCacheCallbacks) { + Log.d(TAG, "readDeviceLevelSettings") + callbacks.onReadDeviceLevelSettingsResult(Status.CANCELED, null) + } + + override fun writeDeviceLevelSettings(callbacks: IFacsCacheCallbacks, bytes: ByteArray) { + Log.d(TAG, "writeDeviceLevelSettings") + callbacks.onWriteDeviceLevelSettingsResult(Status.CANCELED) + } + +}