Disable deadline file in Android.
The deadline file is used to notify chrome the deadline string sent by
the server. This message allows chrome to take a different action based
on the urgency of the update. While we would like to provide a proper
API for this mechanism, it is rarely used in Chrome OS and doesn't work
on Android, so we disable it for now.
Bug: 24868621
Test: Unittest pass. No error message when tested on a dragonboard.
Change-Id: I77fc5b55e1c6ec79f12d88be40426058b8aa4d02
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index e512d13..9ad73d6 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -35,12 +35,10 @@
namespace chromeos_update_engine {
-const char OmahaResponseHandlerAction::kDeadlineFile[] =
- "/tmp/update-check-response-deadline";
-
OmahaResponseHandlerAction::OmahaResponseHandlerAction(
SystemState* system_state)
- : OmahaResponseHandlerAction(system_state, kDeadlineFile) {}
+ : OmahaResponseHandlerAction(system_state,
+ constants::kOmahaResponseDeadlineFile) {}
OmahaResponseHandlerAction::OmahaResponseHandlerAction(
SystemState* system_state, const string& deadline_file)
@@ -127,10 +125,12 @@
// file. Ideally, we would include this information in D-Bus's GetStatus
// method and UpdateStatus signal. A potential issue is that update_engine may
// be unresponsive during an update download.
- utils::WriteFile(deadline_file_.c_str(),
- response.deadline.data(),
- response.deadline.size());
- chmod(deadline_file_.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ if (!deadline_file_.empty()) {
+ utils::WriteFile(deadline_file_.c_str(),
+ response.deadline.data(),
+ response.deadline.size());
+ chmod(deadline_file_.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ }
completer.set_code(ErrorCode::kSuccess);
}