Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayThirdPartyService Supplement #2416

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public enum GmsService {
AD_CONSENT_LOOKUP(195, "com.google.android.gms.ads.service.CONSENT_LOOKUP"),
CREDENTIAL_MANAGER(196, "com.google.android.gms.credential.manager.service.firstparty.START"),
PHONE_INTERNAL(197, "com.google.android.gms.auth.api.phone.service.InternalService.START"),
PAY(198, "com.google.android.gms.pay.service.BIND"),
PAY(198, "com.google.android.gms.pay.service.BIND", "com.google.android.gms.pay.service.THIRD_PARTY"),
ASTERISM(199, "com.google.android.gms.asterism.service.START"),
MODULE_RESTORE(201, "com.google.android.gms.backup.GMS_MODULE_RESTORE"),
FACS_CACHE(202, "com.google.android.gms.facs.cache.service.START"),
Expand Down
1 change: 1 addition & 0 deletions play-services-pay/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ dependencies {
api project(':play-services-base')

implementation "androidx.annotation:annotation:$annotationVersion"
annotationProcessor project(':safe-parcel-processor')
}
34 changes: 22 additions & 12 deletions play-services-pay/core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ SPDX-FileCopyrightText: 2023 microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity-alias
android:name="com.google.android.gms.pay.main.PayActivity"
android:targetActivity="org.microg.gms.pay.PayActivity"
android:exported="true"
android:process=":ui">
android:name="com.google.android.gms.pay.main.PayActivity"
android:exported="true"
android:process=":ui"
android:targetActivity="org.microg.gms.pay.PayActivity">
<intent-filter>
<action android:name="com.google.android.gms.pay.PAY"/>
<action android:name="com.google.android.gms.pay.PAY_OPTIONAL"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="com.google.android.gms.pay.PAY" />
<action android:name="com.google.android.gms.pay.PAY_OPTIONAL" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity-alias>
<activity android:name="org.microg.gms.pay.PayActivity"
android:exported="true"
android:process=":ui"/>
<activity
android:name="org.microg.gms.pay.PayActivity"
android:exported="true"
android:process=":ui" />

<service android:name="org.microg.gms.pay.PayService">
<intent-filter>
<action android:name="com.google.android.gms.pay.service.BIND" />
</intent-filter>
</service>
<service
android:name="com.google.android.gms.pay.service.PayThirdPartyService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.pay.service.THIRD_PARTY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.google.android.gms.pay.service

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.pay.CheckReadinessForEmoneyRequest
import com.google.android.gms.pay.GetMdocCredentialRequest
import com.google.android.gms.pay.GetPayApiAvailabilityStatusRequest
import com.google.android.gms.pay.GetPendingIntentForWalletOnWearRequest
import com.google.android.gms.pay.NotifyCardTapEventRequest
import com.google.android.gms.pay.NotifyEmoneyCardStatusUpdateRequest
import com.google.android.gms.pay.PushEmoneyCardRequest
import com.google.android.gms.pay.SavePassesRequest
import com.google.android.gms.pay.SyncBundleRequest
import com.google.android.gms.pay.internal.IPayServiceCallbacks
import com.google.android.gms.pay.internal.IThirdPartyPayService
import org.microg.gms.BaseService
import org.microg.gms.common.GmsService


private const val TAG = "PayThirdPartyService"

class PayThirdPartyService : BaseService(TAG, GmsService.PAY) {

override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
runCatching {
Log.d(TAG, "handleServiceRequest: ")
callback.onPostInitCompleteWithConnectionInfo(CommonStatusCodes.SUCCESS, PayThirdPartyServiceImpl().asBinder(), ConnectionInfo().apply {
features = arrayOf(Feature("pay_get_pay_api_availability_status", 3),
Feature("pay_save_passes", 5),
Feature("pay_save_passes_jwt", 3),
Feature("pay_sync_bundle", 2),
Feature("pay_get_pending_intent_for_wallet_on_wear", 2),
Feature("pay_get_mdoc_credential_pending_intent", 1),
Feature("pay_notify_card_tap_event", 1),
Feature("pay_check_readiness_for_emoney", 1),
Feature("pay_push_emoney_card", 1),
Feature("pay_notify_emoney_card_status_update", 1)
)
})
}
}
}

