Commit 95147891 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

android: Fix assert in LibraryLoader

The zygote can only use the system linker for loading library as it
cannot communicate with the browser process at all. Relax the assert
that was not aware of zygote.

Bug: 1035101
Change-Id: If88e09224992aff5e28c3b540d232b6f38fbd16f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1973215
Commit-Queue: Bo <boliu@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Auto-Submit: Bo <boliu@chromium.org>
Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726042}
parent b66121f3
......@@ -293,14 +293,14 @@ public class LibraryLoader {
synchronized (mLock) {
setLinkerImplementationIfNeededAlreadyLocked();
if (mUseChromiumLinker) return;
preloadAlreadyLocked(appContext.getApplicationInfo());
preloadAlreadyLocked(appContext.getApplicationInfo(), false /* inZygote */);
}
}
private void preloadAlreadyLocked(ApplicationInfo appInfo) {
private void preloadAlreadyLocked(ApplicationInfo appInfo, boolean inZygote) {
try (TraceEvent te = TraceEvent.scoped("LibraryLoader.preloadAlreadyLocked")) {
// Preloader uses system linker, we shouldn't preload if Chromium linker is used.
assert !mUseChromiumLinker;
assert !mUseChromiumLinker || inZygote;
if (mLibraryPreloader != null && !mLibraryPreloaderCalled) {
mLibraryPreloader.loadLibrary(appInfo);
mLibraryPreloaderCalled = true;
......@@ -451,9 +451,9 @@ public class LibraryLoader {
@GuardedBy("mLock")
@SuppressLint("UnsafeDynamicallyLoadedCode")
private void loadWithSystemLinkerAlreadyLocked(ApplicationInfo appInfo) {
private void loadWithSystemLinkerAlreadyLocked(ApplicationInfo appInfo, boolean inZygote) {
setEnvForNative();
preloadAlreadyLocked(appInfo);
preloadAlreadyLocked(appInfo, inZygote);
// If the libraries are located in the zip file, assert that the device API level is M or
// higher. On devices <=M, the libraries should always be loaded by LegacyLinker.
......@@ -500,7 +500,7 @@ public class LibraryLoader {
loadWithChromiumLinker(appInfo, library);
} else {
Log.d(TAG, "Loading with the System linker.");
loadWithSystemLinkerAlreadyLocked(appInfo);
loadWithSystemLinkerAlreadyLocked(appInfo, inZygote);
}
long stopTime = SystemClock.uptimeMillis();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment