diff --git a/build.gradle b/build.gradle index cfb1200724fb105d55fbbffec3c5a2e56c8b8c7b..69905396d837e1aa4fe38b96f1314dc08f575969 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ */ buildscript { - ext.cronetVersion = '91.0.4472.120' + ext.cronetVersion = '91.0.4472.120.1' ext.nlpVersion = '2.0-alpha6' ext.remoteDroidGuardVersion = '0.1.2' ext.safeParcelVersion = '1.7.0' @@ -116,4 +116,3 @@ subprojects { google() } } - diff --git a/play-services-basement/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt b/play-services-basement/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt index cb87e5ebbdd1833bef6e97dac2291cf3d595cdb9..53a2ea0fc4bffcc45537b822aeb605920c7ee742 100644 --- a/play-services-basement/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt +++ b/play-services-basement/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt @@ -4,6 +4,7 @@ import android.content.ContentValues import android.content.Context import android.database.Cursor import android.net.Uri +import android.os.Binder object SettingsContract { const val AUTHORITY = "org.microg.gms.settings" @@ -103,15 +104,24 @@ object SettingsContract { const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id" } - fun getSettings(context: Context, uri: Uri, projection: Array?, f: (Cursor) -> T): T { + private fun withoutCallingIdentity(f: () -> T): T { + val identity = Binder.clearCallingIdentity() + try { + return f.invoke() + } finally { + Binder.restoreCallingIdentity(identity) + } + } + + fun getSettings(context: Context, uri: Uri, projection: Array?, f: (Cursor) -> T): T = withoutCallingIdentity { context.contentResolver.query(uri, projection, null, null, null).use { c -> require(c != null) { "Cursor for query $uri ${projection?.toList()} was null" } if (!c.moveToFirst()) error("Cursor for query $uri ${projection?.toList()} was empty") - return f.invoke(c) + f.invoke(c) } } - fun setSettings(context: Context, uri: Uri, v: ContentValues.() -> Unit) { + fun setSettings(context: Context, uri: Uri, v: ContentValues.() -> Unit) = withoutCallingIdentity { val values = ContentValues().apply { v.invoke(this) } val affected = context.contentResolver.update(uri, values, null, null) require(affected == 1) { "Update for $uri with $values affected 0 rows"} diff --git a/play-services-core/src/main/java/org/microg/gms/ui/AboutFragment.java b/play-services-core/src/main/java/org/microg/gms/ui/AboutFragment.java index cfdf2881b3d1f5e5a8a3262f2b58050d56a17788..89b7440c02f674268ac70543b6cafcb8bb940a2d 100644 --- a/play-services-core/src/main/java/org/microg/gms/ui/AboutFragment.java +++ b/play-services-core/src/main/java/org/microg/gms/ui/AboutFragment.java @@ -37,6 +37,7 @@ public class AboutFragment extends AbstractAboutFragment { libraries.add(new AbstractAboutFragment.Library("de.hdodenhof.circleimageview", "CircleImageView", "Apache License 2.0, Henning Dodenhof")); libraries.add(new AbstractAboutFragment.Library("su.litvak.chromecast.api.v2", "ChromeCast Java API v2", "Apache License 2.0, Vitaly Litvak")); libraries.add(new AbstractAboutFragment.Library("org.conscrypt", "Conscrypt", "Apache License 2.0, The Android Open Source Project")); + libraries.add(new AbstractAboutFragment.Library("org.chromium.net", "Cronet", "BSD-style License, The Chromium Authors")); libraries.add(new AbstractAboutFragment.Library("org.microg.safeparcel", "SafeParcel", "Apache License 2.0, microG Team")); libraries.add(new AbstractAboutFragment.Library("org.slf4j", "SLF4J", "MIT License, QOS.ch")); libraries.add(new AbstractAboutFragment.Library("org.microg.nlp.service", "UnifiedNlp", "Apache License 2.0, microG Team")); diff --git a/play-services-cronet-core/build.gradle b/play-services-cronet-core/build.gradle index dc358f8c6910f0576577046d965649e4c4142463..a04e4167983ba2eb8e10539fdf75138a37fab0a0 100644 --- a/play-services-cronet-core/build.gradle +++ b/play-services-cronet-core/build.gradle @@ -8,7 +8,11 @@ apply plugin: 'maven-publish' apply plugin: 'signing' dependencies { - implementation("org.microg:cronet-api:$cronetVersion") + // TODO: Embedding the API causes random crashes as the Android AOT compiler will link the native implementation to + // out API classes even if embedded by a third-party app that comes with their own API classes. + // Need to find a better way to disable AOT for Cronet. Could be by packaging cronet as it's own apk that is + // embedded in the main APK but only loaded at runtime so that the AOT compiler has no way to become active. + // implementation("org.microg:cronet-api:$cronetVersion") implementation("org.microg:cronet-common:$cronetVersion") implementation("org.microg:cronet-native:$cronetVersion") }