diff --git a/fs_mgr/fs_mgr_vendor_overlay.cpp b/fs_mgr/fs_mgr_vendor_overlay.cpp index bacfa4b59..6b742e55e 100644 --- a/fs_mgr/fs_mgr_vendor_overlay.cpp +++ b/fs_mgr/fs_mgr_vendor_overlay.cpp @@ -112,6 +112,7 @@ bool fs_mgr_vendor_overlay_mount_all() { // properties are loaded. static const auto vndk_version = android::base::GetProperty(kVndkVersionPropertyName, ""); if (vndk_version.empty()) { + // Vendor overlay is disabled from VNDK deprecated devices. LINFO << "vendor overlay: vndk version not defined"; return false; } diff --git a/fs_mgr/tests/src/com/android/tests/vendoroverlay/VendorOverlayHostTest.java b/fs_mgr/tests/src/com/android/tests/vendoroverlay/VendorOverlayHostTest.java index f08cab239..91f235c86 100644 --- a/fs_mgr/tests/src/com/android/tests/vendoroverlay/VendorOverlayHostTest.java +++ b/fs_mgr/tests/src/com/android/tests/vendoroverlay/VendorOverlayHostTest.java @@ -21,10 +21,8 @@ import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; import com.android.tradefed.util.CommandResult; import com.android.tradefed.util.CommandStatus; - import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.junit.After; import org.junit.Assert; import org.junit.Assume; @@ -38,9 +36,15 @@ import org.junit.runner.RunWith; @RunWith(DeviceJUnit4ClassRunner.class) public class VendorOverlayHostTest extends BaseHostJUnit4Test { boolean wasRoot = false; + String vndkVersion = null; @Before public void setup() throws DeviceNotAvailableException { + vndkVersion = getDevice().executeShellV2Command("getprop ro.vndk.version").getStdout(); + Assume.assumeTrue( + "Vendor Overlay is disabled for VNDK deprecated devices", + vndkVersion != null && !vndkVersion.trim().isEmpty()); + wasRoot = getDevice().isAdbRoot(); if (!wasRoot) { Assume.assumeTrue("Test requires root", getDevice().enableAdbRoot()); @@ -74,8 +78,6 @@ public class VendorOverlayHostTest extends BaseHostJUnit4Test { */ @Test public void testVendorOverlay() throws DeviceNotAvailableException { - String vndkVersion = getDevice().executeShellV2Command("getprop ro.vndk.version").getStdout(); - // Create files and modify policy CommandResult result = getDevice().executeShellV2Command( "echo '/(product|system/product)/vendor_overlay/" + vndkVersion +