History log of /system/update_engine/update_manager/chromeos_policy.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e88e9feb5a64c1358baeb1c8547e82aa08e1cd83 04-Feb-2016 Alex Deymo <deymo@google.com> Android: Print the error code string from the client.

The update_engine_client needs to translate the numeric ErrorCode to a
string name that can be printed on the output. This patch moves the
ErrorCodeToString() function to a new error_code_utils.{h,cc} pair of
files so it can be included easily from the client binary and uses it
in the Android update_engine_client.

Bug: 25631767
Bug: 25598547
TEST=`update_engine_client --update` prints the error message in a non-Brillo device.

Change-Id: Ib40813924ec676f3e703412de90d389b2596177e
/system/update_engine/update_manager/chromeos_policy.cc
1f19dccb115cf608104b1cb0d192a53ae32f238f 03-Feb-2016 Alex Deymo <deymo@google.com> Add ErrorCode::kUserCanceled.

To accomodate the posibility of canceling an ongoing update, this patch
adds a new ErrorCode signaling a user canceling the update.

This patch also removes the now useless unittests that checks if you
added a new error code since the compiler fails if you don't add the
error code to the method mentioned in the test.

Bug: None
TEST=FEATURES=test emerge-link update_engine
TEST=`mmma system/update_engine` on edison-eng and aosp_arm-eng

Change-Id: I991dab1dd8b6c0bb0c24d51cca4e1b75440a86b4
/system/update_engine/update_manager/chromeos_policy.cc
0103c36caa2e38e034e0d22185736b9ccfb35c58 20-Jan-2016 Alex Vakulenko <avakulenko@google.com> update_engine: Update libchrome APIs to r369476

The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.

Change-Id: I42e65bda7f1dbdf6f6e0ebf356d2cfea6b729193
/system/update_engine/update_manager/chromeos_policy.cc
39910dcd1d68987ccee7c3031dc269233a8490bb 10-Nov-2015 Alex Deymo <deymo@google.com> Split payload application code into a subdirectory.

This patch splits from the main libupdate_engine code the part that
is strictly used to download and apply a payload into a new static
library, moving the code to subdirectories. The new library is divided
in two subdirectories: common/ and payload_consumer/, and should not
depend on other update_engine files outside those two subdirectories.
The main difference between those two is that the common/ tools are more
generic and not tied to the payload consumer process, but otherwise they
are both compiled together.

There are still dependencies from the new libpayload_consumer library
into the main directory files and DBus generated files. Those will be
addressed in follow up CLs.

Bug: 25197634
Test: FEATURES=test emerge-link update_engine; `mm` on Brillo.

Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23
/system/update_engine/update_manager/chromeos_policy.cc
dbe13b471c061dcb61395b8b37201a3a6ea18116 06-Nov-2015 Alex Deymo <deymo@google.com> Increase exponential backoff maximum time to 26h on Brillo.

Brillo devices ping Omaha every 5 hours and will increase that value on
an exponential backoff schedule when receiving an error 500 or 503. For
Chrome OS devices, the ping happens every 45 minutes, so the limit on
the exponential backoff is set to 4 hours. This CL changes the limit on
Brillo to 26h, to maintain the proportion.

Bug: 24878416
Test: mm

Change-Id: Ie5ffe6e08a25c2c801ed1aa3b79cb6742cd07caa
/system/update_engine/update_manager/chromeos_policy.cc
14e7dde6cfc533b273cf4dfac2116733bfeb9377 20-Oct-2015 Alex Deymo <deymo@google.com> Poll Omaha every 5 hours on Brillo builds.

This simple patch pings Omaha every 5 hours in Brillo instead of the 45
minutes we use in Chrome OS.

All Omaha clients except for Chrome OS, ping every 5 hours so we want
Brillo to do the same as all other devices. For Chrome OS, being offline
is more common so we want to check more often.

Bug: 24341710
Test: Deployed on a device. Policy manager logs says it will check in 5h.

