diff --git a/.gitignore b/.gitignore index dfd05bed423e62b6dfb7b9324545f8b41ceba33f..082b1d9ec45c204d463476c458a0de3b0c926bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,4 @@ bin/ .classpath .output/ .settings/ -play-services-location/core/provider/.cxx/ -play-services-location/core/provider/src/main/cpp/ -play-services-location/core/provider/src/main/java/ -credentials.properties *keystore diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a43fd8bcf5b21d6444cc52bfee6f156e857bc5e7..a5b6b12448441e8232088bb292bc2ff9847b96f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,8 +19,6 @@ before_script: - echo mapbox.enabled true >> local.properties - echo stadia.key $STADIA_KEY >> local.properties - echo modules.hms false >> local.properties - - echo key=$LOCATION_TOTP_SECRET_PROD >> credentials.properties - - echo url=$LOCATION_ENDPOINT_URL >> credentials.properties - echo "${KEYSTORE}" | base64 -d > play-services-core/e.keystore - export TERM=dumb - export JAVA_OPTS="-XX:+HeapDumpOnOutOfMemoryError -Xmx4096m" @@ -35,7 +33,6 @@ build: - *default_before_script - echo modules.nearby false >> local.properties script: - - ./gradlew hideSecretFromPropertiesFile -PpropertiesFileName=credentials.properties -Ppackage=com.google.android.gms - ./gradlew assembleMapboxDefaultDebug assembleDefaultDebug - ./gradlew assembleMapboxDefaultRelease assembleDefaultRelease artifacts: @@ -53,7 +50,6 @@ build-nearby: - *default_before_script - echo modules.nearby true >> local.properties script: - - ./gradlew hideSecretFromPropertiesFile -PpropertiesFileName=credentials.properties -Ppackage=com.google.android.gms - ./gradlew assembleMapboxDefaultDebug assembleDefaultDebug - ./gradlew assembleMapboxDefaultRelease assembleDefaultRelease diff --git a/build.gradle b/build.gradle index b825de80057d27ce3fdaaeaa03f807aa69b6d653..9b1ff77fdb2f88d78507fe98beb4713322369bf5 100644 --- a/build.gradle +++ b/build.gradle @@ -36,8 +36,6 @@ buildscript { ext.androidBuildVersionTools = '34.0.0' - ext.hiddenSecretVersion = '0.2.1' - ext.appLoungeAuthDataVersion = '1.0.0' ext.androidMinSdk = 21 @@ -69,7 +67,6 @@ buildscript { classpath "com.android.tools.build:gradle:$androidBuildGradleVersion" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion" - classpath "com.klaxit.hiddensecrets:HiddenSecretsPlugin:$hiddenSecretVersion" } } diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt index 0242839fa3b11ef3bff74f14a72b25e6caacadad..8a9ff68474da6851c3f5302f54334fb82a4016d0 100644 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt +++ b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt @@ -250,7 +250,6 @@ object SettingsContract { const val ICHNAEA_ENDPOINT = "location_ichnaea_endpoint" const val ONLINE_SOURCE = "location_online_source" const val ICHNAEA_CONTRIBUTE = "location_ichnaea_contribute" - const val LOCATION_FROM_E = "location_ichnaea_from_e" val PROJECTION = arrayOf( WIFI_ICHNAEA, @@ -264,7 +263,6 @@ object SettingsContract { ICHNAEA_ENDPOINT, ONLINE_SOURCE, ICHNAEA_CONTRIBUTE, - LOCATION_FROM_E, ) } diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt index ae04fd96ead74bb81bf5c986d116f5f5d0359696..fd05f7b639e5a34666949238e6e855d010125e91 100644 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt +++ b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt @@ -332,7 +332,6 @@ class SettingsProvider : ContentProvider() { Location.ICHNAEA_ENDPOINT -> getSettingsString(key, null) Location.ONLINE_SOURCE -> getSettingsString(key, null) Location.ICHNAEA_CONTRIBUTE -> getSettingsBoolean(key, false) - Location.LOCATION_FROM_E -> getSettingsBoolean(key, true) else -> throw IllegalArgumentException("Unknown key: $key") } } @@ -354,7 +353,6 @@ class SettingsProvider : ContentProvider() { Location.ICHNAEA_ENDPOINT -> (value as String).let { if (it.isBlank()) editor.remove(key) else editor.putString(key, it) } Location.ONLINE_SOURCE -> (value as? String?).let { if (it.isNullOrBlank()) editor.remove(key) else editor.putString(key, it) } Location.ICHNAEA_CONTRIBUTE -> editor.putBoolean(key, value as Boolean) - Location.LOCATION_FROM_E -> editor.putBoolean(key, value as Boolean) else -> throw IllegalArgumentException("Unknown key: $key") } } diff --git a/play-services-location/core/base/src/main/kotlin/org/microg/gms/location/LocationSettings.kt b/play-services-location/core/base/src/main/kotlin/org/microg/gms/location/LocationSettings.kt index b9b2a661c0c205feb5673130210c4b114dd33d39..1e91ab91ee736c1da084634d13407d687413e518 100644 --- a/play-services-location/core/base/src/main/kotlin/org/microg/gms/location/LocationSettings.kt +++ b/play-services-location/core/base/src/main/kotlin/org/microg/gms/location/LocationSettings.kt @@ -99,8 +99,4 @@ class LocationSettings(private val context: Context) { var ichnaeaContribute: Boolean get() = getSettings(SettingsContract.Location.ICHNAEA_CONTRIBUTE) { c -> c.getInt(0) != 0 } set(value) = setSettings { put(SettingsContract.Location.ICHNAEA_CONTRIBUTE, value) } - - var ichnaeaFromE: Boolean - get() = getSettings(SettingsContract.Location.LOCATION_FROM_E) { c -> c.getInt(0) != 0 } - set(value) = setSettings { put(SettingsContract.Location.LOCATION_FROM_E, value) } } diff --git a/play-services-location/core/provider/build.gradle b/play-services-location/core/provider/build.gradle index 328e0d1d07df4f1bcf71c3611beaadb8b1788b55..befa80e9b87eba653a1af3b067932fc2d7e7967a 100644 --- a/play-services-location/core/provider/build.gradle +++ b/play-services-location/core/provider/build.gradle @@ -5,7 +5,6 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'com.klaxit.hiddensecrets' dependencies { api project(':play-services-location') @@ -46,13 +45,6 @@ android { buildConfigField "String", "ICHNAEA_USER_AGENT", "\"microG/${version}\"" } - // Enable NDK build - externalNativeBuild { - cmake { - path "src/main/cpp/CMakeLists.txt" - } - } - sourceSets { main.java.srcDirs += 'src/main/kotlin' } diff --git a/play-services-location/core/provider/src/main/kotlin/org/microg/gms/location/network/ichnaea/IchnaeaServiceClient.kt b/play-services-location/core/provider/src/main/kotlin/org/microg/gms/location/network/ichnaea/IchnaeaServiceClient.kt index 0e9056f9c1b9c52f9d602695117b61940869b7a4..f3452de309fe0d0d84759e2ea75c805314fa98ff 100644 --- a/play-services-location/core/provider/src/main/kotlin/org/microg/gms/location/network/ichnaea/IchnaeaServiceClient.kt +++ b/play-services-location/core/provider/src/main/kotlin/org/microg/gms/location/network/ichnaea/IchnaeaServiceClient.kt @@ -11,15 +11,11 @@ import android.net.Uri import android.os.Build import android.os.Bundle import android.os.SystemClock -import android.util.Base64 import android.util.Log -import androidx.annotation.RequiresApi import androidx.collection.LruCache import com.android.volley.VolleyError import com.android.volley.toolbox.JsonObjectRequest import com.android.volley.toolbox.Volley -import com.eatthepath.otp.TimeBasedOneTimePasswordGenerator -import com.google.android.gms.Secrets import org.json.JSONObject import org.microg.gms.location.LocationSettings import org.microg.gms.location.formatRealtime @@ -32,13 +28,7 @@ import org.microg.gms.location.provider.BuildConfig import org.microg.gms.utils.singleInstanceOf import java.io.PrintWriter import java.nio.ByteBuffer -import java.security.Key -import java.time.Duration -import java.time.Instant import java.util.LinkedList -import javax.crypto.Cipher -import javax.crypto.spec.IvParameterSpec -import javax.crypto.spec.SecretKeySpec import kotlin.coroutines.Continuation import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException @@ -51,8 +41,6 @@ class IchnaeaServiceClient(private val context: Context) { private val omitables = LinkedList() private val cache = LruCache(REQUEST_CACHE_SIZE) private val start = SystemClock.elapsedRealtime() - private var locationFromETimestamp: Long = 0L - private var locationUrlFromE: String? = null private fun GeolocateRequest.hash(): ByteArray? { if (cellTowers.isNullOrEmpty() && (wifiAccessPoints?.size ?: 0) < 3 || bluetoothBeacons?.isNotEmpty() == true) return null @@ -122,10 +110,6 @@ class IchnaeaServiceClient(private val context: Context) { val locationFromCache = cache[requestHash.toHexString()] if (locationFromCache == NEGATIVE_CACHE_ENTRY) return null if (locationFromCache != null) return Location(locationFromCache) - if (LocationSettings(context).ichnaeaFromE && - System.currentTimeMillis() - locationFromETimestamp >= E_LOCATION_PERIOD_IN_MIN) { - locationUrlFromE = requestELocationUrl() - } } val response = rawGeoLocate(request) Log.d(TAG, "$request -> $response") @@ -182,51 +166,6 @@ class IchnaeaServiceClient(private val context: Context) { } } - @RequiresApi(Build.VERSION_CODES.O) - private suspend fun requestELocationUrl(): String = suspendCoroutine { continuation -> - Log.i(TAG, "Requesting URL") - val totp = TimeBasedOneTimePasswordGenerator( - Duration.ofSeconds(TOTP_PERIOD_IN_SECONDS), - TOTP_NUMBER_OF_DIGITS, - TimeBasedOneTimePasswordGenerator.TOTP_ALGORITHM_HMAC_SHA512 - ) - - val key: Key by lazy { - val secretKey = Secrets().getkey(context.packageName) - SecretKeySpec(secretKey.toByteArray(), SECRET_KEY_ALGORITHM) - } - - val password = totp.generateOneTimePasswordString(key, Instant.now()) - val json = JSONObject().apply { - put("auth", password) - } - - val url = Uri.parse(Secrets().geturl(context.packageName)).buildUpon().build().toString() - queue.add(object : JsonObjectRequest(Method.POST, url, json, { - locationFromETimestamp = System.currentTimeMillis() - try { - val backendUrl = decrypt(it.getString("url"), "$password$password") - continuation.resume(backendUrl.decodeToString()) - } catch (exception: Exception) { - continuation.resumeWithException(exception) - } - }, { - continuation.resumeWithException(it) - }) { - override fun getHeaders(): Map = getRequestHeaders() - }) - } - - private fun decrypt(url: String, key: String): ByteArray { - val encodedIv = url.substring(0, url.indexOf(":")) - val ivParameterSpec = IvParameterSpec(Base64.decode(encodedIv, Base64.DEFAULT)) - val encodedText = url.substring(url.indexOf(":") + 1) - val secretKey = SecretKeySpec(key.toByteArray(), ENCRYPTION_ALGORITHM) - val cipher = Cipher.getInstance(ENCRYPTION_TRANSFORMATION) - cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParameterSpec) - return cipher.doFinal(Base64.decode(encodedText.toByteArray(), Base64.DEFAULT)) - } - private fun getRequestHeaders(): Map = buildMap { set("User-Agent", "${BuildConfig.ICHNAEA_USER_AGENT} (Linux; Android ${Build.VERSION.RELEASE}; ${context.packageName})") if (settings.ichnaeaContribute) { @@ -255,13 +194,7 @@ class IchnaeaServiceClient(private val context: Context) { } private suspend fun rawGeoLocate(request: GeolocateRequest): GeolocateResponse = suspendCoroutine { continuation -> - val endpoint = if (LocationSettings(context).ichnaeaFromE) { - locationUrlFromE - } else { - settings.effectiveEndpoint - } - - val url = Uri.parse(endpoint).buildUpon().appendPath("v1").appendPath("geolocate").build().toString() + val url = Uri.parse(settings.effectiveEndpoint).buildUpon().appendPath("v1").appendPath("geolocate").build().toString() queue.add(object : JsonObjectRequest(Method.POST, url, request.toJson(), { try { continuation.resume(it.toGeolocateResponse()) @@ -303,12 +236,6 @@ class IchnaeaServiceClient(private val context: Context) { const val CELL_FALLBACK_PRECISION = 0.5 private const val OMITABLES_LIMIT = 100 private const val REQUEST_CACHE_SIZE = 200 - private const val E_LOCATION_PERIOD_IN_MIN = 10L * 1000L * 60L - private const val TOTP_PERIOD_IN_SECONDS = 30L - private const val TOTP_NUMBER_OF_DIGITS = 8 - private const val SECRET_KEY_ALGORITHM = "RAW" - private const val ENCRYPTION_TRANSFORMATION = "AES/CBC/PKCS7Padding" - private const val ENCRYPTION_ALGORITHM = "AES" const val LOCATION_EXTRA_FALLBACK = "fallback" } } diff --git a/play-services-location/core/src/main/kotlin/org/microg/gms/location/ui/LocationPreferencesFragment.kt b/play-services-location/core/src/main/kotlin/org/microg/gms/location/ui/LocationPreferencesFragment.kt index 3adf056f55a3fe52aa631d0e987e8c3aae4919e0..bcf220b7011af59cdfb58c953b448512d9f1cbc1 100644 --- a/play-services-location/core/src/main/kotlin/org/microg/gms/location/ui/LocationPreferencesFragment.kt +++ b/play-services-location/core/src/main/kotlin/org/microg/gms/location/ui/LocationPreferencesFragment.kt @@ -56,7 +56,6 @@ class LocationPreferencesFragment : PreferenceFragmentCompat() { private lateinit var cellLearning: TwoStatePreference private lateinit var nominatim: TwoStatePreference private lateinit var database: LocationAppsDatabase - private lateinit var locationFromE: TwoStatePreference init { setHasOptionsMenu(true) @@ -272,7 +271,6 @@ class LocationPreferencesFragment : PreferenceFragmentCompat() { cellIchnaea = preferenceScreen.findPreference("pref_location_cell_mls_enabled") ?: cellIchnaea cellLearning = preferenceScreen.findPreference("pref_location_cell_learning_enabled") ?: cellLearning nominatim = preferenceScreen.findPreference("pref_geocoder_nominatim_enabled") ?: nominatim - locationFromE = preferenceScreen.findPreference("pref_location_from_e") ?: locationFromE locationAppsAll.setOnPreferenceClickListener { findNavController().navigate(requireContext(), R.id.openAllLocationApps) @@ -316,7 +314,6 @@ class LocationPreferencesFragment : PreferenceFragmentCompat() { } configureChangeListener(cellLearning) { LocationSettings(requireContext()).cellLearning = it } configureChangeListener(nominatim) { LocationSettings(requireContext()).geocoderNominatim = it } - configureChangeListener(locationFromE) { LocationSettings(requireContext()).ichnaeaFromE = it } networkProviderCategory.isVisible = requireContext().hasNetworkLocationServiceBuiltIn() wifiLearning.isVisible = @@ -352,7 +349,6 @@ class LocationPreferencesFragment : PreferenceFragmentCompat() { cellIchnaea.isChecked = LocationSettings(context).cellIchnaea cellLearning.isChecked = LocationSettings(context).cellLearning nominatim.isChecked = LocationSettings(context).geocoderNominatim - locationFromE.isChecked = LocationSettings(context).ichnaeaFromE val (apps, showAll) = withContext(Dispatchers.IO) { val apps = database.listAppsByAccessTime() val res = apps.map { app -> diff --git a/play-services-location/core/src/main/res/values-de/strings.xml b/play-services-location/core/src/main/res/values-de/strings.xml index a060a7b4a1f514056815d024acee39bae67a7816..c62ec67ef9b2de8457e9eef092590315ac379400 100644 --- a/play-services-location/core/src/main/res/values-de/strings.xml +++ b/play-services-location/core/src/main/res/values-de/strings.xml @@ -13,8 +13,6 @@ Anfrage von Hotspot Grobe Ortung erzwingen Nominatim verwenden - Das Standortsystem von /e/OS verwenden - Lassen Sie /e/OS entscheiden, welcher Standortserver im Netzwerk verwendet werden soll. Adressen mit OpenStreetMap Nominatim auflösen. Wi-Fi-Standort direkt von unterstützten Hotspots abrufen, wenn eine Verbindung besteht. Von GPS merken diff --git a/play-services-location/core/src/main/res/values-es/strings.xml b/play-services-location/core/src/main/res/values-es/strings.xml index bd8ffb61e5f50e98c1406c7503871b76a54d26af..d3a3c52c535395e062b2fbe3902198ac119a3f52 100644 --- a/play-services-location/core/src/main/res/values-es/strings.xml +++ b/play-services-location/core/src/main/res/values-es/strings.xml @@ -15,8 +15,6 @@ Recordar desde el GPS Almacena localmente las ubicaciones de la red móvil cuando se utiliza el GPS. Usar Nominatim - Usar el sistema de localización de /e/OS - Deja que /e/OS decida qué servidor de ubicación de red usar. Resolver direcciones utilizando OpenStreetMap Nominatim. Aplicaciones con acceso de ubicación Forzar ubicación aproximada diff --git a/play-services-location/core/src/main/res/values-fr/strings.xml b/play-services-location/core/src/main/res/values-fr/strings.xml index e6d281ff9d14089229d99715279e80f27dcc5e67..edb8661e7b414873c0b124d41abe7ca424338712 100644 --- a/play-services-location/core/src/main/res/values-fr/strings.xml +++ b/play-services-location/core/src/main/res/values-fr/strings.xml @@ -47,6 +47,4 @@ Dernière localisation reportée Récupérer la localisation des réseaux Wi-Fi depuis le service de localisation de Mozilla. Serveur de localisation - Utiliser le système de localisation de /e/OS - Laisser /e/OS décider du serveur de localisation réseau à utiliser. diff --git a/play-services-location/core/src/main/res/values-it/strings.xml b/play-services-location/core/src/main/res/values-it/strings.xml index eccb944f44cec5e45142fe5ff2a009667ab3710f..015a81d1c324e027762f7397b1696f83d6f30f12 100644 --- a/play-services-location/core/src/main/res/values-it/strings.xml +++ b/play-services-location/core/src/main/res/values-it/strings.xml @@ -16,8 +16,6 @@ Richiedi a Mozilla Richiedi agli hotspot Usa Nominatim - Utilizzare il sistema di localizzazione di /e/OS - Lascia che /e/OS decida quale server di localizzazione di rete utilizzare. Cerca gli indirizzi usando OpenStreetMap Nominatim. Geolocalizzazione basata sul Wi-Fi Ricerca degli indirizzi diff --git a/play-services-location/core/src/main/res/values/strings.xml b/play-services-location/core/src/main/res/values/strings.xml index bed5c642ff8d4690454bb35af75a8145de2d24c5..a4c380d8e83b5a4f65bb4df9dd1c1f8b7d2693c1 100644 --- a/play-services-location/core/src/main/res/values/strings.xml +++ b/play-services-location/core/src/main/res/values/strings.xml @@ -23,8 +23,6 @@ Remember from GPS Store mobile network locations locally when GPS is used. Use Nominatim - Use /e/OS\'s location system - Let /e/OS decide which network location server to use. Resolve addresses using OpenStreetMap Nominatim. Resolve addresses using OpenStreetMap Nominatim. diff --git a/play-services-location/core/src/main/res/xml/preferences_location.xml b/play-services-location/core/src/main/res/xml/preferences_location.xml index f43e4c8538eecfeda2ad9852e87a224d72ea7b3f..ac09c996f4fb1fe1a6536e328c6c8b1c3b327d55 100644 --- a/play-services-location/core/src/main/res/xml/preferences_location.xml +++ b/play-services-location/core/src/main/res/xml/preferences_location.xml @@ -81,17 +81,5 @@ android:summary="@string/pref_geocoder_nominatim_enabled_summary" app:iconSpaceReserved="false" /> - - -