History log of /system/update_engine/system_state.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
282aa1f89de19d7052d844b0f7c53fedc04b802e 05-Sep-2017 Tianjie Xu <xunchang@google.com> Move metrics from namespace to class

Add a new metrics reporter interface to handle the current metrics
report for omaha (with metricsd). This helps to add metrics logging
for android phone devices (using other libraries) in the future.

Also change the unit tests accordingly.

Test: unit tests pass for pico
Change-Id: I703c8b6353e4b38bc89d6a71f01623978cf7a549
/system/update_engine/system_state.h
dc066f14d22f7e3843ad3c4bbcfd8718f95d4dcd 27-Mar-2017 Alex Deymo <deymo@google.com> Remove weave support from update_engine.

This codepath is not used anymore.

Bug: None
Test: `make checkbuild`.
Change-Id: I0f7f22d63cb2c3fbfabcda25763160e2470ef2c5
/system/update_engine/system_state.h
b8c6a8f559a89b2709c946ad580d749d20925926 08-Jun-2016 Sen Jiang <senj@google.com> Add PowerManagerInterface.

Hide all dbus stuff under the new interface, so that we can implement
a real power_manager for android in the future if needed.

Test: mma
Bug: 28800946

Change-Id: I26c883f4d0bc71f0410dfe4422b22bdd9df70575
/system/update_engine/system_state.h
f7ead8100211e7a285b48b52f4a235647274ab6e 24-Oct-2015 Alex Deymo <deymo@google.com> Implement update_engine weave commands

The new WeaveServiceInterface abstracs the registration and interaction
with weave whenever present. The compilation and usage of weave is
based on the BRILLO_USE_WEAVE flag.

When enabled, update_engine registers the "_updater" component with
methods to force-check for an update and change channels.

Bug: 24386758
Bug: 24386768
Test: Deployed on edison, weave commands and state available online.

Change-Id: Ic49111772e123b8a2b1971da92fe65785f186ccd
/system/update_engine/system_state.h
b09305e7e55d5375647ddf07538dc1a539923e3f 02-Dec-2015 Alex Deymo <deymo@google.com> Compile delta_generator and payload_consumer when "dbus" is disabled.

delta_generator and payload_consumer should not depend on any DBus
library. This patch now builds those even when "dbus" is disabled.

Bug: 25773375
TEST=`mma` on a target with DBus disabled.

Change-Id: Ia44cb9eed847e6d2eeb43a12373929128ae67d1c
/system/update_engine/system_state.h
d6deb1d0357f47d5525bfaeffa6c201b19abd3e7 29-Aug-2015 Alex Deymo <deymo@google.com> Use installed DBus libraries instead of generating them.

login_manager, power_manager, debugd and shill now expose a client
library with the generated dbus-proxies.h file and the system_api's
installed dbus-constants.h. This patch changes update_engine from
generating these DBus headers to use the installed client libraries.

The client libraries already include the service path string, so we
don't need to include system_api dbus-constants.h in most cases, unless
we actually use some parameter constants defined there.

BUG=b:23084776,b:23560718
TEST=./build_packages --board=link

Change-Id: Idb4501e784ebb5928c92902d114462be57d5826a
/system/update_engine/system_state.h
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/system_state.h
b8803bbfe96abce0ae792a93bc975d478d98d16a 20-Aug-2015 Alex Deymo <deymo@google.com> Split DBus client proxies into separated headers.

Each daemon we talk to should expose its own DBus library. This patch
splits the DBus proxies we generate from other daemon's .xml files into
separated header files so we can then replace them with libraries.

BUG=b:23084776
TEST=FEATURES=test emerge-link update_engine

Change-Id: Idbf1671eb7fc4259d493dbe2c8bcc8dad5b8784f
/system/update_engine/system_state.h
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/system_state.h
305345001d85ca2282112c2a30fe75c7a4773491 21-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Switch to chrome-dbus for client requests in update_engine

