History log of /system/update_engine/common/utils.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d5c120ed8f5b37d9091f71b8fc2d0d762bcd7971 23-Aug-2016 Alex Deymo <deymo@google.com> Lazy unmount postinstall if it fails to unmount.

If postinstall forks a new child that's not killed when killing the main
postinstall process or if postinstall makes any other running process to
hold a file descriptor open in the mounted filesystem, the filesystem is
busy an we can't unmount /postinstall. Since the postinstall mountpoint is
fix in Android, we need to force a lazy unmount in order for the process
to succeed in a future run.

This case can only occur when canceling an update during postinstall (for
example if the update was retried from the server) and would otherwise
clear itself after a few unmount retries if the process using the fd
stops using it.

Bug: 31021934
Test: Added native tests to excersice this case.

(cherry picked from commit 5ba93ad42fad1efc40ae2e7abcda9c8793363508)

Change-Id: I3464377b43e2ee79cd7318dbc9d3a62706c6ea6c
/system/update_engine/common/utils.cc
9629bbc4ba447d3c2806a3ee1ed9c07a4ced75e2 11-Aug-2016 Alex Deymo <deymo@google.com> Setup a temporary directory for update_engine_sideload.

When running update_engine_sideload from recovery, the default temp
directory (/data/misc/update_engine/tmp) is not available. This
directory is currently used to store a blob when applying a bspatch
from a child process. This patch uses /tmp/update_engine_sideload as
a temporary directory when running update_engine_sideload from recovery.

Bug: 27178350
TEST=`adb sideload` an incremental update.

(cherry picked from commit 3295102ed64107f966d4cf8bfe733bb936646630)

Change-Id: Icef9dd48b00991975bcf6c39a148f952ef43d9e3
/system/update_engine/common/utils.cc
a918f9daede277d043e5b3b8443d712c88c949da 04-Jun-2016 Alex Deymo <deymo@google.com> Implement powerwash on Android.

Powerwash, the name for the equivalent of a factory reset or /data wipe,
can be triggered in Android by writing the desired command to the
recovery command file and rebooting into recovery.

This patch moves the powerwash scheduling/canceling logic to the
HardwareInterface and implements it on Android.

Bug: 28700985
TEST=Called update_engine_client passing POWERWASH=1, BCB is stored up
to offset 832.

(cherry picked from commit fb905d9b8d49f8fe41297c7aba2dd0942f1be311)

Change-Id: I66f9473c10fbe8f56e9000ce3e605b2bee345db8
/system/update_engine/common/utils.cc
2e1de4f9f0457cd6117ddb22ffef72c8e2fbd4f3 26-Mar-2016 Alex Deymo <deymo@google.com> Mark block device as read-only before mounting.

Mounting a block device as read-only still allows the filesystem to
write to the block device, while keeping the user-facing filesystem
interface "read-only". This behavior will make dm-verity to fail after
reboot if any block is modified during postinstall.

This patch marks the block device as read-only before mounting it, and
marks them read-only or read-write before using them during the update.

Bug: 27859604
TEST=Added logging and deployed an update to brillo, devices are marked RO/RW as needed during a delta update.

(cherry picked from commit 5fb356cac8a87c62fa83005d99370aa2f8416064)

Change-Id: I8797c35514e1f38c2a0395cedc8e1dce53e28350
/system/update_engine/common/utils.cc
72ea95ab7705448b044cafc6b8cf2a2f4d929bd9 31-Mar-2016 Alex Deymo <deymo@google.com> Parse postinstall program progress updates.

In Android postinstall is expected to take a long time in common cases.
This patch allows the postinstall program to report back to the updater
a progress indication, which will then be forwarded to all the clients
listening. These progress updates are part of the FINALIZING status.

Bug: 27880754
TEST=Added unittests. Deployed an update to an edison-eng and post-install reported progress back with the postinstall_example.

(cherry picked from commit 0d29854cf5bb05a22cf161b50052539aa420a36e)

Change-Id: I003e996bd5a9acccfc83012345351174d269107c
/system/update_engine/common/utils.cc
3a92aa2fe6aafd1007b6427795dfe8711b6cb094 01-Mar-2016 Sen Jiang <senj@google.com> Check if zlib is compatible.

Add a --zlib_fingerprint flag in delta_generator to check if the zlib of
source image is compatible, and only enable IMGDIFF operation if it is.

Test: Added unittest to check /etc/zlib_fingerprint
Bug: 27156099

