0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-13 06:25:06 +00:00

TapAndPay: Add Dummy

This commit is contained in:
Marvin W 2021-06-27 18:52:22 +02:00
parent a43048995c
commit 602a34ff4b
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
21 changed files with 344 additions and 85 deletions

View file

@ -1,5 +0,0 @@
package com.google.android.gms.tapandpay.internal;
interface ITapAndPayService {
}

View file

@ -19,13 +19,13 @@ import java.util.Collection;
*/
@PublicApi
public class IsReadyToPayRequest extends AutoSafeParcelable {
@Field(2)
@Field(value = 2, useDirectList = true)
private ArrayList<Integer> allowedCardNetworks;
@Field(4)
private String unknown4;
@Field(5)
private String unknown5;
@Field(6)
@Field(value = 6, useDirectList = true)
private ArrayList<Integer> allowedPaymentMethods;
@Field(7)
private boolean existingPaymentMethodRequired;

View file

@ -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 {

View file

@ -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')

View file

@ -688,11 +688,6 @@
<action android:name="com.google.android.gms.wallet.service.BIND" />
</intent-filter>
</service>
<service android:name="org.microg.gms.tapandpay.TapAndPayService">
<intent-filter>
<action android:name="com.google.android.gms.tapandpay.service.BIND" />
</intent-filter>
</service>
<service android:name="org.microg.gms.cast.CastDeviceControllerService">
<intent-filter>

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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"
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2021, microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest package="org.microg.gms.tapandpay.api"/>

View file

@ -0,0 +1,3 @@
package com.google.android.gms.tapandpay.firstparty;
parcelable TokenStatus;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -0,0 +1,3 @@
package com.google.android.gms.tapandpay.issuer;
parcelable TokenStatus;

View file

@ -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;
}

View file

@ -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<TokenReference> CREATOR = new AutoCreator<>(TokenReference.class);
}

View file

@ -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<TokenStatus> CREATOR = new AutoCreator<>(TokenStatus.class);
}

View file

@ -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<TokenStatus> CREATOR = new AutoCreator<>(TokenStatus.class);
}

View file

@ -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'

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2021, microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.microg.gms.tapandpay.core">
<application>
<service android:name="org.microg.gms.tapandpay.TapAndPayService">
<intent-filter>
<action android:name="com.google.android.gms.tapandpay.service.BIND" />
</intent-filter>
</service>
</application>
</manifest>

View file

@ -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
}
}

View file

@ -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'