History log of /system/update_engine/update_engine_client.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2997173235e88c5e4cb13d2844f74afc7b25d6e2 05-Feb-2016 Shuqian Zhao <shuqianz@google.com> Add a feature to get the last UpdateAttempt ErrorCode from update_engine

For autotest, update_engine test failures are always hard to debug,
since the error message is not clear. Add a new flag 'last_attempt_error'
to get the last UpdateAttempt ErrorCode from update_engine.

Bug:25598547
Test:emerge-peppy update_engine
emerge-peppy update_engine_client
cros flash a test image to DUT.
(on the DUT):update_engine_client --last_attempt_error
Compare the results with the update_engine logs, matched.

Change-Id: Id12681097ed30b0826cad68809f17f934a07e5b2
/system/update_engine/update_engine_client.cc
5f52811e5afda03e374a28233500e151f1e706f4 28-Jan-2016 Alex Deymo <deymo@google.com> Compile update_engine_client for non-Brillo targets.

The non-Brillo Android targets use the reduced binder interface. This
patch creates a similar update_engine_client command line tool to use
with the non-Brillo interface and compiles it for those targets.

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

Change-Id: I598144db2b703322c8469fa0982a70dc62572936
/system/update_engine/update_engine_client.cc
690810b2a0c45b6e4c0c2257c6e7c189cf3bba25 20-Jan-2016 Alex Deymo <deymo@google.com> update_engine_client: Prevent hanging the client.

We can't call QuitWithExitCode() from the OnInit() method. This CL
delays the flag processing until the initialization of the daemon is
done.

Other minor linter changes included in this CL.

Bug: None
TEST=`update_engine_client --status` works.

Change-Id: I495397015b5d31dcd2cc9e8de52b8e607c5bd7c7
/system/update_engine/update_engine_client.cc
194414134a954d921c8063610304c4fd21f19df2 07-Jan-2016 Casey Dahlin <sadmac@google.com> Initialize DBus in CreateInstance

We now expect the bus to be ready to go as soon as CreateInstance is
finished. The downside is that CreateInstance can now fail when the bus
isn't available, so we must handle nullptr returns.

Change-Id: I1e8d20f8d85d93e7e8b5e93ee1e5ba6043a347c4
Test: Verified commands continue to work
Bug: 26233663
/system/update_engine/update_engine_client.cc
97c870518ce1149b32966d98ebfe93f3eb5d1fef 06-Jan-2016 Casey Dahlin <sadmac@google.com> Introduce status handlers and use them in client

We introduce a StatusUpdateHandler class which can be overridden to
provide a method with which to react to status updates. This replaces
manual dbus logic in several places in update_engine_client with a
consistent interface for asynchronously handling status updates.

Change-Id: Idca4229de82074fb7a87a315b45dd0292c1b1f16
Test: Confirmed --update blocks and resumes correctly
Bug: 26233663
/system/update_engine/update_engine_client.cc
ef361136cea1e423dc462d2b347923ae60b2cf08 17-Dec-2015 Casey Dahlin <sadmac@google.com> Move all blocking client calls to libupdate_engine_client

Change-Id: I27bc86ad2eef3a573c60fde1bb10b6b37af81c1c
Test: Affected commands continue to work
Bug: 26233663
Signed-off-by: Casey Dahlin <sadmac@google.com>
/system/update_engine/update_engine_client.cc
87ab88e35fac5d3ded1c70c8911d307ec47a7db9 17-Dec-2015 Casey Dahlin <sadmac@google.com> Port all available calls to libupdate_engine_client

This is as far as the port can go without improving the library itself.

Change-Id: I5d5dbf14b62746786364b2a7e1a9131d8ef7bfb1
Test: All affected commands still signal the daemon on dragonboard
Bug: 26233663
/system/update_engine/update_engine_client.cc
e844c1a5604765bbddafa7e05f1143a27f136747 16-Dec-2015 Casey Dahlin <sadmac@google.com> Port update_engine_client ResetStatus command to lib

