diff --git a/.gitignore b/.gitignore
index 25ed3657..8db18dfe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,7 @@ build/
user.gradle
local.properties
.directory
+
+.settings
+.classpath
+.project
diff --git a/build.gradle b/build.gradle
index c38d7449..50b5f210 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,6 +4,7 @@
*/
buildscript {
+ ext.cronetVersion = '91.0.4472.120'
ext.nlpVersion = '2.0-alpha6'
ext.remoteDroidGuardVersion = '0.1.2'
ext.safeParcelVersion = '1.7.0'
diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle
index 7cde3e14..685eb1fd 100644
--- a/play-services-core/build.gradle
+++ b/play-services-core/build.gradle
@@ -43,6 +43,7 @@ dependencies {
implementation project(':play-services-base-core')
implementation project(':play-services-base-core-ui')
implementation project(':play-services-conscrypt-provider-core')
+ implementation project(':play-services-cronet-core')
implementation project(':play-services-location-core')
implementation project(':play-services-vision-core')
withNearbyImplementation project(':play-services-nearby-core')
diff --git a/play-services-core/src/main/java/com/google/android/gms/chimera/container/DynamiteContext.java b/play-services-core/src/main/java/com/google/android/gms/chimera/container/DynamiteContext.java
index 7f104fbe..8484447b 100644
--- a/play-services-core/src/main/java/com/google/android/gms/chimera/container/DynamiteContext.java
+++ b/play-services-core/src/main/java/com/google/android/gms/chimera/container/DynamiteContext.java
@@ -28,6 +28,8 @@ public class DynamiteContext extends ContextWrapper {
private Context gmsContext;
private DynamiteContext appContext;
+ private ClassLoader classLoader;
+
public DynamiteContext(DynamiteModuleInfo moduleInfo, Context base, Context gmsContext, DynamiteContext appContext) {
super(base);
this.moduleInfo = moduleInfo;
@@ -38,19 +40,22 @@ public class DynamiteContext extends ContextWrapper {
@Override
public ClassLoader getClassLoader() {
- StringBuilder nativeLoaderDirs = new StringBuilder(gmsContext.getApplicationInfo().nativeLibraryDir);
- if (Build.VERSION.SDK_INT >= 23 && Process.is64Bit()) {
- for (String abi : Build.SUPPORTED_64_BIT_ABIS) {
- nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(abi);
+ if (classLoader == null) {
+ StringBuilder nativeLoaderDirs = new StringBuilder(gmsContext.getApplicationInfo().nativeLibraryDir);
+ if (Build.VERSION.SDK_INT >= 23 && Process.is64Bit()) {
+ for (String abi : Build.SUPPORTED_64_BIT_ABIS) {
+ nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(abi);
+ }
+ } else if (Build.VERSION.SDK_INT >= 21) {
+ for (String abi : Build.SUPPORTED_32_BIT_ABIS) {
+ nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(abi);
+ }
+ } else {
+ nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(Build.CPU_ABI);
}
- } else if (Build.VERSION.SDK_INT >= 21) {
- for (String abi : Build.SUPPORTED_32_BIT_ABIS) {
- nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(abi);
- }
- } else {
- nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(Build.CPU_ABI);
+ classLoader = new PathClassLoader(gmsContext.getApplicationInfo().sourceDir, nativeLoaderDirs.toString(), new FilteredClassLoader(originalContext.getClassLoader(), moduleInfo.getMergedClasses(), moduleInfo.getMergedPackages()));
}
- return new PathClassLoader(gmsContext.getApplicationInfo().sourceDir, nativeLoaderDirs.toString(), new FilteredClassLoader(originalContext.getClassLoader(), moduleInfo.getMergedClasses(), moduleInfo.getMergedPackages()));
+ return classLoader;
}
@Override
diff --git a/play-services-cronet-core/build.gradle b/play-services-cronet-core/build.gradle
new file mode 100644
index 00000000..4afa63c9
--- /dev/null
+++ b/play-services-cronet-core/build.gradle
@@ -0,0 +1,38 @@
+/*
+ * SPDX-FileCopyrightText: 2021, microG Project Team
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+apply plugin: 'com.android.library'
+apply plugin: 'maven-publish'
+apply plugin: 'signing'
+
+dependencies {
+ implementation("org.microg:cronet-api:$cronetVersion")
+ implementation("org.microg:cronet-common:$cronetVersion")
+ implementation("org.microg:cronet-native:$cronetVersion")
+}
+
+android {
+ compileSdkVersion androidCompileSdk
+ buildToolsVersion "$androidBuildVersionTools"
+
+ defaultConfig {
+ versionName version
+ minSdkVersion androidMinSdk
+ targetSdkVersion androidTargetSdk
+ }
+
+ lintOptions {
+ disable 'MissingTranslation'
+ }
+
+ compileOptions {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ }
+}
+
+apply from: '../gradle/publish-android.gradle'
+
+description = 'microG service implementation for play-services-cronet'
diff --git a/play-services-cronet-core/src/main/AndroidManifest.xml b/play-services-cronet-core/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..93245ce8
--- /dev/null
+++ b/play-services-cronet-core/src/main/AndroidManifest.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/play-services-cronet-core/src/main/java/com/google/android/gms/dynamite/descriptors/com/google/android/gms/cronet_dynamite/ModuleDescriptor.java b/play-services-cronet-core/src/main/java/com/google/android/gms/dynamite/descriptors/com/google/android/gms/cronet_dynamite/ModuleDescriptor.java
new file mode 100644
index 00000000..c46af5c9
--- /dev/null
+++ b/play-services-cronet-core/src/main/java/com/google/android/gms/dynamite/descriptors/com/google/android/gms/cronet_dynamite/ModuleDescriptor.java
@@ -0,0 +1,37 @@
+/*
+ * SPDX-FileCopyrightText: 2021, microG Project Team
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package com.google.android.gms.dynamite.descriptors.com.google.android.gms.cronet_dynamite;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class ModuleDescriptor {
+ public static final String MODULE_ID = "com.google.android.gms.cronet_dynamite";
+ public static final int MODULE_VERSION = 2;
+ public static final List MERGED_CLASSES = Arrays.asList(
+ "org.chromium.net.ApiVersion",
+ "org.chromium.net.BidirectionalStream",
+ "org.chromium.net.CallbackException",
+ "org.chromium.net.CronetEngine",
+ "org.chromium.net.CronetException",
+ "org.chromium.net.CronetProvider",
+ "org.chromium.net.ExperimentalBidirectionalStream",
+ "org.chromium.net.ExperimentalCronetEngine",
+ "org.chromium.net.ExperimentalUrlRequest",
+ "org.chromium.net.ICronetEngineBuilder",
+ "org.chromium.net.InlineExecutionProhibitedException",
+ "org.chromium.net.NetworkException",
+ "org.chromium.net.NetworkQualityRttListener",
+ "org.chromium.net.NetworkQualityThroughputListener",
+ "org.chromium.net.QuicException",
+ "org.chromium.net.RequestFinishedInfo",
+ "org.chromium.net.UploadDataProvider",
+ "org.chromium.net.UploadDataProviders",
+ "org.chromium.net.UploadDataSink",
+ "org.chromium.net.UrlRequest",
+ "org.chromium.net.UrlResponseInfo"
+ );
+}
diff --git a/settings.gradle b/settings.gradle
index cdbee860..f6a792a3 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -22,6 +22,7 @@ include ':play-services-wearable-proto'
include ':play-services-base-core'
include ':play-services-conscrypt-provider-core'
+include ':play-services-cronet-core'
include ':play-services-location-core'
include ':play-services-maps-core-mapbox'
include ':play-services-maps-core-vtm'