Change-Id: Idc363080f6f60274d66cd372a420be9ac8b4ba08
/system/update_engine/update_manager/chromeos_policy.cc
763e7dbaac735da0ae802933a1015b6b7874bce2 28-Aug-2015 Alex Deymo <deymo@google.com> update_engine: New BootControlInterface class.

The new BootControlInterface class is a platform-independent
abstraction to control the bootloader. It provides methods for setting
what partition slots are available for booting and getting the
bootloader status about the available slots.

The Chrome OS specific implementation of the bootloader was moved to
the BootControlChromeOS which now depends on the vboot_host
implementation used in Chrome OS. Follow up CL will implement the
equivalent class for Brillo.

BUG=b:23010637
TEST=unittests; cros flash from the new image and rolled back from it.

Change-Id: I0a03aeeb8c21d8c99e1866b625e6e8c96628215b
/system/update_engine/update_manager/chromeos_policy.cc
aea4c1cea20dda7ae7e85fc8924a2d784f70d806 20-Aug-2015 Alex Deymo <deymo@google.com> Re-license update_engine to Apache2

This patch automatically replaced the license on all text files from
Chromium OS (BSD style) to AOSP (Apache2), keeping the original year as
a reference.

The license header was added to .gyp and .gypi files, the NOTICE was
replaced with a copy of the Apache2 license and MODULE_LICENSE_* file
was updated.

BUG=b/23084294
TEST=grep 'Chromium OS Authors' doesn't find anything.

Change-Id: Ie5083750755f5180a8a785b24fe67dbf9195cd10
/system/update_engine/update_manager/chromeos_policy.cc
6a9d3497bcf57b8b9f5765a2909a51c9f8119cd1 15-Jun-2015 Alex Vakulenko <avakulenko@chromium.org> platform2: Fix issues with new version of libchrome

libchrome r334380 has the following breaking changes that need to be fixed:
- base::JSONWriter::Write() and base::JSONWriter::WriteWithOptions() take
"const base::Value&" instead of "const base::Value*"
- base::JSONReader::Read() and base::JSONReader::ReadAndReturnError()
return a scoped_ptr<base::Value> instead of base::Value*
- base/safe_strerror_posix.h is moved to base/posix/safe_strerror.h
- safe_strerror() is now in "base" namespace
- StartsWithASCII(), EndsWith(), StringToUpperASCII(), LowerCaseEqualsASCII()
are now in "base" namespace
- ObserverList<T> is now in "base" namespace
- base::PrintTo(base::FilePath) used in gtest is now moved to libchrome-test
library and as such, unit test runners need to link to this library now.
- crypto::RSAPrivateKey::CreateSensitive() is now removed from //crypto, so
some of tests in chromeos-login that used that function had to be changed
to use crypto::GenerateRSAKeyPairNSS() directly.
- UnixDomanSocket class is now in "base" namespace
- Pickle class is now in "base" namespace

BUG=chromium:496469
TEST=`./build_packages`
CQ-DEPEND=CL:277662

Change-Id: I36e5fbf2e36a92068873ffbd44020c862a3ed9e3
Reviewed-on: https://chromium-review.googlesource.com/277671
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
eb9e6d8d8813b2d5a81a14e0184f7b4798573606 17-Apr-2015 Allie Wood <alliewood@chromium.org> update_engine: Remove copy from source to destination partition.

Removes the copy of the old rootfs and kernel to the new rootfs and
kernel. This was initially done in FilesystemCopierAction, which is now
called FilesystemVerifierAction.

When FilesystemVerifierAction is given a source rootfs or kernel, it
calculates the hashes. When asked to verify the new rootfs or kernel, it
computes the hashes and compares them against the values in the manifest.

BUG=chromium:463562
TEST=Updates using `cros flash --src-image-to-delta` and unit tests.
CQ-DEPEND=CL:267360