This is the first step in getting update_engine_client completely off of
direct DBus calls

Test: Ran --reset_status command and verified update_engine received the
signal.
Bug: 26233663
Signed-off-by: Casey Dahlin <sadmac@google.com>

Change-Id: Iac54d890fd796f91a7813755d6061cf468255347
/system/update_engine/update_engine_client.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/update_engine_client.cc
cbea78f22e1420f3cd2167b963acbf599941eb84 16-Sep-2015 Alex Deymo <deymo@google.com> Remove obsolete GetKernelDevices() method.

update_engine daemon exposed a DBus method GetKernelDevices() returning
the list of available kernel block devices and whether they were
bootable or not. This method was a developer-only method, since it
can't be called from chrome, and no other daemon uses it, besides the
update_engine_client.

The update_engine daemon moved from managing root and kernel partitions
explicitly, to manage slots. So the notion of which block device is the
"kernel" device is now unknown. The information about the available
slots and their status, can be managed with the external tool bootctl
instead. Therefore, this patch removes the GetKernelDevices() method.

Bug: None
Test: emerge-link update_engine; `mma` on AOSP.

Change-Id: I715bdbb73ebbbca3dfb381b16043224a170a3832
/system/update_engine/update_engine_client.cc
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/update_engine_client.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_engine_client.cc
d2956cc4b5c60d3d670eb7bf0f1ba800c8a16d62 18-Aug-2015 Alex Deymo <deymo@chromium.org> update_engine: Split DBus client proxies to a library.

In order to allow other daemons call update_engine's DBus interface, we
split the generated interface to its own client library.

BUG=b:23084607
TEST=rm -rf /build/storm/var/cache/portage/chromeos-base/update_engine/out/Default/ ; emerge-link update_engine

Change-Id: Iac09b3269d9ffab599b27888b4a1a2824d262059
Reviewed-on: https://chromium-review.googlesource.com/294064
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_engine_client.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/update_engine_client.cc
13e0dd63e68f2003b46d413d499760b5a7631a03 01-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: client waits for the service to be ready.

In some test scenarios we re-start the update_engine daemon and then run
update_engine_client right away. In those cases, we need to wait for
update_engine daemon to register the D-Bus service before we can talk
to it.

This patch waits up to 10 seconds for the update_engine daemon to be ready.

BUG=chromium:506053
TEST=stop update-engine ; /tmp/update_engine_client -status
TEST=restart update-engine ; /tmp/update_engine_client -status

Change-Id: Ia1496d2f849c12ff341b901237e5cbb13ef046dd
Reviewed-on: https://chromium-review.googlesource.com/282747
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/update_engine_client.cc
72aa0029bcdaf0169ea5c0ace5d224bdc28fcad8 20-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Migrate update_engine_client to chrome DBus bindings.

chromeos-dbus-bindings now generates the proxy inteface that we can use
to interact with update_engine DBus daemon. This CL migrates
update_engine_client to use this proxy insterface instead of dbus-glib,
removing all glib dependencies from update_engine_client.

There's a small functionallity change in the --follow flag. With this patch,
instead of polling the status every 5 seconds, we use the signals sent by
update_engine (about once a second) to monitor the update status.

BUG=chromium:419827
TEST=deployed and tested manually most flags of update_engine_client and its interaction with update_engine. Specifically, the blocking functionality was also tested.

Change-Id: Id27922cb1cdcef750d623ce4f816fbc5ecbc2354
Reviewed-on: https://chromium-review.googlesource.com/280878
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/update_engine_client.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/update_engine_client.cc
8ce80d68e65eba1142aed568997a2e758d2f9786 28-Jan-2015 Alex Deymo <deymo@chromium.org> update_engine: Improve update_engine_client flag checking.

BUG=None
TEST=`update_engine_client --channel canary-channel` fails.

