From 1b34bbd3a5636399e308bbac56cb64533703fa46 Mon Sep 17 00:00:00 2001 From: DaVinci9196 <150454414+DaVinci9196@users.noreply.github.com> Date: Sat, 17 Feb 2024 04:41:08 +0800 Subject: [PATCH] Add dummy service for PANORAMA(3) (#2173) Co-authored-by: Marvin W --- play-services-core/build.gradle | 1 + .../src/main/AndroidManifest.xml | 1 - play-services-panorama/build.gradle | 41 ++++++++++++++ play-services-panorama/core/build.gradle | 56 +++++++++++++++++++ .../core/src/main/AndroidManifest.xml | 15 +++++ .../microg/gms/panorama/PanoramaService.kt | 31 ++++++++++ .../src/AndroidManifest.xml | 6 ++ .../google/android/gms/panorama/Panorama.java | 30 ++++++++++ .../android/gms/panorama/PanoramaApi.java | 50 +++++++++++++++++ .../panorama/internal/IPanoramaCallbacks.aidl | 11 ++++ .../panorama/internal/IPanoramaService.aidl | 13 +++++ settings.gradle | 2 + 12 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 play-services-panorama/build.gradle create mode 100644 play-services-panorama/core/build.gradle create mode 100644 play-services-panorama/core/src/main/AndroidManifest.xml create mode 100644 play-services-panorama/core/src/main/kotlin/org/microg/gms/panorama/PanoramaService.kt create mode 100644 play-services-panorama/src/AndroidManifest.xml create mode 100644 play-services-panorama/src/main/aidl/com/google/android/gms/panorama/Panorama.java create mode 100644 play-services-panorama/src/main/aidl/com/google/android/gms/panorama/PanoramaApi.java create mode 100644 play-services-panorama/src/main/aidl/com/google/android/gms/panorama/internal/IPanoramaCallbacks.aidl create mode 100644 play-services-panorama/src/main/aidl/com/google/android/gms/panorama/internal/IPanoramaService.aidl diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle index 1c4a9df24a..424c785c47 100644 --- a/play-services-core/build.gradle +++ b/play-services-core/build.gradle @@ -36,6 +36,7 @@ dependencies { implementation project(':play-services-location-core') implementation project(':play-services-location-core-base') implementation project(':play-services-oss-licenses-core') + implementation project(':play-services-panorama-core') implementation project(':play-services-pay-core') implementation project(':play-services-recaptcha-core') implementation project(':play-services-safetynet-core') diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 53cf29cb55..b0ec393f6f 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -931,7 +931,6 @@ - diff --git a/play-services-panorama/build.gradle b/play-services-panorama/build.gradle new file mode 100644 index 0000000000..2c230a6777 --- /dev/null +++ b/play-services-panorama/build.gradle @@ -0,0 +1,41 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +apply plugin: 'com.android.library' +apply plugin: 'maven-publish' +apply plugin: 'signing' + +android { + namespace "com.google.android.gms.panorama" + + compileSdkVersion androidCompileSdk + buildToolsVersion "$androidBuildVersionTools" + + buildFeatures { + aidl = true + } + + defaultConfig { + versionName version + minSdkVersion androidMinSdk + targetSdkVersion androidTargetSdk + } + + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } +} + +apply from: '../gradle/publish-android.gradle' + +description = 'microG implementation of play-services-panorama' + +dependencies { + // Dependencies from play-services-panorama:17.1.0 + api project(":play-services-base") + api project(":play-services-basement") + api project(":play-services-tasks") +} diff --git a/play-services-panorama/core/build.gradle b/play-services-panorama/core/build.gradle new file mode 100644 index 0000000000..81ce810d7b --- /dev/null +++ b/play-services-panorama/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-panorama') + + 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.panorama.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-panorama' diff --git a/play-services-panorama/core/src/main/AndroidManifest.xml b/play-services-panorama/core/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..fbe8d24413 --- /dev/null +++ b/play-services-panorama/core/src/main/AndroidManifest.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/play-services-panorama/core/src/main/kotlin/org/microg/gms/panorama/PanoramaService.kt b/play-services-panorama/core/src/main/kotlin/org/microg/gms/panorama/PanoramaService.kt new file mode 100644 index 0000000000..382a698cb6 --- /dev/null +++ b/play-services-panorama/core/src/main/kotlin/org/microg/gms/panorama/PanoramaService.kt @@ -0,0 +1,31 @@ +/* + * SPDX-FileCopyrightText: 2024 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ +package org.microg.gms.panorama + +import android.net.Uri +import android.os.Bundle +import android.util.Log +import com.google.android.gms.common.api.CommonStatusCodes +import com.google.android.gms.common.internal.GetServiceRequest +import com.google.android.gms.common.internal.IGmsCallbacks +import com.google.android.gms.panorama.internal.IPanoramaCallbacks +import com.google.android.gms.panorama.internal.IPanoramaService +import org.microg.gms.BaseService +import org.microg.gms.common.GmsService + +const val TAG = "PanoramaService" + +class PanoramaService : BaseService(TAG, GmsService.PANORAMA) { + override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { + callback.onPostInitComplete(CommonStatusCodes.SUCCESS, PanoramaServiceImpl().asBinder(), null) + } +} + +class PanoramaServiceImpl : IPanoramaService.Stub() { + override fun loadPanoramaInfo(callback: IPanoramaCallbacks?, uri: Uri, bundle: Bundle, needGrantReadUriPermissions: Boolean) { + Log.d(TAG, "Not implemented! $uri bundle:$bundle") + runCatching { callback?.onPanoramaResult(CommonStatusCodes.SUCCESS, null, 0, null) } + } +} diff --git a/play-services-panorama/src/AndroidManifest.xml b/play-services-panorama/src/AndroidManifest.xml new file mode 100644 index 0000000000..210a05c167 --- /dev/null +++ b/play-services-panorama/src/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + diff --git a/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/Panorama.java b/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/Panorama.java new file mode 100644 index 0000000000..005b0f7609 --- /dev/null +++ b/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/Panorama.java @@ -0,0 +1,30 @@ +/* + * 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.panorama; + +import com.google.android.gms.common.api.Api; +import com.google.android.gms.common.api.GoogleApiClient; + +/** + * The main entry point for panorama integration. + */ +@Deprecated +public class Panorama { + /** + * Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Panorama features. + */ + @Deprecated + public static final Api API = null; + + /** + * The entry point for interacting with the Panorama API. + */ + @Deprecated + public static final PanoramaApi PanoramaApi = null; +} diff --git a/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/PanoramaApi.java b/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/PanoramaApi.java new file mode 100644 index 0000000000..9c255f22fc --- /dev/null +++ b/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/PanoramaApi.java @@ -0,0 +1,50 @@ +/* + * 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.panorama; + +import android.content.Intent; +import android.net.Uri; +import com.google.android.gms.common.api.GoogleApiClient; +import com.google.android.gms.common.api.PendingResult; +import com.google.android.gms.common.api.Result; + +/** + * The main entry point for interacting with Panorama viewer. This class provides methods for obtaining an Intent to view a Panorama. + */ +@Deprecated +public interface PanoramaApi { + /** + * Loads information about a panorama. + * + * @param uri the URI of the panorama to load info about. May be a file:, content:, or android_resource: scheme. + */ + @Deprecated + PendingResult loadPanoramaInfo(GoogleApiClient client, Uri uri); + + /** + * Loads information about a panorama from a content provider. This method will also explicitly grant and revoke access to + * the URI while the load is happening so images in content providers may be inspected without giving permission to an + * entire content provider. The returned viewer intent will also have the {@link Intent#FLAG_GRANT_READ_URI_PERMISSION} set so + * the viewer has access. + */ + @Deprecated + PendingResult loadPanoramaInfoAndGrantAccess(GoogleApiClient client, Uri uri); + + /** + * Result interface for loading panorama info. + */ + @Deprecated + interface PanoramaResult extends Result { + /** + * Returns if the image is a panorama this is not null and will launch a viewer when started. If the image is not a panorama this will be null. + */ + @Deprecated + Intent getViewerIntent(); + } +} diff --git a/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/internal/IPanoramaCallbacks.aidl b/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/internal/IPanoramaCallbacks.aidl new file mode 100644 index 0000000000..58b92427eb --- /dev/null +++ b/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/internal/IPanoramaCallbacks.aidl @@ -0,0 +1,11 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ +package com.google.android.gms.panorama.internal; + +import android.content.Intent; + +interface IPanoramaCallbacks { + void onPanoramaResult(int statusCode, in Bundle statusExtras, int unknown, in Intent viewerIntent); +} \ No newline at end of file diff --git a/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/internal/IPanoramaService.aidl b/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/internal/IPanoramaService.aidl new file mode 100644 index 0000000000..3bada8be22 --- /dev/null +++ b/play-services-panorama/src/main/aidl/com/google/android/gms/panorama/internal/IPanoramaService.aidl @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ +package com.google.android.gms.panorama.internal; + +import com.google.android.gms.panorama.internal.IPanoramaCallbacks; +import android.os.Bundle; +import android.net.Uri; + +interface IPanoramaService { + void loadPanoramaInfo(IPanoramaCallbacks callback, in Uri uri, in Bundle bundle, boolean needGrantReadUriPermissions) = 0; +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 7ad47bc2ea..e1831588e9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -46,6 +46,7 @@ include ':play-services-measurement-base' sublude ':play-services-mlkit:barcode-scanning' include ':play-services-nearby' include ':play-services-oss-licenses' +include ':play-services-panorama' include ':play-services-pay' include ':play-services-phenotype' include ':play-services-places' @@ -97,6 +98,7 @@ sublude ':play-services-maps:core:vtm:microg-theme' if (hasModule("nearby", true)) sublude ':play-services-nearby:core' if (hasModule("nearby", true)) sublude ':play-services-nearby:core:package' sublude ':play-services-oss-licenses:core' +sublude ':play-services-panorama:core' sublude ':play-services-pay:core' sublude ':play-services-safetynet:core' sublude ':play-services-recaptcha:core'