update_engine daemon acts as DBus client to send DBus calls to shill,
power_manager and chrome, and to listen for signals from shill, chrome
and login_manager. This patch migrates these calls and signals to use
chrome-dbus framework instead of dbus-glib.

All references to dbus-glib code are removed.

BUG=chromium:419827
TEST=Updated unittest. Deployed on a link device and tested interactions with shill and chromium.

Change-Id: I31b389e0d1690cccb115ff3b6539c876ba81bd0e
Reviewed-on: https://chromium-review.googlesource.com/290990
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/system_state.h
f6ee0163504eaf1a7cc136ba2c075d77ae2b4dd5 31-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Move ConnectionManager to an abstract Interface.

MockConnectionManager required to use one of ConnectionManager
constructors passing pointers that won't be use by the mock. This
patch moves the interface to its own ConnectionManagerInterface class.

BUG=None
TEST=unittests still pass.

Change-Id: I9ed09daf8e4256304be7dab30cfbe751901dc24b
Reviewed-on: https://chromium-review.googlesource.com/290120
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/system_state.h
cf175a098081f3f0e9ca52d997a7ce1585c14c2d 11-Jul-2014 Gilad Arnold <garnold@chromium.org> Fix cpplint errors.

The only non-obvious change here is the switch from dynamic_cast to
static_cast in three cases of down-casting in UpdateAttempter.
dynamic_cast is banned by style, nor does it add any safety in this
particular case (subsequent code dereferences the result right away
without checking whether it's null).

BUG=None
TEST=None

Change-Id: I9d49b46362feaf9c6fa13b2715ebe9fe50308a9a
Reviewed-on: https://chromium-review.googlesource.com/207470
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/system_state.h
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/system_state.h
7d623ebf9eee346fdeee71f1ccb32ebaf4bd3318 14-May-2014 Nam T. Nguyen <namnguyen@chromium.org> update_engine: Remove GPIO support.

We have not used GPIO since Jan 2013. This CL removes the GPIO handling code.
As a side effect, it also removes dependency on libudev.

BUG=chromium:221725
CQ-DEPEND=CL:199683
TEST=unittest
TEST=AU end2end test on real device from older version to a version that
has CL applied, then from that to another newer version (need not have
this CL applied).

Change-Id: I4352488ec360b44a44b137c40a3ae4ec35c6fe9d
Reviewed-on: https://chromium-review.googlesource.com/199626
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
/system/update_engine/system_state.h
1f84723f499b3b309efac11324ed4e6c937341b6 07-Apr-2014 Gilad Arnold <garnold@chromium.org> Revise the SystemState hierarchy.

* Removed all #includes from SystemState; added includes in .cc files
that use the various objects (MetricsLibrary, DevicePolicy, etc).

* MockSystemState:

- Regulated the set of getters/setters: foo() returns the current Foo
object interface; this object can be overridden by set_foo();
mock_foo() or fake_foo() returns the default (internal) mock/fake
equivalent, and fails if it is different from foo() (safety).

- Make member declaration order consistent with that of API.

- Removed MOCK_METHOD declarations for two methods and replaced them
with fake getter/setter. This means that MockSystemState is now
reduced to a fake, and can be renamed (separate CL). This also means
that a few tests have a slightly different semantics now.

* All virtual overrides are qualified as such. However, removed the
'const' method qualified from all getters: it made little sense,
especially when considering that getters are handing addresses of
internal mock members.

* Made the UpdateAttempter a contained member of both
{Real,Mock}SystemState, resolving initialization dependencies. In
general, the invariant is that all members of the SystemState that
rely on it being fully populated by the time of their initialization,
need to export a separate Init() method, that will be called (by the
SystemState implementation constructor or Init() method) only after
all members are set.

* Made the mock GPIO handler and connection manager contained members of
MockSystemState; the destructor could safely be moved.

* Cleanup in UpdateAttempter (part of resolving dependencies):

- Ordinary member initialization done via default initializers
(constants) or initializer list in the constructor (parameters).

- Init() method only does work that cannot be done during
construction, with appropriate comment documenting the need for it.

- Better reuse via constructor delegation.

BUG=chromium:358278
TEST=Unit tests.

Change-Id: I96ff6fc7e7400b0a9feb6cc8d4ffe97a51000f91
Reviewed-on: https://chromium-review.googlesource.com/193587
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/system_state.h
76b2b4822d57360d0c77f070bd8fc25bc08fd93e 01-Apr-2014 Gilad Arnold <garnold@chromium.org> Fix/extend unit test related functionality.

* Adds mock methods to UpdateAttempterMock and turning corresponding
base methods into a virtual (needed for subsequent unit testing).

* Adds a setter to OmahaRequestParams.

* Limited general cleanup.

BUG=chromium:346914
TEST=Unit tests.

Change-Id: I0519ad5c43ddebabc1aff6585cf43a290a2081dc
Reviewed-on: https://chromium-review.googlesource.com/192660
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/system_state.h
bccbc387ed23ec18adcd0ef8b50d958ef38cd619 03-Apr-2014 Alex Deymo <deymo@chromium.org> Move IsOOBEComplete to HardwareInterface.

This patch moves the mockable IsOOBEComplete to the HardwareInterface
which already has a fake implemented. This is required as a first
step to make it available on the PolicyManager.

This patch also passes a null pointer when the timestamp isn't
required.

BUG=chromium:358269
TEST=Unittests adjusted and passing.

Change-Id: I620e0f4521832b3f2c0170811116251cdfe58f26
Reviewed-on: https://chromium-review.googlesource.com/193101
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/system_state.h
94c0616c9f81b65154953ac31e488cc87191e17c 22-Mar-2014 Alex Deymo <deymo@chromium.org> Create a PolicyManager instance on the SystemState.

This patch creates the PolicyManager object on the update engine's
SystemState class, which aggregates all the singleton classes.

This patch doesn't add any functionality, other than initialize and
destroy the PolicyManager, State and Providers from the SystemState.

BUG=chromium:354079
TEST=Build.

Change-Id: Ib06d9c3d24926eaca43de2d11770ef6da7d16985
Reviewed-on: https://chromium-review.googlesource.com/191502
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/system_state.h
75039d7397f03dff77bdf4e26398049ff88edc4c 25-Mar-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: update to libbase 242728

Made update_engine link with libchrome-242728 and fixed compile
issues due to changes in namespaces and include file layout.

Also removed some of suppressed compiler warnings and fixed the
issues masked by them (e.g. mismatched printf-like specifiers).

Added -Wextra compiler option to enable additional useful warnings
to ensure more strict checking... Had to disable "unused-parameter"
though since we have a lot of functions (mainly in fakes) that do
not use all of their parameters.

BUG=chromium:351593
TEST=Unit tests passed.
CQ-DEPEND=CL:191721

Change-Id: I1aa63a48d5f1f4ea75ba6b00aec7aa5f3bad15c4
Reviewed-on: https://chromium-review.googlesource.com/191510
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/system_state.h
639aa36fc7e27ba400402cd7a32b091f555783a6 04-Feb-2014 David Zeuthen <zeuthen@chromium.org> Record installation date and include it in every Omaha request.

Introduce a new state variable, install-date-days, to track the the
point in time that OOBE completed and include this value - if set - in
each Omaha request. This state variable tracks the number of PST8PDT
("Pacific Time") calendar weeks since Jan 1st 2007 0:00 PST, times
seven. It is included as an attribute of the <app> element, like this:

<app appid="{...}" ... delta_okay="true" ... installdate="2590">

If the state variable is not set, the installdate attribute is not
included.

For new installs (e.g. where OOBE is not complete), the
install-date-days variable is set from the "elapsed_days" value in the
Omaha response. In this case - which should be the majority going
forward - we don't rely on the local clock on the device at all.

On the other hand, for existing installs (e.g. where OOBE was
completed in an OS version not including this CL) and also new
installs where the update-check during OOBE failed (e.g. no network
connection), install-date-days is derived from the timestamp of the
/home/chronos/.oobe_completed marker file. This case obviously relies
on the local clock on the device being set correctly.

Also introduce a new metric, Installer.InstallDateProvisioningSource
to track how install-date-days is provisioned. This metric has two
possible values, kProvisionedFromOmahaResponse (0) and
kProvisionedFromOOBEMarker (1).

In addition to new unit tests, I tested this manually by munging the
/home/chronos/.oobe_completed and
/var/lib/update_engine/prefs/install-date-days files. Also, since
devserver does not send the "elapsed_days" value, I had to point
update_engine to the official Omaha server using the -omaha-url option
with the https://tools.google.com/service/update2 value.

BUG=chromium:336838
TEST=New unit tests + unit tests pass + manual testing.

Change-Id: Id901059c4ab0f9184d1f4ddce72273d739e58224
Reviewed-on: https://chromium-review.googlesource.com/184907
Tested-by: David Zeuthen <zeuthen@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/system_state.h
056b0abc1273a6eebfd73060a1d0344ef02b8696 29-Oct-2013 J. Richard Barnette <jrbarnette@chromium.org> Move IsOfficialBuild() and IsNormalBootMode() into HardwareInterface.

This makes the implementation of the two methods part of the
HardwareInterface, so that unit tests won't end up with meaningless
(and unpredictable) calls to the real functions.

BUG=None
TEST=unit tests

Change-Id: Ia23932634124987c1d6ff0683acb15cf4819bc5e
Reviewed-on: https://chromium-review.googlesource.com/175024
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
/system/update_engine/system_state.h
526cb58ddecbbc1ba5d2e3faf068d26d0661d464 06-Aug-2013 David Zeuthen <zeuthen@chromium.org> p2p: Make P2PManager available from the SystemState singleton

BUG=chromium:260426
TEST=Unit tests pass
Change-Id: Iadaa531d631c8d7268f35d512ff33f8d53e1cc5e
Reviewed-on: https://chromium-review.googlesource.com/64828
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/system_state.h
4243291a6655972fe89d4747a0089834c9e47c20 13-Jul-2013 Alex Deymo <deymo@chromium.org> Send an UMA metric when failed to boot into the new partition.

When a payload is successfully applied, the /other/ partition
is marked as valid and a reboot is needed, the reboot into this
new partition can fail due to several reasons. If than happens,
the firmware can rollback to the previous partition.

When this happens, this fix sends a new UMA metric with the
attempt number of this failing payload.

In order to test this functionality we need to fake the
utils::BootDevice() to emulate a reboot into the same or
a different partition. To achieve this, this function is
moved to a new "HardwareInterface" that can be faked
using the FakeHardware class that can hold similar hardware
related functions. Implementations and unittest were
refactored as needed.

BUG=chromium:243572
TEST=unittests

Change-Id: I1a4242df0bd61e2718ab881ead603b1d3705b877
Reviewed-on: https://gerrit.chromium.org/gerrit/61815
Commit-Queue: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/system_state.h
aa18e1641879f2df5993c2b02eb6f50d4443a649 20-Jun-2013 Chris Sosa <sosa@chromium.org> Blacklist versions as part of Rollback along with unittests.

This CL adds version blacklisting as part of AU Rollback. A few additional
things:

1) Since this pref must persist across rollback I have introduced a
powerwash_safe_prefs as part of system_state that will persist across
powerwashes.
2) Fixed bug where we needed to read the device policy (which is read during an
update_check before Rollback would work).
3) Some refactoring to move pref constants to constants.
4) Passing keepimg into our powerwash command so we don't wipe the old
partitions.

