History log of /system/update_engine/main.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e97b39c4140af015f5a2939808cf8ee39bde43a2 20-Jan-2016 Alex Deymo <deymo@google.com> Implement Android UE daemon using brillo::Daemon.

The setup logic for Brillo and Android devices is very similar despite
the differences in the daemon logic and exposed service interface.
This patch reuses the brillo::Daemon derived class and the main()
function from Brillo to implement the daemon and service setup in
Android as well.

In addition, the Chromium OS build now defines the __CHROMEOS__ macro
to make the code behave the same way as in the Brillo case.

Bug: 25631949
TEST=`mmma system/update_engine` on edison-eng and aosp_arm-eng

Change-Id: I0f9690264e0822ef7e71318c73c2f16eda99e07c
/system/update_engine/main.cc
bdd765e3157a2b04265dcdab0d7a55e747924555 23-Jan-2016 Alex Vakulenko <avakulenko@google.com> Revert "Implement Android UE daemon using brillo::Daemon."

This reverts commit c180400937eac75e8b7119f68d44593713dd4557.

This breaks both AOSP and Chrome OS

Change-Id: Ie9686a4d03a8fd53a614ed1706e3268918c414fb
/system/update_engine/main.cc
c180400937eac75e8b7119f68d44593713dd4557 20-Jan-2016 Alex Deymo <deymo@google.com> Implement Android UE daemon using brillo::Daemon.

The setup logic for Brillo and Android devices is very similar despite
the differences in the daemon logic and exposed service interface.
This patch reuses the brillo::Daemon derived class and the main()
function from Brillo to implement the daemon and service setup in
Android as well.

Bug: 25631949
TEST=`mmma system/update_engine` on edison-eng and aosp_arm-eng

Change-Id: I15b2c2990a8055619dd407b2996ea92216c602a2
/system/update_engine/main.cc
c1c17b4ed6a3896b6343e737fd89682fa0c8436b 23-Nov-2015 Alex Deymo <deymo@google.com> Report Enum metrics from CertificateChecker.

The certificate checker was reporting a "user action" whenever an
update check HTTPS connection or HTTPS payload download had an invalid
HTTPS certificate or a valid one that was changed since the last
connection to the same server.

This patch sends an Enum metric for every HTTPS connection to check for
and update or download the payload with one of the three options: an
invalid certificate, a valid one already seen or a valid but different
certificate.

This patch also moves these metrics to the metrics.{h,cc} module, where
all the other metrics are reported, using an observer pattern in the
CertificateChecker, needed to remove the dependency on the metrics
library from the libpayload_consumer.

Bug: 25818567
TEST=FEATURES=test emerge-link update_engine; mma;

Change-Id: Ia1b6eb799e13b439b520ba14549d8973e18bcbfa
/system/update_engine/main.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/main.cc
3f39d5cc753905874d8d93bef94f857b8808f19e 13-Oct-2015 Alex Vakulenko <avakulenko@google.com> update_engine: Rename "chromeos" -> "brillo" in include paths and namespaces

libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: I770659a95be380a50fe3b2ba9f91d65818f40945
/system/update_engine/main.cc
2e71f90d6af955a5359853132085931f1e0479e0 30-Sep-2015 Alex Deymo <deymo@google.com> Implement XzExtentWriter.

The new XzExtentWriter class is an ExtentWriter that uses xz-embedded
to decompress an xz stream and write it to the underlying extent
writer. This will be used to implement REPLACE_XZ in a follow up CL.

Bug: 23604708
Test: Added unittests.

Change-Id: Ifd2ba0c917b66ab33e5cff1d6069da833ad54882
/system/update_engine/main.cc
a9fea846fce755062537320ad5126a40078409fb 17-Sep-2015 Alex Deymo <deymo@google.com> Allow update_engine to create executable files.

update_engine creates directories in some cases, such as the "prefs"
directory. With this mask set, the directories created in Android don't
have the executable bit for the owner, so you can't create files inside
those directories. In Chrome OS this is not really a problem because
update_engine runs as root anyway.

This patch removes the executable bit mask for the owner.

Bug: 23186405
Test: Deployed on drangonboard; /data/misc/update_engine/prefs is executable.

Change-Id: I0c3cc8dd5cacae538091d1f8e131f8247cbf8fbf
/system/update_engine/main.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/main.cc
0b3db6b6040f53eb9859e614f7fe4c681213d33a 11-Aug-2015 Alex Deymo <deymo@chromium.org> update_engine: Remove all references to glib.

The message loop in production code switched from
chromeos::GlibMessageLoop to chromeos::BaseMessageLoop used in
chromeos::Dameon. This patch moves all the unittests also to use
chromeos::BaseMessageLoop or chromeos::FakeMessageLoop when I/O is not
required.

This patch removes all (now unused) references to glib.

BUG=chromium:499886
TEST=`grep glib[^c] . -R` return no results. Also, unittests work.

Change-Id: Iddfb17def501829d932ed1f70faad3e00268898e
Reviewed-on: https://chromium-review.googlesource.com/292157
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/main.cc
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/main.cc
b7ca096f98a43ebbf412f1b2d3d15bb184f871f8 02-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Migrate UE DBus service to chrome DBus bindings.