Change-Id: I3c9ba60fa4af0c5381ba8a10883bd47dc40adb8c
Reviewed-on: https://chromium-review.googlesource.com/267554
Reviewed-by: Allie Wood <alliewood@chromium.org>
Commit-Queue: Allie Wood <alliewood@chromium.org>
Trybot-Ready: Allie Wood <alliewood@chromium.org>
Tested-by: Allie Wood <alliewood@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
78ecbfc254c574e52cfe63310a801381a0035c43 22-Oct-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: Separate global P2P usage from payload-specific attributes.

This change is needed for two reasons: (a) The decision regarding the
global P2P enabled state and those pertaining to whether individual
payloads may be downloaded and/or shared via P2P have distinct and not
necessarily nested lifespans. (b) Some parts of the update engine are
concerned with the former and some with the latter, and so we need
separate entry points in the Update Manager to accommodate that.

This also introduces two Omaha-derived values, denoting whether P2P
downloading and/or sharing should be disabled for the current payload,
into the UpdateCanStart policy.

BUG=chromium:425233
TEST=Unit tests.

Change-Id: I0ba0090bd4c5ceb0c812ea218b070945083abd95
Reviewed-on: https://chromium-review.googlesource.com/225150
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
14a9e70709b4cda5afc97ac6219bc660810b2077 08-Oct-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: Properly handle update download deterrents.

The UpdateCanStart policy request needs to satisfy two related
requirements:

* It must allow the caller to proceed with the update even if some forms
of download are not allowed (for example, HTTP/HTTPS download blocked
due to scattering) but other are allowed (for example, P2P).

* It needs to assess all the input provided and, upon returning
successfully, convey any new values that pertain to downloading of the
update payload and that need to be persisted (such as the download
URL, backoff and scattering values, and so on). The caller in turn is
assured that, having successfully returned, the policy has indeed
considered all state and it is safe to clear parts of it (such as the
download error history).

This change ensures that the policy suppresses scattering and backoff
decisions if P2P download is allowed. This only suppresses the final
decision, but otherwise still returns whatever URL index and error count
that were inferred. It further adjusts the way in which various download
deterrents (check due, scattering, backoff) are handled, deferring
responses to the very end of the evaluation and thus returning
a complete result.

BUG=chromium:384087
TEST=Unit tests.

Change-Id: Ie95976295c0cd635e2a10912308b8756a677682f
Reviewed-on: https://chromium-review.googlesource.com/222263
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
b2f9919a0e4a77dd885625cb52ff7322974bd338 07-Oct-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: Policy to distinguish between P2P downloading and sharing.

Previously, the UpdateCanStart policy returned a single Boolean,
indicating whether "P2P is allowed". However, the policy has been
incorrectly reproducing decisions made by current code, whereas P2P
sharing is always allowed (if P2P is enabled) but P2P downloading has
additional limitations. This CL introduces distinct flags for both
downloading and sharing, and reasons about them specifically.

This also adds a constraints whereas P2P downloading is allowed for
non-interactive updates only.

BUG=chromium:420732
TEST=Unit tests.

Change-Id: Ife4b6b2830c999745a0d4239089034c863de6388
Reviewed-on: https://chromium-review.googlesource.com/222262
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
f329b933db41d26644a97afef928eb1b319d6d99 30-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Fix all the "using" declaration usage.

This patch removes unused "using" declarations, that is, declarations
included in a .cc file at a global scope such that "using foo::bar"
that later don't use the identifier "bar" at all.

This also unifies the usage of these identifiers in the .cc files
in favor of using the short name defined by the using declaration.
For example, in several cases the .h refer to a type like
"std::string" because using declarations are forbidden in header
files while the .cc includes "using std::string;" with the purpose
of just writting "string" in the .cc file. Very rarely, the full
identifier is used when a local name ocludes it, for example,
StringVectorToGStrv() and StringVectorToString() in utils.cc named
its argument just "vector" need to refer to std::vector with the
full name. This patch renames those arguments instead.

Finally, it also sorts a few lists of using declarations that weren't
in order.

BUG=None
TEST=FEATURES=test emerge-link update_engine