(cherry picked from commit e0d04282910d423ddc950dd38224c001efc41d42)

Change-Id: Ic5dd14abaa4e7b6644bfcb5d73cfc42cc39195c2
/system/update_engine/common/utils.cc
14dbd333439f34c648b9f783ffa656ef565de0cc 02-Mar-2016 Alex Deymo <deymo@google.com> Mount the new system as 'postinstall_file' in postinstall.

When mounting the new filesystem on /postinstall, we need to override
the file attributes from the new system (unknown to the current selinux
policies) with a consistent label that will be used only in the context
of postinstall. This patch passes an extra option to mount(2) in
Brillo and Android to achieve this.

Bug: 27177071
TEST=Deployed a postinstall script with `ls -laZ`, contents show "postinstall_file".

Change-Id: Ia43b45c92e4c4cd340a884818ac00f24a418f9e7
/system/update_engine/common/utils.cc
390efedcb7e17587da765b6d682077cb7fa46ee1 18-Feb-2016 Alex Deymo <deymo@google.com> Parse postinstall parameters from the payload metadata.

Payload v2 includes a description of the post-install command it should
run, while in payload v1 we use the default values. This patch mounts
the partition on the new top-level directory called /postinstall that
should already be created.

Bug: 27177071
TEST=FEATURES=test emerge-link update_engine

Change-Id: Iaedf3b01e5e1ad57c68bd316b4b6e79cbab35bb6
/system/update_engine/common/utils.cc
e88e9feb5a64c1358baeb1c8547e82aa08e1cd83 04-Feb-2016 Alex Deymo <deymo@google.com> Android: Print the error code string from the client.

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

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

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

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

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

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

Change-Id: I991dab1dd8b6c0bb0c24d51cca4e1b75440a86b4
/system/update_engine/common/utils.cc
ab0d976fa47844870d55c87ab530072cea0c8c53 02-Feb-2016 Alex Deymo <deymo@google.com> CPULimiter: Refactor class to manage the CPU limitation.

This new class replaces the functionality embedded in UpdateAttempter
that limits the max CPU usage allowed by update_engine. This refactor
helps reusing this class outside of the brillo UpdateAttempter.

Bug: None
TEST=FEATURES=test emerge-link update_engine

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

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

Change-Id: I42e65bda7f1dbdf6f6e0ebf356d2cfea6b729193
/system/update_engine/common/utils.cc
9138ef59467bafa57baf42fbc15a5d1c3fef0586 22-Nov-2015 Alex Deymo <deymo@google.com> Remove unused includes.

These includes are not used anymore.

Bug: 25773375
TEST=emerge-link update_engine; mma

Change-Id: Ib6ab47d64b526e650208420f3355bb7b88beaec8
/system/update_engine/common/utils.cc
9c12346d5dc18288153fce61e7ffd0bd8e507afc 19-Nov-2015 Sen Jiang <senj@google.com> Fix temporary directory path in Android.

We should use /data/misc/update_engine/tmp instead of /data/local/tmp.

Bug: 24478450
TEST=Delta update nolonger permission denied.

Change-Id: I9a8096e602320195d30147971def5145bd82d775
/system/update_engine/common/utils.cc
a2591795edb1a4f4c751347daab16c70daad1274 17-Nov-2015 Alex Deymo <deymo@google.com> Move metrics time helpers to metrics_utils.

The metrics module reports metrics periodically, for which it needs to
keep track of the duration since some events (for example, the update
finished). These helpers were in the common/utils.h, but they rely on
the global SystemState to access both Prefs and Clock.

Since these helpers are specific to the metric reporting, this CL moves
them to the metrics_utils.h module.

Bug: 25197634
TEST=FEATURES=test emerge-link update_engine; mmma system/update_engine

Change-Id: Ia48091adbdc56c339c69c86c91c5c01aa58c54fb
/system/update_engine/common/utils.cc
38429cf76aaac8c499004b6f537229a26b381602 12-Nov-2015 Alex Deymo <deymo@google.com> common: Split out metrics utils from utils.cc.

The utility functions to convert error codes and network settings to
the types defined by the metrics framework are split out the utils.cc
file. These tools are only used by the update_engine daemon to report
back metrics on an update check.

Bug: 25197634
Test: FEATURES=test emerge-link update_engine; mma

Change-Id: I589dc9f6056fb1399fa84ca4f44076ed3a6b5365
/system/update_engine/common/utils.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/common/utils.cc