diff --git a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassRequestParcel.aidl b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassRequestParcel.aidl new file mode 100644 index 0000000000..ffe2ae733b --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassRequestParcel.aidl @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.gass.internal; + +parcelable GassRequestParcel; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassResponseParcel.aidl b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassResponseParcel.aidl new file mode 100644 index 0000000000..f8f40a73c9 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/GassResponseParcel.aidl @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.gass.internal; + +parcelable GassResponseParcel; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/IGassService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/IGassService.aidl new file mode 100644 index 0000000000..7fafe56aa0 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/gass/internal/IGassService.aidl @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.gass.internal; + +import android.os.Bundle; +import android.os.IInterface; +import com.google.android.gms.gass.internal.GassRequestParcel; +import com.google.android.gms.gass.internal.GassResponseParcel; + +interface IGassService { + GassResponseParcel getGassResponse(in GassRequestParcel gassRequestParcel) = 0; + Bundle getGassBundle(in Bundle bundle, int code) = 3; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/PseudonymousIdToken.aidl b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/PseudonymousIdToken.aidl new file mode 100644 index 0000000000..b8d88c14dd --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/PseudonymousIdToken.aidl @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.pseudonymous; + +parcelable PseudonymousIdToken; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdCallbacks.aidl new file mode 100644 index 0000000000..f6a47ded67 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdCallbacks.aidl @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.pseudonymous.internal; + +import com.google.android.gms.common.api.Status; +import com.google.android.gms.pseudonymous.PseudonymousIdToken; + +interface IPseudonymousIdCallbacks { + void onGetTokenResponse(in Status status, in PseudonymousIdToken token) = 0; + void onSetTokenResponse(in Status status) = 1; + void onGetLastResetWallTimeMsResponse(in Status status, long time) = 2; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdService.aidl new file mode 100644 index 0000000000..e99f7df675 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/pseudonymous/internal/IPseudonymousIdService.aidl @@ -0,0 +1,15 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.pseudonymous.internal; + +import com.google.android.gms.pseudonymous.internal.IPseudonymousIdCallbacks; +import com.google.android.gms.pseudonymous.PseudonymousIdToken; + +interface IPseudonymousIdService { + void getToken(IPseudonymousIdCallbacks call) = 0; + void setToken(IPseudonymousIdCallbacks call, in PseudonymousIdToken token) = 1; + void getLastResetWallTimeMs(IPseudonymousIdCallbacks callbacks) = 2; +} diff --git a/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassRequestParcel.java b/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassRequestParcel.java new file mode 100644 index 0000000000..666696835d --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassRequestParcel.java @@ -0,0 +1,32 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.gass.internal; + +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; + +@SafeParcelable.Class +public class GassRequestParcel extends AbstractSafeParcelable { + + @Field(1) + public int versionCode; + @Field(2) + public String packageName; + @Field(3) + public String appVersionCode; + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(GassRequestParcel.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassResponseParcel.java b/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassResponseParcel.java new file mode 100644 index 0000000000..34e2c61745 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/gass/internal/GassResponseParcel.java @@ -0,0 +1,49 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.gass.internal; + +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 com.google.android.gms.feedback.ErrorReport; + +@SafeParcelable.Class +public class GassResponseParcel extends AbstractSafeParcelable { + + @Field(1) + public int versionCode; + + @Field(2) + public byte[] data; + + public ErrorReport report; + + public GassResponseParcel() { + } + + public GassResponseParcel(int i, byte[] bArr) { + this.versionCode = i; + this.report = null; + this.data = bArr; + } + + public GassResponseParcel(ErrorReport report) { + this.versionCode = 1; + this.report = report; + this.data = null; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(GassResponseParcel.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/pseudonymous/PseudonymousIdToken.java b/play-services-api/src/main/java/com/google/android/gms/pseudonymous/PseudonymousIdToken.java new file mode 100644 index 0000000000..18df15cb08 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/pseudonymous/PseudonymousIdToken.java @@ -0,0 +1,34 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.pseudonymous; + +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; + +@SafeParcelable.Class +public class PseudonymousIdToken extends AbstractSafeParcelable { + + @Field(2) + public String name; + + @Constructor + public PseudonymousIdToken(@Param(2) String name) { + this.name = name; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(PseudonymousIdToken.class); + +} diff --git a/play-services-appset/build.gradle b/play-services-appset/build.gradle new file mode 100644 index 0000000000..cb838e7e5e --- /dev/null +++ b/play-services-appset/build.gradle @@ -0,0 +1,37 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +apply plugin: 'com.android.library' + +android { + namespace "com.google.android.gms.appset" + + compileSdkVersion androidCompileSdk + buildToolsVersion "$androidBuildVersionTools" + + buildFeatures { + aidl = true + } + + defaultConfig { + versionName version + minSdkVersion androidMinSdk + targetSdkVersion androidTargetSdk + } + + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } +} + +description = 'microG implementation of play-services-appset' + +dependencies { + api project(':play-services-base') + api project(':play-services-basement') + + annotationProcessor project(':safe-parcel-processor') +} diff --git a/play-services-appset/core/build.gradle b/play-services-appset/core/build.gradle new file mode 100644 index 0000000000..c6017e1a20 --- /dev/null +++ b/play-services-appset/core/build.gradle @@ -0,0 +1,56 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'maven-publish' +apply plugin: 'signing' + +dependencies { + api project(':play-services-appset') + + implementation project(':play-services-base-core') + + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion" +} + +android { + namespace "org.microg.gms.appset.core" + + compileSdkVersion androidCompileSdk + buildToolsVersion "$androidBuildVersionTools" + + defaultConfig { + versionName version + minSdkVersion androidMinSdk + targetSdkVersion androidTargetSdk + } + + sourceSets { + main { + java.srcDirs = ['src/main/kotlin'] + } + } + + lintOptions { + disable 'MissingTranslation' + } + + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } + + kotlinOptions { + jvmTarget = 1.8 + } +} + +// Nothing to publish yet +//apply from: '../gradle/publish-android.gradle' + +description = 'microG service implementation for play-services-appset' diff --git a/play-services-appset/core/src/main/AndroidManifest.xml b/play-services-appset/core/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..0df43222f7 --- /dev/null +++ b/play-services-appset/core/src/main/AndroidManifest.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt b/play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt new file mode 100644 index 0000000000..a024f498d4 --- /dev/null +++ b/play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.appset + +import android.util.Log +import com.google.android.gms.appset.AppSetIdRequestParams +import com.google.android.gms.appset.internal.IAppSetIdCallback +import com.google.android.gms.appset.internal.IAppSetService +import com.google.android.gms.common.ConnectionResult +import com.google.android.gms.common.Feature +import com.google.android.gms.common.api.Status +import com.google.android.gms.common.internal.ConnectionInfo +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 = "AppSetService" +private val FEATURES = arrayOf(Feature("app_set_id", 1L)) + +class AppSetService : BaseService(TAG, GmsService.APP_SET) { + + override fun handleServiceRequest(callback: IGmsCallbacks?, request: GetServiceRequest?, service: GmsService?) { + callback?.onPostInitCompleteWithConnectionInfo( + ConnectionResult.SUCCESS, + AppSetServiceImpl().asBinder(), + ConnectionInfo().apply { features = FEATURES } + ) + } +} + +class AppSetServiceImpl : IAppSetService.Stub() { + override fun getAppSetIdInfo(params: AppSetIdRequestParams?, callback: IAppSetIdCallback?) { + Log.d(TAG, "AppSetServiceImp getAppSetIdInfo is called -> ${params?.toString()} ") + callback?.onAppSetInfo(Status.SUCCESS, null) + } +} diff --git a/play-services-appset/src/main/AndroidManifest.xml b/play-services-appset/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..8bdb7e14b3 --- /dev/null +++ b/play-services-appset/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetIdRequestParams.aidl b/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetIdRequestParams.aidl new file mode 100644 index 0000000000..5beef70820 --- /dev/null +++ b/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetIdRequestParams.aidl @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.appset; + +parcelable AppSetIdRequestParams; diff --git a/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetInfoParcel.aidl b/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetInfoParcel.aidl new file mode 100644 index 0000000000..c2d4818acf --- /dev/null +++ b/play-services-appset/src/main/aidl/com/google/android/gms/appset/AppSetInfoParcel.aidl @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.appset; + +parcelable AppSetInfoParcel; diff --git a/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetIdCallback.aidl b/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetIdCallback.aidl new file mode 100644 index 0000000000..1b453de3dd --- /dev/null +++ b/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetIdCallback.aidl @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.appset.internal; + +import com.google.android.gms.appset.AppSetInfoParcel; +import com.google.android.gms.common.api.Status; + +interface IAppSetIdCallback { + void onAppSetInfo(in Status status, in AppSetInfoParcel info) = 0; +} \ No newline at end of file diff --git a/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetService.aidl b/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetService.aidl new file mode 100644 index 0000000000..59dbb6f926 --- /dev/null +++ b/play-services-appset/src/main/aidl/com/google/android/gms/appset/internal/IAppSetService.aidl @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.appset.internal; + +import com.google.android.gms.appset.AppSetIdRequestParams; +import com.google.android.gms.appset.internal.IAppSetIdCallback; + +interface IAppSetService { + void getAppSetIdInfo(in AppSetIdRequestParams params, in IAppSetIdCallback callback) = 0; +} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSet.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSet.java new file mode 100644 index 0000000000..f361652754 --- /dev/null +++ b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSet.java @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.android.gms.appset; + +import android.content.Context; +import androidx.annotation.NonNull; + +/** + * Entry point of the app set APIs. + */ +public class AppSet { + /** + * Creates a new instance of {@link AppSetIdClient}. + */ + @NonNull + public static AppSetIdClient getClient (Context context) { + throw new UnsupportedOperationException(); + } +} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdClient.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdClient.java new file mode 100644 index 0000000000..91b6a671c4 --- /dev/null +++ b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdClient.java @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.android.gms.appset; + +import androidx.annotation.NonNull; +import com.google.android.gms.tasks.Task; + +/** + * A client for interacting with the {@link AppSetIdInfo} API. + */ +public interface AppSetIdClient { + /** + * Gets the AppSetIdInfo asynchronously. + * + * @return a {@link Task} of the returned {@link AppSetIdInfo}. + */ + @NonNull + Task getAppSetIdInfo(); +} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdInfo.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdInfo.java new file mode 100644 index 0000000000..29608f5fb8 --- /dev/null +++ b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdInfo.java @@ -0,0 +1,75 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.android.gms.appset; + +import androidx.annotation.IntDef; +import org.microg.gms.common.Hide; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Contains information about app set ID. + */ +public class AppSetIdInfo { + /** + * The app set ID is scoped to the app. + */ + public static final int SCOPE_APP = 1; + /** + * The app set ID is scoped to a developer account on an app store. All apps from the same developer on a device will have + * the same developer scoped app set ID. + */ + public static final int SCOPE_DEVELOPER = 2; + + private final String id; + private final @Scope int scope; + + @Hide + public AppSetIdInfo(String id, @Scope int scope) { + this.id = id; + this.scope = scope; + } + + /** + * Gets the app set ID. + * + * @return the app set ID. + */ + public String getId() { + return id; + } + + /** + * Returns the {@link AppSetIdInfo.Scope} of the app set ID. Possible values include {@link #SCOPE_APP} and {@link #SCOPE_DEVELOPER}. + * + * @return the app set ID's {@link AppSetIdInfo.Scope}. + */ + public @Scope int getScope() { + return scope; + } + + /** + * Allowed constants for {@link AppSetIdInfo#getScope()}. + *

+ * Supported constants: + *

    + *
  • {@link #SCOPE_APP}
  • + *
  • {@link #SCOPE_DEVELOPER}
  • + *
+ */ + @Target({ElementType.TYPE_USE}) + @Retention(RetentionPolicy.SOURCE) + @IntDef({SCOPE_APP, SCOPE_DEVELOPER}) + public @interface Scope { + + } +} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdRequestParams.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdRequestParams.java new file mode 100644 index 0000000000..2bc9b0d019 --- /dev/null +++ b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdRequestParams.java @@ -0,0 +1,45 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.appset; + +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.common.Hide; +import org.microg.gms.utils.ToStringHelper; + +@SafeParcelable.Class +@Hide +public class AppSetIdRequestParams extends AbstractSafeParcelable { + @Field(1) + public final String version; + @Field(2) + public final String clientAppPackageName; + + @Constructor + public AppSetIdRequestParams(@Param(1) String version, @Param(2) String clientAppPackageName) { + this.version = version; + this.clientAppPackageName = clientAppPackageName; + } + + @NonNull + @Override + public String toString() { + return ToStringHelper.name("AppSetIdRequestParams").field("version", version).field("clientAppPackageName", clientAppPackageName).end(); + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AppSetIdRequestParams.class); +} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetInfoParcel.java b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetInfoParcel.java new file mode 100644 index 0000000000..dd47b947df --- /dev/null +++ b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetInfoParcel.java @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.appset; + +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.common.Hide; + +@SafeParcelable.Class +@Hide +public class AppSetInfoParcel extends AbstractSafeParcelable { + @Field(1) + public final String id; + @Field(2) + public final int scope; + + @Constructor + public AppSetInfoParcel(@Param(1) String id, @Param(2) int scope) { + this.id = id; + this.scope = scope; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(AppSetInfoParcel.class); + +} diff --git a/play-services-appset/src/main/java/com/google/android/gms/appset/package-info.java b/play-services-appset/src/main/java/com/google/android/gms/appset/package-info.java new file mode 100644 index 0000000000..e9ab491d25 --- /dev/null +++ b/play-services-appset/src/main/java/com/google/android/gms/appset/package-info.java @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2022 microG Project Team + * SPDX-License-Identifier: CC-BY-4.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ +/** + * For analytics or fraud prevention use cases, on a given device you may + need to correlate usage or actions across a set of apps owned by your organization. + */ +package com.google.android.gms.appset; diff --git a/play-services-auth-base/src/main/aidl/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.aidl b/play-services-auth-base/src/main/aidl/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.aidl new file mode 100644 index 0000000000..950fc2fbb3 --- /dev/null +++ b/play-services-auth-base/src/main/aidl/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.aidl @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.auth.firstparty.dataservice; + +parcelable DeviceManagementInfoResponse; diff --git a/play-services-auth-base/src/main/java/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.java b/play-services-auth-base/src/main/java/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.java new file mode 100644 index 0000000000..bb93f63a9a --- /dev/null +++ b/play-services-auth-base/src/main/java/com/google/android/gms/auth/firstparty/dataservice/DeviceManagementInfoResponse.java @@ -0,0 +1,44 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.auth.firstparty.dataservice; + +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; + +@SafeParcelable.Class +public class DeviceManagementInfoResponse extends AbstractSafeParcelable { + @Field(1) + public final int versionCode; + @Field(2) + public final String info; + @Field(3) + public final boolean status; + + + @Constructor + public DeviceManagementInfoResponse(@Param(1) int versionCode, @Param(2) String info, @Param(3) boolean status) { + this.versionCode = versionCode; + this.info = info; + this.status = status; + } + + public DeviceManagementInfoResponse(String info, boolean status) { + this(1, info, status); + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + CREATOR.writeToParcel(this, dest, flags); + } + + public static final SafeParcelableCreatorAndWriter CREATOR = findCreator(DeviceManagementInfoResponse.class); + +} diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IAccountDataService.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IAccountDataService.aidl new file mode 100644 index 0000000000..2fd6c8540b --- /dev/null +++ b/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IAccountDataService.aidl @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.auth.account.data; + +import com.google.android.gms.auth.account.data.IDeviceManagementInfoCallback; +import android.accounts.Account; +import com.google.android.gms.common.api.internal.IStatusCallback; + +interface IAccountDataService { + void requestDeviceManagementInfo(in IDeviceManagementInfoCallback callback, in Account account) = 0; + void requestAccountInfo(in IStatusCallback callback, in Account account, boolean isPrimary) = 1; + void requestProfileInfo(in IStatusCallback callback, String profile) = 2; +} diff --git a/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IDeviceManagementInfoCallback.aidl b/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IDeviceManagementInfoCallback.aidl new file mode 100644 index 0000000000..801beac3ff --- /dev/null +++ b/play-services-auth/src/main/aidl/com/google/android/gms/auth/account/data/IDeviceManagementInfoCallback.aidl @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.auth.account.data; + +import com.google.android.gms.auth.firstparty.dataservice.DeviceManagementInfoResponse; +import com.google.android.gms.common.api.Status; + +interface IDeviceManagementInfoCallback { + void onResult(in Status status, in DeviceManagementInfoResponse response); +} diff --git a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java index 17e4d6ef30..b926f6f369 100644 --- a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java +++ b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java @@ -168,6 +168,7 @@ public enum GmsService { OCR(279, "com.google.android.gms.ocr.service.START"), POTOKENS(285, "com.google.android.gms.potokens.service.START"), OCR_INTERNAL(281, "com.google.android.gms.ocr.service.internal.START"), + APP_SET(300, "com.google.android.gms.appset.service.START"), MODULE_INSTALL(308, "com.google.android.gms.chimera.container.moduleinstall.ModuleInstallService.START"), IN_APP_REACH(315, "com.google.android.gms.inappreach.service.START"), APP_ERRORS(334, "com.google.android.gms.apperrors.service.START_APP_ERROR"), diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle index 424c785c47..43f7ea95f3 100644 --- a/play-services-core/build.gradle +++ b/play-services-core/build.gradle @@ -24,6 +24,7 @@ dependencies { implementation project(':play-services-ads-identifier-core') implementation project(':play-services-ads-lite-core') implementation project(':play-services-appinvite-core') + implementation project(':play-services-appset-core') implementation project(':play-services-auth-api-phone-core') implementation project(':play-services-base-core') implementation project(':play-services-cast-core') diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index ff1260caed..de2e72a643 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -835,6 +835,24 @@ + + + + + + + + + + + + + + + + + + @@ -863,7 +881,6 @@ - @@ -910,7 +927,6 @@ - @@ -944,7 +960,6 @@ - diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/account/data/AccountDataService.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/account/data/AccountDataService.kt new file mode 100644 index 0000000000..e81ae066c9 --- /dev/null +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/account/data/AccountDataService.kt @@ -0,0 +1,52 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.auth.account.data + +import android.accounts.Account +import android.util.Log +import com.google.android.gms.auth.account.data.IAccountDataService +import com.google.android.gms.auth.account.data.IDeviceManagementInfoCallback +import com.google.android.gms.auth.firstparty.dataservice.DeviceManagementInfoResponse +import com.google.android.gms.common.ConnectionResult +import com.google.android.gms.common.Feature +import com.google.android.gms.common.api.Status +import com.google.android.gms.common.api.internal.IStatusCallback +import com.google.android.gms.common.internal.ConnectionInfo +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 = "AccountDataService" + +class AccountDataService : BaseService(TAG, GmsService.ACCOUNT_DATA) { + + override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { + callback.onPostInitCompleteWithConnectionInfo( + ConnectionResult.SUCCESS, + AccountDataServiceImpl().asBinder(), + ConnectionInfo().apply { features = FEATURES } + ) + } + +} + +class AccountDataServiceImpl : IAccountDataService.Stub() { + override fun requestDeviceManagementInfo(callback: IDeviceManagementInfoCallback, account: Account?) { + Log.d(TAG, "requestDeviceManagementInfo is called ") + callback.onResult(Status.SUCCESS, DeviceManagementInfoResponse(null, false)) + } + + override fun requestAccountInfo(callback: IStatusCallback, account: Account?, isPrimary: Boolean) { + Log.d(TAG, "requestAccountInfo is called ") + callback.onResult(Status.SUCCESS) + } + + override fun requestProfileInfo(callback: IStatusCallback, profile: String?) { + Log.d(TAG, "requestProfileInfo is called ") + callback.onResult(Status.SUCCESS) + } +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/gass/GassService.kt b/play-services-core/src/main/kotlin/org/microg/gms/gass/GassService.kt new file mode 100644 index 0000000000..afff107fef --- /dev/null +++ b/play-services-core/src/main/kotlin/org/microg/gms/gass/GassService.kt @@ -0,0 +1,39 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ +package org.microg.gms.gass + +import android.os.Bundle +import android.util.Log +import com.google.android.gms.common.ConnectionResult +import com.google.android.gms.common.internal.GetServiceRequest +import com.google.android.gms.common.internal.IGmsCallbacks +import com.google.android.gms.gass.internal.GassRequestParcel +import com.google.android.gms.gass.internal.GassResponseParcel +import com.google.android.gms.gass.internal.IGassService +import org.microg.gms.BaseService +import org.microg.gms.common.GmsService + +private const val TAG = "GassService" + +class GassService : BaseService(TAG, GmsService.GASS) { + + override fun handleServiceRequest(callback: IGmsCallbacks?, request: GetServiceRequest?, service: GmsService?) { + callback?.onPostInitComplete(ConnectionResult.SUCCESS, GassServiceImpl().asBinder(), null) + } + +} + +class GassServiceImpl : IGassService.Stub() { + override fun getGassBundle(bundle: Bundle?, code: Int): Bundle? { + Log.d(TAG, "GassServiceImpl getGassBundle is Called") + return null + } + + override fun getGassResponse(gassRequestParcel: GassRequestParcel?): GassResponseParcel? { + Log.d(TAG, "GassServiceImpl getGassResponse is Called") + return null + } + +} diff --git a/play-services-core/src/main/kotlin/org/microg/gms/pseudonymous/PseudonymousIdService.kt b/play-services-core/src/main/kotlin/org/microg/gms/pseudonymous/PseudonymousIdService.kt new file mode 100644 index 0000000000..7750ed3a4d --- /dev/null +++ b/play-services-core/src/main/kotlin/org/microg/gms/pseudonymous/PseudonymousIdService.kt @@ -0,0 +1,52 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.pseudonymous + +import android.util.Log +import com.google.android.gms.common.Feature +import com.google.android.gms.common.api.CommonStatusCodes +import com.google.android.gms.common.api.Status +import com.google.android.gms.common.internal.ConnectionInfo +import com.google.android.gms.common.internal.GetServiceRequest +import com.google.android.gms.common.internal.IGmsCallbacks +import com.google.android.gms.pseudonymous.PseudonymousIdToken +import com.google.android.gms.pseudonymous.internal.IPseudonymousIdCallbacks +import com.google.android.gms.pseudonymous.internal.IPseudonymousIdService +import org.microg.gms.BaseService +import org.microg.gms.common.GmsService + +private const val TAG = "PseudonymousIdService" +private val FEATURES = arrayOf(Feature("get_last_reset_time_api", 1L)) + +class PseudonymousIdService : BaseService(TAG, GmsService.PSEUDONYMOUS_ID) { + + override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { + Log.e(TAG, " PseudonymousIdService handleServiceRequest is start") + callback.onPostInitCompleteWithConnectionInfo( + CommonStatusCodes.SUCCESS, + PseudonymousIdServiceImpl().asBinder(), + ConnectionInfo().apply { features = FEATURES } + ) + } +} + +class PseudonymousIdServiceImpl : IPseudonymousIdService.Stub() { + + override fun getToken(call: IPseudonymousIdCallbacks) { + Log.d(TAG, "PseudonymousIdServiceImpl onResponse is called") + call.onGetTokenResponse(Status.SUCCESS, PseudonymousIdToken(null)) + } + + override fun setToken(call: IPseudonymousIdCallbacks, token: PseudonymousIdToken?) { + Log.d(TAG, "PseudonymousIdServiceImpl onResponseToken is called") + call.onSetTokenResponse(Status.SUCCESS) + } + + override fun getLastResetWallTimeMs(callbacks: IPseudonymousIdCallbacks?) { + Log.d(TAG, "Not yet implemented: getLastResetWallTimeMs") + } + +} diff --git a/settings.gradle b/settings.gradle index e1831588e9..8da636b3a1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,6 +25,7 @@ include ':play-services-ads-base' include ':play-services-ads-identifier' include ':play-services-ads-lite' include ':play-services-appinvite' +include ':play-services-appset' include ':play-services-auth' include ':play-services-auth-api-phone' include ':play-services-auth-base' @@ -76,6 +77,7 @@ sublude ':play-services-ads:core' sublude ':play-services-ads-identifier:core' sublude ':play-services-ads-lite:core' sublude ':play-services-appinvite:core' +sublude ':play-services-appset:core' sublude ':play-services-auth-api-phone:core' sublude ':play-services-base:core' sublude ':play-services-base:core:package'