Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ buildscript {

ext.slf4jVersion = '1.7.36'
ext.volleyVersion = '1.2.1'
ext.wireVersion = '4.8.0'
ext.wireVersion = '4.9.9'
ext.tinkVersion = '1.13.0'
ext.okHttpVersion = '4.12.0'
ext.ktorVersion = '2.3.12'

ext.androidBuildGradleVersion = '8.2.2'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,15 @@ object SettingsContract {

const val LICENSING = "vending_licensing"
const val LICENSING_PURCHASE_FREE_APPS = "vending_licensing_purchase_free_apps"
const val LICENSING_SPLIT_INSTALL = "vending_licensing_split_install"
const val BILLING = "vending_billing"
const val ASSET_DELIVERY = "vending_asset_delivery"
const val ASSET_DEVICE_SYNC = "vending_device_sync"

val PROJECTION = arrayOf(
LICENSING,
LICENSING_PURCHASE_FREE_APPS,
LICENSING_SPLIT_INSTALL,
BILLING,
ASSET_DELIVERY,
ASSET_DEVICE_SYNC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ class SettingsProvider : ContentProvider() {
Vending.BILLING -> getSettingsBoolean(key, false)
Vending.ASSET_DELIVERY -> getSettingsBoolean(key, false)
Vending.ASSET_DEVICE_SYNC -> getSettingsBoolean(key, false)
Vending.LICENSING_SPLIT_INSTALL -> getSettingsBoolean(key, false)
else -> throw IllegalArgumentException("Unknown key: $key")
}
}
Expand All @@ -371,6 +372,7 @@ class SettingsProvider : ContentProvider() {
Vending.BILLING -> editor.putBoolean(key, value as Boolean)
Vending.ASSET_DELIVERY -> editor.putBoolean(key, value as Boolean)
Vending.ASSET_DEVICE_SYNC -> editor.putBoolean(key, value as Boolean)
Vending.LICENSING_SPLIT_INSTALL -> editor.putBoolean(key, value as Boolean)
else -> throw IllegalArgumentException("Unknown key: $key")
}
}
Expand Down
3 changes: 3 additions & 0 deletions play-services-core/src/huawei/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@
<meta-data
android:name="org.microg.gms.settings.vending_device_sync"
android:value="true" />
<meta-data
android:name="org.microg.gms.settings.vending_licensing_split_install"
android:value="true" />
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.microg.gms.vending.VendingPreferences
class VendingFragment : PreferenceFragmentCompat() {
private lateinit var licensingEnabled: TwoStatePreference
private lateinit var licensingPurchaseFreeAppsEnabled: TwoStatePreference
private lateinit var licensingSplitInstallEnabled: TwoStatePreference
private lateinit var iapEnable: TwoStatePreference
private lateinit var assetDeliveryEnabled: TwoStatePreference
private lateinit var deviceSyncEnabled: TwoStatePreference
Expand Down Expand Up @@ -51,6 +52,18 @@ class VendingFragment : PreferenceFragmentCompat() {
true
}

licensingSplitInstallEnabled = preferenceScreen.findPreference(PREF_LICENSING_PURCHASE_SPLIT_INSTALL_DISABLED) ?: licensingSplitInstallEnabled
licensingSplitInstallEnabled.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
val appContext = requireContext().applicationContext
lifecycleScope.launchWhenResumed {
if (newValue is Boolean) {
VendingPreferences.setLicensingSplitInstallEnabled(appContext, newValue)
}
updateContent()
}
true
}

iapEnable = preferenceScreen.findPreference(PREF_IAP_ENABLED) ?: iapEnable
iapEnable.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
val appContext = requireContext().applicationContext
Expand Down Expand Up @@ -98,6 +111,7 @@ class VendingFragment : PreferenceFragmentCompat() {
lifecycleScope.launchWhenResumed {
licensingEnabled.isChecked = VendingPreferences.isLicensingEnabled(appContext)
licensingPurchaseFreeAppsEnabled.isChecked = VendingPreferences.isLicensingPurchaseFreeAppsEnabled(appContext)
licensingSplitInstallEnabled.isChecked = VendingPreferences.isLicensingSplitInstallEnabled(appContext)
iapEnable.isChecked = VendingPreferences.isBillingEnabled(appContext)
assetDeliveryEnabled.isChecked = VendingPreferences.isAssetDeliveryEnabled(appContext)
deviceSyncEnabled.isChecked = VendingPreferences.isDeviceSyncEnabled(appContext)
Expand All @@ -107,6 +121,7 @@ class VendingFragment : PreferenceFragmentCompat() {
companion object {
const val PREF_LICENSING_ENABLED = "vending_licensing"
const val PREF_LICENSING_PURCHASE_FREE_APPS_ENABLED = "vending_licensing_purchase_free_apps"
const val PREF_LICENSING_PURCHASE_SPLIT_INSTALL_DISABLED = "vending_licensing_split_install"
const val PREF_IAP_ENABLED = "vending_iap"
const val PREF_ASSET_DELIVERY_ENABLED = "vending_asset_delivery"
const val PREF_DEVICE_SYNC_ENABLED = "vending_device_sync"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ object VendingPreferences {
}
}

@JvmStatic
fun isLicensingSplitInstallEnabled(context: Context): Boolean {
val projection = arrayOf(SettingsContract.Vending.LICENSING_SPLIT_INSTALL)
return SettingsContract.getSettings(context, SettingsContract.Vending.getContentUri(context), projection) { c ->
c.getInt(0) != 0
}
}

@JvmStatic
fun setLicensingSplitInstallEnabled(context: Context, enabled: Boolean) {
SettingsContract.setSettings(context, SettingsContract.Vending.getContentUri(context)) {
put(SettingsContract.Vending.LICENSING_SPLIT_INSTALL, enabled)
}
}

@JvmStatic
fun isBillingEnabled(context: Context): Boolean {
val projection = arrayOf(SettingsContract.Vending.BILLING)
Expand Down
2 changes: 2 additions & 0 deletions play-services-core/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,6 @@
<string name="prefcat_push_networks_title">الشبكات المستخدمة لإشعارات الدفع</string>
<string name="limited_services_app_name">خدمات مايكرو-جي المحدودة</string>
<string name="auth_action_notification_channel_name">تنبيهات حساب جوجل</string>
<string name="pref_vending_licensing_split_install_switch">تمكين تنزيل ميزات معينة للتطبيق عند الطلب.</string>
<string name="pref_vending_licensing_split_install_summary">باستخدام التثبيت المجزأ، سيقوم التطبيق بتنزيل وحدات الميزات المحددة بناءً على الاستخدام الحالي.</string>
</resources>
2 changes: 2 additions & 0 deletions play-services-core/src/main/res/values-be/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,6 @@
<string name="auth_package_override_request_message"><b><xliff:g example="F-Droid">%1$s</xliff:g></b> спрабуе атрымаць доступ да ўліковага запісу пад выглядам <b><xliff:g example="F-Droid">%2$s</xliff:g> ад <xliff:g example="F-Droid Inc.">%3$s</xliff:g></b>. Гэта дасць прывілеяваны доступ да вашага ўліковага запісу.</string>
<string name="pref_vending_licensing_purchase_free_apps_switch">Аўтаматычна дабаўляць бясплатныя прыкладанні ў бібліятэку</string>
<string name="pref_vending_licensing_purchase_free_apps_summary">Бясплатныя прыкладанні могуць правяраць, ці загружаліся яны з Google Play. Аўтаматычнае даданне бясплатных дадаткаў у бібліятэку вашага акаўнта дазваляе заўсёды праходзіць праверку для ўсіх даступных вам бясплатных прыкладанняў.</string>
<string name="pref_vending_licensing_split_install_switch">Уключыць спампоўванне пэўных функцый прыкладання па патрабаванні.</string>
<string name="pref_vending_licensing_split_install_summary">Выкарыстоўваючы падзеленую ўстаноўку, прыкладанне будзе спампоўваць пэўныя модулі функцый у залежнасці ад бягучага выкарыстання.</string>
</resources>
2 changes: 2 additions & 0 deletions play-services-core/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,6 @@ microG GmsCore 内置一套自由的 SafetyNet 实现,但是官方服务器要
<string name="pref_vending_asset_delivery_switch">启用按需资产传递</string>
<string name="pref_vending_asset_device_sync_summary">使用 Play 资产传递的应用会根据当前使用设备的信息下载额外的资产。</string>
<string name="pref_vending_asset_device_sync_switch">启用设备信息同步</string>
<string name="pref_vending_licensing_split_install_switch">启用按需下载应用的某些功能</string>
<string name="pref_vending_licensing_split_install_summary">使用分包安装,应用会根据当前使用情况下载特定功能模块</string>
</resources>
2 changes: 2 additions & 0 deletions play-services-core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ Please set up a password, PIN, or pattern lock screen."</string>
<string name="pref_vending_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, microG can download a proof of purchase from Google. If disabled, or if no Google account is added, requests for license verification are ignored.</string>
<string name="pref_vending_licensing_purchase_free_apps_switch">Automatically add free apps to library</string>
<string name="pref_vending_licensing_purchase_free_apps_summary">Free apps may check whether they had been downloaded from Google Play. Automatically add free apps to your account library to always pass the check for all free apps currently available to you.</string>
<string name="pref_vending_licensing_split_install_switch">Enable on-demand downloading of specific app features.</string>
<string name="pref_vending_licensing_split_install_summary">By using split installation, the app will download specific feature modules based on current usage.</string>

<string name="feedback_disabled">Feedback currently not possible</string>
<string name="backup_disabled">Backup currently not possible</string>
Expand Down
7 changes: 7 additions & 0 deletions play-services-core/src/main/res/xml/preferences_vending.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,12 @@
android:key="vending_device_sync"
android:persistent="false"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
android:title="@string/pref_vending_licensing_split_install_switch"
android:key="vending_licensing_split_install"
android:summary="@string/pref_vending_licensing_split_install_summary"
android:persistent="false"
android:dependency="vending_licensing"
app:iconSpaceReserved="false" />
</PreferenceCategory>
</PreferenceScreen>
6 changes: 6 additions & 0 deletions vending-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ android {
removeUnusedResources false
obfuscate false
optimizeCode false
proguardFile 'proguard-rules.pro'
}
}
release {
Expand All @@ -34,6 +35,7 @@ android {
removeUnusedResources true
obfuscate false
optimizeCode true
proguardFile 'proguard-rules.pro'
}
}
}
Expand Down Expand Up @@ -99,6 +101,10 @@ dependencies {

implementation "com.squareup.wire:wire-grpc-client:$wireVersion"

implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation "io.ktor:ktor-client-core:$ktorVersion"
implementation "io.ktor:ktor-client-okhttp:$ktorVersion"

//compose
implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.compose.ui:ui'
Expand Down
6 changes: 6 additions & 0 deletions vending-app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# OKHttp rules
-dontwarn okhttp3.internal.platform.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
-dontwarn org.slf4j.impl.StaticLoggerBinder
16 changes: 16 additions & 0 deletions vending-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@
</intent-filter>
</activity>

<service android:name="com.google.android.finsky.splitinstallservice.SplitInstallService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.play.core.splitinstall.BIND_SPLIT_INSTALL_SERVICE"/>
</intent-filter>
</service>

<service
android:name="com.android.vending.billing.InAppBillingService"
android:exported="true">
Expand Down Expand Up @@ -201,5 +208,14 @@
</intent-filter>
</receiver>

<receiver
android:name="com.google.android.finsky.accounts.impl.AccountsChangedReceiver"
android:permission="com.google.android.gms.auth.permission.GOOGLE_ACCOUNT_CHANGE"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.auth.GOOGLE_ACCOUNT_CHANGE"/>
</intent-filter>
</receiver>

</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.play.core.splitinstall.protocol;
import com.google.android.play.core.splitinstall.protocol.ISplitInstallServiceCallback;

interface ISplitInstallService {
void startInstall(String pkg,in List<Bundle> splits,in Bundle bundle, ISplitInstallServiceCallback callback) = 1;
void completeInstalls(String pkg, int sessionId,in Bundle bundle, ISplitInstallServiceCallback callback) = 2;
void cancelInstall(String pkg, int sessionId, ISplitInstallServiceCallback callback) = 3;
void getSessionState(String pkg, int sessionId, ISplitInstallServiceCallback callback) = 4;
void getSessionStates(String pkg, ISplitInstallServiceCallback callback) = 5;
void splitRemoval(String pkg,in List<Bundle> splits, ISplitInstallServiceCallback callback) = 6;
void splitDeferred(String pkg,in List<Bundle> splits,in Bundle bundle, ISplitInstallServiceCallback callback) = 7;
void getSessionState2(String pkg, int sessionId, ISplitInstallServiceCallback callback) = 8;
void getSessionStates2(String pkg, ISplitInstallServiceCallback callback) = 9;
void getSplitsAppUpdate(String pkg, ISplitInstallServiceCallback callback) = 10;
void completeInstallAppUpdate(String pkg, ISplitInstallServiceCallback callback) = 11;
void languageSplitInstall(String pkg,in List<Bundle> splits,in Bundle bundle, ISplitInstallServiceCallback callback) = 12;
void languageSplitUninstall(String pkg,in List<Bundle> splits, ISplitInstallServiceCallback callback) =13;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* SPDX-FileCopyrightText: 2024 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.play.core.splitinstall.protocol;


interface ISplitInstallServiceCallback {
oneway void onStartInstall(int status, in Bundle bundle) = 1;
oneway void onInstallCompleted(int status, in Bundle bundle) = 2;
oneway void onCancelInstall(int status, in Bundle bundle) = 3;
oneway void onGetSessionState(int status, in Bundle bundle) = 4;
oneway void onError(in Bundle bundle) = 5;
oneway void onGetSessionStates(in List<Bundle> list) = 6;
oneway void onDeferredUninstall(in Bundle bundle) = 7;
oneway void onDeferredInstall(in Bundle bundle) = 8;
oneway void onDeferredLanguageInstall(in Bundle bundle) = 11;
oneway void onDeferredLanguageUninstall(in Bundle bundle) = 12;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ object VendingPreferences {
}
}

@JvmStatic
fun isLicensingSplitInstallEnabled(context: Context): Boolean {
val projection = arrayOf(SettingsContract.Vending.LICENSING_SPLIT_INSTALL)
return SettingsContract.getSettings(context, SettingsContract.Vending.getContentUri(context), projection) { c ->
c.getInt(0) != 0
}
}

@JvmStatic
fun isBillingEnabled(context: Context): Boolean {
val projection = arrayOf(SettingsContract.Vending.BILLING)
Expand Down
Loading
Loading