chromeos-dbus-bindings now generates the adaptor interface that
update_engine exposes over DBus. This interface is implemented in
dbus_service.{h,cc}, which now has a UpdateEngineService class
encapsulating all the service methods implementation.

This allows to write unit test for those methods, which are included
in this CL for all the non-trivial methods.

This CL now uses chrome's DBus bindings for the update_engine serive,
but the proxy interaction is still done using dbus-glib. The main loop
in the main.cc file is now replaced with the chromeos::Dameon, which
uses a chromeos::BaseMessageLoop instead of a GlibMessageLoop. This
causes the asynchronous interactions in the proxy side to not work,
which will be fixed in the next CL.

CQ-DEPEND=CL:290990,CL:291092,CL:293334
BUG=chromium:419827
TEST=Added unittest for all dbus_service methods. deployed and tested manually that update_engine dbus interface works.

Change-Id: I6a6d142b2ac1a61a4c3abcb927665b26114abe5c
Reviewed-on: https://chromium-review.googlesource.com/225324
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@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/main.cc
461b259af8815d782200782c5ba3599d8de4a66c 25-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Use libchromeos to launch subprocesses.

The Subprocess class handles the execution of suprocesses in the
update_engine such as the post-install script and bspatch operations.

This patch migrates this class from using glib functions to use
libchromeos classes with equivalent functionality.

Callsites and unittests were updated to match the new interface.

BUG=chromium:499886
TEST=Unittest still pass. Deployed on link and cros flash another image
using a delta payload.

Change-Id: Ia64d39734e220675113f393a6049e9a9b0fe8409
Reviewed-on: https://chromium-review.googlesource.com/288837
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/main.cc
0bb234147ea8f0247b733375fcf1685eaf329aac 19-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Add locations to the MessageLoop calls.

When running the unittests with --v=1, this patch will show the location
where the tasks were posted to the FakeMessageLoop.

BUG=brillo:91
TEST=Ran unittest with --v=1

Change-Id: I0f9b0a3b67a40c26965a396258f1bd45e38f5ba3
Reviewed-on: https://chromium-review.googlesource.com/280568
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/main.cc
cc169259cd4451d6bf23c04ed07ac69a1d4d9444 11-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Switch main to GlibMessageLoop.

This patch instanciates a GlibMessageLoop for the main thread that
can be used by any module by calling MessageLoop::current().

BUG=brillo:91
TEST=Ran update_engine on a link device. Main loop still works.

Change-Id: I42a6011515de77a77dfb636cc5ae9488e072ad58
Reviewed-on: https://chromium-review.googlesource.com/276891
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/main.cc
08d493198de248281beb5c9e2f37904edccf60dc 04-Mar-2015 Timothy Jennison <tjennison@chromium.org> update_engine: fixes to use chromeos-dbus-bindings generation

Add dbus-service-config.json and fix update_engine.xml to have the
correct DBus path. Move both into dbus_bindings folder.

BUG=None
TEST=Successful build and tested generated bindings
CQ-DEPEND=CL:256827,CL:*204736

Change-Id: I7020940c17cc3cf085cf2ef38275ed3a16f37ceb
Reviewed-on: https://chromium-review.googlesource.com/255935
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Timothy Jennison <tjennison@google.com>
Commit-Queue: Timothy Jennison <tjennison@google.com>
/system/update_engine/main.cc
d570820920e030fefd9644fb5427b538160af1a1 29-Sep-2014 Steve Fung <stevefung@chromium.org> update_engine: remove gflags from daemon

We are switching to using chromeos/flag_helper.h instead to standardize the
code everywhere.

BUG=chromium:402635
TEST=`FEATURES=test emerge-panther update_engine`
TEST=`cbuildbot --remote --hwtest -p 'chromiumos/platform2'
{falco,link}-paladin` passes

Change-Id: I873462f6ba8b24086b423572fe2b0bc81e80e4f4
Reviewed-on: https://chromium-review.googlesource.com/212520
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Steve Fung <stevefung@chromium.org>
Tested-by: Steve Fung <stevefung@chromium.org>
/system/update_engine/main.cc
d603ba9ff52c72a68556495245e1069c991866d4 03-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Move variable to function level script to prevent UaF.

main's SetupLogging() had a temporary string variable holding the
result of SetupLogFile(), which is the filename where we should
write the log to. logging::InitLogging interface accepts a
logging::LoggingSettings struct that holds a char* to the log file
name that needs to be alive while it is referenced from the
LoggingSettings struct, instead of just holding a std::string.

This patch moves the temporary string variable to the same scope
as the LoggingSettings struct, preventing a use-after-free.

BUG=chromium:419659
TEST=`USE="clan asan" emerge-link update_engine libchrome libchromeos` and deployed to a link device.
TEST=`update_engine` doesn't crash reporting an error in /var/log/asan.* with this patch.

