Fix lint errors in LibraryLoader.loadAlreadyLocked()

BUG=719977

Change-Id: Ia72e8bd5c4825fc66aedab5b6b4b1b7bd2964644
Reviewed-on: https://chromium-review.googlesource.com/846299
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Egor Pasko <pasko@chromium.org>
Commit-Queue: Andrei Kapishnikov <kapishnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526499}

CrOS-Libchrome-Original-Commit: 53ef8ece9445ef83c7b71e81d282212bbf6b01c1
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 bdbddfa..0d25b81 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
@@ -8,6 +8,7 @@
 import android.content.Context;
 import android.os.AsyncTask;
 import android.os.Build;
+import android.os.Build.VERSION_CODES;
 import android.os.Process;
 import android.os.StrictMode;
 import android.os.SystemClock;
@@ -359,10 +360,10 @@
         }
     }
 
-    // Invoke either Linker.loadLibrary(...) or System.loadLibrary(...), triggering
-    // JNI_OnLoad in native code
+    // Invoke either Linker.loadLibrary(...), System.loadLibrary(...) or System.load(...),
+    // triggering JNI_OnLoad in native code.
     // TODO(crbug.com/635567): Fix this properly.
-    @SuppressLint("DefaultLocale")
+    @SuppressLint({"DefaultLocale", "NewApi", "UnsafeDynamicallyLoadedCode"})
     private void loadAlreadyLocked(Context appContext) throws ProcessInitException {
         try (TraceEvent te = TraceEvent.scoped("LibraryLoader.loadAlreadyLocked")) {
             if (!mLoaded) {
@@ -410,6 +411,11 @@
                     setEnvForNative();
                     preloadAlreadyLocked(appContext);
 
+                    // If the libraries are located in the zip file, assert that the device API
+                    // level is M or higher. On devices lower than M, the libraries should
+                    // always be loaded by LegacyLinker.
+                    assert !Linker.isInZipFile() || Build.VERSION.SDK_INT >= VERSION_CODES.M;
+
                     // Load libraries using the system linker.
                     for (String library : NativeLibraries.LIBRARIES) {
                         try {