Change-Id: I30f6b9510ecb7e03640f1951c48d5bb106309840
Reviewed-on: https://chromium-review.googlesource.com/226423
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
349ac835564382091a80be19f0b9929ead5c55e0 06-Oct-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: Add P2P download limits to UpdateCanStart.

This adds two factors that are currently used for blocking P2P into the
Chrome OS policy implementation: a maximum number of P2P download
attempts and a maximum time period since the first attempt.

BUG=chromium:420732
TEST=Unit tests.

Change-Id: I430dec50cf07f37a0c3f14de3410d3c6bfb8ac78
Reviewed-on: https://chromium-review.googlesource.com/221735
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
ef8d08712d01c23d31e27000519cbdeb88f60b73 03-Oct-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: More permissive use of P2P.

The logic we had in ChromeOSPolicy so far was not as permissive as the
original in P2PManagerImpl::IsP2PEnabled(). Specifically, we want to
allow P2P even if a device policy does not have this value set, but
otherwise indicates that the device is enterprise-enrolled.

This also renames the owner variable name so it is consistent with the
rest of the variable names (no get_ prefix).

BUG=chromium:384087
TEST=Unit tests.

Change-Id: I184ebaebc168352510ea3ed0277ea74167edf666
Reviewed-on: https://chromium-review.googlesource.com/221476
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
d78caf9baf2026a356130f4754af2c504f423945 24-Sep-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: Change policy argument from const ref to value.

It turns out that passing an argument by reference to UpdateCanStart via
UpdateManager::AsyncPolicyRequest is a pain. Furthermore, given that the
policy is async by definition, it makes little sense to hand it a const
reference argument. This changes the said argument to be passed by
value.

BUG=chromium:396148
TEST=Unit tests.

Change-Id: I45a8141b389c173347f3a6b7dc03ffe46cb32228
Reviewed-on: https://chromium-review.googlesource.com/219694
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
dc4bb268eb6e6ddcd087d5eccfd88c8e92252920 23-Jul-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: Incorporate backoff logic in UpdateCanStart.

This change adds backoff computation logic to UpdateCanStart. For the
most part, it is extending a private policy call (UpdateDownloadUrl) to
account for previously enacted backoff periods and to compute new ones
when an update failure is identified (accordingly, it is now called
UpdateBackoffAndDownloadUrl).

To conform with the pure nature of policy implementations, yet
minimizing the amount of "state" that needs to be managed and persisted
by the updater, we now consider download errors in bulks defined by the
most recent update failure (namely, the point in time when all URLs
where tried and failed). The updater is expected to keep track of the
update failure count, setting it to zero when a new update is seen, and
incrementing it (and recording the time it was incremented) when told to
do so by the policy. We therefore make some adjustments to the policy
API and its usage semantics.

BUG=chromium:396148
TEST=Unit tests.

Change-Id: If8787b8c41055779945f9b41368ec08ac5e6fcca
Reviewed-on: https://chromium-review.googlesource.com/210702
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
a2e8eaa743e04f9168aa7c64e88c2182d2ac4048 24-Sep-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: Move static member initialization to .cc file.

Using default initializers for these members in header files results in
multiple instantiations in different translation units and leads to link
errors when compiled (for example) with clang.

BUG=None
TEST=Builds fine w/ clang, passes unit tests.

Change-Id: I60926b7dde0a663736294b3252114979b4e56c66
Reviewed-on: https://chromium-review.googlesource.com/219811
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
ec7f91625b799abf67ea3119490f2f1de8e4e677 15-Jul-2014 Gilad Arnold <garnold@chromium.org> update_engine: Ditch UpdateCheckScheduler, use UpdateCheckAllowed instead.

This change removes the update_check_scheduler module and replaces it
with async requests to the UpdateCheckAllowed policy, done by the
UpdateAttempter directly.