BUG=chromium:252589 chromium:254217
TEST=Unittests + test on device + using rollback with and without powerwash
checking preserve state.

Change-Id: I991fad944594944425fd9941e10b30a919f2b83b
Reviewed-on: https://gerrit.chromium.org/gerrit/59518
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/system_state.h
53173b964f6f43c89dbaba41875fcadd7077b2ea 18-May-2013 Jay Srinivasan <jaysri@chromium.org> Download via HTTP only if enterprise policy allows.

In order to rollout HTTP-downloads for AU to stable channel, we want to
be a bit more conservative to preseve the defense in depth we have now
with HTTPS. So, we're introduced a new enterprise policy which should be
explicitly enabled in order for the payloads to be downloaded via HTTP.

This CL adds the support for honoring such a policy in update engine.

BUG=chromium:235562
TEST=New unit tests added, existing ones updated and they all pass.
TEST=Tested on ZGB with and without policy and it works as expected.
Change-Id: I356efbe237b10031161a57c70cb851c521915a76
Reviewed-on: https://gerrit.chromium.org/gerrit/55805
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/system_state.h
f413fe59759c73d6a5624c2158260b4302d01fe2 22-Apr-2013 David Zeuthen <zeuthen@chromium.org> Add unit tests for duration metrics

As a side-effect, move utils::GetMonotonicTime() into the newly added
ClockInterface type.

