Commit graph

55678 commits

Author SHA1 Message Date
Bernie Innocenti
4adfde41ea Add android::base::expected::ok()
This is an alias for has_value() which is meant to be more concise, yet
more explicit than the conversions to bool.

Leave operator bool() in place for now: due to the large number of
users, removal of operator bool() needs to be broken up into incremental
stages.

Test: cd system/core && atest
Test: m
Change-Id: Ib1eb00f47d3c0f2229bb176b62687463b834f280
2020-02-06 15:27:26 +09:00
Treehugger Robot
07e74d65a2 Merge "use apex_test for test apexes" 2020-02-06 01:34:46 +00:00
David Anderson
367cca3937 libsnapshot: Restrict when snapshots can be deleted.
Do not delete snapshots for any reason other than merge-complete or a
cancel request from update_engine. Additionally, create a rollback
indicator file if booting into the source slot, so update_engine can
attempt to cancel the update.

Bug: 147819418
Bug: 147347110
Test: libsnapshot_test gtest
Change-Id: Id357a91cec467a60246c7c3d133f6c54ccb3fc93
2020-02-05 17:16:17 -08:00
Treehugger Robot
a800e1ee9d Merge changes I63b5e69b,I85c6af63
* changes:
  fiemap: add image_test and writer_test tests to presubmit
  fiemap: fix fiemap size and log message when last extent
2020-02-05 23:47:45 +00:00
Tom Cherry
d44a5f840d liblog: null terminate log_msg
Also, use LOGGER_ENTRY_MAX_LEN instead of sizeof(log_msg) for ensuring
that the read did not overflow, since sizeof(log_msg) is one byte
longer to allow for placing a null terminator already.

Bug: 148966104
Test: liblog unit tests
Change-Id: Id4fe8aa5da44e9d62f59b6541f157a4e7b038d07
2020-02-05 15:04:32 -08:00
Alessio Balsini
c352179e10 fiemap: add image_test and writer_test tests to presubmit
Add fiemap_image_test and fiemap_writer_test to TEST_MAPPING to be run
by TH as presubmits.
Because of a bug under investigation, the actual
fiemap_image_test_presubmit is used instead of the original, that has
one test case disabled.

Bug: none
Test: TH, fiemap_image_test, fiemap_writer_test
Change-Id: I63b5e69b5c245a18eceb1e5896df7bd0577f289b
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-05 22:08:29 +00:00
Keun young Park
606af6dfff bootstat: Migrate to StatsLog for metrics
- All events are migrated to StatsLog atoms.
- Still keep the string based name for BootEvent logging as that makes it
  easier for debugging purpose.

Bug: 132691841
Test: check boot related stats are pushed after boot up
      $ adb shell cmd stats print-stats

Change-Id: I33313695a8a2d0a3c74f7705c0843c8c4bad2133
Merged-In: I33313695a8a2d0a3c74f7705c0843c8c4bad2133
2020-02-05 12:53:24 -08:00
Alessio Balsini
f6034544c0 fiemap: fix fiemap size and log message when last extent
Fix the total fiemap struct plus extents size allocation.
Fix also the logging in IsLastExtent, that was printing error messages
every time.

Bug: none
Test: fiemap_*_test
Change-Id: I85c6af63ba3a75b993a5e8ad7d7170dc7af59582
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-05 18:27:40 +00:00
Tom Cherry
57b9428471 init: use ErrnoErrorf() instead of ErrnoError() << StringPrintf()
Test: force init to print this line and see the log message
Change-Id: Ibb74572347f915cd76cc50f4c19126b66f562810
2020-02-05 07:57:14 -08:00
Tom Cherry
f8e6bf6d81 Check Errorf()/ErrnoErrorf() format string at compile time
fmtlib provides compile time checking of format strings that we're not
currently using.  This change makes Errorf() and ErrnoErrorf() into
macros such that we can take advantage of this capability.

Test: build successfully normally
Test: fail the build if using an invalid format string
Change-Id: Icb8ba8cb973bbd1fa4755a62e7598bdbb0113757
2020-02-05 07:57:14 -08:00
Treehugger Robot
e6211eb978 Merge "first_stage_mount: reading all avb_keys before chroot" 2020-02-05 13:42:34 +00:00
Jiyong Park
17730e7cf6 use apex_test for test apexes
... so that the build system can distinguish testing APEXes and installable APEXes, and apply
different rules to them.

Bug: 146308764
Test: m
Change-Id: I5fdab94da352e8014225b2454aacc2a5b5fc6a52
2020-02-05 18:44:10 +09:00
Bowgo Tsai
e0f5c10691 first_stage_mount: reading all avb_keys before chroot
Avb keys used to verify a partition are stored in the first-stage
ramdisk. However, after /system is mounted, init will chroot into it.
This makes those keys inaccessible for later mounts, e.g., /vendor or
/product.

This change retains avb keys by reading all of them before chroot
into /system.