Change-Id: Ib454781a1ba4928ef03b643d4ed18280f1b0e603
Reviewed-on: https://chromium-review.googlesource.com/243699
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Stephen Fung <stevefung@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_engine_client.cc
1ac8b59d7896d667c3eb5f7421761ddc87e819ce 26-Jan-2015 Alex Deymo <deymo@chromium.org> update_engine: Extend rollback documentation with powerwash behavior.

The powerwash flag is enabled by default when doing a rollback. This
patch mentions that in the -rollback update_engine_client help.

BUG=None
TEST=update_engine_client --help

Change-Id: Ib9dbd49de02663ecf8c0dd07d635e49fd19644fe
Reviewed-on: https://chromium-review.googlesource.com/243340
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_engine_client.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_engine_client.cc
97b6f5a3f847f6ad4495dcecc11346caad4ab611 07-Oct-2014 Steve Fung <stevefung@chromium.org> update_engine: remove gflags dependency

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

BUG=chromium:402636
TEST=`FEATURES=test emerge-panther update_engine`
CQ-DEPEND=I03b10d9e6148f1704de7a60128e1550156519272
CQ-DEPEND=I79112aa60d1f27ff0e5b8ee96f1ae46ee9a89a59
CQ-DEPEND=I6d08c080b6dafd59b23bbf185298c587e581c2ed
CQ-DEPEND=I218f6eab28b0160e8379a2716f5c33edeaf9841d

Change-Id: I81d0159f677b02a25640093c039c11e230af9b1b
Reviewed-on: https://chromium-review.googlesource.com/223216
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Steve Fung <stevefung@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Steve Fung <stevefung@chromium.org>
/system/update_engine/update_engine_client.cc
88b591f24cb3f94f982d7024c2e8ed25c2cc26a2 29-Aug-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: Replace NULL with nullptr

Replaced the usage of NULL with nullptr. This also makes it possible to
use standard gtest macros to compare pointers in Update Manager's unit tests.
So, there is no need in custom UMTEST_... macros which are replaced with the
gtest macros (see change in update_engine/update_manager/umtest_utils.h):

UMTEST_ASSERT_NULL(p) => ASSERT_EQ(nullptr, p)
UMTEST_ASSERT_NOT_NULL(p) => ASSERT_NE(nullptr, p)
UMTEST_EXPECT_NULL(p) => EXPECT_EQ(nullptr, p)
UMTEST_EXPECT_NOT_NULL(p) => EXPECT_NE(nullptr, p)

BUG=None
TEST=FEATURES=test emerge-link update_engine
USE="clang asan" FEATURES=test emerge-link update_engine

Change-Id: I77a42a1e9ce992bb2f9f263db5cf75fe6110a4ec
Reviewed-on: https://chromium-review.googlesource.com/215136
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/update_engine_client.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/update_engine_client.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/update_engine_client.cc
f5c0b9cfe82a93968ebdc798f6f42e3aacb9d021 18-Apr-2014 Chris Sosa <sosa@chromium.org> Exit with 1 if can_rollback returns UNAVAILABLE.

BUG=chromium:356898
TEST=update_engine_client -can_rollback

Change-Id: I1c357f5543abe83f00bb386f3e0226a97c4f44a3
Reviewed-on: https://chromium-review.googlesource.com/195459
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_engine_client.cc
7cb12f980c7f9eafcb295ebd7996334b75afd5bc 08-Apr-2014 David Zeuthen <zeuthen@chromium.org> Unbreak 'update_engine_client -watch_for_updates'.

In CL:186384 we started relying on GLib's ability to use a generic
marshaller when NULL is passed. This was manually tested but
unfortunately the wrong codepath was being tested so

$ update_engine_client -watch_for_updates

has been broken since. The problem is that dbus-glib's
dbus_g_object_register_marshaller() function does still not support a
NULL marshaller. This is easily fixed by passing
g_cclosure_marshal_generic() instead of NULL.

BUG=None
TEST=Verified that 'update_engine_client -watch_for_updates' works again.