BUG=None
TEST=Unit tests pass

Change-Id: I972a7e4ba37b63f96348fbeda901697b8ba2fc05
Reviewed-on: https://gerrit.chromium.org/gerrit/48814
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/system_state.h
be45bef9e283188b00e7def8967f81843669a7f1 10-Apr-2013 Chris Sosa <sosa@chromium.org> Add update reboot metric to the update engine.

This change add the Installer.UpdateNumReboots metric.

This records the number of reboots that occurred while an update was being
attempted. It uses a marker file stored in tmp to discover whether or not
it's already recorded the reboot.

BUG=chromium:226766
TEST=Unittests | ran an update on a test machine and rebooted/resumed and
checked about:histograms to confirm numbers. Also restart update-engine to
verify it didn't double count that.

Change-Id: I5d2af9d5b62a9d974c7c6243a89cb3359051b650
Reviewed-on: https://gerrit.chromium.org/gerrit/47710
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
/system/update_engine/system_state.h
ae4697c073b84b260990a141acd53c6806da0708 19-Mar-2013 Jay Srinivasan <jaysri@chromium.org> Enhanced channel changing behavior

This CL adds a new DBUS API to UpdateEngine called SetTargetChannel to
change the current channel of the device with an option to indicate
whether to do eventually or immediately.

