-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pay: Add bunch of API details for third-party service (#2416)
Co-authored-by: Marvin W <[email protected]>
- Loading branch information
1 parent
ebdacd0
commit 882c8a5
Showing
36 changed files
with
860 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="org.microg.gms.pay.ThirdPartyPayService" | ||
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
play-services-pay/core/src/main/kotlin/org/microg/gms/pay/ThirdPartyPayService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.microg.gms.pay | ||
|
||
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.PayApiAvailabilityStatus | ||
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 = "ThirdPartyPayService" | ||
|
||
class ThirdPartyPayService : BaseService(TAG, GmsService.PAY) { | ||
|
||
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { | ||
callback.onPostInitCompleteWithConnectionInfo(CommonStatusCodes.SUCCESS, ThirdPartyPayServiceImpl().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 ThirdPartyPayServiceImpl : IThirdPartyPayService.Stub() { | ||
override fun getPayApiAvailabilityStatus(request: GetPayApiAvailabilityStatusRequest?, callback: IPayServiceCallbacks) { | ||
Log.d(TAG, "onPayApiAvailabilityStatus: Reporting NOT_ELIGIBLE") | ||
callback.onPayApiAvailabilityStatus(Status.SUCCESS, PayApiAvailabilityStatus.NOT_ELIGIBLE) | ||
} | ||
|
||
override fun savePasses(request: SavePassesRequest?, callback: IPayServiceCallbacks) { | ||
Log.d(TAG, "savePasses: return SERVICE_MISSING") | ||
callback.onPendingIntent(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") | ||
} | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
...services-pay/src/main/aidl/com/google/android/gms/pay/CheckReadinessForEmoneyRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable CheckReadinessForEmoneyRequest; |
3 changes: 3 additions & 0 deletions
3
play-services-pay/src/main/aidl/com/google/android/gms/pay/EmoneyReadiness.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable EmoneyReadiness; |
3 changes: 3 additions & 0 deletions
3
play-services-pay/src/main/aidl/com/google/android/gms/pay/GetMdocCredentialRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable GetMdocCredentialRequest; |
3 changes: 3 additions & 0 deletions
3
...ices-pay/src/main/aidl/com/google/android/gms/pay/GetPayApiAvailabilityStatusRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable GetPayApiAvailabilityStatusRequest; |
3 changes: 3 additions & 0 deletions
3
...-pay/src/main/aidl/com/google/android/gms/pay/GetPendingIntentForWalletOnWearRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable GetPendingIntentForWalletOnWearRequest; |
3 changes: 3 additions & 0 deletions
3
play-services-pay/src/main/aidl/com/google/android/gms/pay/GetWalletStatusResponse.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable GetWalletStatusResponse; |
3 changes: 3 additions & 0 deletions
3
play-services-pay/src/main/aidl/com/google/android/gms/pay/NotifyCardTapEventRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable NotifyCardTapEventRequest; |
3 changes: 3 additions & 0 deletions
3
...ces-pay/src/main/aidl/com/google/android/gms/pay/NotifyEmoneyCardStatusUpdateRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable NotifyEmoneyCardStatusUpdateRequest; |
3 changes: 3 additions & 0 deletions
3
play-services-pay/src/main/aidl/com/google/android/gms/pay/PayApiError.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable PayApiError; |
3 changes: 3 additions & 0 deletions
3
play-services-pay/src/main/aidl/com/google/android/gms/pay/PushEmoneyCardRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable PushEmoneyCardRequest; |
3 changes: 3 additions & 0 deletions
3
play-services-pay/src/main/aidl/com/google/android/gms/pay/SavePassesRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable SavePassesRequest; |
3 changes: 3 additions & 0 deletions
3
play-services-pay/src/main/aidl/com/google/android/gms/pay/SyncBundleRequest.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.google.android.gms.pay; | ||
|
||
parcelable SyncBundleRequest; |
35 changes: 35 additions & 0 deletions
35
...-services-pay/src/main/aidl/com/google/android/gms/pay/internal/IPayServiceCallbacks.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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.EmoneyReadiness; | ||
import com.google.android.gms.pay.GetWalletStatusResponse; | ||
import com.google.android.gms.pay.PayApiError; | ||
|
||
interface IPayServiceCallbacks { | ||
oneway void onStatus(in Status status) = 1; | ||
// oneway void onGetPayGlobalActionCardsResponse(in Status status, in GetPayGlobalActionCardsResponse response) = 2; | ||
oneway void onPendingIntentForWalletOnWear(in Status status, in PendingIntent pendingIntent) = 3; | ||
// oneway void onProtoSafeParcelable(in Status status, in ProtoSafeParcelable proto) = 4; | ||
// oneway void onDataChangeListenerResponse(in DataChangeListenerResponse response) = 5; | ||
// oneway void onGetSortOrderResponse(in Status status, in GetSortOrderResponse response) = 6; | ||
oneway void onStatusAndBoolean(in Status status, boolean b) = 7; | ||
// oneway void onGetTransactionsResponse(in Status status, in GetTransactionsResponse response) = 8; | ||
oneway void onPayApiError(in PayApiError error) = 9; | ||
// oneway void onGetOutstandingPurchaseOrderIdResponse(in Status status, in GetOutstandingPurchaseOrderIdResponse response) = 10; | ||
// oneway void onGetClosedLoopBundleResponse(in Status status, in GetClosedLoopBundleResponse response) = 11; | ||
// oneway void onGetPayCardArtResponse(in Status status, in GetPayCardArtResponse response) = 12; | ||
// oneway void onSyncTransactionsResponse(in Status status, in SyncTransactionsResponse response) = 13; | ||
oneway void onStatusAndByteArray(in Status status, in byte[] bArr) = 14; | ||
// oneway void onGetPassesResponse(in Status status, in GetPassesResponse response) = 15; | ||
oneway void onStatusAndLong(in Status status, long l) = 16; | ||
oneway void onPendingIntent(in Status status) = 17; | ||
// oneway void onGp3SupportInfo(in Status status, Gp3SupportInfo info) = 18; | ||
oneway void onPayApiAvailabilityStatus(in Status status, int availabilityStatus) = 19; | ||
// oneway void onGetTransitCardsResponse(in Status status, in GetTransitCardsResponse response) = 20; | ||
// oneway void onGetWalletStatus(in Status status, in GetWalletStatusResponse getWalletStatusResponse) = 21; | ||
// oneway void onGetSeFeatureReadinessStatusResponse(in Status status, in GetSeFeatureReadinessStatusResponse response) = 22; | ||
// oneway void onSyncTransactionByIdResponse(in Status status, in SyncTransactionByIdResponse response) = 23; | ||
// oneway void onGetImagesForValuableResponse(in Status status, in GetImagesForValuableResponse response) = 24; | ||
oneway void onEmoneyReadiness(in Status status, in EmoneyReadiness emoneyReadiness) = 25; | ||
} |
24 changes: 24 additions & 0 deletions
24
...services-pay/src/main/aidl/com/google/android/gms/pay/internal/IThirdPartyPayService.aidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; // Reply via onPayApiAvailabilityStatus | ||
void savePasses(in SavePassesRequest request, in IPayServiceCallbacks callback) = 2; // Reply via onPendingIntent | ||
void syncBundle(in SyncBundleRequest request, in IPayServiceCallbacks callback) = 3; | ||
void getPendingForWalletOnWear(in GetPendingIntentForWalletOnWearRequest request, in IPayServiceCallbacks callback) = 4; // Reply via onPendingIntentForWalletOnWear | ||
void getMdocCredential(in GetMdocCredentialRequest request, in IPayServiceCallbacks callback) = 5; | ||
void notifyCardTapEvent(in NotifyCardTapEventRequest request, in IPayServiceCallbacks callback) = 6; // Reply via onStatus or onPayApiError | ||
void checkReadinessForEmoney(in CheckReadinessForEmoneyRequest request, in IPayServiceCallbacks callback) = 7; // Reply via onEmoneyReadiness | ||
void pushEmoneyCard(in PushEmoneyCardRequest request, in IPayServiceCallbacks callback) = 8; // Reply via onPendingIntent | ||
void notifyEmoneyCardStatusUpdate(in NotifyEmoneyCardStatusUpdateRequest request, in IPayServiceCallbacks callback) = 9; // Reply via onStatus | ||
} |
32 changes: 32 additions & 0 deletions
32
...services-pay/src/main/java/com/google/android/gms/pay/CheckReadinessForEmoneyRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.google.android.gms.pay; | ||
|
||
import android.os.Parcel; | ||
|
||
import androidx.annotation.Nullable; | ||
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; | ||
|
||
@Hide | ||
@SafeParcelable.Class | ||
public class CheckReadinessForEmoneyRequest extends AbstractSafeParcelable { | ||
@Field(1) | ||
public String serviceProvider; | ||
@Nullable | ||
@Field(2) | ||
public String accountName; | ||
|
||
@Constructor | ||
public CheckReadinessForEmoneyRequest(@Param(1) String serviceProvider, @Nullable @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); | ||
} |
Oops, something went wrong.