class PayThirdPartyServiceImpl : IThirdPartyPayService.Stub() {
override fun getPayApiAvailabilityStatus(request: GetPayApiAvailabilityStatusRequest?, callback: IPayServiceCallbacks) {
callback.onGetPayApiAvailabilityStatus(Status.SUCCESS, 2)
}

override fun savePasses(request: SavePassesRequest?, callback: IPayServiceCallbacks) {
callback.onSavePasses(Status(CommonStatusCodes.SERVICE_MISSING))
}

override fun syncBundle(request: SyncBundleRequest?, callback: IPayServiceCallbacks?) {
Log.d(TAG, "syncBundle Not yet implemented")
}

override fun getPendingForWalletOnWear(request: GetPendingIntentForWalletOnWearRequest?, callback: IPayServiceCallbacks?) {
Log.d(TAG, "getPendingForWalletOnWear Not yet implemented")
}

override fun getMdocCredential(request: GetMdocCredentialRequest?, callback: IPayServiceCallbacks?) {
Log.d(TAG, "getMdocCredential Not yet implemented")
}

override fun notifyCardTapEvent(request: NotifyCardTapEventRequest?, callback: IPayServiceCallbacks?) {
Log.d(TAG, "notifyCardTapEvent Not yet implemented")
}

override fun checkReadinessForEmoney(request: CheckReadinessForEmoneyRequest?, callback: IPayServiceCallbacks?) {
Log.d(TAG, "checkReadinessForEmoney Not yet implemented")
}

override fun pushEmoneyCard(request: PushEmoneyCardRequest?, callback: IPayServiceCallbacks?) {
Log.d(TAG, "pushEmoneyCard Not yet implemented")
}

override fun notifyEmoneyCardStatusUpdate(request: NotifyEmoneyCardStatusUpdateRequest?, callback: IPayServiceCallbacks?) {
Log.d(TAG, "notifyEmoneyCardStatusUpdate Not yet implemented")
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable CheckReadinessForEmoneyRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable GetMdocCredentialRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable GetPayApiAvailabilityStatusRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable GetPendingIntentForWalletOnWearRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable GetWalletStatusResponse;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable NotifyCardTapEventRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable NotifyEmoneyCardStatusUpdateRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable PushEmoneyCardRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable SavePassesRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.google.android.gms.pay;

parcelable SyncBundleRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.google.android.gms.pay.internal;

import android.app.PendingIntent;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.pay.GetWalletStatusResponse;


interface IPayServiceCallbacks {
void onStatusResult(in Status status, in byte[] bArr) = 14;

void onSavePasses(in Status status) = 17;

void onGetPayApiAvailabilityStatus(in Status status, int i) = 19;

void onGetPendingIntent(in Status status, in PendingIntent pendingIntent) = 3;

void onError(in Status status) = 1;

void onGetWalletStatus(in Status status, in GetWalletStatusResponse getWalletStatusResponse) = 21;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.google.android.gms.pay.internal;

import com.google.android.gms.pay.GetPayApiAvailabilityStatusRequest;
import com.google.android.gms.pay.internal.IPayServiceCallbacks;
import com.google.android.gms.pay.SavePassesRequest;
import com.google.android.gms.pay.SyncBundleRequest;
import com.google.android.gms.pay.CheckReadinessForEmoneyRequest;
import com.google.android.gms.pay.GetMdocCredentialRequest;
import com.google.android.gms.pay.GetPendingIntentForWalletOnWearRequest;
import com.google.android.gms.pay.NotifyCardTapEventRequest;
import com.google.android.gms.pay.PushEmoneyCardRequest;
import com.google.android.gms.pay.NotifyEmoneyCardStatusUpdateRequest;

interface IThirdPartyPayService {
void getPayApiAvailabilityStatus(in GetPayApiAvailabilityStatusRequest request, in IPayServiceCallbacks callback) = 1;
void savePasses(in SavePassesRequest request, in IPayServiceCallbacks callback) = 2;
void syncBundle(in SyncBundleRequest request, in IPayServiceCallbacks callback) = 3;
void getPendingForWalletOnWear(in GetPendingIntentForWalletOnWearRequest request,in IPayServiceCallbacks callback) = 4;
void getMdocCredential(in GetMdocCredentialRequest request, in IPayServiceCallbacks callback) = 5;
void notifyCardTapEvent(in NotifyCardTapEventRequest request, in IPayServiceCallbacks callback) = 6;
void checkReadinessForEmoney(in CheckReadinessForEmoneyRequest request, in IPayServiceCallbacks callback) = 7;
void pushEmoneyCard(in PushEmoneyCardRequest request, in IPayServiceCallbacks callback) = 8;
void notifyEmoneyCardStatusUpdate(in NotifyEmoneyCardStatusUpdateRequest request, in IPayServiceCallbacks callback) = 9;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.google.android.gms.pay;

import android.os.Parcel;

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 CheckReadinessForEmoneyRequest extends AbstractSafeParcelable {
@Field(1)
public String serviceProvider;
@Field(2)
public String accountName;

@Constructor
public CheckReadinessForEmoneyRequest(@Param(1) String serviceProvider, @Param(2) String accountName) {
this.serviceProvider = serviceProvider;
this.accountName = accountName;
}

@Override
public void writeToParcel(Parcel out, int flags) {
CREATOR.writeToParcel(this, out, flags);
}

public static final SafeParcelableCreatorAndWriter<CheckReadinessForEmoneyRequest> CREATOR = findCreator(CheckReadinessForEmoneyRequest.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.google.android.gms.pay;

import android.os.Parcel;

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 GetMdocCredentialRequest extends AbstractSafeParcelable {
@Field(1)
public String unknownFieldA;
@Field(2)
public byte[] unknownFieldB;
@Field(5)
public byte[] unknownFieldC;

@Constructor
public GetMdocCredentialRequest(@Param(1) String unknownFieldA, @Param(2) byte[] unknownFieldB, @Param(5) byte[] unknownFieldC) {
this.unknownFieldA = unknownFieldA;
this.unknownFieldB = unknownFieldB;
this.unknownFieldC = unknownFieldC;
}

@Constructor
public GetMdocCredentialRequest() {

}

@Override
public void writeToParcel(Parcel out, int flags) {
CREATOR.writeToParcel(this, out, flags);
}

public static final SafeParcelableCreatorAndWriter<GetMdocCredentialRequest> CREATOR = findCreator(GetMdocCredentialRequest.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.google.android.gms.pay;

import android.os.Parcel;

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 GetPayApiAvailabilityStatusRequest extends AbstractSafeParcelable {
@Field(1)
public int requestType;

@Constructor
public GetPayApiAvailabilityStatusRequest(@Param(1) int requestType) {
this.requestType = requestType;
}

@Override
public void writeToParcel(Parcel out, int flags) {
CREATOR.writeToParcel(this, out, flags);
}

public static final SafeParcelableCreatorAndWriter<GetPayApiAvailabilityStatusRequest> CREATOR = findCreator(GetPayApiAvailabilityStatusRequest.class);

@Override
public String toString() {
return "GetPayApiAvailabilityStatusRequest{" +
"requestType=" + requestType +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.google.android.gms.pay;

import android.os.Parcel;

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 GetPendingIntentForWalletOnWearRequest extends AbstractSafeParcelable {
@Field(2)
public String wearNodeId;
@Field(3)
public int intentSource;

@Constructor
public GetPendingIntentForWalletOnWearRequest(@Param(2) String wearNodeId, @Param(3) int intentSource) {
this.wearNodeId = wearNodeId;
this.intentSource = intentSource;
}

@Override
public void writeToParcel(Parcel out, int flags) {
CREATOR.writeToParcel(this, out, flags);
}

public static final SafeParcelableCreatorAndWriter<GetPendingIntentForWalletOnWearRequest> CREATOR = findCreator(GetPendingIntentForWalletOnWearRequest.class);
}
Loading