The API will be called with the option to do it immediately in a
subsequent CL in Chrome UI. For now the old API (set_track) has been
wired up to call the new API to produce the old behavior (i.e. change
eventually). The old API will be removed after Chrome UI code stops
using it.

It's the UI's responsibility to ask the user for confirmation for the
powerwash that may happen in some cases and call the API with the
appropriate value whether or not the powerwash should happen.

For now, we're restricting the changing of channels to only those
devices that are on canary-channel or running test builds. This
restriction will be lifted off once the UI work is ready to give
warning to the users about the powerwash that may happen when they move
to a more stable channel.

We also enforce ReleaseChannelDelegated and ReleaseChannel policies
correctly now as follows:

* If ReleaseChannelDelegated is false, SetTargetChannel will fail as we
need to honor (only) the ReleaseChannel value in this case.
* If ReleaseChannelDelegated is true, we'll allow the SetTargetChannel
call to specify. In this case, we'll ignore the value of ReleaseChannel,
if any.

BUG=chromium-os:39095
TEST=Tested on ZGB by going from canary to dev-channel with and without
powerwash.
TEST=Existing unit tests have been updated and they pass.
TEST=New unit tests have been added.

Change-Id: Ifbf806a06e1c30d2f318e94d73735d1812049abd
Reviewed-on: https://gerrit.chromium.org/gerrit/44619
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/system_state.h
f3815bb2c4feac57b0b95d1481775d4af4a9b41c 14-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: add missing include

Forgot to include gpio_handler.h in system_state.h.

BUG=None
TEST=Builds

