Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
966 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 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-pay' | ||
|
||
dependencies { | ||
api project(':play-services-base') | ||
|
||
implementation "androidx.annotation:annotation:$annotationVersion" | ||
} |
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,50 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 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-pay') | ||
|
||
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-pay' |
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,30 @@ | ||
<?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" | ||
package="org.microg.gms.pay.core"> | ||
|
||
<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"> | ||
<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"/> | ||
</intent-filter> | ||
</activity-alias> | ||
<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> | ||
</application> | ||
</manifest> |
21 changes: 21 additions & 0 deletions
21
play-services-pay/core/src/main/kotlin/org/microg/gms/pay/PayActivity.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,21 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.microg.gms.pay | ||
|
||
import android.app.Activity | ||
import android.os.Bundle | ||
import android.view.Gravity | ||
import android.widget.TextView | ||
|
||
class PayActivity : Activity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(TextView(this).apply { | ||
text = "Not yet supported:\n${intent?.action}" | ||
gravity = Gravity.CENTER | ||
}) | ||
} | ||
} |
99 changes: 99 additions & 0 deletions
99
play-services-pay/core/src/main/kotlin/org/microg/gms/pay/PayService.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,99 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 microG Project Team | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.microg.gms.pay | ||
|
||
import android.os.Parcel | ||
import com.google.android.gms.common.Feature | ||
import com.google.android.gms.common.api.CommonStatusCodes | ||
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.internal.IPayService | ||
import org.microg.gms.BaseService | ||
import org.microg.gms.common.GmsService | ||
import org.microg.gms.utils.warnOnTransactionIssues | ||
|
||
private const val TAG = "GmsPay" | ||
|
||
class PayService : BaseService(TAG, GmsService.PAY) { | ||
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { | ||
callback.onPostInitCompleteWithConnectionInfo(CommonStatusCodes.SUCCESS, PayImpl(), ConnectionInfo().apply { | ||
features = arrayOf( | ||
Feature("pay", 10), | ||
Feature("pay_attestation_signal", 1), | ||
Feature("pay_pay_capabilities", 1), | ||
Feature("pay_feature_check", 1), | ||
Feature("pay_get_card_centric_bundle", 1), | ||
Feature("pay_get_passes", 1), | ||
Feature("pay_get_pay_api_availability_status", 3), | ||
Feature("pay_get_se_prepaid_card", 1), | ||
Feature("pay_debit_se_prepaid_card", 1), | ||
Feature("pay_get_specific_bulletin", 1), | ||
Feature("pay_get_transit_cards", 1), | ||
Feature("pay_get_wallet_status", 1), | ||
Feature("pay_global_actions", 1), | ||
Feature("pay_gp3_support", 1), | ||
Feature("pay_homescreen_sorting", 3), | ||
Feature("pay_homescreen_bulletins", 2), | ||
Feature("pay_onboarding", 2), | ||
Feature("pay_mark_tos_accepted_for_partner", 1), | ||
Feature("pay_move_card_on_other_device", 1), | ||
Feature("pay_passes_field_update_notifications", 1), | ||
Feature("pay_passes_notifications", 2), | ||
Feature("pay_payment_method", 1), | ||
Feature("pay_payment_method_action_tokens", 2), | ||
Feature("pay_payment_method_server_action", 1), | ||
Feature("pay_provision_se_prepaid_card", 1), | ||
Feature("pay_request_module", 1), | ||
Feature("pay_reverse_purchase", 1), | ||
Feature("pay_save_passes", 5), | ||
Feature("pay_save_passes_jwt", 3), | ||
Feature("pay_save_purchased_card", 1), | ||
Feature("pay_sync_bundle", 2), | ||
Feature("pay_settings", 1), | ||
Feature("pay_topup_se_prepaid_card", 1), | ||
Feature("pay_list_commuter_pass_renewal_options_for_se_prepaid_card", 1), | ||
Feature("pay_transactions", 6), | ||
Feature("pay_update_bundle_with_client_settings", 1), | ||
Feature("pay_clock_skew_millis", 1), | ||
Feature("pay_se_postpaid_transactions", 1), | ||
Feature("pay_se_prepaid_transactions", 1), | ||
Feature("pay_get_clock_skew_millis", 1), | ||
Feature("pay_renew_commuter_pass_for_se_prepaid_card", 1), | ||
Feature("pay_remove_se_postpaid_token", 1), | ||
Feature("pay_change_se_postpaid_default_status", 1), | ||
Feature("pay_wear_payment_methods", 2), | ||
Feature("pay_wear_closed_loop_cards", 1), | ||
Feature("pay_perform_wear_operation", 1), | ||
Feature("pay_delete_se_prepaid_card", 1), | ||
Feature("pay_transit_issuer_tos", 1), | ||
Feature("pay_get_se_mfi_prepaid_cards", 1), | ||
Feature("pay_get_last_user_present_timestamp", 1), | ||
Feature("pay_mdoc", 7), | ||
Feature("pay_get_se_feature_readiness_status", 1), | ||
Feature("pay_recover_se_card", 1), | ||
Feature("pay_set_wallet_item_surfacing", 2), | ||
Feature("pay_set_se_transit_default", 1), | ||
Feature("pay_get_wallet_bulletins", 2), | ||
Feature("pay_mse_operation", 1), | ||
Feature("pay_clear_bulletin_interaction_for_dev", 1), | ||
Feature("pay_get_pending_intent_for_wallet_on_wear", 2), | ||
Feature("pay_get_predefined_rotating_barcode_values", 1), | ||
Feature("pay_get_mdl_refresh_timestamps", 1), | ||
Feature("pay_store_mdl_refresh_timestamp", 1), | ||
Feature("pay_perform_id_card_operation", 1), | ||
Feature("pay_block_closed_loop_cards", 1), | ||
Feature("pay_delete_data_for_tests", 1), | ||
Feature("pay_perform_closed_loop_operation", 1) | ||
) | ||
}) | ||
} | ||
} | ||
|
||
class PayImpl : IPayService.Stub() { | ||
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = | ||
warnOnTransactionIssues(code, reply, flags, TAG) { super.onTransact(code, data, reply, flags) } | ||
} |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ SPDX-FileCopyrightText: 2023 microG Project Team | ||
~ SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
<manifest package="com.google.android.gms.pay"/> |
5 changes: 5 additions & 0 deletions
5
play-services-pay/src/main/aidl/com/google/android/gms/pay/internal/IPayService.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,5 @@ | ||
package com.google.android.gms.pay.internal; | ||
|
||
interface IPayService { | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
play-services-pay/src/main/java/com/google/android/gms/pay/Pay.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 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 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.pay; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import org.microg.gms.pay.PayClientImpl; | ||
|
||
/** | ||
* Entry point for Pay API. | ||
*/ | ||
public class Pay { | ||
/** | ||
* Creates a new instance of {@link PayClient} for use in an {@link Activity}. This client should not be used outside of the given {@code Activity}. | ||
*/ | ||
public static PayClient getClient(Activity activity) { | ||
return new PayClientImpl(activity); | ||
} | ||
|
||
/** | ||
* Creates a new instance of {@link PayClient} for use in a non-{@code Activity} {@link Context}. | ||
*/ | ||
public static PayClient getClient(Context context) { | ||
return new PayClientImpl(context); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
play-services-pay/src/main/java/com/google/android/gms/pay/PayApiAvailabilityStatus.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,33 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 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.pay; | ||
|
||
import androidx.annotation.IntDef; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* Pay API availability status on the device. | ||
*/ | ||
@Target({ElementType.TYPE_USE}) | ||
@Retention(RetentionPolicy.SOURCE) | ||
@IntDef({PayApiAvailabilityStatus.AVAILABLE, PayApiAvailabilityStatus.NOT_ELIGIBLE}) | ||
public @interface PayApiAvailabilityStatus { | ||
/** | ||
* Indicates that the Pay API requested is available and ready to be used. | ||
*/ | ||
int AVAILABLE = 0; | ||
/** | ||
* Indicates that the user is currently not eligible for using the Pay API requested. The user may become eligible in the future. | ||
*/ | ||
int NOT_ELIGIBLE = 2; | ||
} |
Oops, something went wrong.
91e830b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love to see this all implemented
91e830b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now do Google pay can work?
91e830b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This is just the beginning of laying a foundation to get things to work.
91e830b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paolo1983 I just mentioned as a goal it would be great to see it implemented, before this I'd like to see the Find My stuff implemented first, personally.