Change-Id: I87adddeec0002592d67512d14a8d6d1a597843cf
Reviewed-on: https://chromium-review.googlesource.com/221501
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/main.cc
67363ee8c3c542e8799983cc4dd375b77e8252e9 24-Sep-2014 Alex Deymo <deymo@chromium.org> update_engine: Wait for dbus connection to be available.

In the general case, update_engine won't be launched until dbus-daemon
is ready. Nevertheless, if dbus-daemon crashes for some reason,
update_engine will crash and restart again and again because it can't
get the DBus system bus. This will generate many crash reports in a
short period of time.

This patch waits up to 10 seconds to get the DBus system bus, and then
crashes if it couldn't get it by then.

BUG=chromium:417142
TEST=launch update_engine without dbus-daemon and saw it retry and crash.
TEST=launch update_engine in the normal case, it doesn't retry..

Change-Id: I99714cec87f99eeef385fc6e8787334fbc029044
Reviewed-on: https://chromium-review.googlesource.com/219690
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/main.cc
06c76a49bfd29c8abdb8abd5b646a6583783191a 05-Sep-2014 Ben Chan <benchan@chromium.org> Update code to include base/files/file_util.h

file_util.h was moved from base to base/files
(https://codereview.chromium.org/468253002). This CL updates platform2
code to include base/files/file_util.h instead of base/file_util.h.

BUG=chromium:411001
TEST=Trybot run on paladin, release, and chromiumos-sdk builders.

Change-Id: I488925b54615e131e508a460dc1a27f88168f936
Reviewed-on: https://chromium-review.googlesource.com/216851
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/update_engine/main.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/main.cc
44666f97392f1f0f8be292fe6a4edcf9237540df 23-Jul-2014 Alex Deymo <deymo@chromium.org> update_engine: Remove dependency on libupdate_engine from the client.

The update_engine_client is a very small DBus client that only
depends on a single utils:: function from the update_engine daemon
codebase. Because of this, it was forced to be linked against many
libraries that it didn't use.

This patch factors out this glib helper function to a new
glib_utils.{cc,h} file and includes only that in the
update_engine_client binary.

BUG=chromium:396440
TEST=FEATURES=test emerge-link update_engine

Change-Id: Icf8d8b3c6ebd22cdb39e6674fb3d9071071ec941
Reviewed-on: https://chromium-review.googlesource.com/209472
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/main.cc
44cab30e0ee04b277e8463785ab069e9885a9f2d 23-Jul-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: Sort headers alphabetically (build/include_alpha)

We are going to enable build/include_alpha linter warning soon,
so in preparation for this, fixed the warnings in update_engine.

BUG=None
TEST=cpplint.py --filter=-build/include_order,+build/include_alpha update_engine/*
CQ-DEPEND=CL:209472

Change-Id: I261ea04681599a68ec7cb899f2f881cbe228ff7b
Reviewed-on: https://chromium-review.googlesource.com/209631
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/main.cc
d2779df63aaad8b65fc5d4badee7dbc9bed7f2b6 16-Jun-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: fixed warnings from cpplint

Fixed all the cpplint warnings in update engine.

BUG=None
TEST=Unit tests still pass.

Change-Id: I285ae858eec8abe0b26ff203b99a42a200ceb71c
Reviewed-on: https://chromium-review.googlesource.com/204027
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/main.cc
736fcb57ca2dcf09710a797e4c23a64f6cd64e16 22-May-2014 Ben Chan <benchan@chromium.org> update_engine: Update to build against libchrome-271506.

BUG=chromium:375032
TEST=`FEATURES=test emerge-$BOARD update_engine`

Change-Id: Ia7be302c12b439ad8aece51c9cbe128086626620
Reviewed-on: https://chromium-review.googlesource.com/201045
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/update_engine/main.cc
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/main.cc
7e8ac06833aba4d851257fe287b38c98af4e226b 01-May-2014 Alex Deymo <deymo@chromium.org> Use update_engine_service_new() from main().

This a simple fix that uses the update_engine_service_new() function
to create an UpdateEngineService.

BUG=None
TEST=gmerge on the device; restart update-engine; tested the DBus interface works with:
dbus-send --system --dest=org.chromium.UpdateEngine --print-reply /org/chromium/UpdateEngine org.chromium.UpdateEngineInterface.GetStatus

Change-Id: I862007d9bb6cb0dff5c8e3f35580b6471758be40
Reviewed-on: https://chromium-review.googlesource.com/197852
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/main.cc
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/main.cc
1b9d6ae00b3c3badf9785584c2c867710f214a62 03-Mar-2014 Gilad Arnold <garnold@chromium.org> Further cleanup around DBus interface classes.

* Removed the "Glib" part from the various DbusGlib class name and added
"Wrapper" instead: only part of the methods here declared have
anything to do with Glib; in essence, this is an interface containing
wrappers for various DBus functions.

* Changed "Dbus" to "DBus", to comply with the rest of the world.

* Renamed the actual implementation "RealDBusWrapper" (instead of
"Concrete").

* Separated out RealDBusWrapper into its own header file. Client code,
which often only cares about the abstract class, does not need to pull
it unless specifically requiring it.

* Cleaned up the includes in these headers.

Aside from all that, also renamed system_state.cc into
real_system_state.cc, as this is what this file contains.

BUG=None
TEST=Unit tests.

Change-Id: I015c407cbc159aba8b5925eb0e916ba604c829cd
Reviewed-on: https://chromium-review.googlesource.com/189373
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/main.cc
46bf5c8663bd0b7be0809d3d5ea6a844f4c6219f 24-Jun-2013 Ben Chan <benchan@chromium.org> Remove unnecessary call to the deprecated g_thread_init().

g_thread_init() has been deprecated since glib 2.32. This CL removes the
unnecessary call to g_thread_init(), so that we can later migrate to
glib 2.34. It also replaces dbus_g_thread_init(), which calls the
deprecated g_thread_supported(), with dbus_threads_init_default()
directly.

BUG=chromium:253025
TEST=Tested the following:
1. Build and run unit tests.
2. Run trybot builds on x86, amd64, and arm platforms.

Change-Id: I30852f1d3525f3d7b5b6cd756d18c2816a28903f
Reviewed-on: https://gerrit.chromium.org/gerrit/59801
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/update_engine/main.cc
e4c58bf01b6ccc915c6b261007dbb75241ed69b8 19-Jun-2013 David Zeuthen <zeuthen@chromium.org> Add Installer.TimeToRebootMinutes metric

This patch introduces a new metric for tracking the duration between
when an update has successfully completed (and the user is presented
with the "reboot arrow" in the panel) and when the system has booted
into the new update.

BUG=chromium:248800
TEST=New unit test + Unit tests pass + Manual tested

Change-Id: Ia22cedc3b70f1d9c2598bed9469b34a257546a64
Reviewed-on: https://gerrit.chromium.org/gerrit/59132
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/main.cc
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/main.cc
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/main.cc
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/main.cc
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/main.cc
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/main.cc
7c04e76f469b30b0086201baba94db1c15a028e5 23-May-2012 Gilad Arnold <garnold@chromium.org> Enable test mode updates.

* Uses the GPIO module to deduce whether a current update session needs
to be treated as a controlled test, which allows a few relaxations.

* LibcurlHttpFetcher is extended to relax some of its security lock down
provisions.

* Fix: a test mode flag remains persistent throughout an update attempt,
so that it can be delegated to the various HttpFetcher instances used
in the same attempt.

BUG=chromium-os:25397
TEST=Builds and unittests; automated test script works w/ servo
connected Alex

Change-Id: I8a29d1a21a0632912c10f01f69a26d9c659472fd
Reviewed-on: https://gerrit.chromium.org/gerrit/25128
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
/system/update_engine/main.cc
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/main.cc
08fce04e5341c99f308ee7462b1f351f5232eacd 08-Jun-2012 Jay Srinivasan <jaysri@chromium.org> Don't scatter during OOBE or user-initiated update checks.

We need to add logic to disable scattering of downloads if we are in OOBE
or if we're doing a manual update check.

Scheduled checks are already disabled during OOBE, but this extra check
will ensure that any scattering policy (there's a pending work item to get
policy during OOBE) during OOBE will have no effect on the update.

Similarly manual (i.e user-initiated) update checks through
update_engine_client or through Chrome UI should not honor scattering.
That way, this can serve as a simple user-friendly workaround in case
there's any bug in scattering logic that bricks the system by any chance.

BUG=chromeos-31563: Don't scatter during OOBE or manual update checks.
TEST=Updated unit tests. Tested all code paths manually on ZGB and Kaen.
Change-Id: Ib631e560c1f620ca53db79ee59dc66efb27ea83c
Reviewed-on: https://gerrit.chromium.org/gerrit/24564
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/main.cc
4d740ebe4fd3cef70d415113f427f64ee5e87f7e 15-May-2012 Gilad Arnold <garnold@chromium.org> Revised GPIO module interface + GPIO discovery logic

* The GpioHandler class is no longer a static singleton, rather an
ordinary object with a dynamic guard against multiple instances. This
makes testing/mocking a lot easier and simplifies implementation.

* It uses a basic, mockable udev interface; the module comes with
complete unit testing of the discovery mechanism.

* Corresponding changes to user classes, including UpdateAttempter and
UpdateCheckScheduler.

Note that the implementation of the test mode signaling protocol is
currently a no-op, always returning false, and hence has no effect on
the update process yet. This mechanism will be implemented in a later
CL.

BUG=chromium-os:25397
TEST=Builds and passes unit tests (including new ones)

Change-Id: I2f6254db6799ff5ef8616314890833f6e3269ff6
Reviewed-on: https://gerrit.chromium.org/gerrit/22869
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
/system/update_engine/main.cc
8155d081dc729d407f8ff9e95b4ef91ae14281ce 06-Apr-2012 Mike Frysinger <vapier@chromium.org> pull in base/stringprintf.h explicitly

Newer libbase no longer implicitly includes the stringprintf.h header,
so building against it fails with missing StringPrintf definitions.

BUG=chromium-os:25872
TEST=`emerge-x86-alex update_engine` works with old & new libbase

Change-Id: Ia1ea842449c0382ee4c8e5abd3ddfb3012c3ff2f
Reviewed-on: https://gerrit.chromium.org/gerrit/19774
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
/system/update_engine/main.cc
a0b9e777e2c571546bd6ab55356acb023834cbc3 06-Oct-2011 Darin Petkov <petkov@chromium.org> AU: Ensure update_engine_client get proxy retries are spaced out in time.

Hopefully, this will reduce test flakyness. It seems that last time the test
failed all 4 tries happened within a one-second timeframe.

Also, fix GError object memory leaks throughout the code.

BUG=chromium-os:21351
TEST=unit tests, tested on VM

Change-Id: If0bc5d5767d12f3396d0fcb46f3e04ed6d7dfd5c
Reviewed-on: http://gerrit.chromium.org/gerrit/8862
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/update_engine/main.cc
7f9aea2748370b0a26e1d5c36db7d8bbf3ba1245 12-Sep-2011 Bruno Rocha <bpontes@google.com> Add UMA metrics for detecting and reporting update certificate changes.

LibcurlHttpFetcher checks if the update server certificate has changed
since last update, and stores an eventual report in prefs. UpdateCheckScheduler
submits to UMA reports from the previous update.

BUG=chromium-os:19842
TEST=Included unittest for the new class and tested locally on an Alex device,
since we need to verify against the actual server certificates.

Change-Id: I5bee5d648982cd7618db09b67d5bff377eaa1fc1
Reviewed-on: http://gerrit.chromium.org/gerrit/7565
Reviewed-by: Bruno Pontes Soares Rocha <bpontes@chromium.org>
Tested-by: Bruno Pontes Soares Rocha <bpontes@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/update_engine/main.cc
61635a95b9e6c62e31ed61fb5738c55bb5c92048 19-May-2011 Darin Petkov <petkov@chromium.org> AU: Announce the update engine status on startup.

This is to ensure that the system is in a consistent state in case update-engine
crashes.

BUG=chromium-os:15069
TEST=press "Check for update" in Chrome, restart update-engine while downloading
an update, see the status go back to 'up to date' (rather than get stuck in
'Downloading')

Change-Id: I1e89502a9fa134ec3a81e50a9036ce20b46eb9b0
Reviewed-on: http://gerrit.chromium.org/gerrit/1144
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
/system/update_engine/main.cc
d903c3b0507a433ec25675ed6dc68ce8551127c7 13-May-2011 Chris Masone <cmasone@chromium.org> [update_engine] Roll forward to new libchrome

BUG=chromium-os:14304
TEST=build, unit tests

Change-Id: Ic6bc4c27ade8f960b770cd766753d6e5729d4878
Reviewed-on: http://gerrit.chromium.org/gerrit/823
Reviewed-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/update_engine/main.cc
c1d5c93ddf56e193fd501e5f8fc3fc45efdc560f 21-Apr-2011 Andrew de los Reyes <adlr@chromium.org> AU: Handle firmware update failure when booted from FW slot B.

The firmware updater will fail if we are booted into FW slot B and we
try to update firmware. We shouldn't treat this like a usual update
failure because trying again won't help until we reboot. Thus, with
this CL, we detect this case and request a reboot from the
user. Technically this request is a lie, b/c we are reusing the reboot
request mechanism which tells the user an update has been applied and
thus must be rebooted. We accept this fib since this situation is very
rare: use would have to have 2 FW update updates in a row w/o any
extra boots between.

Also, fix error code in subprocess.

Also, remove execute permissions on a bunch of source files.

BUG=chromium-os:14343
TEST=unittests, tested updates on machine that success, fail, have FW B failure

Review URL: http://codereview.chromium.org/6880077

Change-Id: I2509c6e1c9c9da3ff1ea27da4861c4850bd4d000
/system/update_engine/main.cc
6dbf30a3c752c402f5a308de3b59d4c860de2d58 19-Apr-2011 Andrew de los Reyes <adlr@chromium.org> AU: Always run setgoodkernel, unless we abort within 45 seconds of launch.

This addresses a bug in the updater. Previously, we ran setgoodkernel
within 45 seconds of boot, unless an update was running or completed
successfully (thus requiring us to reboot). This change keeps the
indended behavior of running within 45 seconds of boot, but prevents
updating from interfering.

BUG=chromium-os:14280
TEST=tested on device

Change-Id: Ib6a8978835a68440d671785577abccdc5856ef1d

Review URL: http://codereview.chromium.org/6881037
/system/update_engine/main.cc
000d895da247697f4e4e0c67a3a847f71fca8eb9 03-Mar-2011 Andrew de los Reyes <adlr@chromium.org> AU: Full proxy support

This CL Introduces a new proxy resolver that queries Chrome browser
for all URLs. This means the updater now works with Proxy
AutoConfiguration (PAC) files and automatic proxy detection.

BUG=chromium-os:9478
TEST=performed update, unittests

Review URL: http://codereview.chromium.org/6594025

Change-Id: I2c169aec06109e3eabc4011e0b536685dfd13f79
/system/update_engine/main.cc
4516810fe41a39c0c55d2095679898787259ae38 22-Nov-2010 Andrew de los Reyes <adlr@chromium.org> AU: Manual proxy support

Utilize the ChromeProxyResolver to resolve proxies in our network
requests. This means the following changes:

- HttpFetcher classes take a ProxyResolver* in their ctor. Also, a few
useful functions in HttpFetcher to allow subclasses to iterate
through the proxies.

- LibcurlHttpFetcher support for using the ProxyResolver. It will
attempt to use each proxy in the order specified. If any data comes
in from any proxy, it won't continue down the list and will continue
to use that proxy for its lifetime.

- UpdateAttempter can choose, for a given update session, whether or
not to use the ChromeProxyResolver or DirectProxyResolver. For now,
the logic is: for automatic checks, 80% of the time use
ChromeProxyResolver, 20% DirectProxyResolver. For manual checks, the
first 19 manual checks in a row use Chrome, then once it uses
Direct, then starts over again. The idea is that the updater doesn't
necessarily trust Chrome, so some requests should skip it. If a
manual check is performed, the user likely wants her proxy settings
honored, so use them, but don't allow frequent manual checks to
starve out usage of the DirectProxyResolver.

- Updates to tests

BUG=3167
TEST=unittests, tested on device

Review URL: http://codereview.chromium.org/5205002

Change-Id: Iee0f589e5b28d4b804afe1f5b6729ba066d48d62
/system/update_engine/main.cc
30291edee8e2f7646b540b00672c81b442386ed6 12-Nov-2010 Darin Petkov <petkov@chromium.org> AU: Timestamp logs at startup.

This will allow logs to be rotated by init/chromeos-cleanup-logs (separate CL).

BUG=5527
TEST=tested on device, chrome://system

Change-Id: I844ebd198510a8f600afa99f840624b2e65d1584

Review URL: http://codereview.chromium.org/4771007
/system/update_engine/main.cc
eee26eeb4ff86ad3a19cffff22db6325057ed97e 22-Oct-2010 Darin Petkov <petkov@chromium.org> AU: Don't mark booted kernel good if we've applied an update.

Otherwise, we may end up reverting the update.

BUG=7553
TEST=unit tests; tested on device with modified chromeos-setgoodkernel script.

Change-Id: I52bd025947ddfc9146644fe9449a4446ea679b3e

Review URL: http://codereview.chromium.org/3980005
/system/update_engine/main.cc
9c0baf82049efd95230a8389769e1b3e5d001209 07-Oct-2010 Darin Petkov <petkov@chromium.org> AU: Catch terminate signals and block exit if necessary.

Adds a global Terminator class to manage signals and exit blocking.

BUG=7392
TEST=unit tests, gmerged on device, initctl stop update-engine

Change-Id: I2291d4eb55240a6662b18ff834af161d957bce2f

Review URL: http://codereview.chromium.org/3608015
/system/update_engine/main.cc
4dc2ada660d3f7cd50d624b6bf102d806cf8997f 23-Sep-2010 Chris Masone <cmasone@chromium.org> [update_engine] Fix file creation mask to be 0600

In addition to changing the write() call in utils.cc, I also set the umask
of the process to be 177 -- meaning that files will be AT MOST -rw-------

I do this _after_ we initialize logging, so that we don't create log files
with unnecessarily restrictive permissions.

BUG=chromium-os:6581
TEST=Unit tests,

Change-Id: Id6b805a1524af391755bc1df69ec0f6c382154c2

[update_engine] Ensure that created files have restrictive permissions

Change-Id: If93e043465083f7c48619d0e7163dd73f8c46090

Review URL: http://codereview.chromium.org/3495002
/system/update_engine/main.cc
1023a6029771fb8dea867e14193df8e58a59a662 30-Aug-2010 Darin Petkov <petkov@chromium.org> AU: Implement exponential back off for 500 and 503 HTTP response codes.

Also refactors the automatic update checks into a separate
scheduler class and adds unit tests for them.

update_check_scheduler.cc 59 / 59: 100.0%
update_check_scheduler.h 1 / 1: 100.0%

Note: because the unit tests for this CL use the
UpdateAttempter class, the CL brings in several untested
modules into the test report reducing the overall test
coverage to ~82%.

BUG=2394
TEST=unit tests, gmerged on device and inspected logs

Change-Id: I078b1727b5338f6fc34e51f5e04a375518d63cef

Review URL: http://codereview.chromium.org/3215006
/system/update_engine/main.cc
1cd885fe5569952adb97c23886b8d12b68257ba1 26-Aug-2010 Darin Petkov <petkov@chromium.org> AU: Simplify the automatic update check code a little.

Moves automatic update checks into the UpdateAttempter class.
This is in preparation for resolving 2394.

BUG=2394
TEST=unit tests, gmerged on device

Change-Id: I66ddf860cc7e19334187dc7f1892ead53fc936c6

Review URL: http://codereview.chromium.org/3167039
/system/update_engine/main.cc
5c0a8afa879886800d82b195e3164e5a580a2cc7 24-Aug-2010 Darin Petkov <petkov@chromium.org> Add 10 minute random fuzz to automatic update check event schedule.

Schedules the initial check at 7 minutes and periodic checks at 45 minutes
with +/- 5 minute fuzz.

BUG=5983
TEST=unit tests, gmerged on device, inspected logs, observed checks

Change-Id: Ifd38574c4265fec78f6e330f965c2b1054b2dddb

Review URL: http://codereview.chromium.org/3173041
/system/update_engine/main.cc
3d6a2099db1d76d17b6bbbc5c8a7ee1e14e93a34 24-Aug-2010 Andrew de los Reyes <adlr@chromium.org> AU: call script to set boot flags on successful boot.

BUG=5655
TEST=Tested on device, saw script was run

Review URL: http://codereview.chromium.org/3117033
/system/update_engine/main.cc
9b11165c7bb64843118fc9e1c9c4746137271107 16-Aug-2010 Darin Petkov <petkov@chromium.org> AU: Switch GLib's timeout sources from milliseconds to seconds.

There's no need for the extra resolution and seconds is preferred.

BUG=5577
TEST=unit tests, gmerged on device and saw checks at 2 and 30 minutes.

Change-Id: I6d64774d5a0e8961fbb9868edc42e62eb794ba11

Review URL: http://codereview.chromium.org/3183004
/system/update_engine/main.cc
790e62e2d8114647b0785574bea361cf931c482b 12-Aug-2010 Chris Masone <cmasone@chromium.org> [update_engine] Update to use not-hideously-old logging API from chrome

BUG=None
TEST=compile

Change-Id: Ieed8952b6806a72b59e16c1579f7293b6a98157a

Review URL: http://codereview.chromium.org/3170010
/system/update_engine/main.cc
f74eb6543268b58231649465aee135a85920919f 04-Aug-2010 Darin Petkov <petkov@chromium.org> Disable automatic update checks if booting from a removable device.

BUG=5335
TEST=unit tests, gmerged to hard-drive as well as USB

Review URL: http://codereview.chromium.org/2868105
/system/update_engine/main.cc
33d30646542170bea5dc50f50b6e2c9f850c0c7c 04-Aug-2010 Darin Petkov <petkov@chromium.org> Don't schedule periodic update checks for non-official builds.

BUG=5334
TEST=unit tests, gmerged on device and tried with different tracks

Review URL: http://codereview.chromium.org/3041044
/system/update_engine/main.cc
1cbd78ffe68039a5781c3434816e03e64033dc0b 29-Jul-2010 Darin Petkov <petkov@chromium.org> Don't send machine and user ID to Omaha anymore. Send a/r pings instead.

This avoids sending a unique ID in order to track active user counts.
Note that this CL doesn't remove the machine/user/Omaha ID/file from
the params object -- it just makes them unused/obsolete. Removal will
be done in a subsequent CL in an effort to make this CL smaller.

BUG=1439
TEST=unit tests, x86-generic, arm-generic, gmerged and inspected logs

Review URL: http://codereview.chromium.org/2856070
/system/update_engine/main.cc
5a7f565a542196f24eb87ddac96508f8a84e3329 23-Jul-2010 Darin Petkov <petkov@chromium.org> Add support to update_engine_client for -app_version and -omaha_url.

These options prevent auto-detection of these parameters.
Note that this CL makes the check_for_update DBus method obsolete from
the client's point of view.

BUG=4593
TEST=unit tests, gmerged on device and tried the client with different options.

Review URL: http://codereview.chromium.org/3048008
/system/update_engine/main.cc
9d65b7b9249124a433b9a018a1952435f7f75c4d 20-Jul-2010 Darin Petkov <petkov@chromium.org> Measure and send update time to UMA.

BUG=4852
TEST=unit tests, gmerged, force update, looked at about:histograms.

Review URL: http://codereview.chromium.org/2868061
/system/update_engine/main.cc
a4a8a8ccc2d9e0285728ed247b43f09433e63323 16-Jul-2010 Darin Petkov <petkov@chromium.org> Turn OmahaRequestPrepAction into OmahaRequestDeviceParams.

Pass the params to OmahaRequestAction's ctor. This simplifies a bit
executing as well as testing of OmahaRequestAction and testing of
OmahaRequestDeviceParams. It also allows us to initialize the params
once per update attempt and use them for all OmahaRequestActions.

BUG=560
TEST=unit tests, gmerged on device and forced an update through dev server,
inspected logs.

Review URL: http://codereview.chromium.org/2836053
/system/update_engine/main.cc
6b78e29f80e98c4ad009c830012682220dc9de3b 11-May-2010 Andrew de los Reyes <adlr@chromium.org> Init: Start Update Engine at startup

Also related AU Fixes:

- daemonize() for upstart

- remember success in updating across runs of the process.

- bug fixes: don't try to update if an update is in progress, clear
actions out in Update Attempter when updating is complete.

BUG=None
TEST=on device testing

Review URL: http://codereview.chromium.org/2055008
/system/update_engine/main.cc
73520670492f3358c496698767879adcf6c03aea 10-May-2010 Andrew de los Reyes <adlr@chromium.org> AU: check after 2 min, also every 30 min.

also, send updaterversion with omaha request.

also, log to /var/log/update_engine.log

BUG=None
TEST=tested on device

Review URL: http://codereview.chromium.org/2037005
/system/update_engine/main.cc
63b96d74b2ffe5999243ab5c33f588030bcb42ce 10-May-2010 Andrew de los Reyes <adlr@chromium.org> AU: DBus support.

A few changes to support dbus in the Update Engine daemon:

- SConstruct: build marshaller for the dbus signal.

- Update Attempter: respond to dbus calls and broadcast status on dbus
signal.

- Update Engine Client: flag to listen for status updates.

- Also, cleanup outdated code in Omaha Response Handler.

BUG=None
TEST=attached unittests/on device tests

Review URL: http://codereview.chromium.org/2037002
/system/update_engine/main.cc
f97144334e945a5ec88970b4b28f4e98ce0bbb80 04-May-2010 Andrew de los Reyes <adlr@chromium.org> AU: Many minor cleanup changes

postinstall: Run postinst twice, once for pre-commit (ie, before we
mark the install partition bootable in the partition table), and
post-commit (for after we do). This behavior is needed for specific
types of firmware update.

download action: flush caches, as we found was necessary in
memento_updater.sh

omaha request prep action: update the names of keys we look for in
lsb-release, also get the AU server url from a file, rather than
hard-code it.

set bootable flag action: GPT support.

also, some misc utility functions.

BUG=None
TEST=attached unittests

Review URL: http://codereview.chromium.org/1881001
/system/update_engine/main.cc
4e9b9f4d57a0c95fb1b9281077f0eef5fdf5e345 27-Apr-2010 Andrew de los Reyes <adlr@chromium.org> AU: Beginnings of dbus support.

The AU will be a daemon that runs as root. Non-root will communicate
via dbus with the updater to do things such as: query status, request
forced or full updates, etc.

New files for dbus:

UpdateEngine.conf - security configuration
dbus_constants.h - common constants
dbus_service.* - The object exposed over dbus
org.chromium.UpdateEngine.service - the dbus service file
udpate_attempter.* - Refactored this out of main.cc
update_engine_client.cc - Simple command line utility to interact with
Update Engine over dbus. Whereas Update Engine runs as root, this tool
runs as non-root user.

Review URL: http://codereview.chromium.org/1733013
/system/update_engine/main.cc
1e338b8d8289e1abbee16c628612a10e0eaaca93 22-Jan-2010 Andrew de los Reyes <adlr@chromium.org> AU: Gut code for old updater. New protobuf for v2 updater.

Review URL: http://codereview.chromium.org/545072
/system/update_engine/main.cc
4fe15d017c145aca449c2248420c1b4ec8c23758 11-Dec-2009 Andrew de los Reyes <opensource@google.com> AU: Try delta updates first, then full updates

Also, some bug fixes.

Review URL: http://codereview.chromium.org/492008
/system/update_engine/main.cc
c98a7edf648aad88b3f66df3b5a7d43d6a6d7fa9 04-Dec-2009 adlr@google.com <adlr@google.com@06c00378-0e64-4dae-be16-12b19f9950a1> AU: Beginnings of delta support

- proto file for delta files; still needs hardlink support

- code to generate a delta update from two directory trees (old, new).

- code to parse delta update

- Actions: postinst-runner, install, bootable flag setter, filesystem
copier, Omaha response handler, Omaha request preparer,

- misc utility functions, like StringHasSuffix(), templatized Action
classes to feed/collect an object from another action.

- FilesystemIterator: iterates a directory tree with optional
exclusion path. Tolerates deleting of files during iteration.

- Subprocess class: support for synchronously or asynchronously
running an external command. Doesn't pass any env variables.

- Integration test that strings many Actions together and tests using
actual Omaha/Lorry. Currently only tests full updates.

- New simple HTTP server for unittest that supports fake flaky
connections.

- Some refactoring.

Review URL: http://codereview.chromium.org/466036


git-svn-id: svn://chrome-svn/chromeos/trunk@334 06c00378-0e64-4dae-be16-12b19f9950a1
/system/update_engine/main.cc
d2e4ccc22cd4dc1df69bb242321edde4af933e20 05-Nov-2009 seanparent@google.com <seanparent@google.com@06c00378-0e64-4dae-be16-12b19f9950a1> Die glog, die!

Review URL: http://chromereview.prom.corp.google.com/1181050

git-svn-id: svn://chrome-svn/chromeos/trunk@171 06c00378-0e64-4dae-be16-12b19f9950a1
/system/update_engine/main.cc
49fdf1889b965be25f929eeebc5b60cd40b90435 10-Oct-2009 rspangler@google.com <rspangler@google.com@06c00378-0e64-4dae-be16-12b19f9950a1> Almost there...



git-svn-id: svn://chrome-svn/chromeos/trunk@24 06c00378-0e64-4dae-be16-12b19f9950a1
/system/update_engine/main.cc