Merge remote-tracking branch 'aosp/upstream-master' into merge
git merge aosp/upstream-master --commit -s recursive
Test: treehugger
Change-Id: Ifab9f47e1c5bea3898e78df0139d10842b41a44f
diff --git a/Android.bp b/Android.bp
index 29e6025..d5213a8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -170,6 +170,7 @@
recovery_available: true,
srcs: [
+ "aosp/platform_constants_android.cc",
"common/action_processor.cc",
"common/boot_control_stub.cc",
"common/clock.cc",
@@ -183,17 +184,16 @@
"common/http_fetcher.cc",
"common/hwid_override.cc",
"common/multi_range_http_fetcher.cc",
- "common/platform_constants_android.cc",
"common/prefs.cc",
"common/proxy_resolver.cc",
"common/subprocess.cc",
"common/terminator.cc",
"common/utils.cc",
+ "download_action.cc",
"payload_consumer/bzip_extent_writer.cc",
"payload_consumer/cached_file_descriptor.cc",
"payload_consumer/certificate_parser_android.cc",
"payload_consumer/delta_performer.cc",
- "payload_consumer/download_action.cc",
"payload_consumer/extent_reader.cc",
"payload_consumer/extent_writer.cc",
"payload_consumer/file_descriptor.cc",
@@ -273,10 +273,10 @@
recovery_available: true,
srcs: [
- "boot_control_android.cc",
- "cleanup_previous_update_action.cc",
- "dynamic_partition_control_android.cc",
- "dynamic_partition_utils.cc",
+ "aosp/boot_control_android.cc",
+ "aosp/cleanup_previous_update_action.cc",
+ "aosp/dynamic_partition_control_android.cc",
+ "aosp/dynamic_partition_utils.cc",
],
}
@@ -332,17 +332,17 @@
srcs: [
":libupdate_engine_aidl",
- "binder_service_android.cc",
- "binder_service_stable_android.cc",
+ "aosp/binder_service_android.cc",
+ "aosp/binder_service_stable_android.cc",
+ "aosp/daemon_android.cc",
+ "aosp/daemon_state_android.cc",
+ "aosp/hardware_android.cc",
+ "aosp/logging_android.cc",
+ "aosp/network_selector_android.cc",
+ "aosp/update_attempter_android.cc",
"certificate_checker.cc",
- "daemon_android.cc",
- "daemon_state_android.cc",
- "hardware_android.cc",
"libcurl_http_fetcher.cc",
- "logging_android.cc",
"metrics_utils.cc",
- "network_selector_android.cc",
- "update_attempter_android.cc",
"update_boot_flags_action.cc",
"update_status_utils.cc",
],
@@ -364,7 +364,7 @@
"otacerts",
],
- srcs: ["main.cc", "metrics_reporter_android.cc"],
+ srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
init_rc: ["update_engine.rc"],
}
@@ -389,13 +389,13 @@
include_dirs: ["external/cros/system_api/dbus"],
srcs: [
- "hardware_android.cc",
- "logging_android.cc",
- "metrics_reporter_stub.cc",
+ "aosp/hardware_android.cc",
+ "aosp/logging_android.cc",
+ "aosp/sideload_main.cc",
+ "aosp/update_attempter_android.cc",
+ "common/metrics_reporter_stub.cc",
+ "common/network_selector_stub.cc",
"metrics_utils.cc",
- "network_selector_stub.cc",
- "sideload_main.cc",
- "update_attempter_android.cc",
"update_boot_flags_action.cc",
"update_status_utils.cc",
],
@@ -465,8 +465,8 @@
srcs: [
":libupdate_engine_aidl",
+ "aosp/update_engine_client_android.cc",
"common/error_code_utils.cc",
- "update_engine_client_android.cc",
"update_status_utils.cc",
],
}
@@ -699,6 +699,8 @@
test_suites: ["device-tests"],
srcs: [
+ "aosp/dynamic_partition_control_android_unittest.cc",
+ "aosp/update_attempter_android_unittest.cc",
"certificate_checker_unittest.cc",
"common/action_pipe_unittest.cc",
"common/action_processor_unittest.cc",
@@ -710,6 +712,7 @@
"common/hash_calculator_unittest.cc",
"common/http_fetcher_unittest.cc",
"common/hwid_override_unittest.cc",
+ "common/metrics_reporter_stub.cc",
"common/mock_http_fetcher.cc",
"common/prefs_unittest.cc",
"common/proxy_resolver_unittest.cc",
@@ -717,7 +720,7 @@
"common/terminator_unittest.cc",
"common/test_utils.cc",
"common/utils_unittest.cc",
- "dynamic_partition_control_android_unittest.cc",
+ "download_action_android_unittest.cc",
"libcurl_http_fetcher_unittest.cc",
"payload_consumer/bzip_extent_writer_unittest.cc",
"payload_consumer/cached_file_descriptor_unittest.cc",
@@ -725,7 +728,6 @@
"payload_consumer/delta_performer_integration_test.cc",
"payload_consumer/delta_performer_unittest.cc",
"payload_consumer/partition_writer_unittest.cc",
- "payload_consumer/download_action_android_unittest.cc",
"payload_consumer/extent_reader_unittest.cc",
"payload_consumer/extent_writer_unittest.cc",
"payload_consumer/snapshot_extent_writer_unittest.cc",
@@ -758,9 +760,7 @@
"payload_generator/squashfs_filesystem_unittest.cc",
"payload_generator/zip_unittest.cc",
"testrunner.cc",
- "update_attempter_android_unittest.cc",
"update_status_utils_unittest.cc",
- "metrics_reporter_stub.cc",
],
}
diff --git a/BUILD.gn b/BUILD.gn
index aec447c..30ba977 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -143,17 +143,17 @@
"common/http_fetcher.cc",
"common/hwid_override.cc",
"common/multi_range_http_fetcher.cc",
- "common/platform_constants_chromeos.cc",
"common/prefs.cc",
"common/proxy_resolver.cc",
"common/subprocess.cc",
"common/terminator.cc",
"common/utils.cc",
+ "cros/platform_constants_chromeos.cc",
+ "download_action.cc",
"payload_consumer/bzip_extent_writer.cc",
"payload_consumer/cached_file_descriptor.cc",
"payload_consumer/certificate_parser_stub.cc",
"payload_consumer/delta_performer.cc",
- "payload_consumer/download_action.cc",
"payload_consumer/extent_reader.cc",
"payload_consumer/extent_writer.cc",
"payload_consumer/file_descriptor.cc",
@@ -197,32 +197,32 @@
# with Omaha and expose a DBus daemon.
static_library("libupdate_engine") {
sources = [
- "boot_control_chromeos.cc",
"certificate_checker.cc",
- "common_service.cc",
- "connection_manager.cc",
- "connection_utils.cc",
- "daemon_chromeos.cc",
- "dbus_connection.cc",
- "dbus_service.cc",
- "hardware_chromeos.cc",
- "image_properties_chromeos.cc",
+ "common/connection_utils.cc",
+ "cros/boot_control_chromeos.cc",
+ "cros/common_service.cc",
+ "cros/connection_manager.cc",
+ "cros/daemon_chromeos.cc",
+ "cros/dbus_connection.cc",
+ "cros/dbus_service.cc",
+ "cros/hardware_chromeos.cc",
+ "cros/image_properties_chromeos.cc",
+ "cros/logging.cc",
+ "cros/metrics_reporter_omaha.cc",
+ "cros/omaha_request_action.cc",
+ "cros/omaha_request_builder_xml.cc",
+ "cros/omaha_request_params.cc",
+ "cros/omaha_response_handler_action.cc",
+ "cros/omaha_utils.cc",
+ "cros/p2p_manager.cc",
+ "cros/payload_state.cc",
+ "cros/power_manager_chromeos.cc",
+ "cros/real_system_state.cc",
+ "cros/requisition_util.cc",
+ "cros/shill_proxy.cc",
+ "cros/update_attempter.cc",
"libcurl_http_fetcher.cc",
- "logging.cc",
- "metrics_reporter_omaha.cc",
"metrics_utils.cc",
- "omaha_request_action.cc",
- "omaha_request_builder_xml.cc",
- "omaha_request_params.cc",
- "omaha_response_handler_action.cc",
- "omaha_utils.cc",
- "p2p_manager.cc",
- "payload_state.cc",
- "power_manager_chromeos.cc",
- "real_system_state.cc",
- "requisition_util.cc",
- "shill_proxy.cc",
- "update_attempter.cc",
"update_boot_flags_action.cc",
"update_manager/boxed_value.cc",
"update_manager/chromeos_policy.cc",
@@ -281,7 +281,7 @@
}
if (use.chrome_network_proxy) {
- sources += [ "chrome_browser_proxy_resolver.cc" ]
+ sources += [ "cros/chrome_browser_proxy_resolver.cc" ]
}
if (use.chrome_kiosk_app) {
@@ -290,8 +290,8 @@
if (use.dlc) {
sources += [
- "dlcservice_chromeos.cc",
- "excluder_chromeos.cc",
+ "cros/dlcservice_chromeos.cc",
+ "cros/excluder_chromeos.cc",
]
} else {
sources += [
@@ -326,8 +326,8 @@
executable("update_engine_client") {
sources = [
"common/error_code_utils.cc",
- "omaha_utils.cc",
- "update_engine_client.cc",
+ "cros/omaha_utils.cc",
+ "cros/update_engine_client.cc",
]
configs += [ ":target_defaults" ]
deps = [ ":libupdate_engine_client" ]
@@ -396,8 +396,8 @@
"common/fake_prefs.cc",
"common/mock_http_fetcher.cc",
"common/test_utils.cc",
- "fake_shill_proxy.cc",
- "fake_system_state.cc",
+ "cros/fake_shill_proxy.cc",
+ "cros/fake_system_state.cc",
"payload_consumer/fake_file_descriptor.cc",
"payload_generator/fake_filesystem.cc",
"update_manager/umtest_utils.cc",
@@ -422,8 +422,8 @@
openssl_pem_out_dir = "include/update_engine"
sources = [
"unittest_key.pem",
- "unittest_key_RSA4096.pem",
"unittest_key2.pem",
+ "unittest_key_RSA4096.pem",
]
}
@@ -431,9 +431,7 @@
openssl_pem_in_dir = "."
openssl_pem_out_dir = "include/update_engine"
openssl_pem_algorithm = "ec"
- sources = [
- "unittest_key_EC.pem",
- ]
+ sources = [ "unittest_key_EC.pem" ]
}
# Unpacks sample images used for testing.
@@ -472,7 +470,6 @@
# Main unittest file.
executable("update_engine_unittests") {
sources = [
- "boot_control_chromeos_unittest.cc",
"certificate_checker_unittest.cc",
"common/action_pipe_unittest.cc",
"common/action_processor_unittest.cc",
@@ -486,24 +483,28 @@
"common/subprocess_unittest.cc",
"common/terminator_unittest.cc",
"common/utils_unittest.cc",
- "common_service_unittest.cc",
- "connection_manager_unittest.cc",
- "hardware_chromeos_unittest.cc",
- "image_properties_chromeos_unittest.cc",
+ "cros/boot_control_chromeos_unittest.cc",
+ "cros/common_service_unittest.cc",
+ "cros/connection_manager_unittest.cc",
+ "cros/hardware_chromeos_unittest.cc",
+ "cros/image_properties_chromeos_unittest.cc",
+ "cros/metrics_reporter_omaha_unittest.cc",
+ "cros/omaha_request_action_unittest.cc",
+ "cros/omaha_request_builder_xml_unittest.cc",
+ "cros/omaha_request_params_unittest.cc",
+ "cros/omaha_response_handler_action_unittest.cc",
+ "cros/omaha_utils_unittest.cc",
+ "cros/p2p_manager_unittest.cc",
+ "cros/payload_state_unittest.cc",
+ "cros/requisition_util_unittest.cc",
+ "cros/update_attempter_unittest.cc",
+ "download_action_unittest.cc",
"libcurl_http_fetcher_unittest.cc",
- "metrics_reporter_omaha_unittest.cc",
"metrics_utils_unittest.cc",
- "omaha_request_action_unittest.cc",
- "omaha_request_builder_xml_unittest.cc",
- "omaha_request_params_unittest.cc",
- "omaha_response_handler_action_unittest.cc",
- "omaha_utils_unittest.cc",
- "p2p_manager_unittest.cc",
"payload_consumer/bzip_extent_writer_unittest.cc",
"payload_consumer/cached_file_descriptor_unittest.cc",
"payload_consumer/delta_performer_integration_test.cc",
"payload_consumer/delta_performer_unittest.cc",
- "payload_consumer/download_action_unittest.cc",
"payload_consumer/extent_reader_unittest.cc",
"payload_consumer/extent_writer_unittest.cc",
"payload_consumer/file_descriptor_utils_unittest.cc",
@@ -528,10 +529,7 @@
"payload_generator/payload_signer_unittest.cc",
"payload_generator/squashfs_filesystem_unittest.cc",
"payload_generator/zip_unittest.cc",
- "payload_state_unittest.cc",
- "requisition_util_unittest.cc",
"testrunner.cc",
- "update_attempter_unittest.cc",
"update_boot_flags_action_unittest.cc",
"update_manager/boxed_value_unittest.cc",
"update_manager/chromeos_policy_unittest.cc",
@@ -553,7 +551,7 @@
"update_status_utils_unittest.cc",
]
if (use.dlc) {
- sources += [ "excluder_chromeos_unittest.cc" ]
+ sources += [ "cros/excluder_chromeos_unittest.cc" ]
}
# //common-mk:test should be on the top.
@@ -596,7 +594,7 @@
]
}
executable("update_engine_omaha_request_action_fuzzer") {
- sources = [ "omaha_request_action_fuzzer.cc" ]
+ sources = [ "cros/omaha_request_action_fuzzer.cc" ]
configs += [
"//common-mk/common_fuzzer",
":target_defaults",
diff --git a/binder_service_android.cc b/aosp/binder_service_android.cc
similarity index 98%
rename from binder_service_android.cc
rename to aosp/binder_service_android.cc
index 0c8bc2f..ed76c4a 100644
--- a/binder_service_android.cc
+++ b/aosp/binder_service_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/binder_service_android.h"
+#include "update_engine/aosp/binder_service_android.h"
#include <memory>
@@ -24,7 +24,7 @@
#include <brillo/errors/error.h>
#include <utils/String8.h>
-#include "update_engine/binder_service_android_common.h"
+#include "update_engine/aosp/binder_service_android_common.h"
using android::binder::Status;
using android::os::IUpdateEngineCallback;
diff --git a/binder_service_android.h b/aosp/binder_service_android.h
similarity index 92%
rename from binder_service_android.h
rename to aosp/binder_service_android.h
index 5f28225..f41fbdf 100644
--- a/binder_service_android.h
+++ b/aosp/binder_service_android.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_
-#define UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_BINDER_SERVICE_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_BINDER_SERVICE_ANDROID_H_
#include <stdint.h>
@@ -28,8 +28,8 @@
#include "android/os/BnUpdateEngine.h"
#include "android/os/IUpdateEngineCallback.h"
-#include "update_engine/service_delegate_android_interface.h"
-#include "update_engine/service_observer_interface.h"
+#include "update_engine/aosp/service_delegate_android_interface.h"
+#include "update_engine/common/service_observer_interface.h"
namespace chromeos_update_engine {
@@ -96,4 +96,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BINDER_SERVICE_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_BINDER_SERVICE_ANDROID_H_
diff --git a/binder_service_android_common.h b/aosp/binder_service_android_common.h
similarity index 86%
rename from binder_service_android_common.h
rename to aosp/binder_service_android_common.h
index fc621d9..223b32e 100644
--- a/binder_service_android_common.h
+++ b/aosp/binder_service_android_common.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BINDER_SERVICE_ANDROID_COMMON_H_
-#define UPDATE_ENGINE_BINDER_SERVICE_ANDROID_COMMON_H_
+#ifndef UPDATE_ENGINE_AOSP_BINDER_SERVICE_ANDROID_COMMON_H_
+#define UPDATE_ENGINE_AOSP_BINDER_SERVICE_ANDROID_COMMON_H_
#include <string>
#include <vector>
@@ -42,4 +42,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BINDER_SERVICE_ANDROID_COMMON_H_
+#endif // UPDATE_ENGINE_AOSP_BINDER_SERVICE_ANDROID_COMMON_H_
diff --git a/binder_service_stable_android.cc b/aosp/binder_service_stable_android.cc
similarity index 96%
rename from binder_service_stable_android.cc
rename to aosp/binder_service_stable_android.cc
index a12b349..17b35ee 100644
--- a/binder_service_stable_android.cc
+++ b/aosp/binder_service_stable_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/binder_service_stable_android.h"
+#include "update_engine/aosp/binder_service_stable_android.h"
#include <memory>
@@ -24,7 +24,7 @@
#include <brillo/errors/error.h>
#include <utils/String8.h>
-#include "update_engine/binder_service_android_common.h"
+#include "update_engine/aosp/binder_service_android_common.h"
using android::binder::Status;
using android::os::IUpdateEngineStableCallback;
diff --git a/binder_service_stable_android.h b/aosp/binder_service_stable_android.h
similarity index 89%
rename from binder_service_stable_android.h
rename to aosp/binder_service_stable_android.h
index 1667798..212afaa 100644
--- a/binder_service_stable_android.h
+++ b/aosp/binder_service_stable_android.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BINDER_SERVICE_STABLE_ANDROID_H_
-#define UPDATE_ENGINE_BINDER_SERVICE_STABLE_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_BINDER_SERVICE_STABLE_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_BINDER_SERVICE_STABLE_ANDROID_H_
#include <stdint.h>
@@ -28,8 +28,8 @@
#include "android/os/BnUpdateEngineStable.h"
#include "android/os/IUpdateEngineStableCallback.h"
-#include "update_engine/service_delegate_android_interface.h"
-#include "update_engine/service_observer_interface.h"
+#include "update_engine/aosp/service_delegate_android_interface.h"
+#include "update_engine/common/service_observer_interface.h"
namespace chromeos_update_engine {
@@ -82,4 +82,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BINDER_SERVICE_STABLE_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_BINDER_SERVICE_STABLE_ANDROID_H_
diff --git a/boot_control_android.cc b/aosp/boot_control_android.cc
similarity index 97%
rename from boot_control_android.cc
rename to aosp/boot_control_android.cc
index dee5fa8..bda65be 100644
--- a/boot_control_android.cc
+++ b/aosp/boot_control_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/boot_control_android.h"
+#include "update_engine/aosp/boot_control_android.h"
#include <memory>
#include <utility>
@@ -25,8 +25,8 @@
#include <bootloader_message/bootloader_message.h>
#include <brillo/message_loops/message_loop.h>
+#include "update_engine/aosp/dynamic_partition_control_android.h"
#include "update_engine/common/utils.h"
-#include "update_engine/dynamic_partition_control_android.h"
using std::string;
diff --git a/boot_control_android.h b/aosp/boot_control_android.h
similarity index 91%
rename from boot_control_android.h
rename to aosp/boot_control_android.h
index 5009dbd..e288723 100644
--- a/boot_control_android.h
+++ b/aosp/boot_control_android.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
-#define UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_BOOT_CONTROL_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_BOOT_CONTROL_ANDROID_H_
#include <map>
#include <memory>
@@ -24,9 +24,9 @@
#include <android/hardware/boot/1.0/IBootControl.h>
#include <liblp/builder.h>
+#include "update_engine/aosp/dynamic_partition_control_android.h"
#include "update_engine/common/boot_control.h"
#include "update_engine/common/dynamic_partition_control_interface.h"
-#include "update_engine/dynamic_partition_control_android.h"
namespace chromeos_update_engine {
@@ -70,4 +70,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_BOOT_CONTROL_ANDROID_H_
diff --git a/cleanup_previous_update_action.cc b/aosp/cleanup_previous_update_action.cc
similarity index 99%
rename from cleanup_previous_update_action.cc
rename to aosp/cleanup_previous_update_action.cc
index 89ed6f8..16cb9fe 100644
--- a/cleanup_previous_update_action.cc
+++ b/aosp/cleanup_previous_update_action.cc
@@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-#include "update_engine/cleanup_previous_update_action.h"
+#include "update_engine/aosp/cleanup_previous_update_action.h"
#include <chrono> // NOLINT(build/c++11) -- for merge times
#include <functional>
diff --git a/cleanup_previous_update_action.h b/aosp/cleanup_previous_update_action.h
similarity index 94%
rename from cleanup_previous_update_action.h
rename to aosp/cleanup_previous_update_action.h
index fe65e60..b93c557 100644
--- a/cleanup_previous_update_action.h
+++ b/aosp/cleanup_previous_update_action.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CLEANUP_PREVIOUS_UPDATE_ACTION_H_
-#define UPDATE_ENGINE_CLEANUP_PREVIOUS_UPDATE_ACTION_H_
+#ifndef UPDATE_ENGINE_AOSP_CLEANUP_PREVIOUS_UPDATE_ACTION_H_
+#define UPDATE_ENGINE_AOSP_CLEANUP_PREVIOUS_UPDATE_ACTION_H_
#include <chrono> // NOLINT(build/c++11) -- for merge times
#include <memory>
@@ -100,4 +100,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CLEANUP_PREVIOUS_UPDATE_ACTION_H_
+#endif // UPDATE_ENGINE_AOSP_CLEANUP_PREVIOUS_UPDATE_ACTION_H_
diff --git a/daemon_android.cc b/aosp/daemon_android.cc
similarity index 95%
rename from daemon_android.cc
rename to aosp/daemon_android.cc
index 313d7dd..c102e3b 100644
--- a/daemon_android.cc
+++ b/aosp/daemon_android.cc
@@ -14,13 +14,13 @@
// limitations under the License.
//
-#include "update_engine/daemon_android.h"
+#include "update_engine/aosp/daemon_android.h"
#include <sysexits.h>
#include <binderwrapper/binder_wrapper.h>
-#include "update_engine/daemon_state_android.h"
+#include "update_engine/aosp/daemon_state_android.h"
using std::unique_ptr;
diff --git a/daemon_android.h b/aosp/daemon_android.h
similarity index 80%
rename from daemon_android.h
rename to aosp/daemon_android.h
index f0c028e..38a8689 100644
--- a/daemon_android.h
+++ b/aosp/daemon_android.h
@@ -14,18 +14,18 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DAEMON_ANDROID_H_
-#define UPDATE_ENGINE_DAEMON_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_DAEMON_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_DAEMON_ANDROID_H_
#include <memory>
#include <brillo/binder_watcher.h>
-#include "update_engine/binder_service_android.h"
-#include "update_engine/binder_service_stable_android.h"
+#include "update_engine/aosp/binder_service_android.h"
+#include "update_engine/aosp/binder_service_stable_android.h"
+#include "update_engine/common/daemon_base.h"
+#include "update_engine/common/daemon_state_interface.h"
#include "update_engine/common/subprocess.h"
-#include "update_engine/daemon_base.h"
-#include "update_engine/daemon_state_interface.h"
namespace chromeos_update_engine {
@@ -55,4 +55,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DAEMON_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_DAEMON_ANDROID_H_
diff --git a/daemon_state_android.cc b/aosp/daemon_state_android.cc
similarity index 95%
rename from daemon_state_android.cc
rename to aosp/daemon_state_android.cc
index 3376e64..9bdd175 100644
--- a/daemon_state_android.cc
+++ b/aosp/daemon_state_android.cc
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#include "update_engine/daemon_state_android.h"
+#include "update_engine/aosp/daemon_state_android.h"
#include <base/logging.h>
+#include "update_engine/aosp/update_attempter_android.h"
#include "update_engine/common/boot_control.h"
#include "update_engine/common/boot_control_stub.h"
#include "update_engine/common/hardware.h"
#include "update_engine/common/prefs.h"
-#include "update_engine/update_attempter_android.h"
namespace chromeos_update_engine {
diff --git a/daemon_state_android.h b/aosp/daemon_state_android.h
similarity index 84%
rename from daemon_state_android.h
rename to aosp/daemon_state_android.h
index 928a14e..dea3a23 100644
--- a/daemon_state_android.h
+++ b/aosp/daemon_state_android.h
@@ -14,20 +14,20 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_
-#define UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_DAEMON_STATE_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_DAEMON_STATE_ANDROID_H_
#include <memory>
#include <set>
+#include "update_engine/aosp/service_delegate_android_interface.h"
+#include "update_engine/aosp/update_attempter_android.h"
#include "update_engine/certificate_checker.h"
#include "update_engine/common/boot_control_interface.h"
+#include "update_engine/common/daemon_state_interface.h"
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/prefs_interface.h"
-#include "update_engine/daemon_state_interface.h"
-#include "update_engine/service_delegate_android_interface.h"
-#include "update_engine/service_observer_interface.h"
-#include "update_engine/update_attempter_android.h"
+#include "update_engine/common/service_observer_interface.h"
namespace chromeos_update_engine {
@@ -73,4 +73,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_DAEMON_STATE_ANDROID_H_
diff --git a/dynamic_partition_control_android.cc b/aosp/dynamic_partition_control_android.cc
similarity index 99%
rename from dynamic_partition_control_android.cc
rename to aosp/dynamic_partition_control_android.cc
index 7c331f0..d461807 100644
--- a/dynamic_partition_control_android.cc
+++ b/aosp/dynamic_partition_control_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/dynamic_partition_control_android.h"
+#include "update_engine/aosp/dynamic_partition_control_android.h"
#include <chrono> // NOLINT(build/c++11) - using libsnapshot / liblp API
#include <cstdint>
@@ -42,10 +42,10 @@
#include <libsnapshot/snapshot.h>
#include <libsnapshot/snapshot_stub.h>
-#include "update_engine/cleanup_previous_update_action.h"
+#include "update_engine/aosp/cleanup_previous_update_action.h"
+#include "update_engine/aosp/dynamic_partition_utils.h"
#include "update_engine/common/boot_control_interface.h"
#include "update_engine/common/utils.h"
-#include "update_engine/dynamic_partition_utils.h"
#include "update_engine/payload_consumer/delta_performer.h"
using android::base::GetBoolProperty;
diff --git a/dynamic_partition_control_android.h b/aosp/dynamic_partition_control_android.h
similarity index 98%
rename from dynamic_partition_control_android.h
rename to aosp/dynamic_partition_control_android.h
index 4f3964b..a4064e9 100644
--- a/dynamic_partition_control_android.h
+++ b/aosp/dynamic_partition_control_android.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DYNAMIC_PARTITION_CONTROL_ANDROID_H_
-#define UPDATE_ENGINE_DYNAMIC_PARTITION_CONTROL_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_CONTROL_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_CONTROL_ANDROID_H_
#include <memory>
#include <set>
@@ -306,4 +306,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DYNAMIC_PARTITION_CONTROL_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_CONTROL_ANDROID_H_
diff --git a/dynamic_partition_control_android_unittest.cc b/aosp/dynamic_partition_control_android_unittest.cc
similarity index 97%
rename from dynamic_partition_control_android_unittest.cc
rename to aosp/dynamic_partition_control_android_unittest.cc
index c1e0daf..5d6463b 100644
--- a/dynamic_partition_control_android_unittest.cc
+++ b/aosp/dynamic_partition_control_android_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/dynamic_partition_control_android.h"
+#include "update_engine/aosp/dynamic_partition_control_android.h"
#include <set>
#include <vector>
@@ -26,10 +26,10 @@
#include <libavb/libavb.h>
#include <libsnapshot/mock_snapshot.h>
+#include "update_engine/aosp/dynamic_partition_test_utils.h"
+#include "update_engine/aosp/mock_dynamic_partition_control.h"
#include "update_engine/common/mock_prefs.h"
#include "update_engine/common/test_utils.h"
-#include "update_engine/dynamic_partition_test_utils.h"
-#include "update_engine/mock_dynamic_partition_control.h"
using android::dm::DmDeviceState;
using android::snapshot::MockSnapshotManager;
@@ -792,11 +792,11 @@
}
TEST_F(DynamicPartitionControlAndroidTest, IsAvbNotEnabledInFstab) {
- // clang-format off
std::string fstab_content =
- "system /postinstall ext4 ro,nosuid,nodev,noexec slotselect_other,logical\n" // NOLINT(whitespace/line_length)
- "/dev/block/by-name/system /postinstall ext4 ro,nosuid,nodev,noexec slotselect_other\n"; // NOLINT(whitespace/line_length)
- // clang-format on
+ "system /postinstall ext4 ro,nosuid,nodev,noexec "
+ "slotselect_other,logical\n"
+ "/dev/block/by-name/system /postinstall ext4 "
+ "ro,nosuid,nodev,noexec slotselect_other\n";
ScopedTempFile fstab;
ASSERT_TRUE(test_utils::WriteFileString(fstab.path(), fstab_content));
ASSERT_THAT(dynamicControl().RealIsAvbEnabledInFstab(fstab.path()),
@@ -804,10 +804,9 @@
}
TEST_F(DynamicPartitionControlAndroidTest, IsAvbEnabledInFstab) {
- // clang-format off
std::string fstab_content =
- "system /postinstall ext4 ro,nosuid,nodev,noexec slotselect_other,logical,avb_keys=/foo\n"; // NOLINT(whitespace/line_length)
- // clang-format on
+ "system /postinstall ext4 ro,nosuid,nodev,noexec "
+ "slotselect_other,logical,avb_keys=/foo\n";
ScopedTempFile fstab;
ASSERT_TRUE(test_utils::WriteFileString(fstab.path(), fstab_content));
ASSERT_THAT(dynamicControl().RealIsAvbEnabledInFstab(fstab.path()),
diff --git a/dynamic_partition_test_utils.h b/aosp/dynamic_partition_test_utils.h
similarity index 97%
rename from dynamic_partition_test_utils.h
rename to aosp/dynamic_partition_test_utils.h
index d701dce..c7be1cb 100644
--- a/dynamic_partition_test_utils.h
+++ b/aosp/dynamic_partition_test_utils.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DYNAMIC_PARTITION_TEST_UTILS_H_
-#define UPDATE_ENGINE_DYNAMIC_PARTITION_TEST_UTILS_H_
+#ifndef UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_TEST_UTILS_H_
+#define UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_TEST_UTILS_H_
#include <stdint.h>
@@ -285,4 +285,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DYNAMIC_PARTITION_TEST_UTILS_H_
+#endif // UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_TEST_UTILS_H_
diff --git a/dynamic_partition_utils.cc b/aosp/dynamic_partition_utils.cc
similarity index 95%
rename from dynamic_partition_utils.cc
rename to aosp/dynamic_partition_utils.cc
index f9bd886..6b77a45 100644
--- a/dynamic_partition_utils.cc
+++ b/aosp/dynamic_partition_utils.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/dynamic_partition_utils.h"
+#include "update_engine/aosp/dynamic_partition_utils.h"
#include <vector>
diff --git a/dynamic_partition_utils.h b/aosp/dynamic_partition_utils.h
similarity index 85%
rename from dynamic_partition_utils.h
rename to aosp/dynamic_partition_utils.h
index 09fce00..5a51d5e 100644
--- a/dynamic_partition_utils.h
+++ b/aosp/dynamic_partition_utils.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DYNAMIC_PARTITION_UTILS_H_
-#define UPDATE_ENGINE_DYNAMIC_PARTITION_UTILS_H_
+#ifndef UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_UTILS_H_
+#define UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_UTILS_H_
#include <string>
@@ -30,4 +30,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DYNAMIC_PARTITION_UTILS_H_
+#endif // UPDATE_ENGINE_AOSP_DYNAMIC_PARTITION_UTILS_H_
diff --git a/hardware_android.cc b/aosp/hardware_android.cc
similarity index 99%
rename from hardware_android.cc
rename to aosp/hardware_android.cc
index 28c139a..6f884d4 100644
--- a/hardware_android.cc
+++ b/aosp/hardware_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/hardware_android.h"
+#include "update_engine/aosp/hardware_android.h"
#include <sys/types.h>
diff --git a/hardware_android.h b/aosp/hardware_android.h
similarity index 94%
rename from hardware_android.h
rename to aosp/hardware_android.h
index 4d10835..5ffd7c5 100644
--- a/hardware_android.h
+++ b/aosp/hardware_android.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_HARDWARE_ANDROID_H_
-#define UPDATE_ENGINE_HARDWARE_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_
#include <string>
#include <string_view>
@@ -70,4 +70,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HARDWARE_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_HARDWARE_ANDROID_H_
diff --git a/logging_android.cc b/aosp/logging_android.cc
similarity index 100%
rename from logging_android.cc
rename to aosp/logging_android.cc
diff --git a/metrics_reporter_android.cc b/aosp/metrics_reporter_android.cc
similarity index 98%
rename from metrics_reporter_android.cc
rename to aosp/metrics_reporter_android.cc
index d8fa6e5..ea3bb6d 100644
--- a/metrics_reporter_android.cc
+++ b/aosp/metrics_reporter_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/metrics_reporter_android.h"
+#include "update_engine/aosp/metrics_reporter_android.h"
#include <stdint.h>
diff --git a/metrics_reporter_android.h b/aosp/metrics_reporter_android.h
similarity index 92%
rename from metrics_reporter_android.h
rename to aosp/metrics_reporter_android.h
index 7770619..4a173bf 100644
--- a/metrics_reporter_android.h
+++ b/aosp/metrics_reporter_android.h
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_METRICS_REPORTER_ANDROID_H_
-#define UPDATE_ENGINE_METRICS_REPORTER_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_METRICS_REPORTER_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_METRICS_REPORTER_ANDROID_H_
#include <string>
#include "update_engine/common/error_code.h"
-#include "update_engine/metrics_constants.h"
-#include "update_engine/metrics_reporter_interface.h"
+#include "update_engine/common/metrics_constants.h"
+#include "update_engine/common/metrics_reporter_interface.h"
namespace chromeos_update_engine {
@@ -98,4 +98,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_METRICS_REPORTER_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_METRICS_REPORTER_ANDROID_H_
diff --git a/mock_dynamic_partition_control.h b/aosp/mock_dynamic_partition_control.h
similarity index 97%
rename from mock_dynamic_partition_control.h
rename to aosp/mock_dynamic_partition_control.h
index d5853ca..df7208e 100644
--- a/mock_dynamic_partition_control.h
+++ b/aosp/mock_dynamic_partition_control.h
@@ -23,11 +23,11 @@
#include <gmock/gmock.h>
#include <libsnapshot/cow_writer.h>
+#include <libsnapshot/snapshot_writer.h>
-#include "libsnapshot/snapshot_writer.h"
+#include "update_engine/aosp/dynamic_partition_control_android.h"
#include "update_engine/common/boot_control_interface.h"
#include "update_engine/common/dynamic_partition_control_interface.h"
-#include "update_engine/dynamic_partition_control_android.h"
namespace chromeos_update_engine {
diff --git a/network_selector_android.cc b/aosp/network_selector_android.cc
similarity index 88%
rename from network_selector_android.cc
rename to aosp/network_selector_android.cc
index 55ba799..a7db415 100644
--- a/network_selector_android.cc
+++ b/aosp/network_selector_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/network_selector_android.h"
+#include "update_engine/aosp/network_selector_android.h"
#include <memory>
@@ -25,14 +25,14 @@
namespace network {
-// Factory defined in network_selector.h.
+// Factory defined in common/network_selector.h.
std::unique_ptr<NetworkSelectorInterface> CreateNetworkSelector() {
return std::make_unique<NetworkSelectorAndroid>();
}
} // namespace network
-// Defined in network_selector_interface.h.
+// Defined in common/network_selector_interface.h.
const NetworkId kDefaultNetworkId = NETWORK_UNSPECIFIED;
bool NetworkSelectorAndroid::SetProcessNetwork(NetworkId network_id) {
diff --git a/network_selector_android.h b/aosp/network_selector_android.h
similarity index 81%
rename from network_selector_android.h
rename to aosp/network_selector_android.h
index 135536c..b79d1b3 100644
--- a/network_selector_android.h
+++ b/aosp/network_selector_android.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_NETWORK_SELECTOR_ANDROID_H_
-#define UPDATE_ENGINE_NETWORK_SELECTOR_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_NETWORK_SELECTOR_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_NETWORK_SELECTOR_ANDROID_H_
#include <base/macros.h>
-#include "update_engine/network_selector_interface.h"
+#include "update_engine/common/network_selector_interface.h"
namespace chromeos_update_engine {
@@ -37,4 +37,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_NETWORK_SELECTOR_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_NETWORK_SELECTOR_ANDROID_H_
diff --git a/common/platform_constants_android.cc b/aosp/platform_constants_android.cc
similarity index 100%
rename from common/platform_constants_android.cc
rename to aosp/platform_constants_android.cc
diff --git a/service_delegate_android_interface.h b/aosp/service_delegate_android_interface.h
similarity index 95%
rename from service_delegate_android_interface.h
rename to aosp/service_delegate_android_interface.h
index 34a9712..3c28794 100644
--- a/service_delegate_android_interface.h
+++ b/aosp/service_delegate_android_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_SERVICE_DELEGATE_ANDROID_INTERFACE_H_
-#define UPDATE_ENGINE_SERVICE_DELEGATE_ANDROID_INTERFACE_H_
+#ifndef UPDATE_ENGINE_AOSP_SERVICE_DELEGATE_ANDROID_INTERFACE_H_
+#define UPDATE_ENGINE_AOSP_SERVICE_DELEGATE_ANDROID_INTERFACE_H_
#include <inttypes.h>
@@ -124,4 +124,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_SERVICE_DELEGATE_ANDROID_INTERFACE_H_
+#endif // UPDATE_ENGINE_AOSP_SERVICE_DELEGATE_ANDROID_INTERFACE_H_
diff --git a/sideload_main.cc b/aosp/sideload_main.cc
similarity index 98%
rename from sideload_main.cc
rename to aosp/sideload_main.cc
index 27967cd..3cbc0c7 100644
--- a/sideload_main.cc
+++ b/aosp/sideload_main.cc
@@ -28,15 +28,15 @@
#include <brillo/streams/file_stream.h>
#include <brillo/streams/stream.h>
+#include "update_engine/aosp/update_attempter_android.h"
#include "update_engine/common/boot_control.h"
#include "update_engine/common/error_code_utils.h"
#include "update_engine/common/hardware.h"
+#include "update_engine/common/logging.h"
#include "update_engine/common/prefs.h"
#include "update_engine/common/subprocess.h"
#include "update_engine/common/terminator.h"
#include "update_engine/common/utils.h"
-#include "update_engine/logging.h"
-#include "update_engine/update_attempter_android.h"
using std::string;
using std::vector;
diff --git a/update_attempter_android.cc b/aosp/update_attempter_android.cc
similarity index 98%
rename from update_attempter_android.cc
rename to aosp/update_attempter_android.cc
index 3578d95..7ed3249 100644
--- a/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/update_attempter_android.h"
+#include "update_engine/aosp/update_attempter_android.h"
#include <algorithm>
#include <map>
@@ -31,18 +31,18 @@
#include <brillo/strings/string_utils.h>
#include <log/log_safetynet.h>
-#include "update_engine/cleanup_previous_update_action.h"
+#include "update_engine/aosp/cleanup_previous_update_action.h"
#include "update_engine/common/constants.h"
+#include "update_engine/common/daemon_state_interface.h"
+#include "update_engine/common/download_action.h"
#include "update_engine/common/error_code_utils.h"
#include "update_engine/common/file_fetcher.h"
+#include "update_engine/common/metrics_reporter_interface.h"
+#include "update_engine/common/network_selector.h"
#include "update_engine/common/utils.h"
-#include "update_engine/daemon_state_interface.h"
-#include "update_engine/metrics_reporter_interface.h"
#include "update_engine/metrics_utils.h"
-#include "update_engine/network_selector.h"
#include "update_engine/payload_consumer/certificate_parser_interface.h"
#include "update_engine/payload_consumer/delta_performer.h"
-#include "update_engine/payload_consumer/download_action.h"
#include "update_engine/payload_consumer/file_descriptor.h"
#include "update_engine/payload_consumer/file_descriptor_utils.h"
#include "update_engine/payload_consumer/filesystem_verifier_action.h"
diff --git a/update_attempter_android.h b/aosp/update_attempter_android.h
similarity index 94%
rename from update_attempter_android.h
rename to aosp/update_attempter_android.h
index 55003a0..499f8f6 100644
--- a/update_attempter_android.h
+++ b/aosp/update_attempter_android.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_UPDATE_ATTEMPTER_ANDROID_H_
-#define UPDATE_ENGINE_UPDATE_ATTEMPTER_ANDROID_H_
+#ifndef UPDATE_ENGINE_AOSP_UPDATE_ATTEMPTER_ANDROID_H_
+#define UPDATE_ENGINE_AOSP_UPDATE_ATTEMPTER_ANDROID_H_
#include <stdint.h>
@@ -26,21 +26,21 @@
#include <android-base/unique_fd.h>
#include <base/time/time.h>
+#include "update_engine/aosp/service_delegate_android_interface.h"
#include "update_engine/client_library/include/update_engine/update_status.h"
#include "update_engine/common/action_processor.h"
#include "update_engine/common/boot_control_interface.h"
#include "update_engine/common/clock.h"
+#include "update_engine/common/daemon_state_interface.h"
+#include "update_engine/common/download_action.h"
#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/metrics_reporter_interface.h"
+#include "update_engine/common/network_selector_interface.h"
#include "update_engine/common/prefs_interface.h"
-#include "update_engine/daemon_state_interface.h"
-#include "update_engine/metrics_reporter_interface.h"
+#include "update_engine/common/service_observer_interface.h"
#include "update_engine/metrics_utils.h"
-#include "update_engine/network_selector_interface.h"
-#include "update_engine/payload_consumer/download_action.h"
#include "update_engine/payload_consumer/filesystem_verifier_action.h"
#include "update_engine/payload_consumer/postinstall_runner_action.h"
-#include "update_engine/service_delegate_android_interface.h"
-#include "update_engine/service_observer_interface.h"
namespace chromeos_update_engine {
@@ -246,4 +246,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_UPDATE_ATTEMPTER_ANDROID_H_
+#endif // UPDATE_ENGINE_AOSP_UPDATE_ATTEMPTER_ANDROID_H_
diff --git a/update_attempter_android_unittest.cc b/aosp/update_attempter_android_unittest.cc
similarity index 97%
rename from update_attempter_android_unittest.cc
rename to aosp/update_attempter_android_unittest.cc
index 721b735..bb44450 100644
--- a/update_attempter_android_unittest.cc
+++ b/aosp/update_attempter_android_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/update_attempter_android.h"
+#include "update_engine/aosp/update_attempter_android.h"
#include <memory>
#include <string>
@@ -24,15 +24,15 @@
#include <base/time/time.h>
#include <gtest/gtest.h>
+#include "update_engine/aosp/daemon_state_android.h"
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/fake_hardware.h"
#include "update_engine/common/fake_prefs.h"
#include "update_engine/common/mock_action_processor.h"
+#include "update_engine/common/mock_metrics_reporter.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/daemon_state_android.h"
-#include "update_engine/mock_metrics_reporter.h"
using base::Time;
using base::TimeDelta;
diff --git a/update_engine_client_android.cc b/aosp/update_engine_client_android.cc
similarity index 100%
rename from update_engine_client_android.cc
rename to aosp/update_engine_client_android.cc
diff --git a/common/cleanup_previous_update_action_delegate.h b/common/cleanup_previous_update_action_delegate.h
index 7dad9c5..8daf860 100644
--- a/common/cleanup_previous_update_action_delegate.h
+++ b/common/cleanup_previous_update_action_delegate.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CLEANUP_PREVIOUS_UPDATE_ACTION_DELEGETE_H_
-#define UPDATE_ENGINE_CLEANUP_PREVIOUS_UPDATE_ACTION_DELEGETE_H_
+#ifndef UPDATE_ENGINE_COMMON_CLEANUP_PREVIOUS_UPDATE_ACTION_DELEGETE_H_
+#define UPDATE_ENGINE_COMMON_CLEANUP_PREVIOUS_UPDATE_ACTION_DELEGETE_H_
namespace chromeos_update_engine {
@@ -29,4 +29,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CLEANUP_PREVIOUS_UPDATE_ACTION_DELEGETE_H_
+#endif // UPDATE_ENGINE_COMMON_CLEANUP_PREVIOUS_UPDATE_ACTION_DELEGETE_H_
diff --git a/connection_utils.cc b/common/connection_utils.cc
similarity index 97%
rename from connection_utils.cc
rename to common/connection_utils.cc
index 5af7341..44e5128 100644
--- a/connection_utils.cc
+++ b/common/connection_utils.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/connection_utils.h"
+#include "update_engine/common/connection_utils.h"
#include <shill/dbus-constants.h>
diff --git a/connection_utils.h b/common/connection_utils.h
similarity index 89%
rename from connection_utils.h
rename to common/connection_utils.h
index 4e71fcf..5d63fb2 100644
--- a/connection_utils.h
+++ b/common/connection_utils.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CONNECTION_UTILS_H_
-#define UPDATE_ENGINE_CONNECTION_UTILS_H_
+#ifndef UPDATE_ENGINE_COMMON_CONNECTION_UTILS_H_
+#define UPDATE_ENGINE_COMMON_CONNECTION_UTILS_H_
#include <string>
@@ -47,4 +47,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CONNECTION_UTILS_H_
+#endif // UPDATE_ENGINE_COMMON_CONNECTION_UTILS_H_
diff --git a/daemon_base.h b/common/daemon_base.h
similarity index 87%
rename from daemon_base.h
rename to common/daemon_base.h
index 742a0ba..4bc5ef7 100644
--- a/daemon_base.h
+++ b/common/daemon_base.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DAEMON_BASE_H_
-#define UPDATE_ENGINE_DAEMON_BASE_H_
+#ifndef UPDATE_ENGINE_COMMON_DAEMON_BASE_H_
+#define UPDATE_ENGINE_COMMON_DAEMON_BASE_H_
#include <memory>
@@ -37,4 +37,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DAEMON_BASE_H_
+#endif // UPDATE_ENGINE_COMMON_DAEMON_BASE_H_
diff --git a/daemon_state_interface.h b/common/daemon_state_interface.h
similarity index 85%
rename from daemon_state_interface.h
rename to common/daemon_state_interface.h
index 2356816..9509fa2 100644
--- a/daemon_state_interface.h
+++ b/common/daemon_state_interface.h
@@ -14,10 +14,10 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DAEMON_STATE_INTERFACE_H_
-#define UPDATE_ENGINE_DAEMON_STATE_INTERFACE_H_
+#ifndef UPDATE_ENGINE_COMMON_DAEMON_STATE_INTERFACE_H_
+#define UPDATE_ENGINE_COMMON_DAEMON_STATE_INTERFACE_H_
-#include "update_engine/service_observer_interface.h"
+#include "update_engine/common/service_observer_interface.h"
#include <memory>
#include <set>
@@ -46,4 +46,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DAEMON_STATE_INTERFACE_H_
+#endif // UPDATE_ENGINE_COMMON_DAEMON_STATE_INTERFACE_H_
diff --git a/payload_consumer/download_action.h b/common/download_action.h
similarity index 96%
rename from payload_consumer/download_action.h
rename to common/download_action.h
index 6928443..c167c2d 100644
--- a/payload_consumer/download_action.h
+++ b/common/download_action.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_DOWNLOAD_ACTION_H_
-#define UPDATE_ENGINE_PAYLOAD_CONSUMER_DOWNLOAD_ACTION_H_
+#ifndef UPDATE_ENGINE_COMMON_DOWNLOAD_ACTION_H_
+#define UPDATE_ENGINE_COMMON_DOWNLOAD_ACTION_H_
#include <fcntl.h>
#include <sys/stat.h>
@@ -28,9 +28,9 @@
#include "update_engine/common/boot_control_interface.h"
#include "update_engine/common/http_fetcher.h"
#include "update_engine/common/multi_range_http_fetcher.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/payload_consumer/delta_performer.h"
#include "update_engine/payload_consumer/install_plan.h"
-#include "update_engine/system_state.h"
// The Download Action downloads a specified url to disk. The url should point
// to an update in a delta payload format. The payload will be piped into a
@@ -200,4 +200,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_DOWNLOAD_ACTION_H_
+#endif // UPDATE_ENGINE_COMMON_DOWNLOAD_ACTION_H_
diff --git a/common/http_fetcher.h b/common/http_fetcher.h
index f74a0f0..7fa5f09 100644
--- a/common/http_fetcher.h
+++ b/common/http_fetcher.h
@@ -28,8 +28,8 @@
#include <brillo/message_loops/message_loop.h>
#include "update_engine/common/http_common.h"
+#include "update_engine/common/metrics_constants.h"
#include "update_engine/common/proxy_resolver.h"
-#include "update_engine/metrics_constants.h"
// This class is a simple wrapper around an HTTP library (libcurl). We can
// easily mock out this interface for testing.
diff --git a/logging.h b/common/logging.h
similarity index 100%
rename from logging.h
rename to common/logging.h
diff --git a/metrics_constants.h b/common/metrics_constants.h
similarity index 96%
rename from metrics_constants.h
rename to common/metrics_constants.h
index 679680c..b7633b9 100644
--- a/metrics_constants.h
+++ b/common/metrics_constants.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_METRICS_CONSTANTS_H_
-#define UPDATE_ENGINE_METRICS_CONSTANTS_H_
+#ifndef UPDATE_ENGINE_COMMON_METRICS_CONSTANTS_H_
+#define UPDATE_ENGINE_COMMON_METRICS_CONSTANTS_H_
namespace chromeos_update_engine {
@@ -144,4 +144,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_METRICS_CONSTANTS_H_
+#endif // UPDATE_ENGINE_COMMON_METRICS_CONSTANTS_H_
diff --git a/metrics_reporter_interface.h b/common/metrics_reporter_interface.h
similarity index 96%
rename from metrics_reporter_interface.h
rename to common/metrics_reporter_interface.h
index 180a680..d7c5347 100644
--- a/metrics_reporter_interface.h
+++ b/common/metrics_reporter_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_METRICS_REPORTER_INTERFACE_H_
-#define UPDATE_ENGINE_METRICS_REPORTER_INTERFACE_H_
+#ifndef UPDATE_ENGINE_COMMON_METRICS_REPORTER_INTERFACE_H_
+#define UPDATE_ENGINE_COMMON_METRICS_REPORTER_INTERFACE_H_
#include <memory>
#include <string>
@@ -24,8 +24,8 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/error_code.h"
-#include "update_engine/metrics_constants.h"
-#include "update_engine/system_state.h"
+#include "update_engine/common/metrics_constants.h"
+#include "update_engine/common/system_state.h"
namespace chromeos_update_engine {
@@ -244,4 +244,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_METRICS_REPORTER_INTERFACE_H_
+#endif // UPDATE_ENGINE_COMMON_METRICS_REPORTER_INTERFACE_H_
diff --git a/metrics_reporter_stub.cc b/common/metrics_reporter_stub.cc
similarity index 93%
rename from metrics_reporter_stub.cc
rename to common/metrics_reporter_stub.cc
index 81664a5..dcb4e8c 100644
--- a/metrics_reporter_stub.cc
+++ b/common/metrics_reporter_stub.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/metrics_reporter_stub.h"
+#include "update_engine/common/metrics_reporter_stub.h"
#include <memory>
diff --git a/metrics_reporter_stub.h b/common/metrics_reporter_stub.h
similarity index 92%
rename from metrics_reporter_stub.h
rename to common/metrics_reporter_stub.h
index 0cfeea0..1470aaa 100644
--- a/metrics_reporter_stub.h
+++ b/common/metrics_reporter_stub.h
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_METRICS_REPORTER_STUB_H_
-#define UPDATE_ENGINE_METRICS_REPORTER_STUB_H_
+#ifndef UPDATE_ENGINE_COMMON_METRICS_REPORTER_STUB_H_
+#define UPDATE_ENGINE_COMMON_METRICS_REPORTER_STUB_H_
#include <string>
#include "update_engine/common/error_code.h"
-#include "update_engine/metrics_constants.h"
-#include "update_engine/metrics_reporter_interface.h"
+#include "update_engine/common/metrics_constants.h"
+#include "update_engine/common/metrics_reporter_interface.h"
namespace chromeos_update_engine {
@@ -98,4 +98,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_METRICS_REPORTER_STUB_H_
+#endif // UPDATE_ENGINE_COMMON_METRICS_REPORTER_STUB_H_
diff --git a/payload_consumer/mock_download_action.h b/common/mock_download_action.h
similarity index 81%
rename from payload_consumer/mock_download_action.h
rename to common/mock_download_action.h
index 3abb809..ecda9a3 100644
--- a/payload_consumer/mock_download_action.h
+++ b/common/mock_download_action.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_MOCK_DOWNLOAD_ACTION_H_
-#define UPDATE_ENGINE_PAYLOAD_CONSUMER_MOCK_DOWNLOAD_ACTION_H_
+#ifndef UPDATE_ENGINE_COMMON_MOCK_DOWNLOAD_ACTION_H_
+#define UPDATE_ENGINE_COMMON_MOCK_DOWNLOAD_ACTION_H_
#include <stdint.h>
#include <gmock/gmock.h>
+#include "update_engine/common/download_action.h"
#include "update_engine/common/error_code.h"
-#include "update_engine/payload_consumer/download_action.h"
namespace chromeos_update_engine {
@@ -38,4 +38,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_MOCK_DOWNLOAD_ACTION_H_
+#endif // UPDATE_ENGINE_COMMON_MOCK_DOWNLOAD_ACTION_H_
diff --git a/common/mock_excluder.h b/common/mock_excluder.h
index bc54772..560ba0d 100644
--- a/common/mock_excluder.h
+++ b/common/mock_excluder.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_APP_EXCLUDER_H_
-#define UPDATE_ENGINE_MOCK_APP_EXCLUDER_H_
+#ifndef UPDATE_ENGINE_COMMON_MOCK_APP_EXCLUDER_H_
+#define UPDATE_ENGINE_COMMON_MOCK_APP_EXCLUDER_H_
#include "update_engine/common/excluder_interface.h"
@@ -34,4 +34,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_APP_EXCLUDER_H_
+#endif // UPDATE_ENGINE_COMMON_MOCK_APP_EXCLUDER_H_
diff --git a/mock_metrics_reporter.h b/common/mock_metrics_reporter.h
similarity index 93%
rename from mock_metrics_reporter.h
rename to common/mock_metrics_reporter.h
index baf3a78..922d1ee 100644
--- a/mock_metrics_reporter.h
+++ b/common/mock_metrics_reporter.h
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_
-#define UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_
+#ifndef UPDATE_ENGINE_COMMON_MOCK_METRICS_REPORTER_H_
+#define UPDATE_ENGINE_COMMON_MOCK_METRICS_REPORTER_H_
#include <string>
#include <gmock/gmock.h>
-#include "update_engine/metrics_reporter_interface.h"
+#include "update_engine/common/metrics_reporter_interface.h"
namespace chromeos_update_engine {
@@ -96,4 +96,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_METRICS_REPORTER_H_
+#endif // UPDATE_ENGINE_COMMON_MOCK_METRICS_REPORTER_H_
diff --git a/mock_service_observer.h b/common/mock_service_observer.h
similarity index 81%
rename from mock_service_observer.h
rename to common/mock_service_observer.h
index e434eab..2c895f9 100644
--- a/mock_service_observer.h
+++ b/common/mock_service_observer.h
@@ -14,11 +14,11 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_SERVICE_OBSERVER_H_
-#define UPDATE_ENGINE_MOCK_SERVICE_OBSERVER_H_
+#ifndef UPDATE_ENGINE_COMMON_MOCK_SERVICE_OBSERVER_H_
+#define UPDATE_ENGINE_COMMON_MOCK_SERVICE_OBSERVER_H_
#include <gmock/gmock.h>
-#include "update_engine/service_observer_interface.h"
+#include "update_engine/common/service_observer_interface.h"
namespace chromeos_update_engine {
@@ -32,4 +32,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_SERVICE_OBSERVER_H_
+#endif // UPDATE_ENGINE_COMMON_MOCK_SERVICE_OBSERVER_H_
diff --git a/network_selector.h b/common/network_selector.h
similarity index 80%
rename from network_selector.h
rename to common/network_selector.h
index 22aed8e..bfc09c5 100644
--- a/network_selector.h
+++ b/common/network_selector.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_NETWORK_SELECTOR_H_
-#define UPDATE_ENGINE_NETWORK_SELECTOR_H_
+#ifndef UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_H_
+#define UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_H_
#include <memory>
-#include "update_engine/network_selector_interface.h"
+#include "update_engine/common/network_selector_interface.h"
namespace chromeos_update_engine {
namespace network {
@@ -30,4 +30,4 @@
} // namespace network
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_NETWORK_SELECTOR_H_
+#endif // UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_H_
diff --git a/network_selector_interface.h b/common/network_selector_interface.h
similarity index 88%
rename from network_selector_interface.h
rename to common/network_selector_interface.h
index bd0948f..42ce32e 100644
--- a/network_selector_interface.h
+++ b/common/network_selector_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_NETWORK_SELECTOR_INTERFACE_H_
-#define UPDATE_ENGINE_NETWORK_SELECTOR_INTERFACE_H_
+#ifndef UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_INTERFACE_H_
+#define UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_INTERFACE_H_
#include <cstdint>
@@ -45,4 +45,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_NETWORK_SELECTOR_INTERFACE_H_
+#endif // UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_INTERFACE_H_
diff --git a/network_selector_stub.cc b/common/network_selector_stub.cc
similarity index 87%
rename from network_selector_stub.cc
rename to common/network_selector_stub.cc
index 67925f4..24c0e25 100644
--- a/network_selector_stub.cc
+++ b/common/network_selector_stub.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/network_selector_stub.h"
+#include "update_engine/common/network_selector_stub.h"
#include <memory>
@@ -24,14 +24,14 @@
namespace network {
-// Factory defined in network_selector.h.
+// Factory defined in common/network_selector.h.
std::unique_ptr<NetworkSelectorInterface> CreateNetworkSelector() {
return std::make_unique<NetworkSelectorStub>();
}
} // namespace network
-// Defined in network_selector_interface.h.
+// Defined in common/network_selector_interface.h.
const NetworkId kDefaultNetworkId = 0;
bool NetworkSelectorStub::SetProcessNetwork(NetworkId network_id) {
diff --git a/network_selector_stub.h b/common/network_selector_stub.h
similarity index 81%
rename from network_selector_stub.h
rename to common/network_selector_stub.h
index b3f7b48..b32df91 100644
--- a/network_selector_stub.h
+++ b/common/network_selector_stub.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_NETWORK_SELECTOR_STUB_H_
-#define UPDATE_ENGINE_NETWORK_SELECTOR_STUB_H_
+#ifndef UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_STUB_H_
+#define UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_STUB_H_
#include <base/macros.h>
-#include "update_engine/network_selector_interface.h"
+#include "update_engine/common/network_selector_interface.h"
namespace chromeos_update_engine {
@@ -37,4 +37,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_NETWORK_SELECTOR_STUB_H_
+#endif // UPDATE_ENGINE_COMMON_NETWORK_SELECTOR_STUB_H_
diff --git a/service_observer_interface.h b/common/service_observer_interface.h
similarity index 88%
rename from service_observer_interface.h
rename to common/service_observer_interface.h
index 4edb0ac..c471231 100644
--- a/service_observer_interface.h
+++ b/common/service_observer_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_SERVICE_OBSERVER_INTERFACE_H_
-#define UPDATE_ENGINE_SERVICE_OBSERVER_INTERFACE_H_
+#ifndef UPDATE_ENGINE_COMMON_SERVICE_OBSERVER_INTERFACE_H_
+#define UPDATE_ENGINE_COMMON_SERVICE_OBSERVER_INTERFACE_H_
#include <memory>
#include <string>
@@ -43,4 +43,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_SERVICE_OBSERVER_INTERFACE_H_
+#endif // UPDATE_ENGINE_COMMON_SERVICE_OBSERVER_INTERFACE_H_
diff --git a/system_state.h b/common/system_state.h
similarity index 96%
rename from system_state.h
rename to common/system_state.h
index f46cbcf..7a67046 100644
--- a/system_state.h
+++ b/common/system_state.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_SYSTEM_STATE_H_
-#define UPDATE_ENGINE_SYSTEM_STATE_H_
+#ifndef UPDATE_ENGINE_COMMON_SYSTEM_STATE_H_
+#define UPDATE_ENGINE_COMMON_SYSTEM_STATE_H_
namespace chromeos_update_manager {
@@ -117,4 +117,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_SYSTEM_STATE_H_
+#endif // UPDATE_ENGINE_COMMON_SYSTEM_STATE_H_
diff --git a/connection_manager_android.cc b/connection_manager_android.cc
deleted file mode 100644
index 9d0c57b..0000000
--- a/connection_manager_android.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Copyright (C) 2016 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.
-//
-
-#include "update_engine/connection_manager_android.h"
-
-#include <memory>
-
-namespace chromeos_update_engine {
-
-namespace connection_manager {
-std::unique_ptr<ConnectionManagerInterface> CreateConnectionManager(
- SystemState* system_state) {
- return std::unique_ptr<ConnectionManagerInterface>(
- new ConnectionManagerAndroid());
-}
-} // namespace connection_manager
-
-bool ConnectionManagerAndroid::GetConnectionProperties(
- ConnectionType* out_type, ConnectionTethering* out_tethering) {
- return false;
-}
-bool ConnectionManagerAndroid::IsUpdateAllowedOver(
- ConnectionType type, ConnectionTethering tethering) const {
- return true;
-}
-bool ConnectionManagerAndroid::IsAllowedConnectionTypesForUpdateSet() const {
- return false;
-}
-
-} // namespace chromeos_update_engine
diff --git a/connection_manager_android.h b/connection_manager_android.h
deleted file mode 100644
index 006f4ea..0000000
--- a/connection_manager_android.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// Copyright (C) 2016 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.
-//
-
-#ifndef UPDATE_ENGINE_CONNECTION_MANAGER_ANDROID_H_
-#define UPDATE_ENGINE_CONNECTION_MANAGER_ANDROID_H_
-
-#include <base/macros.h>
-
-#include "update_engine/connection_manager_interface.h"
-
-namespace chromeos_update_engine {
-
-// TODO(senj): Remove this class and use ShillProvider from the UpdateManager.
-class ConnectionManagerAndroid : public ConnectionManagerInterface {
- public:
- ConnectionManagerAndroid() = default;
- ~ConnectionManagerAndroid() override = default;
-
- // ConnectionManagerInterface overrides.
- bool GetConnectionProperties(ConnectionType* out_type,
- ConnectionTethering* out_tethering) override;
- bool IsUpdateAllowedOver(ConnectionType type,
- ConnectionTethering tethering) const override;
- bool IsAllowedConnectionTypesForUpdateSet() const override;
-
- DISALLOW_COPY_AND_ASSIGN(ConnectionManagerAndroid);
-};
-
-} // namespace chromeos_update_engine
-
-#endif // UPDATE_ENGINE_CONNECTION_MANAGER_ANDROID_H_
diff --git a/boot_control_chromeos.cc b/cros/boot_control_chromeos.cc
similarity index 99%
rename from boot_control_chromeos.cc
rename to cros/boot_control_chromeos.cc
index da2c891..17659ae 100644
--- a/boot_control_chromeos.cc
+++ b/cros/boot_control_chromeos.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/boot_control_chromeos.h"
+#include "update_engine/cros/boot_control_chromeos.h"
#include <memory>
#include <string>
diff --git a/boot_control_chromeos.h b/cros/boot_control_chromeos.h
similarity index 96%
rename from boot_control_chromeos.h
rename to cros/boot_control_chromeos.h
index 4271672..0dff2c0 100644
--- a/boot_control_chromeos.h
+++ b/cros/boot_control_chromeos.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
-#define UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_CROS_BOOT_CONTROL_CHROMEOS_H_
+#define UPDATE_ENGINE_CROS_BOOT_CONTROL_CHROMEOS_H_
#include <memory>
#include <string>
@@ -101,4 +101,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
+#endif // UPDATE_ENGINE_CROS_BOOT_CONTROL_CHROMEOS_H_
diff --git a/boot_control_chromeos_unittest.cc b/cros/boot_control_chromeos_unittest.cc
similarity index 97%
rename from boot_control_chromeos_unittest.cc
rename to cros/boot_control_chromeos_unittest.cc
index 1c40dce..fc1dd1e 100644
--- a/boot_control_chromeos_unittest.cc
+++ b/cros/boot_control_chromeos_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/boot_control_chromeos.h"
+#include "update_engine/cros/boot_control_chromeos.h"
#include <gtest/gtest.h>
diff --git a/chrome_browser_proxy_resolver.cc b/cros/chrome_browser_proxy_resolver.cc
similarity index 94%
rename from chrome_browser_proxy_resolver.cc
rename to cros/chrome_browser_proxy_resolver.cc
index bfb58f7..3ea8a9b 100644
--- a/chrome_browser_proxy_resolver.cc
+++ b/cros/chrome_browser_proxy_resolver.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/chrome_browser_proxy_resolver.h"
+#include "update_engine/cros/chrome_browser_proxy_resolver.h"
#include <utility>
@@ -23,7 +23,7 @@
#include <base/strings/string_util.h>
#include <brillo/http/http_proxy.h>
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
namespace chromeos_update_engine {
diff --git a/chrome_browser_proxy_resolver.h b/cros/chrome_browser_proxy_resolver.h
similarity index 91%
rename from chrome_browser_proxy_resolver.h
rename to cros/chrome_browser_proxy_resolver.h
index 10a55fb..76848ef 100644
--- a/chrome_browser_proxy_resolver.h
+++ b/cros/chrome_browser_proxy_resolver.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CHROME_BROWSER_PROXY_RESOLVER_H_
-#define UPDATE_ENGINE_CHROME_BROWSER_PROXY_RESOLVER_H_
+#ifndef UPDATE_ENGINE_CROS_CHROME_BROWSER_PROXY_RESOLVER_H_
+#define UPDATE_ENGINE_CROS_CHROME_BROWSER_PROXY_RESOLVER_H_
#include <deque>
#include <map>
@@ -63,4 +63,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CHROME_BROWSER_PROXY_RESOLVER_H_
+#endif // UPDATE_ENGINE_CROS_CHROME_BROWSER_PROXY_RESOLVER_H_
diff --git a/common_service.cc b/cros/common_service.cc
similarity index 97%
rename from common_service.cc
rename to cros/common_service.cc
index 85fb9e4..aecad8b 100644
--- a/common_service.cc
+++ b/cros/common_service.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/common_service.h"
+#include "update_engine/cros/common_service.h"
#include <string>
@@ -30,12 +30,12 @@
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/prefs.h"
#include "update_engine/common/utils.h"
-#include "update_engine/connection_manager_interface.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/omaha_utils.h"
-#include "update_engine/p2p_manager.h"
-#include "update_engine/payload_state_interface.h"
-#include "update_engine/update_attempter.h"
+#include "update_engine/cros/connection_manager_interface.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/omaha_utils.h"
+#include "update_engine/cros/p2p_manager.h"
+#include "update_engine/cros/payload_state_interface.h"
+#include "update_engine/cros/update_attempter.h"
using base::StringPrintf;
using brillo::ErrorPtr;
diff --git a/common_service.h b/cros/common_service.h
similarity index 97%
rename from common_service.h
rename to cros/common_service.h
index cfcece5..6169d9c 100644
--- a/common_service.h
+++ b/cros/common_service.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_COMMON_SERVICE_H_
-#define UPDATE_ENGINE_COMMON_SERVICE_H_
+#ifndef UPDATE_ENGINE_CROS_SERVICE_H_
+#define UPDATE_ENGINE_CROS_SERVICE_H_
#include <inttypes.h>
@@ -26,7 +26,7 @@
#include <brillo/errors/error.h>
#include "update_engine/client_library/include/update_engine/update_status.h"
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
namespace chromeos_update_engine {
@@ -167,4 +167,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_COMMON_SERVICE_H_
+#endif // UPDATE_ENGINE_CROS_SERVICE_H_
diff --git a/common_service_unittest.cc b/cros/common_service_unittest.cc
similarity index 97%
rename from common_service_unittest.cc
rename to cros/common_service_unittest.cc
index 3dc8a22..733ec0a 100644
--- a/common_service_unittest.cc
+++ b/cros/common_service_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/common_service.h"
+#include "update_engine/cros/common_service.h"
#include <gtest/gtest.h>
#include <string>
@@ -25,8 +25,8 @@
#include <policy/mock_device_policy.h>
#include "update_engine/common/fake_prefs.h"
-#include "update_engine/fake_system_state.h"
-#include "update_engine/omaha_utils.h"
+#include "update_engine/cros/fake_system_state.h"
+#include "update_engine/cros/omaha_utils.h"
using std::string;
using std::vector;
diff --git a/connection_manager.cc b/cros/connection_manager.cc
similarity index 96%
rename from connection_manager.cc
rename to cros/connection_manager.cc
index fe43f37..331f76b 100644
--- a/connection_manager.cc
+++ b/cros/connection_manager.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/connection_manager.h"
+#include "update_engine/cros/connection_manager.h"
#include <memory>
#include <set>
@@ -26,12 +26,12 @@
#include <shill/dbus-constants.h>
#include <shill/dbus-proxies.h>
+#include "update_engine/common/connection_utils.h"
#include "update_engine/common/prefs.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/common/utils.h"
-#include "update_engine/connection_utils.h"
-#include "update_engine/shill_proxy.h"
-#include "update_engine/system_state.h"
-#include "update_engine/update_attempter.h"
+#include "update_engine/cros/shill_proxy.h"
+#include "update_engine/cros/update_attempter.h"
using org::chromium::flimflam::ManagerProxyInterface;
using org::chromium::flimflam::ServiceProxyInterface;
diff --git a/connection_manager.h b/cros/connection_manager.h
similarity index 89%
rename from connection_manager.h
rename to cros/connection_manager.h
index d8527a3..b1fb961 100644
--- a/connection_manager.h
+++ b/cros/connection_manager.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CONNECTION_MANAGER_H_
-#define UPDATE_ENGINE_CONNECTION_MANAGER_H_
+#ifndef UPDATE_ENGINE_CROS_CONNECTION_MANAGER_H_
+#define UPDATE_ENGINE_CROS_CONNECTION_MANAGER_H_
#include <memory>
#include <string>
@@ -23,8 +23,8 @@
#include <base/macros.h>
#include <dbus/object_path.h>
-#include "update_engine/connection_manager_interface.h"
-#include "update_engine/shill_proxy_interface.h"
+#include "update_engine/cros/connection_manager_interface.h"
+#include "update_engine/cros/shill_proxy_interface.h"
namespace chromeos_update_engine {
@@ -66,4 +66,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CONNECTION_MANAGER_H_
+#endif // UPDATE_ENGINE_CROS_CONNECTION_MANAGER_H_
diff --git a/connection_manager_interface.h b/cros/connection_manager_interface.h
similarity index 90%
rename from connection_manager_interface.h
rename to cros/connection_manager_interface.h
index 9f77989..6dd9fbd 100644
--- a/connection_manager_interface.h
+++ b/cros/connection_manager_interface.h
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CONNECTION_MANAGER_INTERFACE_H_
-#define UPDATE_ENGINE_CONNECTION_MANAGER_INTERFACE_H_
+#ifndef UPDATE_ENGINE_CROS_CONNECTION_MANAGER_INTERFACE_H_
+#define UPDATE_ENGINE_CROS_CONNECTION_MANAGER_INTERFACE_H_
#include <memory>
#include <base/macros.h>
-#include "update_engine/connection_utils.h"
+#include "update_engine/common/connection_utils.h"
namespace chromeos_update_engine {
@@ -65,4 +65,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CONNECTION_MANAGER_INTERFACE_H_
+#endif // UPDATE_ENGINE_CROS_CONNECTION_MANAGER_INTERFACE_H_
diff --git a/connection_manager_unittest.cc b/cros/connection_manager_unittest.cc
similarity index 98%
rename from connection_manager_unittest.cc
rename to cros/connection_manager_unittest.cc
index 97436c9..3f1ee5a 100644
--- a/connection_manager_unittest.cc
+++ b/cros/connection_manager_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/connection_manager.h"
+#include "update_engine/cros/connection_manager.h"
#include <memory>
#include <set>
@@ -32,8 +32,8 @@
#include <shill/dbus-proxy-mocks.h>
#include "update_engine/common/test_utils.h"
-#include "update_engine/fake_shill_proxy.h"
-#include "update_engine/fake_system_state.h"
+#include "update_engine/cros/fake_shill_proxy.h"
+#include "update_engine/cros/fake_system_state.h"
using chromeos_update_engine::connection_utils::StringForConnectionType;
using org::chromium::flimflam::ManagerProxyMock;
diff --git a/daemon_chromeos.cc b/cros/daemon_chromeos.cc
similarity index 95%
rename from daemon_chromeos.cc
rename to cros/daemon_chromeos.cc
index 21740d8..a7cad8c 100644
--- a/daemon_chromeos.cc
+++ b/cros/daemon_chromeos.cc
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#include "update_engine/daemon_chromeos.h"
+#include "update_engine/cros/daemon_chromeos.h"
#include <sysexits.h>
#include <base/bind.h>
#include <base/location.h>
-#include "update_engine/real_system_state.h"
+#include "update_engine/cros/real_system_state.h"
using brillo::Daemon;
using std::unique_ptr;
diff --git a/daemon_chromeos.h b/cros/daemon_chromeos.h
similarity index 84%
rename from daemon_chromeos.h
rename to cros/daemon_chromeos.h
index 657e797..5d568c7 100644
--- a/daemon_chromeos.h
+++ b/cros/daemon_chromeos.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DAEMON_CHROMEOS_H_
-#define UPDATE_ENGINE_DAEMON_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_CROS_DAEMON_CHROMEOS_H_
+#define UPDATE_ENGINE_CROS_DAEMON_CHROMEOS_H_
#include <memory>
+#include "update_engine/common/daemon_base.h"
+#include "update_engine/common/daemon_state_interface.h"
#include "update_engine/common/subprocess.h"
-#include "update_engine/daemon_base.h"
-#include "update_engine/daemon_state_interface.h"
-#include "update_engine/dbus_service.h"
+#include "update_engine/cros/dbus_service.h"
namespace chromeos_update_engine {
@@ -56,4 +56,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DAEMON_CHROMEOS_H_
+#endif // UPDATE_ENGINE_CROS_DAEMON_CHROMEOS_H_
diff --git a/dbus_connection.cc b/cros/dbus_connection.cc
similarity index 96%
rename from dbus_connection.cc
rename to cros/dbus_connection.cc
index cf17ec9..6808bae 100644
--- a/dbus_connection.cc
+++ b/cros/dbus_connection.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
#include <base/time/time.h>
diff --git a/dbus_connection.h b/cros/dbus_connection.h
similarity index 87%
rename from dbus_connection.h
rename to cros/dbus_connection.h
index c3205ba..8f0d6f1 100644
--- a/dbus_connection.h
+++ b/cros/dbus_connection.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DBUS_CONNECTION_H_
-#define UPDATE_ENGINE_DBUS_CONNECTION_H_
+#ifndef UPDATE_ENGINE_CROS_DBUS_CONNECTION_H_
+#define UPDATE_ENGINE_CROS_DBUS_CONNECTION_H_
#include <base/memory/ref_counted.h>
#include <brillo/dbus/dbus_connection.h>
@@ -41,4 +41,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DBUS_CONNECTION_H_
+#endif // UPDATE_ENGINE_CROS_DBUS_CONNECTION_H_
diff --git a/dbus_service.cc b/cros/dbus_service.cc
similarity index 98%
rename from dbus_service.cc
rename to cros/dbus_service.cc
index a282d1e..d115195 100644
--- a/dbus_service.cc
+++ b/cros/dbus_service.cc
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#include "update_engine/dbus_service.h"
+#include "update_engine/cros/dbus_service.h"
#include <string>
#include <vector>
#include <update_engine/dbus-constants.h>
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
#include "update_engine/proto_bindings/update_engine.pb.h"
#include "update_engine/update_status_utils.h"
diff --git a/dbus_service.h b/cros/dbus_service.h
similarity index 96%
rename from dbus_service.h
rename to cros/dbus_service.h
index 873909e..9e4457f 100644
--- a/dbus_service.h
+++ b/cros/dbus_service.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DBUS_SERVICE_H_
-#define UPDATE_ENGINE_DBUS_SERVICE_H_
+#ifndef UPDATE_ENGINE_CROS_DBUS_SERVICE_H_
+#define UPDATE_ENGINE_CROS_DBUS_SERVICE_H_
#include <inttypes.h>
@@ -27,9 +27,9 @@
#include <brillo/errors/error.h>
#include <update_engine/proto_bindings/update_engine.pb.h>
-#include "update_engine/common_service.h"
-#include "update_engine/service_observer_interface.h"
-#include "update_engine/update_attempter.h"
+#include "update_engine/common/service_observer_interface.h"
+#include "update_engine/cros/common_service.h"
+#include "update_engine/cros/update_attempter.h"
#include "dbus_bindings/org.chromium.UpdateEngineInterface.h"
@@ -191,4 +191,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DBUS_SERVICE_H_
+#endif // UPDATE_ENGINE_CROS_DBUS_SERVICE_H_
diff --git a/dbus_test_utils.h b/cros/dbus_test_utils.h
similarity index 95%
rename from dbus_test_utils.h
rename to cros/dbus_test_utils.h
index 72fd4e0..1116c52 100644
--- a/dbus_test_utils.h
+++ b/cros/dbus_test_utils.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DBUS_TEST_UTILS_H_
-#define UPDATE_ENGINE_DBUS_TEST_UTILS_H_
+#ifndef UPDATE_ENGINE_CROS_DBUS_TEST_UTILS_H_
+#define UPDATE_ENGINE_CROS_DBUS_TEST_UTILS_H_
#include <memory>
#include <set>
@@ -88,4 +88,4 @@
} // namespace dbus_test_utils
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DBUS_TEST_UTILS_H_
+#endif // UPDATE_ENGINE_CROS_DBUS_TEST_UTILS_H_
diff --git a/dlcservice_chromeos.cc b/cros/dlcservice_chromeos.cc
similarity index 95%
rename from dlcservice_chromeos.cc
rename to cros/dlcservice_chromeos.cc
index 08482ee..e510c1d 100644
--- a/dlcservice_chromeos.cc
+++ b/cros/dlcservice_chromeos.cc
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#include "update_engine/dlcservice_chromeos.h"
+#include "update_engine/cros/dlcservice_chromeos.h"
#include <brillo/errors/error.h>
#include <dlcservice/proto_bindings/dlcservice.pb.h>
// NOLINTNEXTLINE(build/include_alpha) "dbus-proxies.h" needs "dlcservice.pb.h"
#include <dlcservice/dbus-proxies.h>
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
using std::string;
using std::vector;
diff --git a/dlcservice_chromeos.h b/cros/dlcservice_chromeos.h
similarity index 91%
rename from dlcservice_chromeos.h
rename to cros/dlcservice_chromeos.h
index 8828e1a..3f11b12 100644
--- a/dlcservice_chromeos.h
+++ b/cros/dlcservice_chromeos.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DLCSERVICE_CHROMEOS_H_
-#define UPDATE_ENGINE_DLCSERVICE_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_CROS_DLCSERVICE_CHROMEOS_H_
+#define UPDATE_ENGINE_CROS_DLCSERVICE_CHROMEOS_H_
#include <memory>
#include <string>
@@ -52,4 +52,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DLCSERVICE_CHROMEOS_H_
+#endif // UPDATE_ENGINE_CROS_DLCSERVICE_CHROMEOS_H_
diff --git a/excluder_chromeos.cc b/cros/excluder_chromeos.cc
similarity index 94%
rename from excluder_chromeos.cc
rename to cros/excluder_chromeos.cc
index bfd6f04..4796525 100644
--- a/excluder_chromeos.cc
+++ b/cros/excluder_chromeos.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/excluder_chromeos.h"
+#include "update_engine/cros/excluder_chromeos.h"
#include <memory>
#include <vector>
@@ -26,7 +26,7 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/prefs.h"
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
using std::string;
using std::vector;
diff --git a/excluder_chromeos.h b/cros/excluder_chromeos.h
similarity index 90%
rename from excluder_chromeos.h
rename to cros/excluder_chromeos.h
index e4c1a52..2480066 100644
--- a/excluder_chromeos.h
+++ b/cros/excluder_chromeos.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_EXCLUDER_CHROMEOS_H_
-#define UPDATE_ENGINE_EXCLUDER_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_CROS_EXCLUDER_CHROMEOS_H_
+#define UPDATE_ENGINE_CROS_EXCLUDER_CHROMEOS_H_
#include <string>
@@ -49,4 +49,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_EXCLUDER_CHROMEOS_H_
+#endif // UPDATE_ENGINE_CROS_EXCLUDER_CHROMEOS_H_
diff --git a/excluder_chromeos_unittest.cc b/cros/excluder_chromeos_unittest.cc
similarity index 97%
rename from excluder_chromeos_unittest.cc
rename to cros/excluder_chromeos_unittest.cc
index dba77e4..3602e56 100644
--- a/excluder_chromeos_unittest.cc
+++ b/cros/excluder_chromeos_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/excluder_chromeos.h"
+#include "update_engine/cros/excluder_chromeos.h"
#include <memory>
diff --git a/fake_p2p_manager.h b/cros/fake_p2p_manager.h
similarity index 94%
rename from fake_p2p_manager.h
rename to cros/fake_p2p_manager.h
index 1f8ae95..1011b7e 100644
--- a/fake_p2p_manager.h
+++ b/cros/fake_p2p_manager.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_P2P_MANAGER_H_
-#define UPDATE_ENGINE_FAKE_P2P_MANAGER_H_
+#ifndef UPDATE_ENGINE_CROS_FAKE_P2P_MANAGER_H_
+#define UPDATE_ENGINE_CROS_FAKE_P2P_MANAGER_H_
#include <string>
-#include "update_engine/p2p_manager.h"
+#include "update_engine/cros/p2p_manager.h"
namespace chromeos_update_engine {
@@ -109,4 +109,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_P2P_MANAGER_H_
+#endif // UPDATE_ENGINE_CROS_FAKE_P2P_MANAGER_H_
diff --git a/fake_p2p_manager_configuration.h b/cros/fake_p2p_manager_configuration.h
similarity index 93%
rename from fake_p2p_manager_configuration.h
rename to cros/fake_p2p_manager_configuration.h
index f5b0e80..8d50ac8 100644
--- a/fake_p2p_manager_configuration.h
+++ b/cros/fake_p2p_manager_configuration.h
@@ -14,10 +14,10 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_P2P_MANAGER_CONFIGURATION_H_
-#define UPDATE_ENGINE_FAKE_P2P_MANAGER_CONFIGURATION_H_
+#ifndef UPDATE_ENGINE_CROS_FAKE_P2P_MANAGER_CONFIGURATION_H_
+#define UPDATE_ENGINE_CROS_FAKE_P2P_MANAGER_CONFIGURATION_H_
-#include "update_engine/p2p_manager.h"
+#include "update_engine/cros/p2p_manager.h"
#include <string>
#include <vector>
@@ -99,4 +99,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_P2P_MANAGER_CONFIGURATION_H_
+#endif // UPDATE_ENGINE_CROS_FAKE_P2P_MANAGER_CONFIGURATION_H_
diff --git a/fake_shill_proxy.cc b/cros/fake_shill_proxy.cc
similarity index 96%
rename from fake_shill_proxy.cc
rename to cros/fake_shill_proxy.cc
index de96511..2d05a6b 100644
--- a/fake_shill_proxy.cc
+++ b/cros/fake_shill_proxy.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/fake_shill_proxy.h"
+#include "update_engine/cros/fake_shill_proxy.h"
#include <utility>
diff --git a/fake_shill_proxy.h b/cros/fake_shill_proxy.h
similarity index 90%
rename from fake_shill_proxy.h
rename to cros/fake_shill_proxy.h
index ae17eaa..8c15a9d 100644
--- a/fake_shill_proxy.h
+++ b/cros/fake_shill_proxy.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_SHILL_PROXY_H_
-#define UPDATE_ENGINE_FAKE_SHILL_PROXY_H_
+#ifndef UPDATE_ENGINE_CROS_FAKE_SHILL_PROXY_H_
+#define UPDATE_ENGINE_CROS_FAKE_SHILL_PROXY_H_
#include <map>
#include <memory>
@@ -25,7 +25,7 @@
#include <shill/dbus-proxies.h>
#include <shill/dbus-proxy-mocks.h>
-#include "update_engine/shill_proxy_interface.h"
+#include "update_engine/cros/shill_proxy_interface.h"
namespace chromeos_update_engine {
@@ -63,4 +63,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_SHILL_PROXY_H_
+#endif // UPDATE_ENGINE_CROS_FAKE_SHILL_PROXY_H_
diff --git a/fake_system_state.cc b/cros/fake_system_state.cc
similarity index 96%
rename from fake_system_state.cc
rename to cros/fake_system_state.cc
index 1bfcafa..9dfdc5b 100644
--- a/fake_system_state.cc
+++ b/cros/fake_system_state.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/fake_system_state.h"
+#include "update_engine/cros/fake_system_state.h"
namespace chromeos_update_engine {
diff --git a/fake_system_state.h b/cros/fake_system_state.h
similarity index 93%
rename from fake_system_state.h
rename to cros/fake_system_state.h
index 24b1eec..2f92b7c 100644
--- a/fake_system_state.h
+++ b/cros/fake_system_state.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_SYSTEM_STATE_H_
-#define UPDATE_ENGINE_FAKE_SYSTEM_STATE_H_
+#ifndef UPDATE_ENGINE_CROS_FAKE_SYSTEM_STATE_H_
+#define UPDATE_ENGINE_CROS_FAKE_SYSTEM_STATE_H_
#include <base/logging.h>
#include <gmock/gmock.h>
@@ -25,15 +25,15 @@
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/fake_hardware.h"
+#include "update_engine/common/mock_metrics_reporter.h"
#include "update_engine/common/mock_prefs.h"
-#include "update_engine/mock_connection_manager.h"
-#include "update_engine/mock_metrics_reporter.h"
-#include "update_engine/mock_omaha_request_params.h"
-#include "update_engine/mock_p2p_manager.h"
-#include "update_engine/mock_payload_state.h"
-#include "update_engine/mock_power_manager.h"
-#include "update_engine/mock_update_attempter.h"
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
+#include "update_engine/cros/mock_connection_manager.h"
+#include "update_engine/cros/mock_omaha_request_params.h"
+#include "update_engine/cros/mock_p2p_manager.h"
+#include "update_engine/cros/mock_payload_state.h"
+#include "update_engine/cros/mock_power_manager.h"
+#include "update_engine/cros/mock_update_attempter.h"
#include "update_engine/update_manager/fake_update_manager.h"
namespace chromeos_update_engine {
@@ -278,4 +278,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_SYSTEM_STATE_H_
+#endif // UPDATE_ENGINE_CROS_FAKE_SYSTEM_STATE_H_
diff --git a/hardware_chromeos.cc b/cros/hardware_chromeos.cc
similarity index 98%
rename from hardware_chromeos.cc
rename to cros/hardware_chromeos.cc
index dbb99db..b9018ff 100644
--- a/hardware_chromeos.cc
+++ b/cros/hardware_chromeos.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/hardware_chromeos.h"
+#include "update_engine/cros/hardware_chromeos.h"
#include <utility>
@@ -37,9 +37,9 @@
#include "update_engine/common/platform_constants.h"
#include "update_engine/common/subprocess.h"
#include "update_engine/common/utils.h"
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
#if USE_CFM
-#include "update_engine/requisition_util.h"
+#include "update_engine/cros/requisition_util.h"
#endif
using std::string;
diff --git a/hardware_chromeos.h b/cros/hardware_chromeos.h
similarity index 94%
rename from hardware_chromeos.h
rename to cros/hardware_chromeos.h
index 9ee62f6..de84d78 100644
--- a/hardware_chromeos.h
+++ b/cros/hardware_chromeos.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
-#define UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_CROS_HARDWARE_CHROMEOS_H_
+#define UPDATE_ENGINE_CROS_HARDWARE_CHROMEOS_H_
#include <memory>
#include <string>
@@ -85,4 +85,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
+#endif // UPDATE_ENGINE_CROS_HARDWARE_CHROMEOS_H_
diff --git a/hardware_chromeos_unittest.cc b/cros/hardware_chromeos_unittest.cc
similarity index 97%
rename from hardware_chromeos_unittest.cc
rename to cros/hardware_chromeos_unittest.cc
index 162dec4..50bced6 100644
--- a/hardware_chromeos_unittest.cc
+++ b/cros/hardware_chromeos_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/hardware_chromeos.h"
+#include "update_engine/cros/hardware_chromeos.h"
#include <memory>
diff --git a/image_properties.h b/cros/image_properties.h
similarity index 91%
rename from image_properties.h
rename to cros/image_properties.h
index 49fe82f..4957d12 100644
--- a/image_properties.h
+++ b/cros/image_properties.h
@@ -18,8 +18,8 @@
// properties are meant to be constant during the life of this daemon, but can
// be modified in dev-move or non-official builds.
-#ifndef UPDATE_ENGINE_IMAGE_PROPERTIES_H_
-#define UPDATE_ENGINE_IMAGE_PROPERTIES_H_
+#ifndef UPDATE_ENGINE_CROS_IMAGE_PROPERTIES_H_
+#define UPDATE_ENGINE_CROS_IMAGE_PROPERTIES_H_
#include <string>
@@ -33,13 +33,9 @@
std::string product_id;
// The canary-channel product id.
std::string canary_product_id;
- // The system id for the Android Things SoM, empty for Chrome OS.
- std::string system_id;
// The product version of this image.
std::string version;
- // The system version of this image.
- std::string system_version;
// The version of all product components in key values pairs.
std::string product_components;
@@ -103,4 +99,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_IMAGE_PROPERTIES_H_
+#endif // UPDATE_ENGINE_CROS_IMAGE_PROPERTIES_H_
diff --git a/image_properties_chromeos.cc b/cros/image_properties_chromeos.cc
similarity index 98%
rename from image_properties_chromeos.cc
rename to cros/image_properties_chromeos.cc
index 5ab8f05..c22da7c 100644
--- a/image_properties_chromeos.cc
+++ b/cros/image_properties_chromeos.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/image_properties.h"
+#include "update_engine/cros/image_properties.h"
#include <string>
#include <vector>
@@ -26,8 +26,8 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/common/utils.h"
-#include "update_engine/system_state.h"
namespace {
diff --git a/image_properties_chromeos_unittest.cc b/cros/image_properties_chromeos_unittest.cc
similarity index 98%
rename from image_properties_chromeos_unittest.cc
rename to cros/image_properties_chromeos_unittest.cc
index d9ed688..4822995 100644
--- a/image_properties_chromeos_unittest.cc
+++ b/cros/image_properties_chromeos_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/image_properties.h"
+#include "update_engine/cros/image_properties.h"
#include <string>
@@ -24,7 +24,7 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/test_utils.h"
-#include "update_engine/fake_system_state.h"
+#include "update_engine/cros/fake_system_state.h"
using chromeos_update_engine::test_utils::WriteFileString;
using std::string;
diff --git a/logging.cc b/cros/logging.cc
similarity index 98%
rename from logging.cc
rename to cros/logging.cc
index 012feee..e09166c 100644
--- a/logging.cc
+++ b/cros/logging.cc
@@ -25,8 +25,8 @@
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
+#include "update_engine/common/logging.h"
#include "update_engine/common/utils.h"
-#include "update_engine/logging.h"
using std::string;
diff --git a/metrics_reporter_omaha.cc b/cros/metrics_reporter_omaha.cc
similarity index 91%
rename from metrics_reporter_omaha.cc
rename to cros/metrics_reporter_omaha.cc
index 0cf0e59..2cc0de5 100644
--- a/metrics_reporter_omaha.cc
+++ b/cros/metrics_reporter_omaha.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/metrics_reporter_omaha.h"
+#include "update_engine/cros/metrics_reporter_omaha.h"
#include <memory>
@@ -25,15 +25,16 @@
#include "update_engine/common/clock_interface.h"
#include "update_engine/common/constants.h"
#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/common/utils.h"
+#include "update_engine/cros/omaha_request_params.h"
#include "update_engine/metrics_utils.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/system_state.h"
+using base::Time;
+using base::TimeDelta;
using std::string;
namespace chromeos_update_engine {
-
namespace metrics {
// UpdateEngine.Daily.* metrics.
@@ -181,10 +182,9 @@
}
base::TimeDelta time_since_last;
- if (metrics_utils::WallclockDurationHelper(
- system_state,
- kPrefsMetricsCheckLastReportingTime,
- &time_since_last)) {
+ if (WallclockDurationHelper(system_state,
+ kPrefsMetricsCheckLastReportingTime,
+ &time_since_last)) {
metric = metrics::kMetricCheckTimeSinceLastCheckMinutes;
metrics_lib_->SendToUMA(metric,
time_since_last.InMinutes(),
@@ -195,7 +195,7 @@
base::TimeDelta uptime_since_last;
static int64_t uptime_since_last_storage = 0;
- if (metrics_utils::MonotonicDurationHelper(
+ if (MonotonicDurationHelper(
system_state, &uptime_since_last_storage, &uptime_since_last)) {
metric = metrics::kMetricCheckTimeSinceLastCheckUptimeMinutes;
metrics_lib_->SendToUMA(metric,
@@ -284,10 +284,9 @@
}
base::TimeDelta time_since_last;
- if (metrics_utils::WallclockDurationHelper(
- system_state,
- kPrefsMetricsAttemptLastReportingTime,
- &time_since_last)) {
+ if (WallclockDurationHelper(system_state,
+ kPrefsMetricsAttemptLastReportingTime,
+ &time_since_last)) {
metric = metrics::kMetricAttemptTimeSinceLastAttemptMinutes;
metrics_lib_->SendToUMA(metric,
time_since_last.InMinutes(),
@@ -298,7 +297,7 @@
static int64_t uptime_since_last_storage = 0;
base::TimeDelta uptime_since_last;
- if (metrics_utils::MonotonicDurationHelper(
+ if (MonotonicDurationHelper(
system_state, &uptime_since_last_storage, &uptime_since_last)) {
metric = metrics::kMetricAttemptTimeSinceLastAttemptUptimeMinutes;
metrics_lib_->SendToUMA(metric,
@@ -557,4 +556,45 @@
50); // num_buckets
}
+bool MetricsReporterOmaha::WallclockDurationHelper(
+ SystemState* system_state,
+ const std::string& state_variable_key,
+ TimeDelta* out_duration) {
+ bool ret = false;
+ Time now = system_state->clock()->GetWallclockTime();
+ int64_t stored_value;
+ if (system_state->prefs()->GetInt64(state_variable_key, &stored_value)) {
+ Time stored_time = Time::FromInternalValue(stored_value);
+ if (stored_time > now) {
+ LOG(ERROR) << "Stored time-stamp used for " << state_variable_key
+ << " is in the future.";
+ } else {
+ *out_duration = now - stored_time;
+ ret = true;
+ }
+ }
+
+ if (!system_state->prefs()->SetInt64(state_variable_key,
+ now.ToInternalValue())) {
+ LOG(ERROR) << "Error storing time-stamp in " << state_variable_key;
+ }
+
+ return ret;
+}
+
+bool MetricsReporterOmaha::MonotonicDurationHelper(SystemState* system_state,
+ int64_t* storage,
+ TimeDelta* out_duration) {
+ bool ret = false;
+ Time now = system_state->clock()->GetMonotonicTime();
+ if (*storage != 0) {
+ Time stored_time = Time::FromInternalValue(*storage);
+ *out_duration = now - stored_time;
+ ret = true;
+ }
+ *storage = now.ToInternalValue();
+
+ return ret;
+}
+
} // namespace chromeos_update_engine
diff --git a/metrics_reporter_omaha.h b/cros/metrics_reporter_omaha.h
similarity index 79%
rename from metrics_reporter_omaha.h
rename to cros/metrics_reporter_omaha.h
index c84ac1e..5b3fdb1 100644
--- a/metrics_reporter_omaha.h
+++ b/cros/metrics_reporter_omaha.h
@@ -14,21 +14,22 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_METRICS_REPORTER_OMAHA_H_
-#define UPDATE_ENGINE_METRICS_REPORTER_OMAHA_H_
+#ifndef UPDATE_ENGINE_CROS_METRICS_REPORTER_OMAHA_H_
+#define UPDATE_ENGINE_CROS_METRICS_REPORTER_OMAHA_H_
#include <memory>
#include <string>
#include <base/time/time.h>
+#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include <metrics/metrics_library.h>
#include "update_engine/certificate_checker.h"
#include "update_engine/common/constants.h"
#include "update_engine/common/error_code.h"
-#include "update_engine/metrics_constants.h"
-#include "update_engine/metrics_reporter_interface.h"
-#include "update_engine/system_state.h"
+#include "update_engine/common/metrics_constants.h"
+#include "update_engine/common/metrics_reporter_interface.h"
+#include "update_engine/common/system_state.h"
namespace chromeos_update_engine {
@@ -171,6 +172,31 @@
private:
friend class MetricsReporterOmahaTest;
+ FRIEND_TEST(MetricsReporterOmahaTest, WallclockDurationHelper);
+ FRIEND_TEST(MetricsReporterOmahaTest, MonotonicDurationHelper);
+
+ // This function returns the duration on the wallclock since the last
+ // time it was called for the same |state_variable_key| value.
+ //
+ // If the function returns |true|, the duration (always non-negative)
+ // is returned in |out_duration|. If the function returns |false|
+ // something went wrong or there was no previous measurement.
+ bool WallclockDurationHelper(SystemState* system_state,
+ const std::string& state_variable_key,
+ base::TimeDelta* out_duration);
+
+ // This function returns the duration on the monotonic clock since the
+ // last time it was called for the same |storage| pointer.
+ //
+ // You should pass a pointer to a 64-bit integer in |storage| which
+ // should be initialized to 0.
+ //
+ // If the function returns |true|, the duration (always non-negative)
+ // is returned in |out_duration|. If the function returns |false|
+ // something went wrong or there was no previous measurement.
+ bool MonotonicDurationHelper(SystemState* system_state,
+ int64_t* storage,
+ base::TimeDelta* out_duration);
std::unique_ptr<MetricsLibraryInterface> metrics_lib_;
@@ -179,4 +205,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_METRICS_REPORTER_OMAHA_H_
+#endif // UPDATE_ENGINE_CROS_METRICS_REPORTER_OMAHA_H_
diff --git a/metrics_reporter_omaha_unittest.cc b/cros/metrics_reporter_omaha_unittest.cc
similarity index 80%
rename from metrics_reporter_omaha_unittest.cc
rename to cros/metrics_reporter_omaha_unittest.cc
index 545d02f..a25472a 100644
--- a/metrics_reporter_omaha_unittest.cc
+++ b/cros/metrics_reporter_omaha_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/metrics_reporter_omaha.h"
+#include "update_engine/cros/metrics_reporter_omaha.h"
#include <memory>
#include <string>
@@ -26,7 +26,7 @@
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/fake_prefs.h"
-#include "update_engine/fake_system_state.h"
+#include "update_engine/cros/fake_system_state.h"
using base::TimeDelta;
using testing::_;
@@ -538,4 +538,115 @@
true /* has_time_restriction_policy */, kDaysToUpdate);
}
+TEST_F(MetricsReporterOmahaTest, WallclockDurationHelper) {
+ FakeSystemState fake_system_state;
+ FakeClock fake_clock;
+ base::TimeDelta duration;
+ const std::string state_variable_key = "test-prefs";
+ FakePrefs fake_prefs;
+
+ fake_system_state.set_clock(&fake_clock);
+ fake_system_state.set_prefs(&fake_prefs);
+
+ // Initialize wallclock to 1 sec.
+ fake_clock.SetWallclockTime(base::Time::FromInternalValue(1000000));
+
+ // First time called so no previous measurement available.
+ EXPECT_FALSE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+
+ // Next time, we should get zero since the clock didn't advance.
+ EXPECT_TRUE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+
+ // We can also call it as many times as we want with it being
+ // considered a failure.
+ EXPECT_TRUE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+ EXPECT_TRUE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+
+ // Advance the clock one second, then we should get 1 sec on the
+ // next call and 0 sec on the subsequent call.
+ fake_clock.SetWallclockTime(base::Time::FromInternalValue(2000000));
+ EXPECT_TRUE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ EXPECT_EQ(duration.InSeconds(), 1);
+ EXPECT_TRUE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+
+ // Advance clock two seconds and we should get 2 sec and then 0 sec.
+ fake_clock.SetWallclockTime(base::Time::FromInternalValue(4000000));
+ EXPECT_TRUE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ EXPECT_EQ(duration.InSeconds(), 2);
+ EXPECT_TRUE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+
+ // There's a possibility that the wallclock can go backwards (NTP
+ // adjustments, for example) so check that we properly handle this
+ // case.
+ fake_clock.SetWallclockTime(base::Time::FromInternalValue(3000000));
+ EXPECT_FALSE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ fake_clock.SetWallclockTime(base::Time::FromInternalValue(4000000));
+ EXPECT_TRUE(reporter_.WallclockDurationHelper(
+ &fake_system_state, state_variable_key, &duration));
+ EXPECT_EQ(duration.InSeconds(), 1);
+}
+
+TEST_F(MetricsReporterOmahaTest, MonotonicDurationHelper) {
+ int64_t storage = 0;
+ FakeSystemState fake_system_state;
+ FakeClock fake_clock;
+ base::TimeDelta duration;
+
+ fake_system_state.set_clock(&fake_clock);
+
+ // Initialize monotonic clock to 1 sec.
+ fake_clock.SetMonotonicTime(base::Time::FromInternalValue(1000000));
+
+ // First time called so no previous measurement available.
+ EXPECT_FALSE(reporter_.MonotonicDurationHelper(
+ &fake_system_state, &storage, &duration));
+
+ // Next time, we should get zero since the clock didn't advance.
+ EXPECT_TRUE(reporter_.MonotonicDurationHelper(
+ &fake_system_state, &storage, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+
+ // We can also call it as many times as we want with it being
+ // considered a failure.
+ EXPECT_TRUE(reporter_.MonotonicDurationHelper(
+ &fake_system_state, &storage, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+ EXPECT_TRUE(reporter_.MonotonicDurationHelper(
+ &fake_system_state, &storage, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+
+ // Advance the clock one second, then we should get 1 sec on the
+ // next call and 0 sec on the subsequent call.
+ fake_clock.SetMonotonicTime(base::Time::FromInternalValue(2000000));
+ EXPECT_TRUE(reporter_.MonotonicDurationHelper(
+ &fake_system_state, &storage, &duration));
+ EXPECT_EQ(duration.InSeconds(), 1);
+ EXPECT_TRUE(reporter_.MonotonicDurationHelper(
+ &fake_system_state, &storage, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+
+ // Advance clock two seconds and we should get 2 sec and then 0 sec.
+ fake_clock.SetMonotonicTime(base::Time::FromInternalValue(4000000));
+ EXPECT_TRUE(reporter_.MonotonicDurationHelper(
+ &fake_system_state, &storage, &duration));
+ EXPECT_EQ(duration.InSeconds(), 2);
+ EXPECT_TRUE(reporter_.MonotonicDurationHelper(
+ &fake_system_state, &storage, &duration));
+ EXPECT_EQ(duration.InSeconds(), 0);
+}
+
} // namespace chromeos_update_engine
diff --git a/mock_connection_manager.h b/cros/mock_connection_manager.h
similarity index 85%
rename from mock_connection_manager.h
rename to cros/mock_connection_manager.h
index 2fff68c..899a49b 100644
--- a/mock_connection_manager.h
+++ b/cros/mock_connection_manager.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_CONNECTION_MANAGER_H_
-#define UPDATE_ENGINE_MOCK_CONNECTION_MANAGER_H_
+#ifndef UPDATE_ENGINE_CROS_MOCK_CONNECTION_MANAGER_H_
+#define UPDATE_ENGINE_CROS_MOCK_CONNECTION_MANAGER_H_
#include <gmock/gmock.h>
-#include "update_engine/connection_manager_interface.h"
+#include "update_engine/cros/connection_manager_interface.h"
namespace chromeos_update_engine {
@@ -41,4 +41,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_CONNECTION_MANAGER_H_
+#endif // UPDATE_ENGINE_CROS_MOCK_CONNECTION_MANAGER_H_
diff --git a/mock_omaha_request_params.h b/cros/mock_omaha_request_params.h
similarity index 92%
rename from mock_omaha_request_params.h
rename to cros/mock_omaha_request_params.h
index 41bdc19..6072d22 100644
--- a/mock_omaha_request_params.h
+++ b/cros/mock_omaha_request_params.h
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_OMAHA_REQUEST_PARAMS_H_
-#define UPDATE_ENGINE_MOCK_OMAHA_REQUEST_PARAMS_H_
+#ifndef UPDATE_ENGINE_CROS_MOCK_OMAHA_REQUEST_PARAMS_H_
+#define UPDATE_ENGINE_CROS_MOCK_OMAHA_REQUEST_PARAMS_H_
#include <string>
#include <gmock/gmock.h>
-#include "update_engine/omaha_request_params.h"
+#include "update_engine/cros/omaha_request_params.h"
namespace chromeos_update_engine {
@@ -79,4 +79,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_OMAHA_REQUEST_PARAMS_H_
+#endif // UPDATE_ENGINE_CROS_MOCK_OMAHA_REQUEST_PARAMS_H_
diff --git a/mock_p2p_manager.h b/cros/mock_p2p_manager.h
similarity index 94%
rename from mock_p2p_manager.h
rename to cros/mock_p2p_manager.h
index fd67034..273f7f9 100644
--- a/mock_p2p_manager.h
+++ b/cros/mock_p2p_manager.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_P2P_MANAGER_H_
-#define UPDATE_ENGINE_MOCK_P2P_MANAGER_H_
+#ifndef UPDATE_ENGINE_CROS_MOCK_P2P_MANAGER_H_
+#define UPDATE_ENGINE_CROS_MOCK_P2P_MANAGER_H_
#include <string>
-#include "update_engine/fake_p2p_manager.h"
+#include "update_engine/cros/fake_p2p_manager.h"
#include <gmock/gmock.h>
@@ -99,4 +99,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_P2P_MANAGER_H_
+#endif // UPDATE_ENGINE_CROS_MOCK_P2P_MANAGER_H_
diff --git a/mock_payload_state.h b/cros/mock_payload_state.h
similarity index 92%
rename from mock_payload_state.h
rename to cros/mock_payload_state.h
index ad22de5..56094e6 100644
--- a/mock_payload_state.h
+++ b/cros/mock_payload_state.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_
-#define UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_
+#ifndef UPDATE_ENGINE_CROS_MOCK_PAYLOAD_STATE_H_
+#define UPDATE_ENGINE_CROS_MOCK_PAYLOAD_STATE_H_
#include <string>
#include <gmock/gmock.h>
-#include "update_engine/omaha_request_action.h"
-#include "update_engine/payload_state_interface.h"
+#include "update_engine/common/system_state.h"
+#include "update_engine/cros/payload_state_interface.h"
namespace chromeos_update_engine {
@@ -81,4 +81,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_
+#endif // UPDATE_ENGINE_CROS_MOCK_PAYLOAD_STATE_H_
diff --git a/mock_power_manager.h b/cros/mock_power_manager.h
similarity index 80%
rename from mock_power_manager.h
rename to cros/mock_power_manager.h
index 8363171..d4a8682 100644
--- a/mock_power_manager.h
+++ b/cros/mock_power_manager.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_POWER_MANAGER_H_
-#define UPDATE_ENGINE_MOCK_POWER_MANAGER_H_
+#ifndef UPDATE_ENGINE_CROS_MOCK_POWER_MANAGER_H_
+#define UPDATE_ENGINE_CROS_MOCK_POWER_MANAGER_H_
#include <gmock/gmock.h>
-#include "update_engine/power_manager_interface.h"
+#include "update_engine/cros/power_manager_interface.h"
namespace chromeos_update_engine {
@@ -32,4 +32,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_POWER_MANAGER_H_
+#endif // UPDATE_ENGINE_CROS_MOCK_POWER_MANAGER_H_
diff --git a/mock_update_attempter.h b/cros/mock_update_attempter.h
similarity index 89%
rename from mock_update_attempter.h
rename to cros/mock_update_attempter.h
index 96d93fd..be8cfcc 100644
--- a/mock_update_attempter.h
+++ b/cros/mock_update_attempter.h
@@ -14,13 +14,13 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_UPDATE_ATTEMPTER_H_
-#define UPDATE_ENGINE_MOCK_UPDATE_ATTEMPTER_H_
+#ifndef UPDATE_ENGINE_CROS_MOCK_UPDATE_ATTEMPTER_H_
+#define UPDATE_ENGINE_CROS_MOCK_UPDATE_ATTEMPTER_H_
#include <string>
#include <vector>
-#include "update_engine/update_attempter.h"
+#include "update_engine/cros/update_attempter.h"
#include <gmock/gmock.h>
@@ -65,4 +65,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_UPDATE_ATTEMPTER_H_
+#endif // UPDATE_ENGINE_CROS_MOCK_UPDATE_ATTEMPTER_H_
diff --git a/omaha_request_action.cc b/cros/omaha_request_action.cc
similarity index 98%
rename from omaha_request_action.cc
rename to cros/omaha_request_action.cc
index 161cf43..0916f9d 100644
--- a/omaha_request_action.cc
+++ b/cros/omaha_request_action.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_request_action.h"
+#include "update_engine/cros/omaha_request_action.h"
#include <inttypes.h>
@@ -44,18 +44,18 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/platform_constants.h"
#include "update_engine/common/prefs.h"
#include "update_engine/common/prefs_interface.h"
#include "update_engine/common/utils.h"
-#include "update_engine/connection_manager_interface.h"
-#include "update_engine/metrics_reporter_interface.h"
+#include "update_engine/cros/connection_manager_interface.h"
+#include "update_engine/cros/omaha_request_builder_xml.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/p2p_manager.h"
+#include "update_engine/cros/payload_state_interface.h"
+#include "update_engine/cros/update_attempter.h"
#include "update_engine/metrics_utils.h"
-#include "update_engine/omaha_request_builder_xml.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/p2p_manager.h"
-#include "update_engine/payload_state_interface.h"
-#include "update_engine/update_attempter.h"
using base::Optional;
using base::Time;
@@ -865,11 +865,6 @@
if (app.id == params_->GetAppId()) {
// this is the app (potentially the only app)
output_object->version = app.manifest_version;
- } else if (!params_->system_app_id().empty() &&
- app.id == params_->system_app_id()) {
- // this is the system app (this check is intentionally skipped if there is
- // no system_app_id set)
- output_object->system_version = app.manifest_version;
} else if (params_->is_install() &&
app.manifest_version != params_->app_version()) {
LOG(WARNING) << "An app has a different version (" << app.manifest_version
diff --git a/omaha_request_action.h b/cros/omaha_request_action.h
similarity index 97%
rename from omaha_request_action.h
rename to cros/omaha_request_action.h
index 30b3d22..1a3a912 100644
--- a/omaha_request_action.h
+++ b/cros/omaha_request_action.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H_
-#define UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H_
+#ifndef UPDATE_ENGINE_CROS_OMAHA_REQUEST_ACTION_H_
+#define UPDATE_ENGINE_CROS_OMAHA_REQUEST_ACTION_H_
#include <fcntl.h>
#include <sys/stat.h>
@@ -33,9 +33,9 @@
#include "update_engine/common/action.h"
#include "update_engine/common/http_fetcher.h"
-#include "update_engine/omaha_request_builder_xml.h"
-#include "update_engine/omaha_response.h"
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
+#include "update_engine/cros/omaha_request_builder_xml.h"
+#include "update_engine/cros/omaha_response.h"
// The Omaha Request action makes a request to Omaha and can output
// the response on the output ActionPipe.
@@ -317,4 +317,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_OMAHA_REQUEST_ACTION_H_
+#endif // UPDATE_ENGINE_CROS_OMAHA_REQUEST_ACTION_H_
diff --git a/omaha_request_action_fuzzer.cc b/cros/omaha_request_action_fuzzer.cc
similarity index 94%
rename from omaha_request_action_fuzzer.cc
rename to cros/omaha_request_action_fuzzer.cc
index 6c41b12..dd02467 100644
--- a/omaha_request_action_fuzzer.cc
+++ b/cros/omaha_request_action_fuzzer.cc
@@ -18,8 +18,8 @@
#include "update_engine/common/mock_http_fetcher.h"
#include "update_engine/common/test_utils.h"
-#include "update_engine/fake_system_state.h"
-#include "update_engine/omaha_request_action.h"
+#include "update_engine/cros/fake_system_state.h"
+#include "update_engine/cros/omaha_request_action.h"
class Environment {
public:
diff --git a/omaha_request_action_unittest.cc b/cros/omaha_request_action_unittest.cc
similarity index 98%
rename from omaha_request_action_unittest.cc
rename to cros/omaha_request_action_unittest.cc
index 61e988b..c3842b8 100644
--- a/omaha_request_action_unittest.cc
+++ b/cros/omaha_request_action_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_request_action.h"
+#include "update_engine/cros/omaha_request_action.h"
#include <stdint.h>
@@ -44,18 +44,18 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/fake_prefs.h"
#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/mock_excluder.h"
#include "update_engine/common/mock_http_fetcher.h"
#include "update_engine/common/platform_constants.h"
#include "update_engine/common/prefs.h"
#include "update_engine/common/test_utils.h"
-#include "update_engine/fake_system_state.h"
-#include "update_engine/metrics_reporter_interface.h"
-#include "update_engine/mock_connection_manager.h"
-#include "update_engine/mock_payload_state.h"
-#include "update_engine/omaha_request_builder_xml.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/omaha_utils.h"
+#include "update_engine/cros/fake_system_state.h"
+#include "update_engine/cros/mock_connection_manager.h"
+#include "update_engine/cros/mock_payload_state.h"
+#include "update_engine/cros/omaha_request_builder_xml.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/omaha_utils.h"
#include "update_engine/update_manager/rollback_prefs.h"
using base::Time;
@@ -648,7 +648,6 @@
EXPECT_TRUE(response.update_exists);
EXPECT_EQ(fake_update_response_.version, response.version);
- EXPECT_EQ("", response.system_version);
EXPECT_EQ(fake_update_response_.GetPayloadUrl(),
response.packages[0].payload_urls[0]);
EXPECT_EQ(fake_update_response_.more_info_url, response.more_info_url);
@@ -711,32 +710,6 @@
EXPECT_EQ(false, response.packages[1].is_delta);
}
-TEST_F(OmahaRequestActionTest, MultiAppAndSystemUpdateTest) {
- fake_update_response_.multi_app = true;
- // Trigger the lining up of the app and system versions.
- request_params_.set_system_app_id(fake_update_response_.app_id2);
- tuc_params_.http_response = fake_update_response_.GetUpdateResponse();
-
- ASSERT_TRUE(TestUpdateCheck());
-
- EXPECT_TRUE(response.update_exists);
- EXPECT_EQ(fake_update_response_.version, response.version);
- EXPECT_EQ(fake_update_response_.version2, response.system_version);
- EXPECT_EQ(fake_update_response_.GetPayloadUrl(),
- response.packages[0].payload_urls[0]);
- EXPECT_EQ(fake_update_response_.codebase2 + "package3",
- response.packages[1].payload_urls[0]);
- EXPECT_EQ(fake_update_response_.hash, response.packages[0].hash);
- EXPECT_EQ(fake_update_response_.size, response.packages[0].size);
- EXPECT_EQ(11u, response.packages[0].metadata_size);
- EXPECT_EQ(true, response.packages[0].is_delta);
- ASSERT_EQ(2u, response.packages.size());
- EXPECT_EQ(string("hash3"), response.packages[1].hash);
- EXPECT_EQ(333u, response.packages[1].size);
- EXPECT_EQ(33u, response.packages[1].metadata_size);
- EXPECT_EQ(false, response.packages[1].is_delta);
-}
-
TEST_F(OmahaRequestActionTest, MultiAppPartialUpdateTest) {
fake_update_response_.multi_app = true;
fake_update_response_.multi_app_self_update = true;
@@ -746,7 +719,6 @@
EXPECT_TRUE(response.update_exists);
EXPECT_EQ(fake_update_response_.version, response.version);
- EXPECT_EQ("", response.system_version);
EXPECT_EQ(fake_update_response_.GetPayloadUrl(),
response.packages[0].payload_urls[0]);
EXPECT_EQ(fake_update_response_.hash, response.packages[0].hash);
@@ -768,7 +740,6 @@
EXPECT_TRUE(response.update_exists);
EXPECT_EQ(fake_update_response_.version, response.version);
- EXPECT_EQ("", response.system_version);
EXPECT_EQ(fake_update_response_.GetPayloadUrl(),
response.packages[0].payload_urls[0]);
EXPECT_EQ(fake_update_response_.codebase + "package2",
diff --git a/omaha_request_builder_xml.cc b/cros/omaha_request_builder_xml.cc
similarity index 96%
rename from omaha_request_builder_xml.cc
rename to cros/omaha_request_builder_xml.cc
index 6660afb..43ee548 100644
--- a/omaha_request_builder_xml.cc
+++ b/cros/omaha_request_builder_xml.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_request_builder_xml.h"
+#include "update_engine/cros/omaha_request_builder_xml.h"
#include <inttypes.h>
@@ -30,7 +30,7 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/prefs_interface.h"
#include "update_engine/common/utils.h"
-#include "update_engine/omaha_request_params.h"
+#include "update_engine/cros/omaha_request_params.h"
using std::string;
@@ -422,16 +422,6 @@
.app_params = {.active_counting_type = OmahaRequestParams::kDayBased,
.send_ping = include_ping_}};
app_xml += GetApp(product_app);
- if (!params_->system_app_id().empty()) {
- OmahaAppData system_app = {
- .id = params_->system_app_id(),
- .version = params_->system_version(),
- .skip_update = false,
- .is_dlc = false,
- .app_params = {.active_counting_type = OmahaRequestParams::kDayBased,
- .send_ping = include_ping_}};
- app_xml += GetApp(system_app);
- }
for (const auto& it : params_->dlc_apps_params()) {
OmahaAppData dlc_app_data = {
.id = it.first,
diff --git a/omaha_request_builder_xml.h b/cros/omaha_request_builder_xml.h
similarity index 94%
rename from omaha_request_builder_xml.h
rename to cros/omaha_request_builder_xml.h
index 50c708d..4f860dd 100644
--- a/omaha_request_builder_xml.h
+++ b/cros/omaha_request_builder_xml.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_OMAHA_REQUEST_BUILDER_XML_H_
-#define UPDATE_ENGINE_OMAHA_REQUEST_BUILDER_XML_H_
+#ifndef UPDATE_ENGINE_CROS_OMAHA_REQUEST_BUILDER_XML_H_
+#define UPDATE_ENGINE_CROS_OMAHA_REQUEST_BUILDER_XML_H_
#include <fcntl.h>
#include <sys/stat.h>
@@ -33,9 +33,9 @@
#include "update_engine/common/action.h"
#include "update_engine/common/http_fetcher.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/omaha_response.h"
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/omaha_response.h"
namespace chromeos_update_engine {
@@ -196,4 +196,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_OMAHA_REQUEST_BUILDER_XML_H_
+#endif // UPDATE_ENGINE_CROS_OMAHA_REQUEST_BUILDER_XML_H_
diff --git a/omaha_request_builder_xml_unittest.cc b/cros/omaha_request_builder_xml_unittest.cc
similarity index 98%
rename from omaha_request_builder_xml_unittest.cc
rename to cros/omaha_request_builder_xml_unittest.cc
index 042d991..11d808b 100644
--- a/omaha_request_builder_xml_unittest.cc
+++ b/cros/omaha_request_builder_xml_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_request_builder_xml.h"
+#include "update_engine/cros/omaha_request_builder_xml.h"
#include <string>
#include <utility>
@@ -23,7 +23,7 @@
#include <base/guid.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_system_state.h"
+#include "update_engine/cros/fake_system_state.h"
using std::pair;
using std::string;
diff --git a/omaha_request_params.cc b/cros/omaha_request_params.cc
similarity index 96%
rename from omaha_request_params.cc
rename to cros/omaha_request_params.cc
index 5a48720..c814e00 100644
--- a/omaha_request_params.cc
+++ b/cros/omaha_request_params.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_request_params.h"
+#include "update_engine/cros/omaha_request_params.h"
#include <errno.h>
#include <fcntl.h>
@@ -35,8 +35,8 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/common/utils.h"
-#include "update_engine/system_state.h"
#include "update_engine/update_manager/policy.h"
#define CALL_MEMBER_FN(object, member) ((object).*(member))
@@ -78,14 +78,7 @@
LOG(INFO) << "Running from channel " << image_props_.current_channel;
os_platform_ = constants::kOmahaPlatformName;
- if (!image_props_.system_version.empty()) {
- if (app_version == "ForcedUpdate") {
- image_props_.system_version = app_version;
- }
- os_version_ = image_props_.system_version;
- } else {
- os_version_ = OmahaRequestParams::kOsVersion;
- }
+ os_version_ = OmahaRequestParams::kOsVersion;
if (!app_version.empty())
image_props_.version = app_version;
diff --git a/omaha_request_params.h b/cros/omaha_request_params.h
similarity index 96%
rename from omaha_request_params.h
rename to cros/omaha_request_params.h
index ed3cc80..26ea1c9 100644
--- a/omaha_request_params.h
+++ b/cros/omaha_request_params.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H_
-#define UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H_
+#ifndef UPDATE_ENGINE_CROS_OMAHA_REQUEST_PARAMS_H_
+#define UPDATE_ENGINE_CROS_OMAHA_REQUEST_PARAMS_H_
#include <stdint.h>
@@ -29,7 +29,7 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/platform_constants.h"
-#include "update_engine/image_properties.h"
+#include "update_engine/cros/image_properties.h"
#include "update_engine/update_manager/policy.h"
// This gathers local system information and prepares info used by the
@@ -94,10 +94,6 @@
inline std::string canary_app_id() const {
return image_props_.canary_product_id;
}
- inline std::string system_app_id() const { return image_props_.system_id; }
- inline void set_system_app_id(const std::string& system_app_id) {
- image_props_.system_id = system_app_id;
- }
inline void set_app_id(const std::string& app_id) {
image_props_.product_id = app_id;
image_props_.canary_product_id = app_id;
@@ -110,9 +106,6 @@
image_props_.version = version;
}
inline std::string app_version() const { return image_props_.version; }
- inline std::string system_version() const {
- return image_props_.system_version;
- }
inline std::string product_components() const {
return image_props_.product_components;
}
@@ -366,7 +359,7 @@
// The value defining the parameters of the LTS (Long Term Support).
std::string lts_tag_;
- std::string hwid_; // Hardware Qualification ID of the client
+ std::string hwid_; // Hardware Qualification ID of the client
// TODO(b:133324571) tracks removal of this field once it is no longer
// needed in AU requests. Remove by October 1st 2019.
std::string device_requisition_; // Chrome OS Requisition type.
@@ -424,4 +417,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H_
+#endif // UPDATE_ENGINE_CROS_OMAHA_REQUEST_PARAMS_H_
diff --git a/omaha_request_params_unittest.cc b/cros/omaha_request_params_unittest.cc
similarity index 98%
rename from omaha_request_params_unittest.cc
rename to cros/omaha_request_params_unittest.cc
index fcf8062..71f3d4c 100644
--- a/omaha_request_params_unittest.cc
+++ b/cros/omaha_request_params_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_request_params.h"
+#include "update_engine/cros/omaha_request_params.h"
#include <stdio.h>
@@ -29,7 +29,7 @@
#include "update_engine/common/platform_constants.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/fake_system_state.h"
+#include "update_engine/cros/fake_system_state.h"
using chromeos_update_engine::test_utils::WriteFileString;
using std::string;
diff --git a/omaha_response.h b/cros/omaha_response.h
similarity index 96%
rename from omaha_response.h
rename to cros/omaha_response.h
index 77f9083..43783d6 100644
--- a/omaha_response.h
+++ b/cros/omaha_response.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_OMAHA_RESPONSE_H_
-#define UPDATE_ENGINE_OMAHA_RESPONSE_H_
+#ifndef UPDATE_ENGINE_CROS_OMAHA_RESPONSE_H_
+#define UPDATE_ENGINE_CROS_OMAHA_RESPONSE_H_
#include <fcntl.h>
#include <sys/stat.h>
@@ -38,7 +38,6 @@
// These are only valid if update_exists is true:
std::string version;
- std::string system_version;
struct Package {
// The ordered list of URLs in the Omaha response. Each item is a complete
@@ -119,4 +118,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_OMAHA_RESPONSE_H_
+#endif // UPDATE_ENGINE_CROS_OMAHA_RESPONSE_H_
diff --git a/omaha_response_handler_action.cc b/cros/omaha_response_handler_action.cc
similarity index 97%
rename from omaha_response_handler_action.cc
rename to cros/omaha_response_handler_action.cc
index 92e0a72..b6c223f 100644
--- a/omaha_response_handler_action.cc
+++ b/cros/omaha_response_handler_action.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_response_handler_action.h"
+#include "update_engine/cros/omaha_response_handler_action.h"
#include <limits>
#include <string>
@@ -28,10 +28,10 @@
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/prefs_interface.h"
#include "update_engine/common/utils.h"
-#include "update_engine/connection_manager_interface.h"
-#include "update_engine/omaha_request_params.h"
+#include "update_engine/cros/connection_manager_interface.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/payload_state_interface.h"
#include "update_engine/payload_consumer/delta_performer.h"
-#include "update_engine/payload_state_interface.h"
#include "update_engine/update_manager/policy.h"
#include "update_engine/update_manager/update_manager.h"
@@ -75,7 +75,6 @@
// |OmahaRequestAction| and keep the enforcement of exclusions for updates.
install_plan_.download_url = current_url;
install_plan_.version = response.version;
- install_plan_.system_version = response.system_version;
OmahaRequestParams* const params = system_state_->request_params();
PayloadStateInterface* const payload_state = system_state_->payload_state();
diff --git a/omaha_response_handler_action.h b/cros/omaha_response_handler_action.h
similarity index 91%
rename from omaha_response_handler_action.h
rename to cros/omaha_response_handler_action.h
index d2e6db8..f3b821e 100644
--- a/omaha_response_handler_action.h
+++ b/cros/omaha_response_handler_action.h
@@ -14,17 +14,17 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H_
-#define UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H_
+#ifndef UPDATE_ENGINE_CROS_OMAHA_RESPONSE_HANDLER_ACTION_H_
+#define UPDATE_ENGINE_CROS_OMAHA_RESPONSE_HANDLER_ACTION_H_
#include <string>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "update_engine/common/action.h"
-#include "update_engine/omaha_request_action.h"
+#include "update_engine/common/system_state.h"
+#include "update_engine/cros/omaha_request_action.h"
#include "update_engine/payload_consumer/install_plan.h"
-#include "update_engine/system_state.h"
// This class reads in an Omaha response and converts what it sees into
// an install plan which is passed out.
@@ -90,4 +90,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H_
+#endif // UPDATE_ENGINE_CROS_OMAHA_RESPONSE_HANDLER_ACTION_H_
diff --git a/omaha_response_handler_action_unittest.cc b/cros/omaha_response_handler_action_unittest.cc
similarity index 98%
rename from omaha_response_handler_action_unittest.cc
rename to cros/omaha_response_handler_action_unittest.cc
index 9613e8d..8da3205 100644
--- a/omaha_response_handler_action_unittest.cc
+++ b/cros/omaha_response_handler_action_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_response_handler_action.h"
+#include "update_engine/cros/omaha_response_handler_action.h"
#include <memory>
#include <string>
@@ -29,8 +29,8 @@
#include "update_engine/common/platform_constants.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_payload_state.h"
+#include "update_engine/cros/fake_system_state.h"
+#include "update_engine/cros/mock_payload_state.h"
#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/update_manager/mock_policy.h"
@@ -919,7 +919,6 @@
OmahaResponse in;
in.update_exists = true;
in.version = "a.b.c.d";
- in.system_version = "b.c.d.e";
in.packages.push_back({.payload_urls = {"http://package/1"},
.size = 1,
.hash = kPayloadHashHex});
@@ -936,7 +935,6 @@
EXPECT_EQ(expected_hash_, install_plan.payloads[0].hash);
EXPECT_EQ(expected_hash_, install_plan.payloads[1].hash);
EXPECT_EQ(in.version, install_plan.version);
- EXPECT_EQ(in.system_version, install_plan.system_version);
}
TEST_F(OmahaResponseHandlerActionTest, TestDeferredByPolicy) {
diff --git a/omaha_utils.cc b/cros/omaha_utils.cc
similarity index 95%
rename from omaha_utils.cc
rename to cros/omaha_utils.cc
index c7f9921..fc05cb9 100644
--- a/omaha_utils.cc
+++ b/cros/omaha_utils.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_utils.h"
+#include "update_engine/cros/omaha_utils.h"
#include <base/logging.h>
#include <base/strings/string_number_conversions.h>
diff --git a/omaha_utils.h b/cros/omaha_utils.h
similarity index 89%
rename from omaha_utils.h
rename to cros/omaha_utils.h
index 458bf9e..6741635 100644
--- a/omaha_utils.h
+++ b/cros/omaha_utils.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_OMAHA_UTILS_H_
-#define UPDATE_ENGINE_OMAHA_UTILS_H_
+#ifndef UPDATE_ENGINE_CROS_OMAHA_UTILS_H_
+#define UPDATE_ENGINE_CROS_OMAHA_UTILS_H_
#include <string>
@@ -36,4 +36,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_OMAHA_UTILS_H_
+#endif // UPDATE_ENGINE_CROS_OMAHA_UTILS_H_
diff --git a/omaha_utils_unittest.cc b/cros/omaha_utils_unittest.cc
similarity index 96%
rename from omaha_utils_unittest.cc
rename to cros/omaha_utils_unittest.cc
index 849905a..f89f690 100644
--- a/omaha_utils_unittest.cc
+++ b/cros/omaha_utils_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_utils.h"
+#include "update_engine/cros/omaha_utils.h"
#include <gtest/gtest.h>
#include <vector>
diff --git a/p2p_manager.cc b/cros/p2p_manager.cc
similarity index 99%
rename from p2p_manager.cc
rename to cros/p2p_manager.cc
index 00ff8ce..dc12b35 100644
--- a/p2p_manager.cc
+++ b/cros/p2p_manager.cc
@@ -23,7 +23,7 @@
#define _BSD_SOURCE
#endif
-#include "update_engine/p2p_manager.h"
+#include "update_engine/cros/p2p_manager.h"
#include <errno.h>
#include <fcntl.h>
diff --git a/p2p_manager.h b/cros/p2p_manager.h
similarity index 97%
rename from p2p_manager.h
rename to cros/p2p_manager.h
index ef62f0d..bd359fa 100644
--- a/p2p_manager.h
+++ b/cros/p2p_manager.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_P2P_MANAGER_H_
-#define UPDATE_ENGINE_P2P_MANAGER_H_
+#ifndef UPDATE_ENGINE_CROS_P2P_MANAGER_H_
+#define UPDATE_ENGINE_CROS_P2P_MANAGER_H_
#include <string>
#include <vector>
@@ -183,4 +183,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_P2P_MANAGER_H_
+#endif // UPDATE_ENGINE_CROS_P2P_MANAGER_H_
diff --git a/p2p_manager_unittest.cc b/cros/p2p_manager_unittest.cc
similarity index 98%
rename from p2p_manager_unittest.cc
rename to cros/p2p_manager_unittest.cc
index 5510dd7..8b6d741 100644
--- a/p2p_manager_unittest.cc
+++ b/cros/p2p_manager_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/p2p_manager.h"
+#include "update_engine/cros/p2p_manager.h"
#include <dirent.h>
#include <fcntl.h>
@@ -51,7 +51,7 @@
#include "update_engine/common/subprocess.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/fake_p2p_manager_configuration.h"
+#include "update_engine/cros/fake_p2p_manager_configuration.h"
#include "update_engine/update_manager/fake_update_manager.h"
#include "update_engine/update_manager/mock_policy.h"
diff --git a/payload_state.cc b/cros/payload_state.cc
similarity index 98%
rename from payload_state.cc
rename to cros/payload_state.cc
index 1d1583b..d2e6851 100644
--- a/payload_state.cc
+++ b/cros/payload_state.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/payload_state.h"
+#include "update_engine/cros/payload_state.h"
#include <algorithm>
#include <string>
@@ -29,15 +29,15 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/error_code_utils.h"
#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/prefs.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/common/utils.h"
-#include "update_engine/connection_manager_interface.h"
-#include "update_engine/metrics_reporter_interface.h"
+#include "update_engine/cros/connection_manager_interface.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/update_attempter.h"
#include "update_engine/metrics_utils.h"
-#include "update_engine/omaha_request_params.h"
#include "update_engine/payload_consumer/install_plan.h"
-#include "update_engine/system_state.h"
-#include "update_engine/update_attempter.h"
using base::Time;
using base::TimeDelta;
diff --git a/payload_state.h b/cros/payload_state.h
similarity index 98%
rename from payload_state.h
rename to cros/payload_state.h
index 77197a7..0827273 100644
--- a/payload_state.h
+++ b/cros/payload_state.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PAYLOAD_STATE_H_
-#define UPDATE_ENGINE_PAYLOAD_STATE_H_
+#ifndef UPDATE_ENGINE_CROS_PAYLOAD_STATE_H_
+#define UPDATE_ENGINE_CROS_PAYLOAD_STATE_H_
#include <algorithm>
#include <string>
@@ -25,9 +25,9 @@
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "update_engine/common/excluder_interface.h"
+#include "update_engine/common/metrics_constants.h"
#include "update_engine/common/prefs_interface.h"
-#include "update_engine/metrics_constants.h"
-#include "update_engine/payload_state_interface.h"
+#include "update_engine/cros/payload_state_interface.h"
namespace chromeos_update_engine {
@@ -599,4 +599,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PAYLOAD_STATE_H_
+#endif // UPDATE_ENGINE_CROS_PAYLOAD_STATE_H_
diff --git a/payload_state_interface.h b/cros/payload_state_interface.h
similarity index 97%
rename from payload_state_interface.h
rename to cros/payload_state_interface.h
index d384a0e..9ead650 100644
--- a/payload_state_interface.h
+++ b/cros/payload_state_interface.h
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PAYLOAD_STATE_INTERFACE_H_
-#define UPDATE_ENGINE_PAYLOAD_STATE_INTERFACE_H_
+#ifndef UPDATE_ENGINE_CROS_PAYLOAD_STATE_INTERFACE_H_
+#define UPDATE_ENGINE_CROS_PAYLOAD_STATE_INTERFACE_H_
#include <string>
#include "update_engine/common/action_processor.h"
#include "update_engine/common/constants.h"
-#include "update_engine/omaha_response.h"
+#include "update_engine/cros/omaha_response.h"
namespace chromeos_update_engine {
@@ -212,4 +212,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PAYLOAD_STATE_INTERFACE_H_
+#endif // UPDATE_ENGINE_CROS_PAYLOAD_STATE_INTERFACE_H_
diff --git a/payload_state_unittest.cc b/cros/payload_state_unittest.cc
similarity index 99%
rename from payload_state_unittest.cc
rename to cros/payload_state_unittest.cc
index 2d571c1..b48cff4 100644
--- a/payload_state_unittest.cc
+++ b/cros/payload_state_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/payload_state.h"
+#include "update_engine/cros/payload_state.h"
#include <base/files/file_path.h>
#include <base/files/file_util.h>
@@ -27,14 +27,14 @@
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/fake_hardware.h"
#include "update_engine/common/fake_prefs.h"
+#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/mock_excluder.h"
#include "update_engine/common/mock_prefs.h"
#include "update_engine/common/prefs.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/fake_system_state.h"
-#include "update_engine/metrics_reporter_interface.h"
-#include "update_engine/omaha_request_action.h"
+#include "update_engine/cros/fake_system_state.h"
+#include "update_engine/cros/omaha_request_action.h"
using base::Time;
using base::TimeDelta;
diff --git a/common/platform_constants_chromeos.cc b/cros/platform_constants_chromeos.cc
similarity index 100%
rename from common/platform_constants_chromeos.cc
rename to cros/platform_constants_chromeos.cc
diff --git a/power_manager_chromeos.cc b/cros/power_manager_chromeos.cc
similarity index 92%
rename from power_manager_chromeos.cc
rename to cros/power_manager_chromeos.cc
index 531d367..c1a2859 100644
--- a/power_manager_chromeos.cc
+++ b/cros/power_manager_chromeos.cc
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#include "update_engine/power_manager_chromeos.h"
+#include "update_engine/cros/power_manager_chromeos.h"
#include <memory>
#include <power_manager/dbus-constants.h>
#include <power_manager/dbus-proxies.h>
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
namespace chromeos_update_engine {
diff --git a/power_manager_chromeos.h b/cros/power_manager_chromeos.h
similarity index 83%
rename from power_manager_chromeos.h
rename to cros/power_manager_chromeos.h
index eeb14d8..8930508 100644
--- a/power_manager_chromeos.h
+++ b/cros/power_manager_chromeos.h
@@ -14,13 +14,13 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_POWER_MANAGER_CHROMEOS_H_
-#define UPDATE_ENGINE_POWER_MANAGER_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_CROS_POWER_MANAGER_CHROMEOS_H_
+#define UPDATE_ENGINE_CROS_POWER_MANAGER_CHROMEOS_H_
#include <base/macros.h>
#include <power_manager/dbus-proxies.h>
-#include "update_engine/power_manager_interface.h"
+#include "update_engine/cros/power_manager_interface.h"
namespace chromeos_update_engine {
@@ -41,4 +41,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_POWER_MANAGER_CHROMEOS_H_
+#endif // UPDATE_ENGINE_CROS_POWER_MANAGER_CHROMEOS_H_
diff --git a/power_manager_interface.h b/cros/power_manager_interface.h
similarity index 87%
rename from power_manager_interface.h
rename to cros/power_manager_interface.h
index 8f77650..1f712d2 100644
--- a/power_manager_interface.h
+++ b/cros/power_manager_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_POWER_MANAGER_INTERFACE_H_
-#define UPDATE_ENGINE_POWER_MANAGER_INTERFACE_H_
+#ifndef UPDATE_ENGINE_CROS_POWER_MANAGER_INTERFACE_H_
+#define UPDATE_ENGINE_CROS_POWER_MANAGER_INTERFACE_H_
#include <memory>
@@ -44,4 +44,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_POWER_MANAGER_INTERFACE_H_
+#endif // UPDATE_ENGINE_CROS_POWER_MANAGER_INTERFACE_H_
diff --git a/real_system_state.cc b/cros/real_system_state.cc
similarity index 97%
rename from real_system_state.cc
rename to cros/real_system_state.cc
index 924271e..4f57246 100644
--- a/real_system_state.cc
+++ b/cros/real_system_state.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/real_system_state.h"
+#include "update_engine/cros/real_system_state.h"
#include <memory>
#include <string>
@@ -35,11 +35,11 @@
#include "update_engine/common/dlcservice_interface.h"
#include "update_engine/common/hardware.h"
#include "update_engine/common/utils.h"
-#include "update_engine/metrics_reporter_omaha.h"
-#include "update_engine/update_boot_flags_action.h"
+#include "update_engine/cros/metrics_reporter_omaha.h"
#if USE_DBUS
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
#endif // USE_DBUS
+#include "update_engine/update_boot_flags_action.h"
#include "update_engine/update_manager/state_factory.h"
using brillo::MessageLoop;
diff --git a/real_system_state.h b/cros/real_system_state.h
similarity index 90%
rename from real_system_state.h
rename to cros/real_system_state.h
index 807a205..798fca0 100644
--- a/real_system_state.h
+++ b/cros/real_system_state.h
@@ -14,10 +14,10 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_REAL_SYSTEM_STATE_H_
-#define UPDATE_ENGINE_REAL_SYSTEM_STATE_H_
+#ifndef UPDATE_ENGINE_CROS_REAL_SYSTEM_STATE_H_
+#define UPDATE_ENGINE_CROS_REAL_SYSTEM_STATE_H_
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
#include <memory>
#include <set>
@@ -31,17 +31,17 @@
#include "update_engine/certificate_checker.h"
#include "update_engine/common/boot_control_interface.h"
#include "update_engine/common/clock.h"
+#include "update_engine/common/daemon_state_interface.h"
#include "update_engine/common/dlcservice_interface.h"
#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/prefs.h"
-#include "update_engine/connection_manager_interface.h"
-#include "update_engine/daemon_state_interface.h"
-#include "update_engine/metrics_reporter_interface.h"
-#include "update_engine/metrics_reporter_omaha.h"
-#include "update_engine/p2p_manager.h"
-#include "update_engine/payload_state.h"
-#include "update_engine/power_manager_interface.h"
-#include "update_engine/update_attempter.h"
+#include "update_engine/cros/connection_manager_interface.h"
+#include "update_engine/cros/metrics_reporter_omaha.h"
+#include "update_engine/cros/p2p_manager.h"
+#include "update_engine/cros/payload_state.h"
+#include "update_engine/cros/power_manager_interface.h"
+#include "update_engine/cros/update_attempter.h"
#include "update_engine/update_manager/update_manager.h"
namespace chromeos_update_engine {
@@ -199,4 +199,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_REAL_SYSTEM_STATE_H_
+#endif // UPDATE_ENGINE_CROS_REAL_SYSTEM_STATE_H_
diff --git a/requisition_util.cc b/cros/requisition_util.cc
similarity index 97%
rename from requisition_util.cc
rename to cros/requisition_util.cc
index 5445bce..6296d0b 100644
--- a/requisition_util.cc
+++ b/cros/requisition_util.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/requisition_util.h"
+#include "update_engine/cros/requisition_util.h"
#include <memory>
#include <vector>
diff --git a/requisition_util.h b/cros/requisition_util.h
similarity index 86%
rename from requisition_util.h
rename to cros/requisition_util.h
index 8577ee7..6ec4783 100644
--- a/requisition_util.h
+++ b/cros/requisition_util.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_REQUISITION_UTIL_H_
-#define UPDATE_ENGINE_REQUISITION_UTIL_H_
+#ifndef UPDATE_ENGINE_CROS_REQUISITION_UTIL_H_
+#define UPDATE_ENGINE_CROS_REQUISITION_UTIL_H_
#include <string>
@@ -29,4 +29,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_REQUISITION_UTIL_H_
+#endif // UPDATE_ENGINE_CROS_REQUISITION_UTIL_H_
diff --git a/requisition_util_unittest.cc b/cros/requisition_util_unittest.cc
similarity index 97%
rename from requisition_util_unittest.cc
rename to cros/requisition_util_unittest.cc
index c21c9c7..269585e 100644
--- a/requisition_util_unittest.cc
+++ b/cros/requisition_util_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/requisition_util.h"
+#include "update_engine/cros/requisition_util.h"
#include <string>
diff --git a/shill_proxy.cc b/cros/shill_proxy.cc
similarity index 93%
rename from shill_proxy.cc
rename to cros/shill_proxy.cc
index d398bba..a3c8543 100644
--- a/shill_proxy.cc
+++ b/cros/shill_proxy.cc
@@ -14,9 +14,9 @@
// limitations under the License.
//
-#include "update_engine/shill_proxy.h"
+#include "update_engine/cros/shill_proxy.h"
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
using org::chromium::flimflam::ManagerProxy;
using org::chromium::flimflam::ManagerProxyInterface;
diff --git a/shill_proxy.h b/cros/shill_proxy.h
similarity index 88%
rename from shill_proxy.h
rename to cros/shill_proxy.h
index 4b466c9..aff428a 100644
--- a/shill_proxy.h
+++ b/cros/shill_proxy.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_SHILL_PROXY_H_
-#define UPDATE_ENGINE_SHILL_PROXY_H_
+#ifndef UPDATE_ENGINE_CROS_SHILL_PROXY_H_
+#define UPDATE_ENGINE_CROS_SHILL_PROXY_H_
#include <memory>
#include <string>
@@ -25,7 +25,7 @@
#include <dbus/object_path.h>
#include <shill/dbus-proxies.h>
-#include "update_engine/shill_proxy_interface.h"
+#include "update_engine/cros/shill_proxy_interface.h"
namespace chromeos_update_engine {
@@ -51,4 +51,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_SHILL_PROXY_H_
+#endif // UPDATE_ENGINE_CROS_SHILL_PROXY_H_
diff --git a/shill_proxy_interface.h b/cros/shill_proxy_interface.h
similarity index 91%
rename from shill_proxy_interface.h
rename to cros/shill_proxy_interface.h
index 5f6b44e..19e81f3 100644
--- a/shill_proxy_interface.h
+++ b/cros/shill_proxy_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_SHILL_PROXY_INTERFACE_H_
-#define UPDATE_ENGINE_SHILL_PROXY_INTERFACE_H_
+#ifndef UPDATE_ENGINE_CROS_SHILL_PROXY_INTERFACE_H_
+#define UPDATE_ENGINE_CROS_SHILL_PROXY_INTERFACE_H_
#include <memory>
#include <string>
@@ -53,4 +53,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_SHILL_PROXY_INTERFACE_H_
+#endif // UPDATE_ENGINE_CROS_SHILL_PROXY_INTERFACE_H_
diff --git a/update_attempter.cc b/cros/update_attempter.cc
similarity index 98%
rename from update_attempter.cc
rename to cros/update_attempter.cc
index 38b0f82..e8cb291 100644
--- a/update_attempter.cc
+++ b/cros/update_attempter.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/update_attempter.h"
+#include "update_engine/cros/update_attempter.h"
#include <stdint.h>
@@ -47,26 +47,26 @@
#include "update_engine/common/clock_interface.h"
#include "update_engine/common/constants.h"
#include "update_engine/common/dlcservice_interface.h"
+#include "update_engine/common/download_action.h"
#include "update_engine/common/excluder_interface.h"
#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/platform_constants.h"
#include "update_engine/common/prefs.h"
#include "update_engine/common/prefs_interface.h"
#include "update_engine/common/subprocess.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/common/utils.h"
+#include "update_engine/cros/omaha_request_action.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/omaha_response_handler_action.h"
+#include "update_engine/cros/omaha_utils.h"
+#include "update_engine/cros/p2p_manager.h"
+#include "update_engine/cros/payload_state_interface.h"
+#include "update_engine/cros/power_manager_interface.h"
#include "update_engine/libcurl_http_fetcher.h"
-#include "update_engine/metrics_reporter_interface.h"
-#include "update_engine/omaha_request_action.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/omaha_response_handler_action.h"
-#include "update_engine/omaha_utils.h"
-#include "update_engine/p2p_manager.h"
-#include "update_engine/payload_consumer/download_action.h"
#include "update_engine/payload_consumer/filesystem_verifier_action.h"
#include "update_engine/payload_consumer/postinstall_runner_action.h"
-#include "update_engine/payload_state_interface.h"
-#include "update_engine/power_manager_interface.h"
-#include "update_engine/system_state.h"
#include "update_engine/update_boot_flags_action.h"
#include "update_engine/update_manager/policy.h"
#include "update_engine/update_manager/policy_utils.h"
diff --git a/update_attempter.h b/cros/update_attempter.h
similarity index 97%
rename from update_attempter.h
rename to cros/update_attempter.h
index 3a1bef4..0f4c952 100644
--- a/update_attempter.h
+++ b/cros/update_attempter.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_UPDATE_ATTEMPTER_H_
-#define UPDATE_ENGINE_UPDATE_ATTEMPTER_H_
+#ifndef UPDATE_ENGINE_CROS_UPDATE_ATTEMPTER_H_
+#define UPDATE_ENGINE_CROS_UPDATE_ATTEMPTER_H_
#include <time.h>
@@ -30,22 +30,22 @@
#include <base/time/time.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#if USE_CHROME_NETWORK_PROXY
-#include "update_engine/chrome_browser_proxy_resolver.h"
-#endif // USE_CHROME_NETWORK_PROXY
#include "update_engine/certificate_checker.h"
#include "update_engine/client_library/include/update_engine/update_status.h"
#include "update_engine/common/action_processor.h"
#include "update_engine/common/cpu_limiter.h"
+#include "update_engine/common/download_action.h"
#include "update_engine/common/excluder_interface.h"
#include "update_engine/common/proxy_resolver.h"
-#include "update_engine/omaha_request_builder_xml.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/omaha_response_handler_action.h"
-#include "update_engine/payload_consumer/download_action.h"
+#include "update_engine/common/service_observer_interface.h"
+#include "update_engine/common/system_state.h"
+#if USE_CHROME_NETWORK_PROXY
+#include "update_engine/cros/chrome_browser_proxy_resolver.h"
+#endif // USE_CHROME_NETWORK_PROXY
+#include "update_engine/cros/omaha_request_builder_xml.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/omaha_response_handler_action.h"
#include "update_engine/payload_consumer/postinstall_runner_action.h"
-#include "update_engine/service_observer_interface.h"
-#include "update_engine/system_state.h"
#include "update_engine/update_manager/policy.h"
#include "update_engine/update_manager/staging_utils.h"
#include "update_engine/update_manager/update_manager.h"
@@ -150,7 +150,7 @@
// UPDATED_NEED_REBOOT. Returns true on success, false otherwise.
bool RebootIfNeeded();
- // Sets the DLC as active or inactive. See common_service.h
+ // Sets the DLC as active or inactive. See chromeos/common_service.h
virtual bool SetDlcActiveValue(bool is_active, const std::string& dlc_id);
// DownloadActionDelegate methods:
@@ -573,4 +573,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_UPDATE_ATTEMPTER_H_
+#endif // UPDATE_ENGINE_CROS_UPDATE_ATTEMPTER_H_
diff --git a/update_attempter_unittest.cc b/cros/update_attempter_unittest.cc
similarity index 99%
rename from update_attempter_unittest.cc
rename to cros/update_attempter_unittest.cc
index 767bb82..f3211a0 100644
--- a/update_attempter_unittest.cc
+++ b/cros/update_attempter_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/update_attempter.h"
+#include "update_engine/cros/update_attempter.h"
#include <stdint.h>
@@ -43,16 +43,16 @@
#include "update_engine/common/mock_action_processor.h"
#include "update_engine/common/mock_http_fetcher.h"
#include "update_engine/common/mock_prefs.h"
+#include "update_engine/common/mock_service_observer.h"
#include "update_engine/common/platform_constants.h"
#include "update_engine/common/prefs.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/fake_system_state.h"
+#include "update_engine/cros/fake_system_state.h"
+#include "update_engine/cros/mock_p2p_manager.h"
+#include "update_engine/cros/mock_payload_state.h"
+#include "update_engine/cros/omaha_utils.h"
#include "update_engine/libcurl_http_fetcher.h"
-#include "update_engine/mock_p2p_manager.h"
-#include "update_engine/mock_payload_state.h"
-#include "update_engine/mock_service_observer.h"
-#include "update_engine/omaha_utils.h"
#include "update_engine/payload_consumer/filesystem_verifier_action.h"
#include "update_engine/payload_consumer/install_plan.h"
#include "update_engine/payload_consumer/payload_constants.h"
@@ -1722,7 +1722,6 @@
// but the update is being deferred by the Policy.
OmahaResponseHandlerAction response_action(&fake_system_state_);
response_action.install_plan_.version = "a.b.c.d";
- response_action.install_plan_.system_version = "b.c.d.e";
response_action.install_plan_.payloads.push_back(
{.size = 1234ULL, .type = InstallPayloadType::kFull});
// Inform the UpdateAttempter that the OmahaResponseHandlerAction has
diff --git a/update_engine_client.cc b/cros/update_engine_client.cc
similarity index 99%
rename from update_engine_client.cc
rename to cros/update_engine_client.cc
index 31448ea..6f20f11 100644
--- a/update_engine_client.cc
+++ b/cros/update_engine_client.cc
@@ -37,7 +37,7 @@
#include "update_engine/client.h"
#include "update_engine/common/error_code.h"
#include "update_engine/common/error_code_utils.h"
-#include "update_engine/omaha_utils.h"
+#include "update_engine/cros/omaha_utils.h"
#include "update_engine/status_update_handler.h"
#include "update_engine/update_status.h"
#include "update_engine/update_status_utils.h"
diff --git a/payload_consumer/download_action.cc b/download_action.cc
similarity index 98%
rename from payload_consumer/download_action.cc
rename to download_action.cc
index ea99892..10dffd2 100644
--- a/payload_consumer/download_action.cc
+++ b/download_action.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/payload_consumer/download_action.h"
+#include "update_engine/common/download_action.h"
#include <errno.h>
@@ -30,9 +30,9 @@
#include "update_engine/common/error_code_utils.h"
#include "update_engine/common/multi_range_http_fetcher.h"
#include "update_engine/common/utils.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/p2p_manager.h"
-#include "update_engine/payload_state_interface.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/p2p_manager.h"
+#include "update_engine/cros/payload_state_interface.h"
using base::FilePath;
using std::string;
diff --git a/payload_consumer/download_action_android_unittest.cc b/download_action_android_unittest.cc
similarity index 97%
rename from payload_consumer/download_action_android_unittest.cc
rename to download_action_android_unittest.cc
index f78845f..f222977 100644
--- a/payload_consumer/download_action_android_unittest.cc
+++ b/download_action_android_unittest.cc
@@ -23,10 +23,10 @@
#include "update_engine/common/action_pipe.h"
#include "update_engine/common/boot_control_stub.h"
#include "update_engine/common/constants.h"
+#include "update_engine/common/download_action.h"
#include "update_engine/common/mock_http_fetcher.h"
#include "update_engine/common/mock_prefs.h"
#include "update_engine/common/test_utils.h"
-#include "update_engine/payload_consumer/download_action.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
diff --git a/payload_consumer/download_action_unittest.cc b/download_action_unittest.cc
similarity index 98%
rename from payload_consumer/download_action_unittest.cc
rename to download_action_unittest.cc
index 9daa791..5264b0f 100644
--- a/payload_consumer/download_action_unittest.cc
+++ b/download_action_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/payload_consumer/download_action.h"
+#include "update_engine/common/download_action.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -34,14 +34,14 @@
#include "update_engine/common/action_pipe.h"
#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/mock_download_action.h"
#include "update_engine/common/mock_http_fetcher.h"
#include "update_engine/common/mock_prefs.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/fake_p2p_manager_configuration.h"
-#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_file_writer.h"
-#include "update_engine/payload_consumer/mock_download_action.h"
+#include "update_engine/cros/fake_p2p_manager_configuration.h"
+#include "update_engine/cros/fake_system_state.h"
+#include "update_engine/payload_consumer/mock_file_writer.h"
#include "update_engine/update_manager/fake_update_manager.h"
namespace chromeos_update_engine {
diff --git a/image_properties_android.cc b/image_properties_android.cc
deleted file mode 100644
index 2d418b3..0000000
--- a/image_properties_android.cc
+++ /dev/null
@@ -1,246 +0,0 @@
-//
-// Copyright (C) 2015 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.
-//
-
-#include "update_engine/image_properties.h"
-
-#include <fcntl.h>
-
-#include <string>
-
-#include <android-base/properties.h>
-#include <base/logging.h>
-#include <base/strings/string_util.h>
-#include <bootloader_message/bootloader_message.h>
-#include <brillo/osrelease_reader.h>
-#include <brillo/strings/string_utils.h>
-
-#include "update_engine/common/boot_control_interface.h"
-#include "update_engine/common/constants.h"
-#include "update_engine/common/platform_constants.h"
-#include "update_engine/common/prefs_interface.h"
-#include "update_engine/common/utils.h"
-#include "update_engine/system_state.h"
-
-using android::base::GetProperty;
-using std::string;
-
-namespace chromeos_update_engine {
-
-namespace {
-
-// Build time properties name used in Android Things.
-const char kProductId[] = "product_id";
-const char kProductVersion[] = "product_version";
-const char kSystemId[] = "system_id";
-const char kSystemVersion[] = "system_version";
-
-// The path to the product_components file which stores the version of each
-// components in OEM partition.
-const char kProductComponentsPath[] = "/oem/os-release.d/product_components";
-
-// Prefs used to store the powerwash settings.
-const char kPrefsImgPropPowerwashAllowed[] = "img-prop-powerwash-allowed";
-
-// System properties that identifies the "board".
-const char kPropProductName[] = "ro.product.name";
-const char kPropBuildFingerprint[] = "ro.build.fingerprint";
-const char kPropBuildType[] = "ro.build.type";
-
-// Default channel from factory.prop
-const char kPropDefaultChannel[] = "ro.update.default_channel";
-
-// A prefix added to the path, used for testing.
-const char* root_prefix = nullptr;
-
-string GetStringWithDefault(const brillo::OsReleaseReader& osrelease,
- const string& key,
- const string& default_value) {
- string result;
- if (osrelease.GetString(key, &result))
- return result;
- LOG(INFO) << "Cannot load ImageProperty " << key << ", using default value "
- << default_value;
- return default_value;
-}
-
-// Open misc partition for read or write and output the fd in |out_fd|.
-bool OpenMisc(bool write, int* out_fd) {
- string misc_device;
- int flags = write ? O_WRONLY | O_SYNC : O_RDONLY;
- if (root_prefix) {
- // Use a file for unittest and create one if doesn't exist.
- misc_device = base::FilePath(root_prefix).Append("misc").value();
- if (write)
- flags |= O_CREAT;
- } else {
- string err;
- misc_device = get_bootloader_message_blk_device(&err);
- if (misc_device.empty()) {
- LOG(ERROR) << "Unable to get misc block device: " << err;
- return false;
- }
- }
-
- int fd = HANDLE_EINTR(open(misc_device.c_str(), flags, 0600));
- if (fd < 0) {
- PLOG(ERROR) << "Opening misc failed";
- return false;
- }
- *out_fd = fd;
- return true;
-}
-
-// The offset and size of the channel field in misc partition.
-constexpr size_t kChannelOffset =
- BOOTLOADER_MESSAGE_OFFSET_IN_MISC +
- offsetof(bootloader_message_ab, update_channel);
-constexpr size_t kChannelSize = sizeof(bootloader_message_ab::update_channel);
-
-// Read channel from misc partition to |out_channel|, return false if unable to
-// read misc or no channel is set in misc.
-bool ReadChannelFromMisc(string* out_channel) {
- int fd;
- TEST_AND_RETURN_FALSE(OpenMisc(false, &fd));
- ScopedFdCloser fd_closer(&fd);
- char channel[kChannelSize] = {0};
- ssize_t bytes_read = 0;
- if (!utils::PReadAll(
- fd, channel, kChannelSize - 1, kChannelOffset, &bytes_read) ||
- bytes_read != kChannelSize - 1) {
- PLOG(ERROR) << "Reading update channel from misc failed";
- return false;
- }
- if (channel[0] == '\0') {
- LOG(INFO) << "No channel set in misc.";
- return false;
- }
- if (!base::EndsWith(channel, "-channel", base::CompareCase::SENSITIVE)) {
- LOG(ERROR) << "Channel " << channel << " doesn't end with -channel.";
- return false;
- }
- out_channel->assign(channel);
- return true;
-}
-
-// Write |in_channel| to misc partition, return false if failed to write.
-bool WriteChannelToMisc(const string& in_channel) {
- int fd;
- TEST_AND_RETURN_FALSE(OpenMisc(true, &fd));
- ScopedFdCloser fd_closer(&fd);
- if (in_channel.size() >= kChannelSize) {
- LOG(ERROR) << "Channel name is too long: " << in_channel
- << ", the maximum length is " << kChannelSize - 1;
- return false;
- }
- char channel[kChannelSize] = {0};
- memcpy(channel, in_channel.data(), in_channel.size());
- if (!utils::PWriteAll(fd, channel, kChannelSize, kChannelOffset)) {
- PLOG(ERROR) << "Writing update channel to misc failed";
- return false;
- }
- return true;
-}
-
-string GetTargetChannel() {
- string channel;
- if (!ReadChannelFromMisc(&channel))
- channel = GetProperty(kPropDefaultChannel, "stable-channel");
- return channel;
-}
-} // namespace
-
-namespace test {
-void SetImagePropertiesRootPrefix(const char* test_root_prefix) {
- root_prefix = test_root_prefix;
-}
-} // namespace test
-
-ImageProperties LoadImageProperties(SystemState* system_state) {
- ImageProperties result;
-
- brillo::OsReleaseReader osrelease;
- if (root_prefix)
- osrelease.LoadTestingOnly(base::FilePath(root_prefix));
- else
- osrelease.Load();
- result.product_id =
- GetStringWithDefault(osrelease, kProductId, "invalid-product");
- result.system_id = GetStringWithDefault(
- osrelease, kSystemId, "developer-boards:brillo-starter-board");
- // Update the system id to match the prefix of product id for testing.
- string prefix, not_used, system_id;
- if (brillo::string_utils::SplitAtFirst(
- result.product_id, ":", &prefix, ¬_used, false) &&
- brillo::string_utils::SplitAtFirst(
- result.system_id, ":", ¬_used, &system_id, false)) {
- result.system_id = prefix + ":" + system_id;
- }
- result.canary_product_id = result.product_id;
- result.version = GetStringWithDefault(osrelease, kProductVersion, "0.0.0.0");
- result.system_version =
- GetStringWithDefault(osrelease, kSystemVersion, "0.0.0.0");
- // Can't read it with OsReleaseReader because it has multiple lines.
- utils::ReadFile(kProductComponentsPath, &result.product_components);
-
- result.board = GetProperty(kPropProductName, "brillo");
- result.build_fingerprint = GetProperty(kPropBuildFingerprint, "none");
- result.build_type = GetProperty(kPropBuildType, "");
-
- // Android doesn't have channel information in system image, we try to read
- // the channel of current slot from prefs and then fallback to use the
- // persisted target channel as current channel.
- string current_channel_key =
- kPrefsChannelOnSlotPrefix +
- std::to_string(system_state->boot_control()->GetCurrentSlot());
- string current_channel;
- if (!system_state->prefs()->Exists(current_channel_key) ||
- !system_state->prefs()->GetString(current_channel_key, ¤t_channel))
- current_channel = GetTargetChannel();
- result.current_channel = current_channel;
- result.allow_arbitrary_channels = true;
-
- // Brillo only supports the official omaha URL.
- result.omaha_url = constants::kOmahaDefaultProductionURL;
-
- return result;
-}
-
-MutableImageProperties LoadMutableImageProperties(SystemState* system_state) {
- MutableImageProperties result;
- result.target_channel = GetTargetChannel();
- if (!system_state->prefs()->GetBoolean(kPrefsImgPropPowerwashAllowed,
- &result.is_powerwash_allowed)) {
- result.is_powerwash_allowed = false;
- }
- return result;
-}
-
-bool StoreMutableImageProperties(SystemState* system_state,
- const MutableImageProperties& properties) {
- bool ret = true;
- if (!WriteChannelToMisc(properties.target_channel))
- ret = false;
- if (!system_state->prefs()->SetBoolean(kPrefsImgPropPowerwashAllowed,
- properties.is_powerwash_allowed))
- ret = false;
- return ret;
-}
-
-void LogImageProperties() {
- // TODO(*): Implement this.
-}
-
-} // namespace chromeos_update_engine
diff --git a/image_properties_android_unittest.cc b/image_properties_android_unittest.cc
deleted file mode 100644
index 607284a..0000000
--- a/image_properties_android_unittest.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// Copyright (C) 2017 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.
-//
-
-#include "update_engine/image_properties.h"
-
-#include <string>
-
-#include <base/files/file_util.h>
-#include <base/files/scoped_temp_dir.h>
-#include <gtest/gtest.h>
-
-#include "update_engine/common/constants.h"
-#include "update_engine/common/fake_prefs.h"
-#include "update_engine/common/test_utils.h"
-#include "update_engine/fake_system_state.h"
-
-using chromeos_update_engine::test_utils::WriteFileString;
-using std::string;
-
-namespace chromeos_update_engine {
-
-class ImagePropertiesTest : public ::testing::Test {
- protected:
- void SetUp() override {
- // Create a uniquely named test directory.
- ASSERT_TRUE(tempdir_.CreateUniqueTempDir());
- osrelease_dir_ = tempdir_.GetPath().Append("etc/os-release.d");
- EXPECT_TRUE(base::CreateDirectory(osrelease_dir_));
- test::SetImagePropertiesRootPrefix(tempdir_.GetPath().value().c_str());
- }
-
- void WriteOsRelease(const string& key, const string& value) {
- ASSERT_TRUE(WriteFileString(osrelease_dir_.Append(key).value(), value));
- }
-
- void WriteChannel(const string& channel) {
- string misc(2080, '\0');
- misc += channel;
- misc.resize(4096);
- ASSERT_TRUE(
- WriteFileString(tempdir_.GetPath().Append("misc").value(), misc));
- }
-
- FakeSystemState fake_system_state_;
-
- base::ScopedTempDir tempdir_;
- base::FilePath osrelease_dir_;
-};
-
-TEST_F(ImagePropertiesTest, SimpleTest) {
- WriteOsRelease("product_id", "abc");
- WriteOsRelease("system_id", "def");
- WriteOsRelease("product_version", "1.2.3.4");
- WriteOsRelease("system_version", "5.6.7.8");
- ImageProperties props = LoadImageProperties(&fake_system_state_);
- EXPECT_EQ("abc", props.product_id);
- EXPECT_EQ("def", props.system_id);
- EXPECT_EQ("1.2.3.4", props.version);
- EXPECT_EQ("5.6.7.8", props.system_version);
- EXPECT_EQ("stable-channel", props.current_channel);
- EXPECT_EQ(constants::kOmahaDefaultProductionURL, props.omaha_url);
-}
-
-TEST_F(ImagePropertiesTest, IDPrefixTest) {
- WriteOsRelease("product_id", "abc:def");
- WriteOsRelease("system_id", "foo:bar");
- ImageProperties props = LoadImageProperties(&fake_system_state_);
- EXPECT_EQ("abc:def", props.product_id);
- EXPECT_EQ("abc:bar", props.system_id);
-}
-
-TEST_F(ImagePropertiesTest, IDInvalidPrefixTest) {
- WriteOsRelease("product_id", "def");
- WriteOsRelease("system_id", "foo:bar");
- ImageProperties props = LoadImageProperties(&fake_system_state_);
- EXPECT_EQ("def", props.product_id);
- EXPECT_EQ("foo:bar", props.system_id);
-
- WriteOsRelease("product_id", "abc:def");
- WriteOsRelease("system_id", "bar");
- props = LoadImageProperties(&fake_system_state_);
- EXPECT_EQ("abc:def", props.product_id);
- EXPECT_EQ("bar", props.system_id);
-}
-
-TEST_F(ImagePropertiesTest, LoadChannelTest) {
- WriteChannel("unittest-channel");
- ImageProperties props = LoadImageProperties(&fake_system_state_);
- EXPECT_EQ("unittest-channel", props.current_channel);
-}
-
-TEST_F(ImagePropertiesTest, DefaultStableChannelTest) {
- WriteChannel("");
- ImageProperties props = LoadImageProperties(&fake_system_state_);
- EXPECT_EQ("stable-channel", props.current_channel);
-}
-
-TEST_F(ImagePropertiesTest, StoreLoadMutableChannelTest) {
- FakePrefs prefs;
- fake_system_state_.set_prefs(&prefs);
- WriteChannel("previous-channel");
- MutableImageProperties props;
- props.target_channel = "new-channel";
- EXPECT_TRUE(StoreMutableImageProperties(&fake_system_state_, props));
- MutableImageProperties loaded_props =
- LoadMutableImageProperties(&fake_system_state_);
- EXPECT_EQ(props.target_channel, loaded_props.target_channel);
-}
-
-} // namespace chromeos_update_engine
diff --git a/main.cc b/main.cc
index ceb5b56..a23a08b 100644
--- a/main.cc
+++ b/main.cc
@@ -23,11 +23,11 @@
#include <base/logging.h>
#include <brillo/flag_helper.h>
+#include "update_engine/common/daemon_base.h"
+#include "update_engine/common/logging.h"
#include "update_engine/common/subprocess.h"
#include "update_engine/common/terminator.h"
#include "update_engine/common/utils.h"
-#include "update_engine/daemon_base.h"
-#include "update_engine/logging.h"
using std::string;
diff --git a/metrics_utils.cc b/metrics_utils.cc
index a947a7e..34da5a1 100644
--- a/metrics_utils.cc
+++ b/metrics_utils.cc
@@ -23,7 +23,6 @@
#include "update_engine/common/clock_interface.h"
#include "update_engine/common/constants.h"
#include "update_engine/common/utils.h"
-#include "update_engine/system_state.h"
using base::Time;
using base::TimeDelta;
@@ -295,48 +294,6 @@
return metrics::ConnectionType::kUnknown;
}
-bool WallclockDurationHelper(SystemState* system_state,
- const std::string& state_variable_key,
- TimeDelta* out_duration) {
- bool ret = false;
-
- Time now = system_state->clock()->GetWallclockTime();
- int64_t stored_value;
- if (system_state->prefs()->GetInt64(state_variable_key, &stored_value)) {
- Time stored_time = Time::FromInternalValue(stored_value);
- if (stored_time > now) {
- LOG(ERROR) << "Stored time-stamp used for " << state_variable_key
- << " is in the future.";
- } else {
- *out_duration = now - stored_time;
- ret = true;
- }
- }
-
- if (!system_state->prefs()->SetInt64(state_variable_key,
- now.ToInternalValue())) {
- LOG(ERROR) << "Error storing time-stamp in " << state_variable_key;
- }
-
- return ret;
-}
-
-bool MonotonicDurationHelper(SystemState* system_state,
- int64_t* storage,
- TimeDelta* out_duration) {
- bool ret = false;
-
- Time now = system_state->clock()->GetMonotonicTime();
- if (*storage != 0) {
- Time stored_time = Time::FromInternalValue(*storage);
- *out_duration = now - stored_time;
- ret = true;
- }
- *storage = now.ToInternalValue();
-
- return ret;
-}
-
int64_t GetPersistedValue(const std::string& key, PrefsInterface* prefs) {
CHECK(prefs);
if (!prefs->Exists(key))
@@ -406,8 +363,7 @@
return false;
Time system_updated_at = Time::FromInternalValue(stored_value);
- base::TimeDelta time_to_reboot =
- clock->GetMonotonicTime() - system_updated_at;
+ TimeDelta time_to_reboot = clock->GetMonotonicTime() - system_updated_at;
if (time_to_reboot.ToInternalValue() < 0) {
LOG(ERROR) << "time_to_reboot is negative - system_updated_at: "
<< utils::ToString(system_updated_at);
diff --git a/metrics_utils.h b/metrics_utils.h
index 8f1aad1..5952ec3 100644
--- a/metrics_utils.h
+++ b/metrics_utils.h
@@ -22,11 +22,11 @@
#include <base/time/time.h>
#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/connection_utils.h"
#include "update_engine/common/error_code.h"
+#include "update_engine/common/metrics_constants.h"
+#include "update_engine/common/metrics_reporter_interface.h"
#include "update_engine/common/prefs_interface.h"
-#include "update_engine/connection_utils.h"
-#include "update_engine/metrics_constants.h"
-#include "update_engine/metrics_reporter_interface.h"
namespace chromeos_update_engine {
@@ -50,29 +50,6 @@
metrics::ConnectionType GetConnectionType(ConnectionType type,
ConnectionTethering tethering);
-// This function returns the duration on the wallclock since the last
-// time it was called for the same |state_variable_key| value.
-//
-// If the function returns |true|, the duration (always non-negative)
-// is returned in |out_duration|. If the function returns |false|
-// something went wrong or there was no previous measurement.
-bool WallclockDurationHelper(SystemState* system_state,
- const std::string& state_variable_key,
- base::TimeDelta* out_duration);
-
-// This function returns the duration on the monotonic clock since the
-// last time it was called for the same |storage| pointer.
-//
-// You should pass a pointer to a 64-bit integer in |storage| which
-// should be initialized to 0.
-//
-// If the function returns |true|, the duration (always non-negative)
-// is returned in |out_duration|. If the function returns |false|
-// something went wrong or there was no previous measurement.
-bool MonotonicDurationHelper(SystemState* system_state,
- int64_t* storage,
- base::TimeDelta* out_duration);
-
// Returns the persisted value from prefs for the given key. It also
// validates that the value returned is non-negative.
int64_t GetPersistedValue(const std::string& key, PrefsInterface* prefs);
diff --git a/metrics_utils_unittest.cc b/metrics_utils_unittest.cc
index 6ea996f..cedd269 100644
--- a/metrics_utils_unittest.cc
+++ b/metrics_utils_unittest.cc
@@ -20,7 +20,6 @@
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/fake_prefs.h"
-#include "update_engine/fake_system_state.h"
namespace chromeos_update_engine {
namespace metrics_utils {
@@ -74,116 +73,5 @@
GetConnectionType(ConnectionType::kWifi, ConnectionTethering::kUnknown));
}
-TEST(MetricsUtilsTest, WallclockDurationHelper) {
- FakeSystemState fake_system_state;
- FakeClock fake_clock;
- base::TimeDelta duration;
- const std::string state_variable_key = "test-prefs";
- FakePrefs fake_prefs;
-
- fake_system_state.set_clock(&fake_clock);
- fake_system_state.set_prefs(&fake_prefs);
-
- // Initialize wallclock to 1 sec.
- fake_clock.SetWallclockTime(base::Time::FromInternalValue(1000000));
-
- // First time called so no previous measurement available.
- EXPECT_FALSE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
-
- // Next time, we should get zero since the clock didn't advance.
- EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
-
- // We can also call it as many times as we want with it being
- // considered a failure.
- EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
- EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
-
- // Advance the clock one second, then we should get 1 sec on the
- // next call and 0 sec on the subsequent call.
- fake_clock.SetWallclockTime(base::Time::FromInternalValue(2000000));
- EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- EXPECT_EQ(duration.InSeconds(), 1);
- EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
-
- // Advance clock two seconds and we should get 2 sec and then 0 sec.
- fake_clock.SetWallclockTime(base::Time::FromInternalValue(4000000));
- EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- EXPECT_EQ(duration.InSeconds(), 2);
- EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
-
- // There's a possibility that the wallclock can go backwards (NTP
- // adjustments, for example) so check that we properly handle this
- // case.
- fake_clock.SetWallclockTime(base::Time::FromInternalValue(3000000));
- EXPECT_FALSE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- fake_clock.SetWallclockTime(base::Time::FromInternalValue(4000000));
- EXPECT_TRUE(metrics_utils::WallclockDurationHelper(
- &fake_system_state, state_variable_key, &duration));
- EXPECT_EQ(duration.InSeconds(), 1);
-}
-
-TEST(MetricsUtilsTest, MonotonicDurationHelper) {
- int64_t storage = 0;
- FakeSystemState fake_system_state;
- FakeClock fake_clock;
- base::TimeDelta duration;
-
- fake_system_state.set_clock(&fake_clock);
-
- // Initialize monotonic clock to 1 sec.
- fake_clock.SetMonotonicTime(base::Time::FromInternalValue(1000000));
-
- // First time called so no previous measurement available.
- EXPECT_FALSE(metrics_utils::MonotonicDurationHelper(
- &fake_system_state, &storage, &duration));
-
- // Next time, we should get zero since the clock didn't advance.
- EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
- &fake_system_state, &storage, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
-
- // We can also call it as many times as we want with it being
- // considered a failure.
- EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
- &fake_system_state, &storage, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
- EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
- &fake_system_state, &storage, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
-
- // Advance the clock one second, then we should get 1 sec on the
- // next call and 0 sec on the subsequent call.
- fake_clock.SetMonotonicTime(base::Time::FromInternalValue(2000000));
- EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
- &fake_system_state, &storage, &duration));
- EXPECT_EQ(duration.InSeconds(), 1);
- EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
- &fake_system_state, &storage, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
-
- // Advance clock two seconds and we should get 2 sec and then 0 sec.
- fake_clock.SetMonotonicTime(base::Time::FromInternalValue(4000000));
- EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
- &fake_system_state, &storage, &duration));
- EXPECT_EQ(duration.InSeconds(), 2);
- EXPECT_TRUE(metrics_utils::MonotonicDurationHelper(
- &fake_system_state, &storage, &duration));
- EXPECT_EQ(duration.InSeconds(), 0);
-}
-
} // namespace metrics_utils
} // namespace chromeos_update_engine
diff --git a/mock_boot_control_hal.h b/mock_boot_control_hal.h
deleted file mode 100644
index 4e9cb50..0000000
--- a/mock_boot_control_hal.h
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright (C) 2018 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.
-//
-
-#include <android/hardware/boot/1.0/IBootControl.h>
-#include <stdint.h>
-
-#include <gmock/gmock.h>
-
-namespace chromeos_update_engine {
-
-class MockBootControlHal
- : public ::android::hardware::boot::V1_0::IBootControl {
- public:
- MOCK_METHOD0(getNumberSlots, ::android::hardware::Return<uint32_t>());
- MOCK_METHOD0(getCurrentSlot, ::android::hardware::Return<uint32_t>());
- MOCK_METHOD1(markBootSuccessful,
- ::android::hardware::Return<void>(markBootSuccessful_cb));
- MOCK_METHOD2(setActiveBootSlot,
- ::android::hardware::Return<void>(uint32_t,
- setActiveBootSlot_cb));
- MOCK_METHOD2(setSlotAsUnbootable,
- ::android::hardware::Return<void>(uint32_t,
- setSlotAsUnbootable_cb));
- MOCK_METHOD1(
- isSlotBootable,
- ::android::hardware::Return<::android::hardware::boot::V1_0::BoolResult>(
- uint32_t));
- MOCK_METHOD1(
- isSlotMarkedSuccessful,
- ::android::hardware::Return<::android::hardware::boot::V1_0::BoolResult>(
- uint32_t));
- MOCK_METHOD2(getSuffix,
- ::android::hardware::Return<void>(uint32_t, getSuffix_cb));
-};
-
-} // namespace chromeos_update_engine
diff --git a/mock_libcurl_http_fetcher.h b/mock_libcurl_http_fetcher.h
index a8ef0f4..a14f953 100644
--- a/mock_libcurl_http_fetcher.h
+++ b/mock_libcurl_http_fetcher.h
@@ -19,7 +19,7 @@
#include <gmock/gmock.h>
-#include "update_engine/connection_manager_interface.h"
+#include "update_engine/libcurl_http_fetcher.h"
namespace chromeos_update_engine {
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index a3989d6..30bd1ef 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -41,6 +41,7 @@
#include <puffin/puffpatch.h>
#include "update_engine/common/constants.h"
+#include "update_engine/common/download_action.h"
#include "update_engine/common/error_code.h"
#include "update_engine/common/error_code_utils.h"
#include "update_engine/common/hardware_interface.h"
@@ -50,7 +51,6 @@
#include "update_engine/payload_consumer/bzip_extent_writer.h"
#include "update_engine/payload_consumer/cached_file_descriptor.h"
#include "update_engine/payload_consumer/certificate_parser_interface.h"
-#include "update_engine/payload_consumer/download_action.h"
#include "update_engine/payload_consumer/extent_reader.h"
#include "update_engine/payload_consumer/extent_writer.h"
#include "update_engine/payload_consumer/partition_update_generator_interface.h"
@@ -345,6 +345,7 @@
<< "Trusting metadata size in payload = " << metadata_size_;
}
+ // NOLINTNEXTLINE(whitespace/braces)
auto [payload_verifier, perform_verification] = CreatePayloadVerifier();
if (!payload_verifier) {
LOG(ERROR) << "Failed to create payload verifier.";
@@ -1285,6 +1286,7 @@
ErrorCode::kPayloadHashMismatchError,
payload_hash_calculator_.raw_hash() == update_check_response_hash);
+ // NOLINTNEXTLINE(whitespace/braces)
auto [payload_verifier, perform_verification] = CreatePayloadVerifier();
if (!perform_verification) {
LOG(WARNING) << "Not verifying signed delta payload -- missing public key.";
diff --git a/payload_consumer/delta_performer_fuzzer.cc b/payload_consumer/delta_performer_fuzzer.cc
index 73082c4..0ce5081 100644
--- a/payload_consumer/delta_performer_fuzzer.cc
+++ b/payload_consumer/delta_performer_fuzzer.cc
@@ -18,11 +18,11 @@
#include <base/logging.h>
#include <fuzzer/FuzzedDataProvider.h>
+#include "update_engine/common/download_action.h"
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_hardware.h"
#include "update_engine/common/prefs.h"
#include "update_engine/payload_consumer/delta_performer.h"
-#include "update_engine/payload_consumer/download_action.h"
#include "update_engine/payload_consumer/install_plan.h"
namespace chromeos_update_engine {
diff --git a/payload_consumer/delta_performer_integration_test.cc b/payload_consumer/delta_performer_integration_test.cc
index 74ddd27..374131e 100644
--- a/payload_consumer/delta_performer_integration_test.cc
+++ b/payload_consumer/delta_performer_integration_test.cc
@@ -37,12 +37,12 @@
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_hardware.h"
#include "update_engine/common/fake_prefs.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/mock_download_action.h"
#include "update_engine/common/mock_prefs.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/hardware_android.h"
#include "update_engine/payload_consumer/install_plan.h"
-#include "update_engine/payload_consumer/mock_download_action.h"
#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_consumer/payload_metadata.h"
#include "update_engine/payload_consumer/payload_verifier.h"
diff --git a/payload_consumer/delta_performer_unittest.cc b/payload_consumer/delta_performer_unittest.cc
index f742b1c..2f308c0 100644
--- a/payload_consumer/delta_performer_unittest.cc
+++ b/payload_consumer/delta_performer_unittest.cc
@@ -41,10 +41,10 @@
#include "update_engine/common/fake_hardware.h"
#include "update_engine/common/fake_prefs.h"
#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/mock_download_action.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
#include "update_engine/payload_consumer/fake_file_descriptor.h"
-#include "update_engine/payload_consumer/mock_download_action.h"
#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_consumer/payload_metadata.h"
#include "update_engine/payload_generator/bzip.h"
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index c7ef7b2..4a37836 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -82,11 +82,6 @@
}
string version_str = base::StringPrintf(", version: %s", version.c_str());
- if (!system_version.empty()) {
- version_str +=
- base::StringPrintf(", system_version: %s", system_version.c_str());
- }
-
string url_str = download_url;
if (base::StartsWith(
url_str, "fd://", base::CompareCase::INSENSITIVE_ASCII)) {
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index 5534fb3..ee1a72b 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -54,8 +54,6 @@
bool is_resume{false};
std::string download_url; // url to download from
std::string version; // version we are installing.
- // system version, if present and separate from version
- std::string system_version;
struct Payload {
std::vector<std::string> payload_urls; // URLs to download the payload
diff --git a/mock_file_writer.h b/payload_consumer/mock_file_writer.h
similarity index 100%
rename from mock_file_writer.h
rename to payload_consumer/mock_file_writer.h
diff --git a/payload_consumer/postinstall_runner_action_unittest.cc b/payload_consumer/postinstall_runner_action_unittest.cc
index 5910c23..cce86e9 100644
--- a/payload_consumer/postinstall_runner_action_unittest.cc
+++ b/payload_consumer/postinstall_runner_action_unittest.cc
@@ -45,7 +45,7 @@
#include "update_engine/common/subprocess.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/mock_payload_state.h"
+#include "update_engine/cros/mock_payload_state.h"
using brillo::MessageLoop;
using chromeos_update_engine::test_utils::ScopedLoopbackDeviceBinder;
diff --git a/payload_generator/generate_delta_main.cc b/payload_generator/generate_delta_main.cc
index 1944847..29ec290 100644
--- a/payload_generator/generate_delta_main.cc
+++ b/payload_generator/generate_delta_main.cc
@@ -29,13 +29,13 @@
#include <brillo/message_loops/base_message_loop.h>
#include <xz.h>
+#include "update_engine/common/download_action.h"
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_hardware.h"
#include "update_engine/common/file_fetcher.h"
#include "update_engine/common/prefs.h"
#include "update_engine/common/terminator.h"
#include "update_engine/common/utils.h"
-#include "update_engine/payload_consumer/download_action.h"
#include "update_engine/payload_consumer/filesystem_verifier_action.h"
#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
diff --git a/power_manager_android.cc b/power_manager_android.cc
deleted file mode 100644
index 63a0351..0000000
--- a/power_manager_android.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// Copyright (C) 2016 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.
-//
-
-#include "update_engine/power_manager_android.h"
-
-#include <memory>
-
-#include <base/logging.h>
-
-namespace chromeos_update_engine {
-
-namespace power_manager {
-std::unique_ptr<PowerManagerInterface> CreatePowerManager() {
- return std::unique_ptr<PowerManagerInterface>(new PowerManagerAndroid());
-}
-} // namespace power_manager
-
-bool PowerManagerAndroid::RequestReboot() {
- LOG(WARNING) << "PowerManager not implemented.";
- return false;
-}
-
-} // namespace chromeos_update_engine
diff --git a/power_manager_android.h b/power_manager_android.h
deleted file mode 100644
index 86399ab..0000000
--- a/power_manager_android.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Copyright (C) 2016 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.
-//
-
-#ifndef UPDATE_ENGINE_POWER_MANAGER_ANDROID_H_
-#define UPDATE_ENGINE_POWER_MANAGER_ANDROID_H_
-
-#include <base/macros.h>
-
-#include "update_engine/power_manager_interface.h"
-
-namespace chromeos_update_engine {
-
-class PowerManagerAndroid : public PowerManagerInterface {
- public:
- PowerManagerAndroid() = default;
- ~PowerManagerAndroid() override = default;
-
- // PowerManagerInterface overrides.
- bool RequestReboot() override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PowerManagerAndroid);
-};
-
-} // namespace chromeos_update_engine
-
-#endif // UPDATE_ENGINE_POWER_MANAGER_ANDROID_H_
diff --git a/update_boot_flags_action_unittest.cc b/update_boot_flags_action_unittest.cc
index 1b2bfa5..26cbe90 100644
--- a/update_boot_flags_action_unittest.cc
+++ b/update_boot_flags_action_unittest.cc
@@ -22,18 +22,17 @@
#include <base/bind.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_system_state.h"
+#include "update_engine/common/fake_boot_control.h"
namespace chromeos_update_engine {
class UpdateBootFlagsActionTest : public ::testing::Test {
- public:
- FakeSystemState fake_system_state_;
+ protected:
+ FakeBootControl boot_control_;
};
TEST_F(UpdateBootFlagsActionTest, SimpleTest) {
- auto boot_control = fake_system_state_.fake_boot_control();
- auto action = std::make_unique<UpdateBootFlagsAction>(boot_control);
+ auto action = std::make_unique<UpdateBootFlagsAction>(&boot_control_);
ActionProcessor processor;
processor.EnqueueAction(std::move(action));
@@ -49,9 +48,8 @@
UpdateBootFlagsAction::updated_boot_flags_ = false;
UpdateBootFlagsAction::is_running_ = false;
- auto boot_control = fake_system_state_.fake_boot_control();
- auto action1 = std::make_unique<UpdateBootFlagsAction>(boot_control);
- auto action2 = std::make_unique<UpdateBootFlagsAction>(boot_control);
+ auto action1 = std::make_unique<UpdateBootFlagsAction>(&boot_control_);
+ auto action2 = std::make_unique<UpdateBootFlagsAction>(&boot_control_);
ActionProcessor processor1, processor2;
processor1.EnqueueAction(std::move(action1));
processor2.EnqueueAction(std::move(action2));
diff --git a/update_manager/boxed_value.cc b/update_manager/boxed_value.cc
index ba84a41..907eb95 100644
--- a/update_manager/boxed_value.cc
+++ b/update_manager/boxed_value.cc
@@ -25,8 +25,8 @@
#include <base/time/time.h>
#include <base/version.h>
+#include "update_engine/common/connection_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/connection_utils.h"
#include "update_engine/update_manager/rollback_prefs.h"
#include "update_engine/update_manager/shill_provider.h"
#include "update_engine/update_manager/updater_provider.h"
diff --git a/update_manager/real_device_policy_provider.cc b/update_manager/real_device_policy_provider.cc
index 0aaf20e..05091d9 100644
--- a/update_manager/real_device_policy_provider.cc
+++ b/update_manager/real_device_policy_provider.cc
@@ -25,8 +25,8 @@
#include <base/time/time.h>
#include <policy/device_policy.h>
+#include "update_engine/common/connection_utils.h"
#include "update_engine/common/utils.h"
-#include "update_engine/connection_utils.h"
#include "update_engine/update_manager/generic_variables.h"
using base::TimeDelta;
diff --git a/update_manager/real_device_policy_provider_unittest.cc b/update_manager/real_device_policy_provider_unittest.cc
index 4699ad1..32396d6 100644
--- a/update_manager/real_device_policy_provider_unittest.cc
+++ b/update_manager/real_device_policy_provider_unittest.cc
@@ -34,7 +34,7 @@
#include "update_engine/common/test_utils.h"
#if USE_DBUS
-#include "update_engine/dbus_test_utils.h"
+#include "update_engine/cros/dbus_test_utils.h"
#endif // USE_DBUS
#include "update_engine/update_manager/umtest_utils.h"
diff --git a/update_manager/real_shill_provider.h b/update_manager/real_shill_provider.h
index ec5c570..baa2cdc 100644
--- a/update_manager/real_shill_provider.h
+++ b/update_manager/real_shill_provider.h
@@ -28,7 +28,7 @@
#include <dbus/object_path.h>
#include "update_engine/common/clock_interface.h"
-#include "update_engine/shill_proxy_interface.h"
+#include "update_engine/cros/shill_proxy_interface.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/shill_provider.h"
diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
index 505f2f8..682c233 100644
--- a/update_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -29,8 +29,8 @@
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/test_utils.h"
-#include "update_engine/dbus_test_utils.h"
-#include "update_engine/fake_shill_proxy.h"
+#include "update_engine/cros/dbus_test_utils.h"
+#include "update_engine/cros/fake_shill_proxy.h"
#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
diff --git a/update_manager/real_system_provider.cc b/update_manager/real_system_provider.cc
index 9b5bc02..4e88b07 100644
--- a/update_manager/real_system_provider.cc
+++ b/update_manager/real_system_provider.cc
@@ -27,7 +27,7 @@
#include "update_engine/common/boot_control_interface.h"
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/utils.h"
-#include "update_engine/omaha_request_params.h"
+#include "update_engine/cros/omaha_request_params.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/variable.h"
diff --git a/update_manager/real_system_provider.h b/update_manager/real_system_provider.h
index 0e68997..ffa1467 100644
--- a/update_manager/real_system_provider.h
+++ b/update_manager/real_system_provider.h
@@ -22,7 +22,7 @@
#include <base/version.h>
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/update_manager/system_provider.h"
namespace org {
diff --git a/update_manager/real_system_provider_unittest.cc b/update_manager/real_system_provider_unittest.cc
index 9757146..8add690 100644
--- a/update_manager/real_system_provider_unittest.cc
+++ b/update_manager/real_system_provider_unittest.cc
@@ -24,7 +24,7 @@
#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/fake_hardware.h"
-#include "update_engine/fake_system_state.h"
+#include "update_engine/cros/fake_system_state.h"
#include "update_engine/update_manager/umtest_utils.h"
#if USE_CHROME_KIOSK_APP
#include "kiosk-app/dbus-proxies.h"
diff --git a/update_manager/real_updater_provider.cc b/update_manager/real_updater_provider.cc
index 1548d57..e975b80 100644
--- a/update_manager/real_updater_provider.cc
+++ b/update_manager/real_updater_provider.cc
@@ -29,8 +29,8 @@
#include "update_engine/client_library/include/update_engine/update_status.h"
#include "update_engine/common/clock_interface.h"
#include "update_engine/common/prefs.h"
-#include "update_engine/omaha_request_params.h"
-#include "update_engine/update_attempter.h"
+#include "update_engine/cros/omaha_request_params.h"
+#include "update_engine/cros/update_attempter.h"
#include "update_engine/update_status_utils.h"
using base::StringPrintf;
diff --git a/update_manager/real_updater_provider.h b/update_manager/real_updater_provider.h
index 0819357..a32e7e9 100644
--- a/update_manager/real_updater_provider.h
+++ b/update_manager/real_updater_provider.h
@@ -20,7 +20,7 @@
#include <memory>
#include <string>
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/updater_provider.h"
diff --git a/update_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc
index 06808b8..0dc56ac 100644
--- a/update_manager/real_updater_provider_unittest.cc
+++ b/update_manager/real_updater_provider_unittest.cc
@@ -25,9 +25,9 @@
#include "update_engine/common/fake_clock.h"
#include "update_engine/common/fake_prefs.h"
-#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_update_attempter.h"
-#include "update_engine/omaha_request_params.h"
+#include "update_engine/cros/fake_system_state.h"
+#include "update_engine/cros/mock_update_attempter.h"
+#include "update_engine/cros/omaha_request_params.h"
#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
diff --git a/update_manager/shill_provider.h b/update_manager/shill_provider.h
index c7bb2e2..ebe7a3a 100644
--- a/update_manager/shill_provider.h
+++ b/update_manager/shill_provider.h
@@ -19,7 +19,7 @@
#include <base/time/time.h>
-#include "update_engine/connection_utils.h"
+#include "update_engine/common/connection_utils.h"
#include "update_engine/update_manager/provider.h"
#include "update_engine/update_manager/variable.h"
diff --git a/update_manager/staging_utils.cc b/update_manager/staging_utils.cc
index f4f685c..e8f07bb 100644
--- a/update_manager/staging_utils.cc
+++ b/update_manager/staging_utils.cc
@@ -27,7 +27,7 @@
#include "update_engine/common/constants.h"
#include "update_engine/common/hardware_interface.h"
#include "update_engine/common/prefs_interface.h"
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
using base::TimeDelta;
using chromeos_update_engine::kPrefsWallClockStagingWaitPeriod;
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index a0d8a63..a95a5a8 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -25,7 +25,7 @@
#include "update_engine/common/clock_interface.h"
#if USE_DBUS
-#include "update_engine/dbus_connection.h"
+#include "update_engine/cros/dbus_connection.h"
#endif // USE_DBUS
#include "update_engine/update_manager/fake_shill_provider.h"
#include "update_engine/update_manager/real_config_provider.h"
@@ -36,7 +36,7 @@
#include "update_engine/update_manager/real_time_provider.h"
#include "update_engine/update_manager/real_updater_provider.h"
#if USE_SHILL
-#include "update_engine/shill_proxy.h"
+#include "update_engine/cros/shill_proxy.h"
#include "update_engine/update_manager/real_shill_provider.h"
#endif // USE_SHILL
diff --git a/update_manager/state_factory.h b/update_manager/state_factory.h
index 1c1c1d9..ac3bf6b 100644
--- a/update_manager/state_factory.h
+++ b/update_manager/state_factory.h
@@ -17,7 +17,7 @@
#ifndef UPDATE_ENGINE_UPDATE_MANAGER_STATE_FACTORY_H_
#define UPDATE_ENGINE_UPDATE_MANAGER_STATE_FACTORY_H_
-#include "update_engine/system_state.h"
+#include "update_engine/common/system_state.h"
#include "update_engine/update_manager/state.h"
namespace org {