Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1919)

Unified Diff: base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java

Issue 869593002: Skip direct map from apk check for pre-KitKat Samsung. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix capitalization in a comment. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/android/java/src/org/chromium/base/library_loader/Linker.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
diff --git a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
index 89cb5bb6de4d041466c1ff5e00693b2f30b096c1..602358b8e4145dbfac210f73623b12f07e36235b 100644
--- a/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
+++ b/base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java
@@ -12,6 +12,8 @@ import org.chromium.base.CommandLine;
import org.chromium.base.JNINamespace;
import org.chromium.base.TraceEvent;
+import java.util.Locale;
+
import javax.annotation.Nullable;
/**
@@ -59,6 +61,13 @@ public class LibraryLoader {
// APK file with executable permissions.
private static boolean sMapApkWithExecPermission = false;
+ // One-way switch to indicate whether we probe for memory mapping the APK
+ // file with executable permissions. We suppress the probe under some
+ // conditions.
+ // For more, see:
+ // https://code.google.com/p/chromium/issues/detail?id=448084
+ private static boolean sProbeMapApkWithExecPermission = true;
+
// One-way switch becomes true if the Chromium library was loaded from the
// APK file directly.
private static boolean sLibraryWasLoadedFromApk = false;
@@ -166,11 +175,30 @@ public class LibraryLoader {
String apkFilePath = null;
boolean useMapExecSupportFallback = false;
+ // If the Android build version pre-dates KitKat and the device
+ // manufacturer is Samsung, skip the check for mmap exec support and
+ // return false. This avoids triggering a warning on these devices.
+ // The version check is included because these devices do not show
+ // the warning on later OS builds.
+ //
+ // For more, see:
+ // https://code.google.com/p/chromium/issues/detail?id=448084
+ final String manufacturer = android.os.Build.MANUFACTURER;
+ final int version = android.os.Build.VERSION.SDK_INT;
+ if (manufacturer != null
+ && version < android.os.Build.VERSION_CODES.KITKAT
+ && manufacturer.toLowerCase(Locale.ENGLISH).contains("samsung")) {
+ Log.w(TAG, "Suppressed load from APK support check on this device");
+ sProbeMapApkWithExecPermission = false;
+ }
+
// Check if the device supports memory mapping the APK file
// with executable permissions.
if (context != null) {
apkFilePath = context.getApplicationInfo().sourceDir;
- sMapApkWithExecPermission = Linker.checkMapExecSupport(apkFilePath);
+ if (sProbeMapApkWithExecPermission) {
+ sMapApkWithExecPermission = Linker.checkMapExecSupport(apkFilePath);
+ }
if (!sMapApkWithExecPermission && Linker.isInZipFile()) {
Log.w(TAG, "the no map executable support fallback will be used because"
+ " memory mapping the APK file with executable permissions is"
@@ -378,6 +406,10 @@ public class LibraryLoader {
return LibraryLoadFromApkStatusCodes.UNKNOWN;
}
+ if (!sProbeMapApkWithExecPermission) {
+ return LibraryLoadFromApkStatusCodes.UNKNOWN;
+ }
+
return sMapApkWithExecPermission
? LibraryLoadFromApkStatusCodes.SUPPORTED
: LibraryLoadFromApkStatusCodes.NOT_SUPPORTED;
« no previous file with comments | « no previous file | base/android/java/src/org/chromium/base/library_loader/Linker.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698