diff options
author | 2024-02-13 19:18:22 +0000 | |
---|---|---|
committer | 2024-02-15 18:22:04 +0000 | |
commit | 69e080c8abb020998a326c5d7b39e38745fde82f (patch) | |
tree | 582a54f7eb8b1006d888f1c691ce8e241fa4eca1 | |
parent | daff9792121d7778c3d628d4607bccd5ff5b0ecd (diff) |
Add tests for loading with absolute paths through System.load().
Introduce a base class for common tests for all apps.
This just "documents" current behaviour as a preparation for a later CL
that will change the logic for loading private native libs.
Test: atest libnativeloader_e2e_tests
Bug: 237577392
Change-Id: I80fd10f1d980fd79d0f6f544ec6f776987531ee6
12 files changed, 292 insertions, 47 deletions
diff --git a/libnativeloader/test/Android.bp b/libnativeloader/test/Android.bp index 68c9126407..268e93ab3f 100644 --- a/libnativeloader/test/Android.bp +++ b/libnativeloader/test/Android.bp @@ -66,16 +66,6 @@ android_test_helper_app { ], } -java_library { - name: "loadlibrarytest_test_utils", - sdk_version: "31", - static_libs: [ - "androidx.test.ext.junit", - "androidx.test.ext.truth", - ], - srcs: ["src/android/test/lib/TestUtils.java"], -} - // Test fixture that represents a shared library in /system/framework. java_library { name: "libnativeloader_system_shared_lib", @@ -110,6 +100,23 @@ java_library { srcs: ["src/android/test/vendorsharedlib/VendorSharedLib.java"], } +java_library { + name: "loadlibrarytest_testlib", + sdk_version: "31", + static_libs: [ + "androidx.test.ext.junit", + "androidx.test.ext.truth", + "androidx.test.rules", + ], + libs: [ + "libnativeloader_system_shared_lib", + "libnativeloader_system_ext_shared_lib", + "libnativeloader_product_shared_lib", + "libnativeloader_vendor_shared_lib", + ], + srcs: ["src/android/test/lib/*.java"], +} + java_defaults { name: "loadlibrarytest_app_defaults", defaults: ["art_module_source_build_java_defaults"], @@ -120,9 +127,7 @@ java_defaults { // measures getting enabled in these tests, so set some high number. target_sdk_version: "9999", static_libs: [ - "androidx.test.ext.junit", - "androidx.test.rules", - "loadlibrarytest_test_utils", + "loadlibrarytest_testlib", ], libs: [ "libnativeloader_system_shared_lib", diff --git a/libnativeloader/test/src/android/test/app/DataAppTest.java b/libnativeloader/test/src/android/test/app/DataAppTest.java index 39762ef6cc..905b5bb0d1 100644 --- a/libnativeloader/test/src/android/test/app/DataAppTest.java +++ b/libnativeloader/test/src/android/test/app/DataAppTest.java @@ -16,19 +16,24 @@ package android.test.app; +import android.test.lib.AppTestCommon; import android.test.lib.TestUtils; import android.test.productsharedlib.ProductSharedLib; import android.test.systemextsharedlib.SystemExtSharedLib; import android.test.systemsharedlib.SystemSharedLib; import android.test.vendorsharedlib.VendorSharedLib; + import androidx.test.filters.MediumTest; -import androidx.test.runner.AndroidJUnit4; + import org.junit.Test; -import org.junit.runner.RunWith; @MediumTest -@RunWith(AndroidJUnit4.class) -public class DataAppTest { +public class DataAppTest extends AppTestCommon { + @Override + public AppLocation getAppLocation() { + return AppLocation.DATA; + } + @Test public void testLoadExtendedPublicLibraries() { System.loadLibrary("system_extpub.oem1"); @@ -64,12 +69,15 @@ public class DataAppTest { public void testLoadPrivateLibrariesViaSystemSharedLib() { // TODO(b/237577392): Loading a private native system library via a shared system library // ought to work. - // SystemSharedLib.loadLibrary("system_private2"); - // SystemSharedLib.loadLibrary("systemext_private2"); + TestUtils.assertLibraryInaccessible(() -> SystemSharedLib.loadLibrary("system_private2")); + TestUtils.assertLibraryInaccessible( + () -> SystemSharedLib.loadLibrary("systemext_private2")); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> SystemSharedLib.loadLibrary("product_private2")); } + TestUtils.assertLibraryInaccessible(() -> SystemSharedLib.loadLibrary("vendor_private2")); } @@ -77,12 +85,16 @@ public class DataAppTest { public void testLoadPrivateLibrariesViaSystemExtSharedLib() { // TODO(b/237577392): Loading a private native system library via a shared system library // ought to work. - // SystemExtSharedLib.loadLibrary("system_private3"); - // SystemExtSharedLib.loadLibrary("systemext_private3"); + TestUtils.assertLibraryInaccessible( + () -> SystemExtSharedLib.loadLibrary("system_private3")); + TestUtils.assertLibraryInaccessible( + () -> SystemExtSharedLib.loadLibrary("systemext_private3")); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> SystemExtSharedLib.loadLibrary("product_private3")); } + TestUtils.assertLibraryInaccessible( () -> SystemExtSharedLib.loadLibrary("vendor_private3")); } @@ -92,9 +104,11 @@ public class DataAppTest { TestUtils.assertLibraryInaccessible(() -> ProductSharedLib.loadLibrary("system_private4")); TestUtils.assertLibraryInaccessible( () -> ProductSharedLib.loadLibrary("systemext_private4")); + if (!TestUtils.skipPublicProductLibTests()) { ProductSharedLib.loadLibrary("product_private4"); } + TestUtils.assertLibraryInaccessible(() -> ProductSharedLib.loadLibrary("vendor_private4")); } @@ -103,10 +117,12 @@ public class DataAppTest { TestUtils.assertLibraryInaccessible(() -> VendorSharedLib.loadLibrary("system_private5")); TestUtils.assertLibraryInaccessible( () -> VendorSharedLib.loadLibrary("systemext_private5")); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> VendorSharedLib.loadLibrary("product_private5")); } + VendorSharedLib.loadLibrary("vendor_private5"); } diff --git a/libnativeloader/test/src/android/test/app/ProductAppTest.java b/libnativeloader/test/src/android/test/app/ProductAppTest.java index fae20a0806..bfa648b013 100644 --- a/libnativeloader/test/src/android/test/app/ProductAppTest.java +++ b/libnativeloader/test/src/android/test/app/ProductAppTest.java @@ -18,6 +18,7 @@ package android.test.app; import android.os.Build; import android.os.SystemProperties; +import android.test.lib.AppTestCommon; import android.test.lib.TestUtils; import android.test.productsharedlib.ProductSharedLib; import android.test.systemextsharedlib.SystemExtSharedLib; @@ -25,14 +26,16 @@ import android.test.systemsharedlib.SystemSharedLib; import android.test.vendorsharedlib.VendorSharedLib; import androidx.test.filters.MediumTest; -import androidx.test.runner.AndroidJUnit4; import org.junit.Test; -import org.junit.runner.RunWith; @MediumTest -@RunWith(AndroidJUnit4.class) -public class ProductAppTest { +public class ProductAppTest extends AppTestCommon { + @Override + public AppLocation getAppLocation() { + return AppLocation.PRODUCT; + } + // True if apps in product partitions get shared library namespaces, so we // cannot test that libs in system and system_ext get blocked. private static boolean productAppsAreShared() { @@ -80,12 +83,15 @@ public class ProductAppTest { public void testLoadPrivateLibrariesViaSystemSharedLib() { // TODO(b/237577392): Loading a private native system library via a shared system library // ought to work. - // SystemSharedLib.loadLibrary("system_private2"); - // SystemSharedLib.loadLibrary("systemext_private2"); + TestUtils.assertLibraryInaccessible(() -> SystemSharedLib.loadLibrary("system_private2")); + TestUtils.assertLibraryInaccessible( + () -> SystemSharedLib.loadLibrary("systemext_private2")); + if (!productAppsAreShared()) { TestUtils.assertLibraryInaccessible( () -> SystemSharedLib.loadLibrary("product_private2")); } + TestUtils.assertLibraryInaccessible(() -> SystemSharedLib.loadLibrary("vendor_private2")); } @@ -93,12 +99,16 @@ public class ProductAppTest { public void testLoadPrivateLibrariesViaSystemExtSharedLib() { // TODO(b/237577392): Loading a private native system library via a shared system library // ought to work. - // SystemExtSharedLib.loadLibrary("system_private3"); - // SystemExtSharedLib.loadLibrary("systemext_private3"); + TestUtils.assertLibraryInaccessible( + () -> SystemExtSharedLib.loadLibrary("system_private3")); + TestUtils.assertLibraryInaccessible( + () -> SystemExtSharedLib.loadLibrary("systemext_private3")); + if (!productAppsAreShared()) { TestUtils.assertLibraryInaccessible( () -> SystemExtSharedLib.loadLibrary("product_private3")); } + TestUtils.assertLibraryInaccessible( () -> SystemExtSharedLib.loadLibrary("vendor_private3")); } @@ -111,7 +121,10 @@ public class ProductAppTest { TestUtils.assertLibraryInaccessible( () -> ProductSharedLib.loadLibrary("systemext_private4")); } + + // Can load product_private4 by name only through the app classloader namespace. ProductSharedLib.loadLibrary("product_private4"); + TestUtils.assertLibraryInaccessible(() -> ProductSharedLib.loadLibrary("vendor_private4")); } @@ -122,8 +135,10 @@ public class ProductAppTest { () -> VendorSharedLib.loadLibrary("system_private5")); TestUtils.assertLibraryInaccessible( () -> VendorSharedLib.loadLibrary("systemext_private5")); + TestUtils.assertLibraryInaccessible( () -> VendorSharedLib.loadLibrary("product_private5")); + // When the app has a shared namespace, its libraries get loaded // with shared namespaces as well, inheriting the same paths. So // since the app wouldn't have access to /vendor/${LIB}, diff --git a/libnativeloader/test/src/android/test/app/SystemAppTest.java b/libnativeloader/test/src/android/test/app/SystemAppTest.java index 5c55f93974..8d14753b18 100644 --- a/libnativeloader/test/src/android/test/app/SystemAppTest.java +++ b/libnativeloader/test/src/android/test/app/SystemAppTest.java @@ -16,20 +16,25 @@ package android.test.app; +import android.test.lib.AppTestCommon; import android.test.lib.TestUtils; import android.test.productsharedlib.ProductSharedLib; import android.test.systemextsharedlib.SystemExtSharedLib; import android.test.systemsharedlib.SystemSharedLib; import android.test.vendorsharedlib.VendorSharedLib; + import androidx.test.filters.MediumTest; -import androidx.test.runner.AndroidJUnit4; + import org.junit.Test; -import org.junit.runner.RunWith; // These tests are run from /system/app, /system/priv-app, and /system_ext/app. @MediumTest -@RunWith(AndroidJUnit4.class) -public class SystemAppTest { +public class SystemAppTest extends AppTestCommon { + @Override + public AppLocation getAppLocation() { + return AppLocation.SYSTEM; + } + @Test public void testPrivateLibsExist() { TestUtils.testPrivateLibsExist("/system", "system_private"); @@ -72,10 +77,12 @@ public class SystemAppTest { public void testLoadPrivateLibrariesViaSystemSharedLib() { SystemSharedLib.loadLibrary("system_private2"); SystemSharedLib.loadLibrary("systemext_private2"); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> SystemSharedLib.loadLibrary("product_private2")); } + TestUtils.assertLibraryInaccessible(() -> SystemSharedLib.loadLibrary("vendor_private2")); } @@ -83,33 +90,43 @@ public class SystemAppTest { public void testLoadPrivateLibrariesViaSystemExtSharedLib() { SystemExtSharedLib.loadLibrary("system_private3"); SystemExtSharedLib.loadLibrary("systemext_private3"); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> SystemExtSharedLib.loadLibrary("product_private3")); } + TestUtils.assertLibraryInaccessible( () -> SystemExtSharedLib.loadLibrary("vendor_private3")); } @Test public void testLoadPrivateLibrariesViaProductSharedLib() { + // See AppTestCommon.isSharedSystemApp() for an explanation of these + // behaviours. ProductSharedLib.loadLibrary("system_private4"); ProductSharedLib.loadLibrary("systemext_private4"); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> ProductSharedLib.loadLibrary("product_private4")); } + TestUtils.assertLibraryInaccessible(() -> ProductSharedLib.loadLibrary("vendor_private4")); } @Test public void testLoadPrivateLibrariesViaVendorSharedLib() { + // See AppTestCommon.isSharedSystemApp() for an explanation of these + // behaviours. VendorSharedLib.loadLibrary("system_private5"); VendorSharedLib.loadLibrary("systemext_private5"); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> VendorSharedLib.loadLibrary("product_private5")); } + TestUtils.assertLibraryInaccessible(() -> VendorSharedLib.loadLibrary("vendor_private5")); } diff --git a/libnativeloader/test/src/android/test/app/VendorAppTest.java b/libnativeloader/test/src/android/test/app/VendorAppTest.java index 2177cf2cc4..377f670c74 100644 --- a/libnativeloader/test/src/android/test/app/VendorAppTest.java +++ b/libnativeloader/test/src/android/test/app/VendorAppTest.java @@ -16,19 +16,24 @@ package android.test.app; +import android.test.lib.AppTestCommon; import android.test.lib.TestUtils; import android.test.productsharedlib.ProductSharedLib; import android.test.systemextsharedlib.SystemExtSharedLib; import android.test.systemsharedlib.SystemSharedLib; import android.test.vendorsharedlib.VendorSharedLib; + import androidx.test.filters.MediumTest; -import androidx.test.runner.AndroidJUnit4; + import org.junit.Test; -import org.junit.runner.RunWith; @MediumTest -@RunWith(AndroidJUnit4.class) -public class VendorAppTest { +public class VendorAppTest extends AppTestCommon { + @Override + public AppLocation getAppLocation() { + return AppLocation.VENDOR; + } + @Test public void testPrivateLibsExist() { TestUtils.testPrivateLibsExist("/vendor", "vendor_private"); @@ -68,12 +73,15 @@ public class VendorAppTest { public void testLoadPrivateLibrariesViaSystemSharedLib() { // TODO(b/237577392): Loading a private native system library via a shared system library // ought to work. - // SystemSharedLib.loadLibrary("system_private2"); - // SystemSharedLib.loadLibrary("systemext_private2"); + TestUtils.assertLibraryInaccessible(() -> SystemSharedLib.loadLibrary("system_private2")); + TestUtils.assertLibraryInaccessible( + () -> SystemSharedLib.loadLibrary("systemext_private2")); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> SystemSharedLib.loadLibrary("product_private2")); } + TestUtils.assertLibraryInaccessible(() -> SystemSharedLib.loadLibrary("vendor_private2")); } @@ -81,12 +89,16 @@ public class VendorAppTest { public void testLoadPrivateLibrariesViaSystemExtSharedLib() { // TODO(b/237577392): Loading a private native system library via a shared system library // ought to work. - // SystemExtSharedLib.loadLibrary("system_private3"); - // SystemExtSharedLib.loadLibrary("systemext_private3"); + TestUtils.assertLibraryInaccessible( + () -> SystemExtSharedLib.loadLibrary("system_private3")); + TestUtils.assertLibraryInaccessible( + () -> SystemExtSharedLib.loadLibrary("systemext_private3")); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> SystemExtSharedLib.loadLibrary("product_private3")); } + TestUtils.assertLibraryInaccessible( () -> SystemExtSharedLib.loadLibrary("vendor_private3")); } @@ -96,9 +108,11 @@ public class VendorAppTest { TestUtils.assertLibraryInaccessible(() -> ProductSharedLib.loadLibrary("system_private4")); TestUtils.assertLibraryInaccessible( () -> ProductSharedLib.loadLibrary("systemext_private4")); + if (!TestUtils.skipPublicProductLibTests()) { ProductSharedLib.loadLibrary("product_private4"); } + TestUtils.assertLibraryInaccessible(() -> ProductSharedLib.loadLibrary("vendor_private4")); } @@ -107,10 +121,13 @@ public class VendorAppTest { TestUtils.assertLibraryInaccessible(() -> VendorSharedLib.loadLibrary("system_private5")); TestUtils.assertLibraryInaccessible( () -> VendorSharedLib.loadLibrary("systemext_private5")); + if (!TestUtils.skipPublicProductLibTests()) { TestUtils.assertLibraryInaccessible( () -> VendorSharedLib.loadLibrary("product_private5")); } + + // Can load vendor_private5 by name only through the app classloader namespace. VendorSharedLib.loadLibrary("vendor_private5"); } diff --git a/libnativeloader/test/src/android/test/hostside/LibnativeloaderTest.java b/libnativeloader/test/src/android/test/hostside/LibnativeloaderTest.java index 80bd72667e..bcb4528ffe 100644 --- a/libnativeloader/test/src/android/test/hostside/LibnativeloaderTest.java +++ b/libnativeloader/test/src/android/test/hostside/LibnativeloaderTest.java @@ -281,7 +281,7 @@ public class LibnativeloaderTest extends BaseHostJUnit4Test { // // Remember to update testPrivateLibsExist in TestUtils.java when // the number of libraries changes. - for (int i = 1; i <= 6; ++i) { + for (int i = 1; i <= 10; ++i) { pushNativeTestLib(libApk, "libsystem_testlib.so", "/system/${LIB}/libsystem_private" + i + ".so"); pushNativeTestLib(libApk, "libsystem_testlib.so", diff --git a/libnativeloader/test/src/android/test/lib/AppTestCommon.java b/libnativeloader/test/src/android/test/lib/AppTestCommon.java new file mode 100644 index 0000000000..36ef3dc77a --- /dev/null +++ b/libnativeloader/test/src/android/test/lib/AppTestCommon.java @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.test.lib; + +import android.test.productsharedlib.ProductSharedLib; +import android.test.systemextsharedlib.SystemExtSharedLib; +import android.test.systemsharedlib.SystemSharedLib; +import android.test.vendorsharedlib.VendorSharedLib; + +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +public abstract class AppTestCommon { + public enum AppLocation { DATA, SYSTEM, PRODUCT, VENDOR } + + public abstract AppLocation getAppLocation(); + + // Loading private libs using absolute paths through shared libs should only + // depend on the location of the shared lib, so these tests are shared for + // all apps, regardless of location. + + // There's an exception for system apps. For them LibraryNamespaces::Create + // gets called with is_shared=true. That means they don't set up separate + // "unbundled" namespaces for the shared libs in product and vendor, so + // ProductSharedLib and VendorSharedLib can still load private system libs + // through their classloader namespaces, but not the private libs in the + // same partition as themselves. + private boolean isSharedSystemApp() { + return getAppLocation() == AppLocation.SYSTEM; + } + + @Test + public void testLoadPrivateLibrariesViaSystemSharedLibWithAbsolutePaths() { + if (getAppLocation() == AppLocation.SYSTEM) { + SystemSharedLib.load(TestUtils.libPath("/system", "system_private7")); + SystemSharedLib.load(TestUtils.libPath("/system_ext", "systemext_private7")); + } else { + // Cannot load private system libs because there is no provision in + // LibraryNamespaces::Create to create an "unbundled system apk" for + // shared system libs based on their location. Hence SystemSharedLib + // gets a classloader namespace as an "other apk", with the same + // library_path as the app. + TestUtils.assertLibraryInaccessible(() -> { + SystemSharedLib.load(TestUtils.libPath("/system", "system_private7")); + }); + TestUtils.assertLibraryInaccessible(() -> { + SystemSharedLib.load(TestUtils.libPath("/system_ext", "systemext_private7")); + }); + } + + TestUtils.assertLibraryInaccessible( + () -> { SystemSharedLib.load(TestUtils.libPath("/product", "product_private7")); }); + + TestUtils.assertLibraryInaccessible( + () -> { SystemSharedLib.load(TestUtils.libPath("/vendor", "vendor_private7")); }); + } + + @Test + public void testLoadPrivateLibrariesViaSystemExtSharedLibWithAbsolutePaths() { + if (getAppLocation() == AppLocation.SYSTEM) { + SystemExtSharedLib.load(TestUtils.libPath("/system", "system_private8")); + SystemExtSharedLib.load(TestUtils.libPath("/system_ext", "systemext_private8")); + } else { + // See comment in the corresponding test for SystemSharedLib above. + TestUtils.assertLibraryInaccessible(() -> { + SystemExtSharedLib.load(TestUtils.libPath("/system", "system_private8")); + }); + TestUtils.assertLibraryInaccessible(() -> { + SystemExtSharedLib.load(TestUtils.libPath("/system_ext", "systemext_private8")); + }); + } + + TestUtils.assertLibraryInaccessible(() -> { + SystemExtSharedLib.load(TestUtils.libPath("/product", "product_private8")); + }); + + TestUtils.assertLibraryInaccessible(() -> { + SystemExtSharedLib.load(TestUtils.libPath("/vendor", "vendor_private8")); + }); + } + + @Test + public void testLoadPrivateLibrariesViaProductSharedLibWithAbsolutePaths() { + if (isSharedSystemApp()) { + ProductSharedLib.load(TestUtils.libPath("/system", "system_private9")); + ProductSharedLib.load(TestUtils.libPath("/system_ext", "systemext_private9")); + } else { + TestUtils.assertLibraryInaccessible(() -> { + ProductSharedLib.load(TestUtils.libPath("/system", "system_private9")); + }); + TestUtils.assertLibraryInaccessible(() -> { + ProductSharedLib.load(TestUtils.libPath("/system_ext", "systemext_private9")); + }); + } + + if (!isSharedSystemApp()) { + ProductSharedLib.load(TestUtils.libPath("/product", "product_private9")); + } else { + TestUtils.assertLibraryInaccessible(() -> { + ProductSharedLib.load(TestUtils.libPath("/product", "product_private9")); + }); + } + + TestUtils.assertLibraryInaccessible( + () -> { ProductSharedLib.load(TestUtils.libPath("/vendor", "vendor_private9")); }); + } + + @Test + public void testLoadPrivateLibrariesViaVendorSharedLibWithAbsolutePaths() { + if (isSharedSystemApp()) { + VendorSharedLib.load(TestUtils.libPath("/system", "system_private10")); + VendorSharedLib.load(TestUtils.libPath("/system_ext", "systemext_private10")); + } else { + TestUtils.assertLibraryInaccessible(() -> { + VendorSharedLib.load(TestUtils.libPath("/system", "system_private10")); + }); + TestUtils.assertLibraryInaccessible(() -> { + VendorSharedLib.load(TestUtils.libPath("/system_ext", "systemext_private10")); + }); + } + + TestUtils.assertLibraryInaccessible(() -> { + VendorSharedLib.load(TestUtils.libPath("/product", "product_private10")); + }); + + if (!isSharedSystemApp()) { + VendorSharedLib.load(TestUtils.libPath("/vendor", "vendor_private10")); + } else { + TestUtils.assertLibraryInaccessible(() -> { + VendorSharedLib.load(TestUtils.libPath("/vendor", "vendor_private10")); + }); + } + } +} diff --git a/libnativeloader/test/src/android/test/lib/TestUtils.java b/libnativeloader/test/src/android/test/lib/TestUtils.java index 26bc0f8265..6d2a9db0f3 100644 --- a/libnativeloader/test/src/android/test/lib/TestUtils.java +++ b/libnativeloader/test/src/android/test/lib/TestUtils.java @@ -52,7 +52,7 @@ public final class TestUtils { public static void testPrivateLibsExist(String libDir, String libStem) { // Remember to update pushPrivateLibs in LibnativeloaderTest.java when // the number of libraries changes. - for (int i = 1; i <= 6; ++i) { + for (int i = 1; i <= 10; ++i) { String libPath = libPath(libDir, libStem + i); assertWithMessage(libPath + " does not exist") .that(new File(libPath).exists()) diff --git a/libnativeloader/test/src/android/test/productsharedlib/ProductSharedLib.java b/libnativeloader/test/src/android/test/productsharedlib/ProductSharedLib.java index a500d2a976..a8966d9825 100644 --- a/libnativeloader/test/src/android/test/productsharedlib/ProductSharedLib.java +++ b/libnativeloader/test/src/android/test/productsharedlib/ProductSharedLib.java @@ -17,5 +17,11 @@ package android.test.productsharedlib; public final class ProductSharedLib { - public static void loadLibrary(String name) { System.loadLibrary(name); } + public static void loadLibrary(String name) { + System.loadLibrary(name); + } + + public static void load(String path) { + System.load(path); + } } diff --git a/libnativeloader/test/src/android/test/systemextsharedlib/SystemExtSharedLib.java b/libnativeloader/test/src/android/test/systemextsharedlib/SystemExtSharedLib.java index 1240e12e55..ae9a6da053 100644 --- a/libnativeloader/test/src/android/test/systemextsharedlib/SystemExtSharedLib.java +++ b/libnativeloader/test/src/android/test/systemextsharedlib/SystemExtSharedLib.java @@ -17,5 +17,11 @@ package android.test.systemextsharedlib; public final class SystemExtSharedLib { - public static void loadLibrary(String name) { System.loadLibrary(name); } + public static void loadLibrary(String name) { + System.loadLibrary(name); + } + + public static void load(String path) { + System.load(path); + } } diff --git a/libnativeloader/test/src/android/test/systemsharedlib/SystemSharedLib.java b/libnativeloader/test/src/android/test/systemsharedlib/SystemSharedLib.java index 8e2af9f79c..ba8c9e2574 100644 --- a/libnativeloader/test/src/android/test/systemsharedlib/SystemSharedLib.java +++ b/libnativeloader/test/src/android/test/systemsharedlib/SystemSharedLib.java @@ -17,5 +17,11 @@ package android.test.systemsharedlib; public final class SystemSharedLib { - public static void loadLibrary(String name) { System.loadLibrary(name); } + public static void loadLibrary(String name) { + System.loadLibrary(name); + } + + public static void load(String path) { + System.load(path); + } } diff --git a/libnativeloader/test/src/android/test/vendorsharedlib/VendorSharedLib.java b/libnativeloader/test/src/android/test/vendorsharedlib/VendorSharedLib.java index 8859b63db4..14223d88f8 100644 --- a/libnativeloader/test/src/android/test/vendorsharedlib/VendorSharedLib.java +++ b/libnativeloader/test/src/android/test/vendorsharedlib/VendorSharedLib.java @@ -17,5 +17,11 @@ package android.test.vendorsharedlib; public final class VendorSharedLib { - public static void loadLibrary(String name) { System.loadLibrary(name); } + public static void loadLibrary(String name) { + System.loadLibrary(name); + } + + public static void load(String path) { + System.load(path); + } } |