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-core/src/main/kotlin/com/google/android/gms/appset/internal/AppSetService.kt b/play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt similarity index 86% rename from play-services-core/src/main/kotlin/com/google/android/gms/appset/internal/AppSetService.kt rename to play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt index 6de9ac17cf..a024f498d4 100644 --- a/play-services-core/src/main/kotlin/com/google/android/gms/appset/internal/AppSetService.kt +++ b/play-services-appset/core/src/main/kotlin/org/microg/gms/appset/AppSetService.kt @@ -1,12 +1,14 @@ /* - * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-FileCopyrightText: 2024 microG Project Team * SPDX-License-Identifier: Apache-2.0 */ -package com.google.android.gms.appset.internal +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 @@ -35,4 +37,4 @@ class AppSetServiceImpl : IAppSetService.Stub() { Log.d(TAG, "AppSetServiceImp getAppSetIdInfo is called -> ${params?.toString()} ") callback?.onAppSetInfo(Status.SUCCESS, null) } -} \ No newline at end of file +} 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..5dada3c85c --- /dev/null +++ b/play-services-appset/src/main/java/com/google/android/gms/appset/AppSetIdClient.java @@ -0,0 +1,24 @@ +/* + * 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(); +} \ No newline at end of file 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: + *

+ */ + @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 index 1a6224dad4..2bc9b0d019 100644 --- 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 @@ -13,9 +13,11 @@ 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; 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 index 378e99138b..dd47b947df 100644 --- 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 @@ -12,8 +12,10 @@ 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; 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-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index a3a57a5575..de2e72a643 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -835,30 +835,24 @@ - + - + - + - - - - - - diff --git a/play-services-core/src/main/kotlin/com/google/android/gms/gass/internal/GassService.kt b/play-services-core/src/main/kotlin/org/microg/gms/gass/GassService.kt similarity index 80% rename from play-services-core/src/main/kotlin/com/google/android/gms/gass/internal/GassService.kt rename to play-services-core/src/main/kotlin/org/microg/gms/gass/GassService.kt index 22946dacd6..afff107fef 100644 --- a/play-services-core/src/main/kotlin/com/google/android/gms/gass/internal/GassService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/gass/GassService.kt @@ -1,14 +1,17 @@ /* - * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-FileCopyrightText: 2024 microG Project Team * SPDX-License-Identifier: Apache-2.0 */ -package com.google.android.gms.gass.internal +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 diff --git a/play-services-core/src/main/kotlin/com/google/android/gms/pseudonymous/PseudonymousIdService.kt b/play-services-core/src/main/kotlin/org/microg/gms/pseudonymous/PseudonymousIdService.kt similarity index 92% rename from play-services-core/src/main/kotlin/com/google/android/gms/pseudonymous/PseudonymousIdService.kt rename to play-services-core/src/main/kotlin/org/microg/gms/pseudonymous/PseudonymousIdService.kt index 333e51f1aa..7750ed3a4d 100644 --- a/play-services-core/src/main/kotlin/com/google/android/gms/pseudonymous/PseudonymousIdService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/pseudonymous/PseudonymousIdService.kt @@ -1,9 +1,9 @@ /* - * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-FileCopyrightText: 2024 microG Project Team * SPDX-License-Identifier: Apache-2.0 */ -package com.google.android.gms.pseudonymous +package org.microg.gms.pseudonymous import android.util.Log import com.google.android.gms.common.Feature @@ -12,6 +12,7 @@ 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 diff --git a/settings.gradle b/settings.gradle index 6fa3fd3a61..22e9bf7873 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,19 +1,19 @@ def sublude(name) { - def projectName = ':' + name.substring(1).replace(':', '-') - include projectName - project(projectName).projectDir = file(name.substring(1).replace(':', '/')) + def projectName = ':' + name.substring(1).replace(':', '-') + include projectName + project(projectName).projectDir = file(name.substring(1).replace(':', '/')) } def localProperties = new Properties() try { - var stream = new File(rootDir, 'local.properties').newDataInputStream() - localProperties.load(stream) - stream.close() + var stream = new File(rootDir, 'local.properties').newDataInputStream() + localProperties.load(stream) + stream.close() } catch (ignored) { - // Ignore + // Ignore } def hasModule = (String name, boolean enabledByDefault) -> { - return localProperties.getProperty("modules." + name, enabledByDefault.toString()).toBoolean() + return localProperties.getProperty("modules." + name, enabledByDefault.toString()).toBoolean() } include ':fake-signature' @@ -77,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' @@ -110,4 +111,4 @@ sublude ':play-services-wearable:core' sublude ':firebase-auth:core' include ':play-services-core:microg-ui-tools' // Legacy -include ':play-services-core' \ No newline at end of file +include ':play-services-core'