Change-Id: I26d54487ad937deb24ea791fdd1fc332d0af021e
Reviewed-on: https://gerrit.chromium.org/gerrit/41224
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/system_state.h
55f50c24c2624487b803ba2f93588494cc69e523 11-Jan-2013 Jay Srinivasan <jaysri@chromium.org> Segregate UMA metrics for production scenarios from test scenarios.

Currently we separate the UMA metrics only by one category: whether the
device is in dev mode or not. In addition, we need to exclude the noise
from these two categories:
1. Most of our testing on MP-signed images which are performed
with autest.
2. All our hwlab tests run in non-dev mode but they use dev-signed images
with dev-firmware keys.

So this CL defines additional bit fields to represent these states and
if any of these three flags are set, the UMA metric is sent to a
DevModeErrorCodes bucket. Thus the NormalErrorCodes bucket will have only
the production errors and thus we can monitor more effectively.

BUG=chromium-os:37613
TEST=Updated unit tests, ran on ZGB for all scenarios.
Change-Id: Id9cce33f09d1cc50cb15e67c731f7548940cbc24
Reviewed-on: https://gerrit.chromium.org/gerrit/41103
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/system_state.h
bf7919ba5ecd58a6a03afdca8ff88caebd25581d 08-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: disable GPIOs in production; some structural changes

Since we are not making use of the GPIO funcionality in UE for the
moment, it's been advised that it should be disabled. This CL does just
that, plus a few small changes:

* Adds a "no-op" GPIO implementation, which simply returns a constant
value every time it's being asked whether test-mode was signaled (in
this case, we set it to return false).

* The GPIO handler is embedded in SystemState. This makes sense from
both the conceptual and usability standpoint. The SystemState object
can be parametrized to initialize either a real or a no-op GPIO
handler.

BUG=chromium-os:32263
TEST=passes unit tests; does not engage GPIO protocol on x86-alex

Change-Id: I8121647baa7611041073dcf305beddab57c0e49c
Reviewed-on: https://gerrit.chromium.org/gerrit/40633
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/system_state.h
082628869ed3ee3e173c08354d3fc40cdb7df2c0 29-Dec-2012 Jay Srinivasan <jaysri@chromium.org> Implement exponential backoff for throttling repeated AU downloads.

Today we retry the same payload over and over again every hour. Ideally,
we shouldn't require ever to re-download the same payload again. But
from experience we find that post-install or firmware updates may succeed
on a second attempt. So until we have code that can do such selective
retries of those steps, we currently re-download and re-apply the whole
payload. So instead of retrying over and over again, we backoff the
successive payload download attempts at 1 day, 2 days, 4 days, etc. with
an upper limit of 16 days.

Another subtle reason for which we depend on the payload retry mechanism
today is if we've failed downloading the payload via all the URLs that are
specified in the rule, we don't want to keep re-attempting the download.
This case is different from the case discussed above, because in this case
we haven't even downloaded a payload once completely. In this case also,
there's a need for throttling the amount of bytes we end up downloading
repeatedly for a particular operation that may fail. This is done by
treating the exhaustion of all URLs as equivalent to having downloaded
a full payload and subjecting it to the same backoff behavior.

We waive backoffs for dev/test images so as not to cause any delay in
our testing or development.

BUG=chromium-os:36806
TEST=Added new unit tests. Tested all scenarios on my ZGB.
Change-Id: I6bd0d3f296a3c0da0a8026fb71b24785d825e39c
Reviewed-on: https://gerrit.chromium.org/gerrit/40220
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/system_state.h
2b5a0f065187fd19179e3809148dbfc376ada7a0 20-Dec-2012 Jay Srinivasan <jaysri@chromium.org> Classify errors and advance URL index according to the error code.

In CL https://gerrit.chromium.org/gerrit/39638, we always incremented
the URL index irrespective of the error code. That would cause the first
URL to be given up too quickly in favor of the second one even for
transient errors such as when user closes a lid and reopens after some
time.

The right behavior in this case is to just count those failures towards
the URL and only after repeated failures with no progress should we
advance the URL index.

