diff options
author | Patrick Rohr <prohr@google.com> | 2023-09-01 10:47:07 -0700 |
---|---|---|
committer | Patrick Rohr <prohr@google.com> | 2023-09-05 16:38:37 +0000 |
commit | 4f7ebec594e3f79ab72eb7401ea4bbba62bf5441 (patch) | |
tree | 3e28d0cc0875bc5b99cb998208c2bcef419bc5dd | |
parent | ede7923eec05c56158d1668c80d92c628be5634a (diff) | |
download | cronet-4f7ebec594e3f79ab72eb7401ea4bbba62bf5441.tar.gz |
Rename libcronet.so to prevent conflict when calling System.loadLibrary()
When calling System.loadLibrary(), ART includes a check to ensure the
native library has not already been loaded from a different class loader
context: "The library will be associated with class_loader. The JNI spec
says we can't load the same library into more than one class loader."
This error is encountered regardless of the conflicting libraries being
in different linker namespaces (which would later correctly load /
resolve symbols).
This is an issue specifically for HttpEngine which calls
System.loadLibrary("cronet.114.0.5735.84") just as upstream Cronet does.
If an app happens to statically link upstream Cronet with version
114.0.5735.84, it will crash when trying to use HttpEngine.
The immediate solution is to rename HttpEngine's libcronet.so to
libhttpengine.so.
Bug: 298674099
Test: TH
Change-Id: I64f48f5337caa36e53d33d5a300ee0ed25aa29ec
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | components/cronet/android/java/src/org/chromium/net/impl/CronetLibraryLoader.java | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Android.bp b/Android.bp index 862b6b21f..d4fa2942a 100644 --- a/Android.bp +++ b/Android.bp @@ -6984,7 +6984,7 @@ cc_library_shared { "-Wl,-wrap,valloc", "-Wl,-wrap,vasprintf", ], - stem: "libcronet.114.0.5735.84", + stem: "libmainlinecronet.114.0.5735.84", visibility: [ "//packages/modules/Connectivity:__subpackages__", ], diff --git a/components/cronet/android/java/src/org/chromium/net/impl/CronetLibraryLoader.java b/components/cronet/android/java/src/org/chromium/net/impl/CronetLibraryLoader.java index b2a632927..588f635bc 100644 --- a/components/cronet/android/java/src/org/chromium/net/impl/CronetLibraryLoader.java +++ b/components/cronet/android/java/src/org/chromium/net/impl/CronetLibraryLoader.java @@ -28,7 +28,7 @@ import org.chromium.net.NetworkChangeNotifier; public class CronetLibraryLoader { // Synchronize initialization. private static final Object sLoadLock = new Object(); - private static final String LIBRARY_NAME = "cronet." + ImplVersion.getCronetVersion(); + private static final String LIBRARY_NAME = "mainlinecronet." + ImplVersion.getCronetVersion(); private static final String TAG = CronetLibraryLoader.class.getSimpleName(); // Thread used for initialization work and processing callbacks for // long-lived global singletons. This thread lives forever as things like |