diff --git a/play-services-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayService.aidl deleted file mode 100644 index 622b0ba7..00000000 --- a/play-services-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayService.aidl +++ /dev/null @@ -1,5 +0,0 @@ -package com.google.android.gms.tapandpay.internal; - -interface ITapAndPayService { - -} diff --git a/play-services-api/src/main/java/com/google/android/gms/wallet/IsReadyToPayRequest.java b/play-services-api/src/main/java/com/google/android/gms/wallet/IsReadyToPayRequest.java index 5af03541..2f9fde8b 100644 --- a/play-services-api/src/main/java/com/google/android/gms/wallet/IsReadyToPayRequest.java +++ b/play-services-api/src/main/java/com/google/android/gms/wallet/IsReadyToPayRequest.java @@ -19,13 +19,13 @@ import java.util.Collection; */ @PublicApi public class IsReadyToPayRequest extends AutoSafeParcelable { - @Field(2) + @Field(value = 2, useDirectList = true) private ArrayList allowedCardNetworks; @Field(4) private String unknown4; @Field(5) private String unknown5; - @Field(6) + @Field(value = 6, useDirectList = true) private ArrayList allowedPaymentMethods; @Field(7) private boolean existingPaymentMethodRequired; diff --git a/play-services-base-core/build.gradle b/play-services-base-core/build.gradle index 035dd5a5..6bc36bec 100644 --- a/play-services-base-core/build.gradle +++ b/play-services-base-core/build.gradle @@ -9,9 +9,9 @@ apply plugin: 'signing' dependencies { api project(':play-services-basement') + api "androidx.lifecycle:lifecycle-service:$lifecycleVersion" implementation "androidx.annotation:annotation:$annotationVersion" - implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion" } android { diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle index 685eb1fd..9f87ea76 100644 --- a/play-services-core/build.gradle +++ b/play-services-core/build.gradle @@ -45,9 +45,11 @@ dependencies { implementation project(':play-services-conscrypt-provider-core') implementation project(':play-services-cronet-core') implementation project(':play-services-location-core') - implementation project(':play-services-vision-core') withNearbyImplementation project(':play-services-nearby-core') withNearbyImplementation project(':play-services-nearby-core-ui') + implementation project(':play-services-tapandpay-core') + implementation project(':play-services-vision-core') + implementation project(':play-services-core-proto') implementation project(':play-services-core:microg-ui-tools') // deprecated implementation project(':play-services-api') diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 73ca617d..38092b8c 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -688,11 +688,6 @@ - - - - - diff --git a/play-services-core/src/main/java/org/microg/gms/tapandpay/TapAndPayImpl.java b/play-services-core/src/main/java/org/microg/gms/tapandpay/TapAndPayImpl.java deleted file mode 100644 index 40632650..00000000 --- a/play-services-core/src/main/java/org/microg/gms/tapandpay/TapAndPayImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.tapandpay; - -import com.google.android.gms.tapandpay.internal.ITapAndPayService; -import android.os.Parcel; -import android.os.RemoteException; -import android.util.Log; - -public class TapAndPayImpl extends ITapAndPayService.Stub { - private static final String TAG = "GmsTapAndPayImpl"; - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-core/src/main/java/org/microg/gms/tapandpay/TapAndPayService.java b/play-services-core/src/main/java/org/microg/gms/tapandpay/TapAndPayService.java deleted file mode 100644 index 082234e6..00000000 --- a/play-services-core/src/main/java/org/microg/gms/tapandpay/TapAndPayService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2019 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.microg.gms.tapandpay; - -import android.os.RemoteException; - -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 org.microg.gms.BaseService; -import org.microg.gms.common.GmsService; - -public class TapAndPayService extends BaseService { - public TapAndPayService() { - super("GmsTapAndPaySvc", GmsService.TAP_AND_PAY); - } - - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { - callback.onPostInitComplete(CommonStatusCodes.SUCCESS, new TapAndPayImpl(), null); - - } -} diff --git a/play-services-tapandpay-api/build.gradle b/play-services-tapandpay-api/build.gradle new file mode 100644 index 00000000..4be043c1 --- /dev/null +++ b/play-services-tapandpay-api/build.gradle @@ -0,0 +1,36 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +apply plugin: 'com.android.library' +apply plugin: 'maven-publish' +apply plugin: 'signing' + +android { + compileSdkVersion androidCompileSdk + buildToolsVersion "$androidBuildVersionTools" + + defaultConfig { + versionName version + minSdkVersion androidMinSdk + targetSdkVersion androidTargetSdk + } + + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } +} + +// Nothing to publish yet +//apply from: '../gradle/publish-android.gradle' + +description = 'microG API for play-services-tapandpay' + +dependencies { + api project(':play-services-basement') + api project(':play-services-base-api') + + implementation "androidx.annotation:annotation:$annotationVersion" +} diff --git a/play-services-tapandpay-api/src/main/AndroidManifest.xml b/play-services-tapandpay-api/src/main/AndroidManifest.xml new file mode 100644 index 00000000..0b3e189b --- /dev/null +++ b/play-services-tapandpay-api/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + diff --git a/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/firstparty/TokenStatus.aidl b/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/firstparty/TokenStatus.aidl new file mode 100644 index 00000000..16841b3f --- /dev/null +++ b/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/firstparty/TokenStatus.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.tapandpay.firstparty; + +parcelable TokenStatus; diff --git a/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayService.aidl b/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayService.aidl new file mode 100644 index 00000000..9ee50010 --- /dev/null +++ b/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayService.aidl @@ -0,0 +1,39 @@ +package com.google.android.gms.tapandpay.internal; + +import com.google.android.gms.tapandpay.internal.ITapAndPayServiceCallbacks; + +interface ITapAndPayService { +// void setSelectedToken(in SetSelectedTokenRequest request, ITapAndPayServiceCallbacks callbacks) = 0; +// void getAllCards(in GetAllCardsRequest request, ITapAndPayServiceCallbacks callbacks) = 1; +// void deleteToken(in DeleteTokenRequest request, ITapAndPayServiceCallbacks callbacks) = 2; +// void firstPartyTokenizePan(in FirstPartyTokenizePanRequest request, ITapAndPayServiceCallbacks callbacks) = 3; +// void setActiveAccount(in SetActiveAccountRequest request, ITapAndPayServiceCallbacks callbacks) = 4; +// void showSecurityPrompt(in ShowSecurityPromptRequest request, ITapAndPayServiceCallbacks callbacks) = 7; +// void getActiveAccount(in GetActiveAccountRequest request, ITapAndPayServiceCallbacks callbacks) = 8; + void registerDataChangedListener(ITapAndPayServiceCallbacks callbacks) = 9; +// void isDeviceUnlockedForPayment(in IsDeviceUnlockedForPaymentRequest request, ITapAndPayServiceCallbacks callbacks) = 10; +// void promptDeviceUnlockForPayment(in PromptDeviceUnlockForPaymentRequest request, ITapAndPayServiceCallbacks callbacks) = 11; +// void sendTapEvent(in SendTapEventRequest request, ITapAndPayServiceCallbacks callbacks) = 12; +// void getReceivesTransactionNotification(in GetReceivesTransactionNotificationsRequest request, ITapAndPayServiceCallbacks callbacks) = 13; +// void setReceivesTransactionNotification(in SetReceivesTransactionNotificationsRequest request, ITapAndPayServiceCallbacks callbacks) = 14; +// void retrieveInAppPaymentCredential(in RetrieveInAppPaymentCredentialRequest request, ITapAndPayServiceCallbacks callbacks) = 15; +// void getActiveCardsForAccount(in GetActiveCardsForAccountRequest request, ITapAndPayServiceCallbacks callbacks) = 17; +// void getAnalyticsContext(ITapAndPayServiceCallbacks callbacks) = 19; +// void getActiveWalletId(ITapAndPayServiceCallbacks callbacks) = 20; + void getTokenStatus(int tokenProvider, String issuerTokenId, ITapAndPayServiceCallbacks callbacks) = 21; +// void issuerTokenize(int tokenProvider, String issuerTokenId, String s2, ITapAndPayServiceCallbacks callbacks) = 22; +// void requestSelectToken(int tokenProvider, String issuerTokenId, ITapAndPayServiceCallbacks callbacks) = 23; +// void requestDeleteToken(int tokenProvider, String issuerTokenId, ITapAndPayServiceCallbacks callbacks) = 24; +// void isDeviceUnlockedForInAppPayment(in IsDeviceUnlockedForInAppPaymentRequest request, ITapAndPayServiceCallbacks callbacks) = 25; +// void reportInAppTransactionCompleted(in ReportInAppTransactionCompletedRequest request, ITapAndPayServiceCallbacks callbacks) = 26; +// void pushTokenize(in PushTokenizeRequest request, ITapAndPayServiceCallbacks callbacks) = 27; +// void createWallet(ITapAndPayServiceCallbacks callbacks) = 28; + void getStableHardwareId(ITapAndPayServiceCallbacks callbacks) = 29; +// void getEnvironment(ITapAndPayServiceCallbacks callbacks) = 30; +// void enablePayOnWear(in EnablePayOnWearRequest request, ITapAndPayServiceCallbacks callbacks) = 31; +// void isPayPalAvailable(ITapAndPayServiceCallbacks callbacks) = 32; +// void unknown34(ITapAndPayServiceCallbacks callbacks) = 33; +// void getSecurityParams(ITapAndPayServiceCallbacks callbacks) = 34; +// void getNotificationSettings(in GetNotificationSettingsRequest request, ITapAndPayServiceCallbacks callbacks) = 36; +// void setNotificationSettings(in SetNotificationSettingsRequest request, ITapAndPayServiceCallbacks callbacks) = 37; +} diff --git a/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayServiceCallbacks.aidl b/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayServiceCallbacks.aidl new file mode 100644 index 00000000..980d3657 --- /dev/null +++ b/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/internal/ITapAndPayServiceCallbacks.aidl @@ -0,0 +1,47 @@ +package com.google.android.gms.tapandpay.internal; + +import com.google.android.gms.common.api.Status; +import com.google.android.gms.tapandpay.issuer.TokenStatus; + +interface ITapAndPayServiceCallbacks { + void onSetSelectedTokenResponse(in Status status) = 1; + void onStatus3(in Status status, in Bundle data) = 2; +// void onGetAllCardsResponse(in Status status, in GetAllCardsResponse response) = 3; + void onDeleteTokenResponse(in Status status) = 4; + void onSetActiveAccountResponse(in Status status) = 5; +// void onGetActiveAccountResponse(in Status status, in GetActiveAccountResponse response) = 7; + void onStatus9(in Status status) = 8; + void onReturn10() = 9; + void onIsDeviceUnlockedForPaymentResponse(in Status status, boolean isDeviceUnlockedForPayment) = 10; + void onStatus12(in Status status) = 11; + void onGetReceivesTransactionNotificationsResponse(in Status status, boolean receivesTransactionNotifications) = 12; + void onSetReceivesTransactionNotificationsResponse(in Status status) = 13; +// void onGetActiveCardsForAccountResponse(in Status status, in GetActiveCardsForAccountResponse response) = 14; +// void onRetrieveInAppPaymentCredentialResponse(in Status status, in RetrieveInAppPaymentCredentialResponse response) = 16; + void onGetAnalyticsContextResponse(in Status status, String analyticsContext) = 17; + void onTokenStatus(in Status status, in TokenStatus tokenStatus) = 19; + void onIsDeviceUnlockedForInAppPaymentResponse(in Status status, boolean isDeviceUnlockedForInAppPayment) = 20; + void onReportInAppTransactionCompletedResponse(in Status status) = 21; + void onGetStableHardwareIdResponse(in Status status, String stableHardwareId) = 22; + void onGetEnvironmentResponse(in Status status, String env) = 23; + void onEnablePayOnWearResponse(in Status status) = 24; + void onIsPayPalAvailableResponse(in Status status, boolean IsPayPalAvailable) = 25; +// void onGetSecurityParamsResponse(in Status status, in GetSecurityParamsResponse response) = 26; +// void onGetNotificationSettingsResponse(in Status status, in GetNotificationSettingsResponse response) = 27; + void onSetNotificationSettingsResponse(in Status status) = 28; +// void onGetAvailableOtherPaymentMethodsResponse(in Status status, in GetAvailableOtherPaymentMethodsResponse response) = 29; +// void onGetActiveTokensForAccountResponse(in Status status, in GetActiveTokensForAccountResponse response) = 30; +// void onGetSeChipTransactionsResponse(in Status status, in GetSeChipTransactionsResponse response) = 34; +// void onReserveResourceResponse(in Status status, in ReserveResourceResponse response) = 35; + void onReleaseResourceResponse(in Status status) = 36; + void onDisableSelectedTokenResponse(in Status status) = 37; +// void onGetFelicaTosAcceptanceResponse(in Status status, in GetFelicaTosAcceptanceResponse response) = 38; + void onSetFelicaTosAcceptanceResponse(in Status status) = 39; +// void onRefreshSeCardsResponse(in Status status, in RefreshSeCardsResponse response) = 40; +// void onGetGlobalActionCardsResponse(in Status status, in GetGlobalActionCardsResponse response) = 41; + void onGetLinkingTokenResponse(in Status status, String linkingToken) = 42; + void onBlockPaymentCardsResponse(in Status status) = 43; + void onUnblockPaymentCardsResponse(in Status status) = 44; +// void onGetLastAttestationResultResponse(in Status status, in GetLastAttestationResultResponse response) = 45; +// void onQuickAccessWalletConfig(in Status status, in QuickAccessWalletConfig config) = 46; +} diff --git a/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/issuer/TokenStatus.aidl b/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/issuer/TokenStatus.aidl new file mode 100644 index 00000000..b23fc997 --- /dev/null +++ b/play-services-tapandpay-api/src/main/aidl/com/google/android/gms/tapandpay/issuer/TokenStatus.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.tapandpay.issuer; + +parcelable TokenStatus; diff --git a/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/TapAndPayStatusCodes.java b/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/TapAndPayStatusCodes.java new file mode 100644 index 00000000..368c58d8 --- /dev/null +++ b/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/TapAndPayStatusCodes.java @@ -0,0 +1,19 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.tapandpay; + +import com.google.android.gms.common.api.CommonStatusCodes; + +import org.microg.gms.common.PublicApi; + +@PublicApi +public class TapAndPayStatusCodes extends CommonStatusCodes { + public static final int TAP_AND_PAY_NO_ACTIVE_WALLET = 15002; + public static final int TAP_AND_PAY_TOKEN_NOT_FOUND = 15003; + public static final int TAP_AND_PAY_INVALID_TOKEN_STATE = 15004; + public static final int TAP_AND_PAY_ATTESTATION_ERROR = 15005; + public static final int TAP_AND_PAY_UNAVAILABLE = 15009; +} diff --git a/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/firstparty/TokenReference.java b/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/firstparty/TokenReference.java new file mode 100644 index 00000000..cd04c662 --- /dev/null +++ b/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/firstparty/TokenReference.java @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.tapandpay.firstparty; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class TokenReference extends AutoSafeParcelable { + @Field(2) + public String tokenReferenceId; + @Field(3) + public int tokenProvider; + + public static final Creator CREATOR = new AutoCreator<>(TokenReference.class); +} diff --git a/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/firstparty/TokenStatus.java b/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/firstparty/TokenStatus.java new file mode 100644 index 00000000..213a804d --- /dev/null +++ b/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/firstparty/TokenStatus.java @@ -0,0 +1,19 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.tapandpay.firstparty; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class TokenStatus extends AutoSafeParcelable { + @Field(2) + public TokenReference tokenReference; + @Field(3) + public int tokenState; + @Field(4) + public boolean isSelected; + + public static final Creator CREATOR = new AutoCreator<>(TokenStatus.class); +} diff --git a/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/issuer/TokenStatus.java b/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/issuer/TokenStatus.java new file mode 100644 index 00000000..e4429af9 --- /dev/null +++ b/play-services-tapandpay-api/src/main/java/com/google/android/gms/tapandpay/issuer/TokenStatus.java @@ -0,0 +1,32 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.tapandpay.issuer; + +import org.microg.gms.common.PublicApi; +import org.microg.safeparcel.AutoSafeParcelable; + +@PublicApi +public class TokenStatus extends AutoSafeParcelable { + @Field(2) + @PublicApi(exclude = true) + public String issuerTokenId; + @Field(3) + @PublicApi(exclude = true) + private int tokenState; + @Field(4) + @PublicApi(exclude = true) + private boolean isSelected; + + public int getTokenState() { + return tokenState; + } + + public boolean isSelected() { + return isSelected; + } + + public static final Creator CREATOR = new AutoCreator<>(TokenStatus.class); +} diff --git a/play-services-tapandpay-core/build.gradle b/play-services-tapandpay-core/build.gradle new file mode 100644 index 00000000..5faa9b60 --- /dev/null +++ b/play-services-tapandpay-core/build.gradle @@ -0,0 +1,50 @@ +/* + * SPDX-FileCopyrightText: 2021, 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-tapandpay-api') + + 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 { + 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 + } +} + +// Nothing to publish yet +//apply from: '../gradle/publish-android.gradle' + +description = 'microG service implementation for play-services-tapandpay' diff --git a/play-services-tapandpay-core/src/main/AndroidManifest.xml b/play-services-tapandpay-core/src/main/AndroidManifest.xml new file mode 100644 index 00000000..64ee486c --- /dev/null +++ b/play-services-tapandpay-core/src/main/AndroidManifest.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/play-services-tapandpay-core/src/main/kotlin/org/microg/gms/tapandpay/TapAndPayService.kt b/play-services-tapandpay-core/src/main/kotlin/org/microg/gms/tapandpay/TapAndPayService.kt new file mode 100644 index 00000000..0a08696b --- /dev/null +++ b/play-services-tapandpay-core/src/main/kotlin/org/microg/gms/tapandpay/TapAndPayService.kt @@ -0,0 +1,49 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ +package org.microg.gms.tapandpay + +import android.os.Parcel +import android.os.RemoteException +import android.util.Log +import com.google.android.gms.common.api.CommonStatusCodes +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.tapandpay.TapAndPayStatusCodes.TAP_AND_PAY_NO_ACTIVE_WALLET +import com.google.android.gms.tapandpay.internal.ITapAndPayService +import com.google.android.gms.tapandpay.internal.ITapAndPayServiceCallbacks +import org.microg.gms.BaseService +import org.microg.gms.common.GmsService + +private const val TAG = "GmsTapAndPay" + +class TapAndPayService : BaseService(TAG, GmsService.TAP_AND_PAY) { + override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { + callback.onPostInitComplete(CommonStatusCodes.SUCCESS, TapAndPayImpl(), null) + } +} + +class TapAndPayImpl : ITapAndPayService.Stub() { + override fun registerDataChangedListener(callbacks: ITapAndPayServiceCallbacks) { + Log.d(TAG, "registerDataChangedListener()") + callbacks.onStatus9(Status.SUCCESS) + } + + override fun getTokenStatus(tokenProvider: Int, issuerTokenId: String, callbacks: ITapAndPayServiceCallbacks) { + Log.d(TAG, "getTokenStatus($tokenProvider, $issuerTokenId)") + callbacks.onTokenStatus(Status(TAP_AND_PAY_NO_ACTIVE_WALLET), null) + } + + override fun getStableHardwareId(callbacks: ITapAndPayServiceCallbacks) { + Log.d(TAG, "getStableHardwareId()") + callbacks.onGetStableHardwareIdResponse(Status.SUCCESS, "") + } + + override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean { + if (super.onTransact(code, data, reply, flags)) return true + Log.d(TAG, "onTransact [unknown]: $code, $data, $flags") + return false + } +} diff --git a/settings.gradle b/settings.gradle index f6a792a3..23264525 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,6 +10,7 @@ include ':play-services-droidguard-api' include ':play-services-iid-api' include ':play-services-location-api' include ':play-services-nearby-api' +include ':play-services-tapandpay-api' include ':play-services-vision-api' include ':play-services-vision-common-api' include ':play-services-wearable-api' @@ -28,6 +29,7 @@ include ':play-services-maps-core-mapbox' include ':play-services-maps-core-vtm' include ':play-services-maps-core-vtm:vtm-microg-theme' include ':play-services-nearby-core' +include ':play-services-tapandpay-core' include ':play-services-vision-core' include ':play-services-base-core-ui'