* A new UpdateAttempter::ScheduleUpdates() is used as a replacement for
UpdateCheckScheduler::Run() and rescheduling of periodic checks inside
UpdateCheckScheduler. The callback
UpdateAttempter::OnUpdateScheduled() handles both periodic and
interactive checks.

* The UpdateAttempter keeps track of whether or not an update check is
being waited for (waiting_for_scheduled_check_) so that we can ensure
liveness. This is a similar check to the one performed inside the
UpdateCheckScheduler.

* Inference of the update target version prefix and channel (via device
policy), as well as update disabled, are now performed by the
UpdateManager policy. Also eliminating reference to the list of
network types allowed by policy, which is not enforced anyway and will
be superceded by another policy request (UpdateDownloadAllowed).

* Since update check scheduling is now performed relative to the last
update check time (as recorded by the UpdateAttempter), we care to
update this time as soon as the request is issued (in addition to when
a response is received). This ensures that we won't be scheduling
back-to-back update requests in the case where a response was not
received. Updating the last check time is delegated to a method call;
we replace raw use of time(2) with the ClockInterface abstraction.

* Handling of forced update checks has been revised: the UpdateAttempter
keeps track of the most recent app_version and omaha_url values that
were received through DBus events; it notifies the UpdateManager not
only of whether or not a forced (formerly, "interactive") update
request is pending, but also whether or not it is indeed interactive
or should be treated as a normal periodic one. The UpdateManager
reflects this back to the updater via the result output of
UpdateCheckAllowed, which tells the UpdateManager whether the custom
app_version and omaha_url should be used (interactive) or not.

BUG=chromium:358269
TEST=Unit tests.

Change-Id: Ifa9857b98e58fdd974f91a0fec674fa4472e3a9d
Reviewed-on: https://chromium-review.googlesource.com/209101
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
f3e2801f18bae14e41099e007de7c9a019735556 27-Aug-2014 David Zeuthen <zeuthen@chromium.org> update_engine: Reject XML with internal entity declarations.

This helps avoid resource exhaustion problems.

BUG=chromium:406546
TEST=New unit test + unit tests pass.

Change-Id: Ib54f378cf533c200631b274c0414075c2ea4ff67
Reviewed-on: https://chromium-review.googlesource.com/214291
Reviewed-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
d4b303246eae1fcd0b4820657f1d787e8238146f 22-Jul-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: UpdateCheckAllowed returns target version prefix.

This piece of information is also provided by the device policy and
needed when performing the update check. Borrows logic currently in
UpdateAttempter::CalculateUpdateParams().

BUG=chromium:358269
TEST=Unit tests.

Change-Id: I5259404df1763be8944b445d51e1fafbca946306
Reviewed-on: https://chromium-review.googlesource.com/209228
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
44dc3bfd45eaddc1e7b586f8839babe4540418b5 19-Jul-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: UpdateCheckAllowed now considers interactive update requests.

This is necessary so we can delegate handling of all update checks to
the UpdateManager, allowing us to share logic between the two cases and
eliminate multiple entry point to UpdateAttempter::Update() and handling
of interference between these two processes. Instead, these are all
handled naturally by the UpdateManager.

BUG=chromium:394389
TEST=Unit tests.

Change-Id: I32a1ab917e5aeb5c2da1953d8b0ffa8c9d8d62f9
Reviewed-on: https://chromium-review.googlesource.com/209100
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
a65fced5f4c2b551616b26ee90a800b44090735f 23-Jul-2014 Gilad Arnold <garnold@chromium.org> update_engine: UM: Add check for monotonic time elapsed.

This forks the former EvaluationStatus::IsTimeGreaterThan() into two
separate variants, checking either the wallclock or monotonic current
time against a corresponding timestamp. This is needed for policies that
require resilience against wallclock time volatility.

BUG=chromium:394778
TEST=Unit tests.

Change-Id: I9ecd20cc87a3a520e119f157e55ae4f54104a506
Reviewed-on: https://chromium-review.googlesource.com/209487
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
072359ca138504065e1e0c1189eb38c09576d324 18-Jul-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: fixed remaining linter and some spelling errors

