Merge "Make VNDK APEX as bootstrap APEX"
diff --git a/apexd/apexd.cpp b/apexd/apexd.cpp
index 80414ee..1ac7edc 100644
--- a/apexd/apexd.cpp
+++ b/apexd/apexd.cpp
@@ -117,9 +117,6 @@
 
 static constexpr size_t kLoopDeviceSetupAttempts = 3u;
 
-static const bool kUpdatable =
-    android::sysprop::ApexProperties::updatable().value_or(false);
-
 bool gBootstrap = false;
 static const std::vector<std::string> kBootstrapApexes = ([]() {
   std::vector<std::string> ret = {
@@ -163,12 +160,11 @@
     }
   }
 
-  // note: do not call preAllocateLoopDevices() if size == 0
-  // or the device does not support updatable APEX.
+  // note: do not call preAllocateLoopDevices() if size == 0.
   // For devices (e.g. ARC) which doesn't support loop-control
   // preAllocateLoopDevices() can cause problem when it tries
   // to access /dev/loop-control.
-  if (size == 0 || !kUpdatable) {
+  if (size == 0) {
     return {};
   }
   return loop::preAllocateLoopDevices(size);
@@ -718,11 +714,6 @@
   if (!verify_package_boot_status) {
     return verify_package_boot_status;
   }
-  if (!kUpdatable) {
-    return Error() << "Attempted to upgrade apex package "
-                   << apex_file.GetPath()
-                   << " on a device that doesn't support it";
-  }
   Result<ApexVerityData> verity_or = apex_file.VerifyApexVerity();
 
   constexpr const auto kSuccessFn = [](const std::string& /*mount_point*/) {
@@ -1103,9 +1094,6 @@
   if (gBootstrap && !isBootstrapApex(apex_file)) {
     LOG(INFO) << "Skipped when bootstrapping";
     return {};
-  } else if (!kUpdatable && !gBootstrap && isBootstrapApex(apex_file)) {
-    LOG(INFO) << "Package already activated in bootstrap";
-    return {};
   }
 
   // See whether we think it's active, and do not allow to activate the same
diff --git a/apexd/apexd_main.cpp b/apexd/apexd_main.cpp
index 8105e52..1e228c2 100644
--- a/apexd/apexd_main.cpp
+++ b/apexd/apexd_main.cpp
@@ -69,20 +69,23 @@
 int main(int /*argc*/, char** argv) {
   // Use CombinedLogger to also log to the kernel log.
   android::base::InitLogging(argv, CombinedLogger());
+  // TODO: add a -v flag or an external setting to change LogSeverity.
+  android::base::SetMinimumLogSeverity(android::base::VERBOSE);
 
+  const bool has_subcommand = argv[1] != nullptr;
   if (!android::sysprop::ApexProperties::updatable().value_or(false)) {
     LOG(INFO) << "This device does not support updatable APEX. Exiting";
-    android::apex::onAllPackagesReady();  // mark apexd as ready so that init
-                                          // can proceed
-    android::base::SetProperty("ctl.stop", "apexd");
+    if (!has_subcommand) {
+      // mark apexd as ready so that init can proceed
+      android::apex::onAllPackagesReady();
+      android::base::SetProperty("ctl.stop", "apexd");
+    }
     return 0;
   }
 
-  if (argv[1] != nullptr) {
+  if (has_subcommand) {
     return HandleSubcommand(argv);
   }
-  // TODO: add a -v flag or an external setting to change LogSeverity.
-  android::base::SetMinimumLogSeverity(android::base::VERBOSE);
 
   android::base::Result<android::apex::VoldCheckpointInterface>
       vold_service_st = android::apex::VoldCheckpointInterface::Create();