Change-Id: Ia038d89fcec8d650fc2ac48f348811e5a363022b
Reviewed-on: https://chromium-review.googlesource.com/193605
Tested-by: David Zeuthen <zeuthen@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_engine_client.cc
9d73a72522b0c0e4ef84aeba55a7c284cfa460d5 04-Apr-2014 David Zeuthen <zeuthen@chromium.org> update_engine_client: Make it easy to write a reboot manager.

This CL adds options -block_until_reboot_is_needed and -is_reboot_needed
flags to update_engine_client. This makes it easy to write a simple
script that can be used to reboot the device when an update has been
applied. For example, something like this:

while true;
update_engine_client -block_until_reboot_is_needed
if "$?" != "0"; then
log -p user.critical "update_engine_client failed!"
else
# TODO: app-specific logic to figure out if now is a good time to reboot
reboot
fi
sleep 1
done

BUG=chromium:353871
TEST=Manually tested.

Change-Id: I8399498911b5eb68ceb0c493926ef685a8b89e82
Reviewed-on: https://chromium-review.googlesource.com/193651
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_engine_client.cc
2bddadd17e31ca1341604f8652432a8619557688 27-Mar-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: Added more logging and debugging for rollback checking

To help troubleshoot issues similar to http://crbug.com/356975 I added
more logging in DBus methods of update_engine to trace various stages
of determining available boot partitions, etc.

Also added two more DBus methods - to get the suggested rollback
partition name (and switched CanRollback to use this method) and
the list of availavle kernel partitions along with the 'bootable'
flag for each.

Changed update_engine_client to show the name of avaiable rollback
partition with --can_rollback and also added --show_kernels to
output list of available kernel partitions and whether each partition
is bootable or not.

BUG=None
TEST=Unit tests pass

Change-Id: Ib7f92a6460c578953ea1ba9b23bd0669acb0e22f
Reviewed-on: https://chromium-review.googlesource.com/191949
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/update_engine_client.cc
dea2eac2c565ed5b587278b865e2c07b805a8333 14-Mar-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: Added ability to retrieve old version via DBus

Now it is possible to retrieve an old OS version that was in use
before the last reboot, provided that we are now booted into
an updated version. This is to be used by crash reporter in case
the reboot was caused by a crash in kernel while reboot was pending
for an update. In such a scenario, the crash would be attributed
to the current (updated) version, which is wrong.

Also added additional parameter, --old_version, to
update_engine_client to retrieve the old version number, if any,
from the update engine.

BUG=chrome-os-partner:26518
TEST=cros deploy and tested via update_engine_client

Change-Id: I84e2322c5698b44b4c77f25c8f4211cdb367e5dc
Reviewed-on: https://chromium-review.googlesource.com/190149
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/update_engine_client.cc
59e253e555072d11f3646fc1286459cbc6aa5419 24-Feb-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: added CanRollback dbus method

Added a method to the update engine to check if a rollback
partition is available and can be booted from.
update_engine_client is also updated to call the function
when --can_rollback paramater is specified

BUG=chromium:343301
TEST=Ran "update_engine_client --can_rollback" and unit tests

Change-Id: If3fcb29a0067069a22812f60e9b67c6fdbbd18bd
Reviewed-on: https://chromium-review.googlesource.com/187157
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/update_engine_client.cc
3d41c4df3a51e5b0ad5ac2d87c61f08b36710919 14-Feb-2014 Alex Deymo <deymo@chromium.org> Remove the marshal generation code.

Starting from GLib version 2.29.12, it's not required to provide a
marshaller function when receiving and sending signals over DBus since
the default works with all the basic types.

This was introduced in the following changes in GLib:

* https://git.gnome.org/browse/glib/commit/?id=88ab35f3cb6127036361e421987a127bddb989c8
* https://git.gnome.org/browse/glib/commit/?id=fa2861e3b6109e002b68aa105b5ecbcba88724c1

BUG=None
TEST=unittest and manual test.