Fixed remaining errors from cpplint as well as some spelling errors
mostly in comments.

BUG=None
TEST=FEATURES=test emerge-link update_engine

Change-Id: I484988ab846ac5a3c68c016ddccfb247f225ec27
Reviewed-on: https://chromium-review.googlesource.com/208897
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
a0258a557d36ff78eacdacd39bdc88c5e6c1056e 11-Jul-2014 Gilad Arnold <garnold@chromium.org> UpdateManager: Obey server-dictated poll interval when scheduling checks.

This abides by the current logic, as found in
UpdateCheckScheduler::ComputeNextIntervalAndFuzz(). New unit tests
added to verify this behavior, as well as the addition of a new
UpdaterProvider variable to pull this value from the UpdateAttempter.

BUG=chromium:358269
TEST=Unit tests.

Change-Id: I0ac67dea5a622823a9c4713ec7165a55bc0a5c92
Reviewed-on: https://chromium-review.googlesource.com/207471
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
a1eabcdc93d118146639139257c2f5ccc3ffb061 10-Jul-2014 Gilad Arnold <garnold@chromium.org> UpdateManager: Do not schedule update checks if OOBE did not complete.

This abides by the current logic, as found in
UpdateCheckScheduler::StaticCheck(). New unit test added to verify this
behavior.

BUG=chromium:358269
TEST=Unit tests.

Change-Id: I747e8a59408d6b93ceea62ef741b36e09f937a08
Reviewed-on: https://chromium-review.googlesource.com/207241
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
bfc44f70a99a74bdb714c84fc65be2ab50806bab 09-Jul-2014 Gilad Arnold <garnold@chromium.org> UpdateManager: Do not schedule update checks if booted from removable device.

This abides by the current logic, as found in
UpdateCheckScheduler::Run(). New unit test added to verify this
behavior.

BUG=chromium:358269
TEST=Unit tests.

Change-Id: I5720b2b3c85c7de7f64eec4f7da000d3e13c778d
Reviewed-on: https://chromium-review.googlesource.com/207230
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
fe12a0f5589b084ef38f45c20953922307a26295 09-Jul-2014 Gilad Arnold <garnold@chromium.org> UpdateManager: Do not schedule periodic update checks on unofficial builds.

This abides by the current logic, as found in
UpdateCheckScheduler::Run(). New unit test added to verify this
behavior.

BUG=chromium:358269
TEST=Unit tests.

Change-Id: Id7ff2134492f0c861f5abff76223b61496a2fe63
Reviewed-on: https://chromium-review.googlesource.com/207213
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
38b1402462bd15025a53bea993ca3d93cdf0d8de 09-Jul-2014 Gilad Arnold <garnold@chromium.org> UpdateManager: Fix update scheduling interval/fuzz inference.

This addresses two differences wrt current logic:

* In the case of recurring periodic check, we should use
kTimeoutPeriodicInterval as the base check interval (and not
kTimeoutInitialInterval).

* When doing exponential backoff, we should be using the interval / 2 as
the fuzz factor (and not the fixed kTimeoutRegularFuzz).

Added two new tests (RecurringCheckBaseIntervalAndFuzz and
RecurringCheckBackoffIntervalAndFuzz) to ensure the correct values are
used.

Also fixed existing unit tests to properly distinguish a first update
check from recurring ones (FirstCheckIsAtMostInitialIntervalAfterStart)
and to properly verify that deferred update check times are within the
expected buzz boundaries (FirstCheckIsAtMostInitialIntervalAfterStart
and ExponentialBackoffIsCapped).

BUG=chromium:392582
TEST=Unit tests.

Change-Id: I3085502c57616cba2eff4cb0372ca5699427ae20
Reviewed-on: https://chromium-review.googlesource.com/207192
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
28d6be6ba06170dc99b2b9fd1685a7a6405abc1a 30-Jun-2014 Gilad Arnold <garnold@chromium.org> UpdateManager: UpdateCurrentConnectionAllowed should return kAskMeAgainLater.