This CL implements this logic and completes the multiple URL-related
work items outlined in the design doc.

BUG=chromium-os:37206
TEST=Tested all uses cases on my ZGB. Added and updated unit tests.

Change-Id: Ida0cfbfeb9bfab732144049d1b27e3b8958bc252
Reviewed-on: https://gerrit.chromium.org/gerrit/39885
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/system_state.h
6f6ea00aa8c4cf54b6842be32ca1226854c24f78 14-Dec-2012 Jay Srinivasan <jaysri@chromium.org> Support for processing multiple URLs in update_engine.

Main changes:
1. Added a new PayloadState class which encapsulates all the persisted
state we use for multiple URLs, back-off (TBD), etc.
2. Added support for handling multiple URLs stored in the OmahaResponse in
OmahaRequestAction and OmahaResponseHandlerAction code.
3. Added support for picking the right URL in OmahaResponseHandlerAction
and putting it in the install_plan. This way, the rest of the code that
uses the install_plan is oblivious to the presence of multiple URLs :-)
4. Added support for advancing to next URL when an update fails. The full
error classification is a new work item (chromium-os:37206). Right now,
it's a basic round-robin on every error.
5. Updated the conditions for determining when hash checks are mandatory.
Previously since there was only one URL, if it was HTTPS, the checks were
waived. Now, even if there's one HTTP URL, we make hash checks mandatory
even if other HTTPS URLs are present.

6. Added new unit tests for PayloadState and the new logic added to other
places.

Noisy changes:
1. Instead of passing PrefsInterface to OmahaRequestAction and
OmahaResponseHandlerAction, we're now passing SystemState which will now
contain PrefsInterface and the newly added PayloadState object that these
actions need to do their work.
2. Renamed a bunch of setters/getters to set_x() and x() instead of SetX()
and GetX() methods - this was pending from Gilad's old CR. As I'm
adding new methods in the correct style, I went ahead and fixed it to
avoid the confusing styles.
3. Updated all existing unit tests to reflect these changes.

BUG=chromium-os:36807
TEST=All Single/Multiple URL scenarios work fine on my ZGB as expected.
TEST=Old and new unit tests run fine.

Change-Id: Id31f9ccb220471f3ec3a475f624dc03c16119144
Reviewed-on: https://gerrit.chromium.org/gerrit/39638
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/system_state.h
f057205065339c54d3403263f049e2ea69417665 24-Oct-2012 Jay Srinivasan <jaysri@chromium.org> Send UMA Stats for update engine error codes.

With the latest addition of new optional security checks for the update
manifest and operations checked in, we now want to track the number of
failures, if any, over time to help us decide when it is safe to make
the new security checks mandatory. This CL adds the UMA metric for
reporting the new (as well as the old) error codes to UMA for the first
time.

There's no change to the existing errors that are being sent to Omaha.
Due to UMA restrictions, some Omaha codes will be aggregated when being
sent to UMA.

BUG=chromium-os:34299
TEST=Unit tests pass, tested on real ZGB, all stats show up in
chrome://histograms correctly for both dev mode and normal mode.
Change-Id: I3ce4645636311cedbb33f601e775951966c0a545
Reviewed-on: https://gerrit.chromium.org/gerrit/36408
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/system_state.h
4348879380222dc8c74b0976e527bf3da66ba08f 19-Jun-2012 Jay Srinivasan <jaysri@chromium.org> UpdateEngine-side changes to allow updates over 3G based on device policy.

Some enterprise chromebooks have only 3G and hence they need the ability
to update over 3G if the enterprise policy allows that. This CL adds
the support in update_engine to enable that.

BUG=chromium-os:31099
TEST=Tested E2E on 3G, added unit tests and did regression testing.
CQ-DEPEND=I1a55a392f3dc0f12d917eb45dcf0456b57735514
Change-Id: I121bda35e54fa6c35e002a76db198d13b72b650e
Reviewed-on: https://gerrit.chromium.org/gerrit/25470
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/system_state.h