Manual test procedure:
* update_engine_client sends the method request for updating and gets
the signal sent by update_engine on dbus_service.cc

Change-Id: Id13b45cb4191dcfb9cab371b82bb589c132c7e09
Reviewed-on: https://chromium-review.googlesource.com/186384
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_engine_client.cc
192449ed75fd9ef81e59b82cc26ad9a5f0e5f8a2 28-Oct-2013 Chris Sosa <sosa@chromium.org> Add --follow to update_engine_client that follows any AU operation to completion.

Before, this ability was nested in with -update, this CL separates the logic
into a --follow flag. To keep existing behavior, I'm forcing --follow to true
when --update is set.

In this CL I also sort the flags variables and clean up some of the logic.
Now all flags should work together except for explicitly mutually exclusive
flags which I noted in the code (this removes early return 0's).

Finally I changed all the LOG(FATAL)'s to LOG(ERROR)'s because the fatals
throw a stack trace which isn't valuable.

BUG=chromium:309051
TEST=Ran
-rollback with and without -follow (found bug with policy that I also fixed.
tested also with update, check_for_update, status, watch_for_status_updates
and app_version.

Change-Id: I1bc1d5bf760af1df117172443112c4ad5864d8a3
Reviewed-on: https://chromium-review.googlesource.com/174905
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_engine_client.cc
75a4c3ee6d45c0892e33e46973816e2fec07e277 06-Sep-2013 David Zeuthen <zeuthen@chromium.org> update_engine_client: Add -interactive=true|false flag

This makes it easier to test the update_engine codepaths dealing with
non-interactive update attempts.

BUG=chromium:273251
TEST=Manually tested with 'update_engine_client -update -interactive=X' +
unit tests pass.

Change-Id: Id3894261fd1c0dc2afdf2426484835f487924433
Reviewed-on: https://chromium-review.googlesource.com/168445
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_engine_client.cc
36dc2f34ebb67ff2c58e9798bf021d6ffa5bbf5b 30-Aug-2013 Alex Deymo <deymo@chromium.org> client: Replace DBus client generated method names.

The dbus-binding-tool uses a different annotation name to specify
the C Symbol of a method when generating the interface .h file from
the .xml file. For the server side, the
org.freedesktop.DBus.GLib.CSymbol is used while for the client side
org.freedesktop.DBus.GLib.ClientCSymbol is used.

This fix adds the client annotation C Symbol and replaces all the
function calls to those functions.

BUG=None
TEST=Code compiles. Generated names are correct.

Change-Id: Ibc9c6c343e618fb2c455f61f89e06c58f9551656
Reviewed-on: https://chromium-review.googlesource.com/167525
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_engine_client.cc
5fdf776fe7eabb0492636ae52d4809ebdbe8a25e 18-Jul-2013 Alex Deymo <deymo@chromium.org> New DBus methods to enable/disable P2P update sharing.

This patch adds two new methods to enable/disable sharing updates
over P2P in the local network. This allows a crosh command to set
and get this flag to enable or disable this feature.

BUG=chromium:260441
TEST=Manual test. See below.

Manual test procedure.
1. Enable P2P:
update_engine_client -p2p_update yes -show_p2p_update

[0829/141039:INFO:update_engine_client.cc(433)] Current update using P2P setting: ENABLED
[0829/141039:INFO:update_engine_client.cc(500)] Done.

2. Start the p2p server (this will be done by the p2p_manager
as part of the update_engine procedure).

3. Run an update check
update_engine_client -check_for_update

The /var/log/update_engine.log shows the following line confirming
p2p is enabled.
[0829/141317:INFO:p2p_manager.cc(194)] Returning value 1 for whether p2p is enabled.

4. Disable p2p and verify the p2p server is not running.
update_engine_client -p2p_update no -show_p2p_update

[0829/141039:INFO:update_engine_client.cc(433)] Current update using P2P setting: ENABLED
[0829/141039:INFO:update_engine_client.cc(500)] Done.

5. Verify p2p server is not running (ps aux | grep p2p doesn't show
p2p-server)

Change-Id: I3215e2961be440c491f669d4c580bbf87f7fec25
Reviewed-on: https://chromium-review.googlesource.com/62505
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alejandro Deymo <deymo@chromium.org>
Tested-by: Alejandro Deymo <deymo@chromium.org>
/system/update_engine/update_engine_client.cc
cb7fa886480e74440b41e94856cd3d12a6099e00 26-Jul-2013 Chris Sosa <sosa@chromium.org> Remove all mentions of Set/Get Track and hard-coding of canary-channel.

This CL removes the deprecated functionality of Set/Get Track previously
used to change channels. Now that the UI is using Set/Get Channel we no
longer need these methods. I've also gone ahead and fixed the long standing
bug of needed to do an update check before testing channel change.

I've also added the testing of allow powerwash functionality to update_engine
client to better test this feature.

BUG=chromium:221850
TEST=unittests + update_engine_client with channel change and allowing
powerwash and not allowing powerwash. Confirmed the versions were as expected (
when going more stable we send version 0.0.0.0 when we allow powerwash vs the
actual version when not).

Change-Id: I87297f7e7e103bb25e62f2d896e155e758030ead
Reviewed-on: https://gerrit.chromium.org/gerrit/63674
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_engine_client.cc
f4867c4dab4d1ca566f1aa3f585bd16d87b911dd 28-Jun-2013 Alex Deymo <deymo@chromium.org> Add DBus methods to allow/disallow updates over 3G

This fix adds a new DBus pair of methods to allow/disallow the
updates over cellular networks and get the current state of this
setting. The setting is overridden by the device policy and the
SetUpdateOverCellularPermission() method fails if called on an
enrolled device that has the autoupdate settings in the device
policy.

BUG=chromium:213401
TEST=unittests for connection_manager changes. Manual test for the DBus service, see below.

Manual test procedure.
======================
Run on a shell:

1. Test for the default setting.
$ update_engine_client -show_update_over_cellular
[0701/183633:INFO:update_engine_client.cc(371)] Current update over cellular network setting: DISABLED
[0701/183633:INFO:update_engine_client.cc(443)] Done.

2. Test that enable works.
$ update_engine_client -update_over_cellular=yes -show_update_over_cellular
[0701/183655:INFO:update_engine_client.cc(371)] Current update over cellular network setting: ENABLED
[0701/183655:INFO:update_engine_client.cc(443)] Done.

3. Test that disable works.
$ update_engine_client -update_over_cellular=no -show_update_over_cellular
[0701/183659:INFO:update_engine_client.cc(371)] Current update over cellular network setting: DISABLED
[0701/183659:INFO:update_engine_client.cc(443)] Done.

4. Enable again the update over cellular, connect the chromebook to a 3G
and perform an update check.

Change-Id: Ic234a3ef8898b1e60e26277208276a958b7e0d94
Reviewed-on: https://gerrit.chromium.org/gerrit/60716
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_engine_client.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/update_engine_client.cc
d317e40be46e1b69f624a8165472c99fe6346a1e 12-Jun-2013 Chris Sosa <sosa@chromium.org> Implement Rollback to previously booted partitions.

This CL implements rollback to whatever partition we ran from before.
We expose this functionality via dbus under AttemptRollback and expose
a new command-line option to update_engine_client that a developer can
use.

BUG=chromium:242665
TEST=Unittests, full update, update + rollback and verified.

Change-Id: Ie59f90b9a0b777dc1329592449090c70892236bf
Reviewed-on: https://gerrit.chromium.org/gerrit/58427
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_engine_client.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/update_engine_client.cc
50c6063bf22ea1776579fda55402ce34b4c21daa 25-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: recommend cgpt undo on update_engine_client -reset_status

While -reset_status will reset the update engine's internal state, as
well as remove the flag file that necessitates a reboot, it will not
undo the (potentially detrimental) effect of an update to a machine's
partition table. With this change, update_engine_client now prompts the
user to apply a one-liner shell command to reverse the impact of such
changes, ensuring that a subsequent reboot will load the current
kernel/rootfs (and not the updated ones).

Note that this command should work regardless of which physical device
is the boot device (e.g. /dev/sda, /dev/mmcblk0) and the partition
scheme used (rootfs is e.g. /dev/sda3, /dev/mmcblk0p3). It does,
however, assume that the number of the kernel partition is that of the
corresponding rootfs partition minus one.

BUG=None
TEST=Expected log message displayed

Change-Id: I4503c4377a9ddbfd597ac7e049fad72ba989a213
Reviewed-on: https://gerrit.chromium.org/gerrit/42022
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_engine_client.cc
d793606f2d46f5020669ecf24af2f4a3bb446b30 18-Jan-2013 Richard Barnette <jrbarnette@chromium.org> Change how update_engine_client handles DBus proxy failures.

Change GetProxy() to log failures with LOG(ERROR) and then
terminate, rather than use LOG(FATAL), as the latter unhelpfully
generates a core file.

BUG=chromium-os:37542
TEST=run update_engine_client with and without a working update_engine

Change-Id: Id84b56ff0b5ffa51cf4fda4cb7ad847f5bb617e5
Reviewed-on: https://gerrit.chromium.org/gerrit/41662
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
/system/update_engine/update_engine_client.cc
8e3f1263218c5046d2281c1d1d3c886acda85b47 08-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: replace sleep/usleep with g_usleep

Also deploying 'using base::TimeDelta' where it is useful.

BUG=chromium-os:33541
TEST=Passes unit tests; update runs on x86-alex

Change-Id: I9478d46d0796b13789878393e3a4086564124d33
Reviewed-on: https://gerrit.chromium.org/gerrit/40904
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_engine_client.cc
c1ba09a8f4d3eda4654b34bf01d41fd9ad1d9f38 14-Aug-2012 Jay Srinivasan <jaysri@chromium.org> Support in update_engine for script for UI jank investigation.

We need to update image_to_live.sh to run in a loop to help investigate
the kernel behavior during AU. Since update_engine doesn't allow a
new update to be applied unless the device is rebooted after the previous
update, this CL adds an option to reset the state for testing purposes.

This CL does not cause any change in product code, since
update_engine_client will never be invoked with this option in product.

BUG=chromium-os:27954
TEST=Tested on ZGB.
Change-Id: I561e58893818a1b4990fdc131cd3bb64e473155e
Reviewed-on: https://gerrit.chromium.org/gerrit/29907
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_engine_client.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/update_engine_client.cc
8ed2d16a80c33b28dc8c0c955a97696566d36868 12-Aug-2011 Andrew de los Reyes <adlr@chromium.org> client: don't log about getting dbus proxy tries until one fails.

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

Change-Id: Ib616a293829f1db7ecb1ab4d882e453ee9ee7f5a
Reviewed-on: http://gerrit.chromium.org/gerrit/5898
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
/system/update_engine/update_engine_client.cc
68ab6eda13740601112b34964ea3027412e60bb4 09-Aug-2011 Andrew de los Reyes <adlr@chromium.org> client: GetProxy: add retries

Because in some cases, esp on very loaded systems, the updater may be
temporarily unresponsive, add retry logic when trying to connect over
dbus.

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

Change-Id: I277e843ae1ded174a7768c63093e095c29143dcb
Reviewed-on: http://gerrit.chromium.org/gerrit/5614
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
/system/update_engine/update_engine_client.cc
583667b33cb62b97fbbd792d6c830c530d759ec1 27-Oct-2010 Satoru Takabayashi <satorux@chromium.org> AU: Implement getting of tracks through GetTrack.

Add SetTrack and GetTrack to UpdateEngine.xml as well.

BUG=chromium-os:8104
TEST=tested on device with update_engine_client

Change-Id: I10ef2552e9280524b3a8d5f232d104a81a114e06

Review URL: http://codereview.chromium.org/4181001
/system/update_engine/update_engine_client.cc
49d91329a3a84d7e2b35f6e1ffc8a9b4d478515b 26-Oct-2010 Darin Petkov <petkov@chromium.org> AU: Implement switching of tracks through SetTrack.

On official images, update engine allows updating the track
only to dev-channel or beta-channel. The track is verified
both at setting and at getting time.

BUG=8104
TEST=unit test; tested on device

Change-Id: Ic81d4e3a9e09554d2239ee5c7a6c78e4dfe30d19

Review URL: http://codereview.chromium.org/4103002
/system/update_engine/update_engine_client.cc
8daa3247249c5cd71ae920ef6808dd0224ef42e7 25-Oct-2010 Darin Petkov <petkov@chromium.org> AU: Provide a D-Bus API for changing the update track.

The method is SetTrack(string). It doesn't do anything right now but hopefully
this CL will enable work on libcros.

BUG=8104
TEST=unit tests; tested on device through update_engine_client.

Change-Id: I6941fe3d04165d85c4612e3a01939d02c02014f9

Review URL: http://codereview.chromium.org/4094001
/system/update_engine/update_engine_client.cc
71e8e5cbc15202f6bb99d25365ff004ee8b63b92 10-Sep-2010 Kenneth Waters <kwaters@chromium.org> update_engine_client: Clarify error message.

BUG=None
TEST=Built and run on tegra2_dev-board

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

Change-Id: Ic6a95bacf651aa658ce46d8d08333499d1eb36d3
/system/update_engine/update_engine_client.cc
9d911fa4ed05cb51319636a4b6ce94b0260156ae 19-Aug-2010 Darin Petkov <petkov@chromium.org> AU: Update status to DOWNLOADING only after receiving some bytes from server.

This ensures that users don't see an update download notification until
after a download has successfully started.

Also, added some DownloadActionDelegate unit tests.

BUG=5822
TEST=unit tests, gmerged to device, made sure updates happened and
notifications received

Change-Id: I96912dcd98a53e9bd7eecc63dab704f959a06441

Review URL: http://codereview.chromium.org/3131022
/system/update_engine/update_engine_client.cc
58529db65ee21eaa3279bc2bb28baf1fec72e621 13-Aug-2010 Darin Petkov <petkov@chromium.org> Provide a -update option to the AU client to allow synchronous updates.

This makes "update_engine_client -update" an easy replacement for
memento_updater.sh from developer's standpoint.

Also, remove currently unused flag force_update.

BUG=5401
TEST=gmerged and tested the client on the device

Change-Id: Ib9cc6d6de77d339f57059fb9470c838897149a4f

Review URL: http://codereview.chromium.org/3110012
/system/update_engine/update_engine_client.cc
296889c68c92b04d307035c5803681f8d2c8f9d3 24-Jul-2010 Darin Petkov <petkov@chromium.org> AU: Provide a reboot_if_needed D-Bus API.

This will reboot if the current state is UPDATED_REBOOT_NEEDED.
Also add -reboot option to the update_engine_client.

BUG=4250
TEST=unit tests,gmerged on device and tried reboot requests

Review URL: http://codereview.chromium.org/3034026
/system/update_engine/update_engine_client.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/update_engine_client.cc
ada4220cc4f05e8e4c72ed18cfddf1bf7f1ad75b 16-Jul-2010 Andrew de los Reyes <adlr@chromium.org> AU: land http://codereview.chromium.org/2931008/show for tfarina

Review URL: http://codereview.chromium.org/2847054
/system/update_engine/update_engine_client.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/update_engine_client.cc
c702078734db27d1fd712b02b686a75becbb5c9d 28-Apr-2010 Andrew de los Reyes <adlr@chromium.org> AU: FilesystemCopierAction: copy bit-exactly

Review URL: http://codereview.chromium.org/1700018
/system/update_engine/update_engine_client.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/update_engine_client.cc