Revert "Add preference for play licensing microg@4ef2248"

This reverts commit 9a12599b
This commit is contained in:
Cuynu 2025-03-22 15:51:40 +07:00
commit ef31eda600
31 changed files with 2 additions and 234 deletions

Binary file not shown.

View file

@ -103,17 +103,6 @@ object SettingsContract {
)
}
object Play {
private const val id = "play"
fun getContentUri(context: Context) = Uri.withAppendedPath(getAuthorityUri(context), id)
fun getContentType(context: Context) = "vnd.android.cursor.item/vnd.${getAuthority(context)}.$id"
const val LICENSING = "play_licensing"
val PROJECTION = arrayOf(
LICENSING
)
}
private fun <T> withoutCallingIdentity(f: () -> T): T {
val identity = Binder.clearCallingIdentity()
try {

View file

@ -14,7 +14,6 @@ import android.content.SharedPreferences
import android.database.Cursor
import android.database.MatrixCursor
import android.net.Uri
import org.microg.gms.settings.SettingsContract.Play
import android.preference.PreferenceManager
import org.microg.gms.common.PackageUtils.warnIfNotMainProcess
import org.microg.gms.settings.SettingsContract.Auth
@ -69,7 +68,6 @@ class SettingsProvider : ContentProvider() {
Gcm.getContentUri(context!!) -> queryGcm(projection ?: Gcm.PROJECTION)
Auth.getContentUri(context!!) -> queryAuth(projection ?: Auth.PROJECTION)
Profile.getContentUri(context!!) -> queryProfile(projection ?: Profile.PROJECTION)
Play.getContentUri(context!!) -> queryPlay(projection ?: Play.PROJECTION)
else -> null
}
@ -86,30 +84,11 @@ class SettingsProvider : ContentProvider() {
Gcm.getContentUri(context!!) -> updateGcm(values)
Auth.getContentUri(context!!) -> updateAuth(values)
Profile.getContentUri(context!!) -> updateProfile(values)
Play.getContentUri(context!!) -> updatePlay(values)
else -> return 0
}
return 1
}
private fun queryPlay(p: Array<out String>): Cursor = MatrixCursor(p).addRow(p) { key ->
when (key) {
Play.LICENSING -> getSettingsBoolean(key, false)
else -> throw IllegalArgumentException("Unknown key: $key")
}
}
private fun updatePlay(values: ContentValues) {
if (values.size() == 0) return
val editor = preferences.edit()
values.valueSet().forEach { (key, value) ->
when (key) {
Play.LICENSING -> editor.putBoolean(key, value as Boolean)
else -> throw IllegalArgumentException("Unknown key: $key")
}
}
editor.apply()
}
private fun queryCheckIn(p: Array<out String>): Cursor = MatrixCursor(p).addRow(p) { key ->
when (key) {
CheckIn.ENABLED -> getSettingsBoolean(key, true)

View file

@ -1,18 +0,0 @@
package org.microg.gms.play
import android.content.Context
import org.microg.gms.settings.SettingsContract
object PlayPreferences {
@JvmStatic
fun isLicensingEnabled(context: Context): Boolean {
val projection = arrayOf(SettingsContract.Play.LICENSING)
return SettingsContract.getSettings(context, SettingsContract.Play.getContentUri(context), projection) { c ->
c.getInt(0) != 0
}
}
@JvmStatic
fun setLicensingEnabled(context: Context, enabled: Boolean) {
SettingsContract.setSettings(context, SettingsContract.Play.getContentUri(context)) {
put(SettingsContract.Play.LICENSING, enabled)
}
}
}

View file

@ -1,42 +0,0 @@
package org.microg.gms.ui
import android.annotation.SuppressLint
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.TwoStatePreference
import com.mgoogle.android.gms.R
import org.microg.gms.play.PlayPreferences
class PlayFragment : PreferenceFragmentCompat() {
private lateinit var licensingEnabled: TwoStatePreference
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.preferences_play)
}
@SuppressLint("RestrictedApi")
override fun onBindPreferences() {
licensingEnabled = preferenceScreen.findPreference(PREF_LICENSING_ENABLED) ?: licensingEnabled
licensingEnabled.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
val appContext = requireContext().applicationContext
lifecycleScope.launchWhenResumed {
if (newValue is Boolean) {
PlayPreferences.setLicensingEnabled(appContext, newValue)
}
updateContent()
}
true
}
}
override fun onResume() {
super.onResume()
updateContent()
}
private fun updateContent() {
val appContext = requireContext().applicationContext
lifecycleScope.launchWhenResumed {
licensingEnabled.isChecked = PlayPreferences.isLicensingEnabled(appContext)
}
}
companion object {
const val PREF_LICENSING_ENABLED = "play_licensing"
}
}

View file

@ -11,9 +11,6 @@
<action android:id="@+id/openCheckinSettings" app:destination="@id/checkinFragment" />
<action android:id="@+id/openGcmSettings" app:destination="@id/gcmFragment" />
<action android:id="@+id/openAbout" app:destination="@id/aboutFragment" />
<action
android:id="@+id/openPlaySettings"
app:destination="@id/playFragment" />
</fragment>
<fragment
@ -35,9 +32,6 @@
<action
android:id="@+id/openGcmAdvancedSettings"
app:destination="@id/gcmAdvancedFragment" />
<action
android:id="@+id/openPlaySettings"
app:destination="@id/playFragment" />
</fragment>
<fragment
android:id="@+id/gcmAllAppsFragment"
@ -65,8 +59,4 @@
android:id="@+id/aboutFragment"
android:name="org.microg.gms.ui.AboutFragment"
android:label="@string/prefcat_about" />
<fragment
android:id="@+id/playFragment"
android:name="org.microg.gms.ui.PlayFragment"
android:label="@string/service_name_play" />
</navigation>

View file

@ -138,9 +138,4 @@
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -138,9 +138,4 @@ Bu bir neçə dəqiqə çəkə bilər."</string>
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -138,9 +138,4 @@
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -139,9 +139,4 @@
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -135,9 +135,4 @@ Tato akce může trvat několik minut."</string>
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -138,9 +138,4 @@ Esto puede tardar unos minutos."</string>
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -138,9 +138,4 @@ Cela peut prendre quelques minutes."</string>
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -85,9 +85,4 @@
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -137,9 +137,4 @@
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -136,9 +136,4 @@ Ini bisa berlangsung beberapa menit."</string>
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -135,9 +135,4 @@ Questo potrà richiedere un paio di minuti"</string>
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -138,9 +138,4 @@
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -138,9 +138,4 @@
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

View file

@ -138,9 +138,4 @@ Tai gali užtrukti keletą minučių."</string>
<string name="manage_googleaccount_title">Manage signed in Google accounts</string>
<string name="manage_googleaccount_summary">This will open your device settings !</string>
<string name="miscellaneous_settings">Miscellaneous settings</string>
<string name="pref_play_summary_licensing_off">Licensing off</string>
<string name="pref_play_summary_licensing_on">Licensing on</string>
<string name="pref_play_licensing_enable_switch">Answer license verification requests</string>
<string name="pref_play_license_enable_summary">Some apps require verification that you have purchased them on Google Play. When requested by an app, Vanced+ 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="service_name_play">Play Store services</string>
</resources>

Some files were not shown because too many files have changed in this diff Show more