This source file includes following definitions.
- JNINamespace
- runChecks
- nativeCheckForSharedRelros
- nativeCheckForNoSharedRelros
package org.chromium.chromium_linker_test_apk;
import android.util.Log;
import org.chromium.base.JNINamespace;
import org.chromium.base.library_loader.Linker;
@JNINamespace("content")
public class LinkerTests implements Linker.TestRunner {
private static final String TAG = "LinkerTests";
public LinkerTests() {}
@Override
public boolean runChecks(int memoryDeviceConfig,
boolean isBrowserProcess) {
boolean checkSharedRelro;
if (isBrowserProcess) {
switch (Linker.BROWSER_SHARED_RELRO_CONFIG) {
case Linker.BROWSER_SHARED_RELRO_CONFIG_NEVER:
checkSharedRelro = false;
break;
case Linker.BROWSER_SHARED_RELRO_CONFIG_LOW_RAM_ONLY:
checkSharedRelro =
(memoryDeviceConfig == Linker.MEMORY_DEVICE_CONFIG_LOW);
break;
case Linker.BROWSER_SHARED_RELRO_CONFIG_ALWAYS:
checkSharedRelro = true;
break;
default:
Log.e(TAG, "Invalid shared RELRO linker configuration: " +
Linker.BROWSER_SHARED_RELRO_CONFIG);
return false;
}
} else {
checkSharedRelro = true;
}
if (checkSharedRelro)
return nativeCheckForSharedRelros(isBrowserProcess);
else
return nativeCheckForNoSharedRelros(isBrowserProcess);
}
private static native boolean nativeCheckForSharedRelros(boolean isBrowserProcess);
private static native boolean nativeCheckForNoSharedRelros(boolean isBrowserProcess);
}