Note that it is intentional to perform public matching for both
preload_avb_key_blobs and fstab_entry.avb_keys in libfs_avb.
As some keys might only be availble before init chroots into /system,
e.g., /avb/key1 in the first-stage ramdisk, while other keys might
only be available after the chroot, e.g., /system/etc/avb/key2.

Bug: 147585411
Test: specify avb_keys for a partition and checks the keys are preloaded
Test: atest libfs_avb_test
Test: atest libfs_avb_internal_test
Change-Id: I6bd490c4215480db2937cdfc3fea0d616e224a91
2020-02-05 15:51:41 +08:00
Bernie Innocenti
ab65ef22a5 Merge "Delete dangerous comparison operators from base::expected" 2020-02-05 05:51:45 +00:00
Treehugger Robot
3cbb753b0d Merge "liblp: add test to presubmit" 2020-02-05 01:20:36 +00:00
Josh Gao
c71a1e7ab0 Merge "adb: report error in copy_to_file." 2020-02-04 23:49:37 +00:00
Yifan Hong
e8cd50a7a0 Merge "libsnapshot::RemoveAllUpdateState log stack" 2020-02-04 23:31:47 +00:00
Daniel Rosenberg
02e5e1ea22 Merge "Make /data/media case insensitive" 2020-02-04 23:03:38 +00:00
Treehugger Robot
405d26dacb Merge "Set e2freefrag and e2fsdroid as required by libfs_mgr_defaults" 2020-02-04 22:57:36 +00:00
Yifan Hong
c19b08a66a Merge "Make snapshotctl logging better." 2020-02-04 22:18:33 +00:00
Treehugger Robot
b34a729469 Merge "snapshot/test: Add delay to all the CreateLogicalAndSnapshotPartitions" 2020-02-04 22:16:52 +00:00
Yifan Hong
e8148150c3 libsnapshot::RemoveAllUpdateState log stack
Bug: 148818798
Test: apply OTA but cancel it in the middle, then
      delete /data/misc/update_engine/prefs/*, then
      reapply it again (to trigger CancelUpdate()).
      Stack is dumped.

Change-Id: I2dfb6b7f15b9d5854d0b81ed8ad260538d21c922
2020-02-04 14:01:24 -08:00
Yifan Hong
12fe03d470 Make snapshotctl logging better.
snapshotctl merge --logcat --log-to-file
- If --logcat, log to logcat
- If --log-to-file, log to /data/misc/snapshotctl_log/
- If both, log to both
- If none, log to stdout

Test: manually test these 4 cases
Bug: 148818798
Change-Id: I44b52936c0d095867acc6ee781c6bec04f6ebd6b
2020-02-04 14:01:24 -08:00
Josh Gao
3828ebcdd8 adb: report error in copy_to_file.
Previously, if we failed to read a file after successfully opening it,
(e.g. because it's a directory), we would return prematurely without
notifying our caller, which would then wait forever for a response that
isn't coming.

Switch all of the adb install callsites over to checking the result,
but leave the other callsites ignoring the result, because they're
either deprecated, or don't care.

Bug: http://b/145621968
Test: mkdir foo.apk; adb install foo.apk
Change-Id: Ia82f8280b144f7881e067a10cd17f9a89019cf3f
2020-02-04 13:47:57 -08:00
Treehugger Robot
1b727bce06 Merge "Extra logging for metadata errors" 2020-02-04 21:37:42 +00:00
Alessio Balsini
13d2d968d9 liblp: add test to presubmit
Add liblp_test to TEST_MAPPING to be triggered as TH presubmit test.

Bug: none
Test: liblp_test
Change-Id: If4d60e816e4e1b321603e1a5ed00e21297567d38
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-04 21:33:56 +00:00
Alessio Balsini
272ef868f1 Extra logging for metadata errors
Increase logging in metadata image management.

Bug: none
Test: m
Change-Id: Ie49ca9ac90cd593c95d31f4651ae724d617d5695
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-04 20:49:59 +00:00
Alessio Balsini
841bccc1eb snapshot/test: Add delay to all the CreateLogicalAndSnapshotPartitions
In tests CreateLogicalAndSnapshotPartitions may give flaky results
because not synchronous.
Add a bounded delay that prevents this behavior defined by a single
constexpr.

Bug: none
Test: libsnapshot_test
Change-Id: Iad3c24b1d3e82e3bd695d6dbbc8af8eab75bee32
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-04 19:33:35 +00:00
Treehugger Robot
09b9fc56a2 Merge "tests: handle legacy and new bootstat complete" 2020-02-04 19:06:42 +00:00
Treehugger Robot
44da3704f7 Merge "task_profiles.json: Fix uclamp attribute" 2020-02-04 17:50:11 +00:00
Mark Salyzyn
3576ed043c tests: handle legacy and new bootstat complete
Regression from commit cb1a8e7fdd
("Don't retrigger bootstat during userspace reboot.")

sys.boot_completed and either sys.logbootcomplete (legacy) or
sys.bootstat.first_boot_completed set to determine if the display
has gone active for bootstat.  For adb remount test we have no
desire or need to wait for bootstat complete, reduce script
complexity.

Also solve a possible problem with no content supplied to xargs.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Test: adb-remount-test.sh
Bug: 148804390
Bug: 135984674
Change-Id: Ieefddf583ff7422e8811d2e338a0f16c8943b0d7
2020-02-04 09:01:31 -08:00
Quentin Perret
20b2f1e0ab task_profiles.json: Fix uclamp attribute
task_profiles.json currently uses attributes of a defunct version of
uclamp, which was used for testing.

Let's use the attributes that actually got merged upstream instead.

Bug: 143710295
Change-Id: Ic6a14f52e14efeefc91f6e6bf580c15e2eded82e
Signed-off-by: Quentin Perret <qperret@google.com>
2020-02-04 13:10:31 +00:00
Bernie Innocenti
1cc76dfe84 Delete dangerous comparison operators from base::expected
These operators were included because they're present in the draft
standard proposal of std::expected, but they were deemed to lead to
bugs, particularly when T is implicitly convertible to bool.

Change-Id: Ib149decf1f230198f358dc1ae0eaed71961363f6
Test: m
2020-02-04 12:55:23 +00:00
Josh Gao
955601beb4 Merge "Add libadbd_auth to adbd's required list." 2020-02-04 10:16:41 +00:00
Josh Gao
9952258416 Add libadbd_auth to adbd's required list.
It seems like we might not be tracking dependencies properly on
devices with flattened APEXes? Add libadbd_auth to adbd's required
list to work around this for now.

Bug: http://b/148812347
Test: `ls $ANDROID_PRODUCT_OUT/system/lib/libadbd_auth.so` before and after when building a go device
Change-Id: If60abeb00797e37bf6a5a037249a21877e0b3d26
2020-02-04 07:17:19 +00:00
Treehugger Robot
b970633642 Merge "Mount binderfs" 2020-02-04 00:50:10 +00:00
Josh Gao
d0854b3397 Merge "Add adbd_test to mts." 2020-02-03 23:30:12 +00:00
Daniel Rosenberg
2e10d8f74f Merge "Add support for casefold and product ID to format" 2020-02-03 23:12:15 +00:00
Hridya Valsaraju
b237d76ae5 Mount binderfs
Mount binderfs at /dev/binderfs. Also add symlinks from /dev/binder,
/dev/hwbinder and /dev/vndbinder to /dev/binderfs/binder,
/dev/binderfs/hwbinder and /dev/binderfs/vndbinder respectively.

The symlink commands will fail harmlessly on a kernel
which does not support binderfs since /dev/{binder,hwbinder,vndbinder}
devices will exist on the same.

Bug: 136497735
Bug: 148696163

Test: Cuttlefish boots on Android Common Kernel 4.19 with kernel config
CONFIG_ANDROID_BINDERFS=y.

Change-Id: I8e04340dc4622b0a3c1fc4aa6bbefcb24eefe00b
2020-02-03 22:14:21 +00:00
Treehugger Robot
be074feb93 Merge "Add libdm_test to presubmit" 2020-02-03 21:55:39 +00:00
Josh Gao
d5bad7c021 Merge "adbd: actually dynamically link against libadbd_auth." 2020-02-03 20:15:20 +00:00
Treehugger Robot
962e3ddfd6 Merge "Missing UpdateState::Cancelled string conversions" 2020-02-03 20:03:56 +00:00
Treehugger Robot
a911933a23 Merge "The darwin linker does not support version scripts" 2020-02-03 19:48:25 +00:00
Treehugger Robot
823beae16a Merge "Revert "Mount binderfs"" 2020-02-03 18:37:40 +00:00
Yifan Hong
3d3165702b Merge "charger: uses health HAL service." 2020-02-03 18:12:23 +00:00
Dan Willemsen
a536b4280e The darwin linker does not support version scripts
Fixes: 148774297
Test: m nothing   on a mac
Change-Id: I4000b2076fe2dde3776b112b506ee3266a529fc6
2020-02-03 10:02:41 -08:00
Oli Lan
0460f65f78 Merge "Allow apexd to snapshot and restore DE data." 2020-02-03 17:50:51 +00:00
Alessio Balsini
d7cc465481 Add libdm_test to presubmit
Also add libdm_test to the TEST_MAPPING's presubmit of fs_mgr to run the
test on TH whenever changes are applied to the fs_mgr contents.

Test: TH
Bug: none
Change-Id: Icc6adeeacaefbcfeb494f37fc776eb5a886a5183
Signed-off-by: Alessio Balsini <balsini@google.com>
2020-02-03 17:34:44 +00:00
Treehugger Robot
ad9190e340 Merge "Update assertion on DmTargetDefaultKey param string" 2020-02-03 17:15:47 +00:00
Nikita Ioffe
64e28438c8 Merge "Don't retrigger bootstat during userspace reboot." 2020-02-03 17:02:49 +00:00