This reflects the fact that the restriction is temporary, and that the
update process should not be terminated, therefore is more correct than
returning kFailed.

This also relocates the code that allows user settings to enable update
over a cellular connection, in cases where a policy is active but does
not specify allowed connections.

BUG=chromium:390264
TEST=Unit tests.

Change-Id: Iadfd05ba3c4617a22c69b82232b7802d1ea65504
Reviewed-on: https://chromium-review.googlesource.com/206144
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
42f253b5318dbe6d0ecf48f7f9a639363fa253e2 25-Jun-2014 Gilad Arnold <garnold@chromium.org> UpdateManager: Move logic from UpdateCanStart to UpdateCheckAllowed.

The following should be part of the policy that is consulted before
performing an update check:

1) Whether updates are disabled by device policy.

2) Whether a specific target channel is dictated by the device policy.

This CL moves it from UpdateCanStart into UpdateCheckAllowed.

Another change is renaming the output construct of UpdateCanStart into
'UpdateDownloadParams'; this is in line with the naming of the output
struct of UpdateCheckAllowed, and reflects the fact that it contains
information regarding the download of an update, to be used by the
caller.

BUG=chromium:388386
TEST=Unit tests.

Change-Id: I0631a4464800db77807d7da9a2a2c256b519c5c3
Reviewed-on: https://chromium-review.googlesource.com/205728
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
684219dc29acb0111d09aaf2d466cf837b043d9e 07-Jul-2014 Gilad Arnold <garnold@chromium.org> UpdateManager: rename UpdateCurrentConnectionAllowed into UpdateDownloadAllowed.

The signifies the *functional* nature of this policy request, instead of
dwelling on the low-level information it is evaluating.

BUG=chromium:389677
TEST=Unit tests.

Change-Id: I684ea13d4e89554b6a4d596666c18e2dbd609991
Reviewed-on: https://chromium-review.googlesource.com/206903
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
b3b05446d3ef9620c90084e11cd1ae4eca20f4a2 30-May-2014 Gilad Arnold <garnold@chromium.org> UM: Policy for deciding download URL.

This adds a new private policy (UpdateDownloadUrl) for determining which
download URL should be used for obtaining the update payload. We further
extend an existing public policy (UpdateCanStart) to return the download
URL details, based on the current URL index and the number of failures
associated with it. This renders the explicit notion of "HTTP download
allowed" in the return value unnecessary: If HTTP is not allowed, then
HTTP URLs will not be considered.

We also implement logic for logging the start/end of a policy
evaluation, so that intermediate log messages emitted during evaluation
have a clear context.

BUG=chromium:358329
TEST=Unit tests.

Change-Id: Ib5343417480d8825082f83bed2630a6611360b61
Reviewed-on: https://chromium-review.googlesource.com/203373
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
a8262e23b4d94af58e8e92d2a4b6e15ae4b4cf50 02-Jun-2014 Gilad Arnold <garnold@chromium.org> UM: Relocate implementation of UpdateCurrentConnectionAllowed.

This is just a small change to make sure that the order of method
implementation matches the order of declaration (as advised by style).

BUG=None
TEST=Unit tests.

Change-Id: I72db663c8543efcdb392afd825343e810ec1f2bb
Reviewed-on: https://chromium-review.googlesource.com/203208
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc
63784a578dd26880454d70797519358a2326291b 28-May-2014 Alex Deymo <deymo@chromium.org> Rename the PolicyManager to UpdateManager.

This change renames the PolicyManager class, directory, tests, etc,
to avoid confusion with libpolicy and its classes.

BUG=chromium:373551
TEST=emerged on link.
CQ-DEPEND=CL:I43081673c7ba409f02273197da7915537bde39c6

Change-Id: Iffa76caa3b95ecbbdba87ab01006d1d8ce35a27f
Reviewed-on: https://chromium-review.googlesource.com/201876
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_manager/chromeos_policy.cc