Commit graph

55051 commits

Author SHA1 Message Date
Treehugger Robot
0ba7842577 Merge "Create libstatssocket_q" 2019-12-19 17:36:08 +00:00
Peter Collingbourne
1d789eb210 Merge "Stop using weak symbols in libvndksupport." 2019-12-19 17:27:37 +00:00
Muhammad Qureshi
a3dcefc079 Create libstatssocket_q
Break up libstatssocket into libstatssocket_q and libstatssocket.
libstatssocket_q is for Q Mainline modules.

Bug: 145569088
Test: m -j
Test: bit statsd_test:*
Test: adb shell cmd stats print-logs && adb logcat "*:S statsd:*"
Change-Id: I2978dd544f4cb17714f3d14d5977cf6b46277ef9
Merged-In: I9d113b37640345ebad6aa269ab710db0d2179671
2019-12-18 15:11:53 -08:00
Treehugger Robot
1cdcc5f7e8 Merge "adb: fix use after free of atransport." 2019-12-18 22:39:48 +00:00
Treehugger Robot
d054eb7310 Merge "Simplified stats_event.c; exposed getter methods" 2019-12-18 22:27:27 +00:00
Treehugger Robot
a23ce83a3b Merge changes I15abdf13,I70304168,I52b0cb8e
* changes:
  General cleanup; add support for key-value pairs
  Move type ids to stats_event.h
  Set default timestamp to elapsedRealtimeNanos
2019-12-18 22:17:30 +00:00
Treehugger Robot
5158ab9ff2 Merge "First draft of native StatsEvent API" 2019-12-18 22:17:23 +00:00
Ruchir Rastogi
a38d5a6fd6 Simplified stats_event.c; exposed getter methods
Simplifications/changes:
(1) We remove the bufPos field and track the end of the buffer using
    only the size field.
(2) We rename put_<type>() functions to append_<type>() to signify that the
    value will be placed at the end of the buffer. We also move the
    increment of event->size to within the append_<type>() functions;
    this improves readability of the write_<type>() functions.
(3) We immediately write the timestamp and atom id to the buffer in
    order to simplify stats_event_build().
(4) We never check for null pointers; checking for null pointers
    delays errors and obfuscates the root problem.
(5) We change the the annotationId and numPairs parameters to be
    uint8_t's. This helps signify to clients that these values must fit
    in 1 byte.
(6) Clients no longer have to pass in the length of strings. Instead, we
    expect them to pass in null-terminated strings, and we will
    calculate the length outselves using strnlen.

Test: m -j libstatssocket
Change-Id: I6d192768876a23d7016173bcdaf59f8b7e92b182
Merged-In: I0173f8bc76ef25118379dce5d2481f5f7a9b7519
2019-12-18 13:17:36 -08:00
Ruchir Rastogi
3822e61d7b General cleanup; add support for key-value pairs
Encoding of key-value pairs follows strategy described in
go/statsd-socket-doc.

Fixed bug where timestamp and atom id were not contributing to the
number of fields in the buffer.

Note: Similar to ag/9603344, which was abandoned because of git rebasing
issues.

Test: m -j libstatssocket compiles
Bug: 143079361
Change-Id: I15abdf13ad8debf83ae1f6c372676db4fe390289
Merged-In: I8d23ddf2dbfee518ad970894ac09ba3ad5b5b4ad
2019-12-18 13:11:28 -08:00
Ruchir Rastogi
a3bc1af1b8 Move type ids to stats_event.h
This allows the parsing code within statsd to access the type ids.
Also, we move stats_event.h to the include directory for consistency.

Test: m -j libstatssocket
Change-Id: I7030416872677f3a523c2baf7bf6bcb4ca0ae6a4
Merged-In: I1db7fc9e9d0efd2225612353a8fc49bb13220ff0
2019-12-18 11:58:42 -08:00
Ruchir Rastogi
f4d23fc353 Set default timestamp to elapsedRealtimeNanos
Test: m -j libstatssocket compiles
Change-Id: I52b0cb8e1e916413db3dc0fe1b9a7e922833bdf7
Merged-In: I62f4c6bb14c3914124a6af25ff46fb0a980204e7
2019-12-18 11:53:38 -08:00
Ruchir Rastogi
bb0da94f8d First draft of native StatsEvent API
Test: m -j libstatssocket compiles
Change-Id: I874968d4f77a5990764100123794b923847e5eb5
Merged-In: I0da9740d29749d79d14be39e5949b98c58df704d
2019-12-18 11:33:22 -08:00
Elliott Hughes
264a37d12f Merge "Fix SEGV in libziparchive with malformed zip file." 2019-12-18 16:14:54 +00:00
David Anderson
43ad6362da Merge "liblp: Add a VIRTUAL_AB_DEVICE flag for LpMetadataHeader." 2019-12-18 15:42:44 +00:00
David Anderson
42c86c763c Merge "libfiemap: Fix fallocate() usage." 2019-12-18 15:37:10 +00:00
Treehugger Robot
90e9217aca Merge "Enable "localfilesystem" UNIX domain socket for ADB." 2019-12-18 05:34:30 +00:00
Peter Collingbourne
683192270f Stop using weak symbols in libvndksupport.
These weak symbols are no longer necessary because we no longer
need to statically link libvndksupport.

Furthermore, these symbols are not really optional when libvndksupport is
dynamically linked. When the library is linked with --as-needed the linker
may drop the reference to libdl_android.so, which leads to a failure to boot.

Bug: 146456667
Change-Id: I4d2290d8d0206e0d89665d4d872a7c53b3e1531b
2019-12-17 17:52:05 -08:00
David Anderson
71b287bfd7 libfiemap: Fix fallocate() usage.
This fixes two bugs in how we use fallocate(). First, using ZERO_RANGE
is a mechanism to allocate holes, not blocks. Instead we should be
passing no flags.

The reason this code worked is because of our explicit writes to the
file, which is intended to defeat lazy block allocation. This is not
necessary for F2FS with proper file pinning support, so we now skip this
when possible.

Together, these fixes improve the speed of "adb remount" when backed
by libfiemap.

Bug: 134949511
Test: adb remount when backed by /data
Change-Id: I746053d183e0c83d56979d9c3fa6d96b40b5e478
2019-12-17 15:04:08 -08:00
Yifan Hong
18c6248ffe Merge changes from topic "wait_for_merge"
* changes:
  libsnapshot: add WaitForMerge
  libsnapshot: SnapshotUpdateTest::AddOperation
  libsnapshot: add GetCurrentSlot
2019-12-17 23:01:59 +00:00
Treehugger Robot
bc58945cd1 Merge "Revert "Have /storage always point to sdcardfs by default."" 2019-12-17 17:38:47 +00:00
David Anderson
1526a46e92 Merge "fs_mgr: Move libfiemap back to fs_mgr from system/gsid." 2019-12-17 17:32:09 +00:00
Elliott Hughes
fba2a1a1ec Fix SEGV in libziparchive with malformed zip file.
d77c99ebc3 changed MappedFile to return a
bogus zero-length mapping on failure rather than nullptr. None of the
calling code was changed, though, and it seems like doing so would be a
bad idea. Revert that part of the change.

Add missing tests, and tidy up some of the logging. Also remove
single-use or obfuscatory constants from the tests.

The new "empty.zip" was created by using zip(1) to create a zip file
with one entry, then using `zip -d` to remove it.

The new "zero-size-cd.zip" was created by using zip(1) to create a zip
file containing a single empty file, and then hex editing the two byte
"size of the central directory" field in the "end of central directory
record" structure at the end of the file. (This is equivalent to, but
much smaller than, the example zip file provided by the bug reporter.)

Bug: http://b/145925341
Test: treehugger
Change-Id: Iff64673bce7dae886ccbc9dd6c2bbe18de19f9d2
2019-12-17 08:39:09 -08:00
Martijn Coenen
0dbb2a75f2 Revert "Have /storage always point to sdcardfs by default."
This reverts commit 5d53bfce2d.

Reason for revert: for consistency, we've decided that for now, all code will have the same view of /storage: FUSE. Will address the TODO here later.

Change-Id: Ia75e23c91fb098f6309c160de2889f06507c3717
2019-12-17 13:45:10 +00:00
Nikita Ioffe
e4b931146d Merge "Unmount bind-mounts on top of /data before unmounting /data" 2019-12-17 12:06:59 +00:00
Ed Chen
701abc3f14 Merge "Revert "remount: Remove the "backing" parameter to fs_mgr_overlayfs_setup."" 2019-12-17 09:18:53 +00:00
Ed Chen
1981401909 Revert "remount: Remove the "backing" parameter to fs_mgr_overlayfs_setup."
This reverts commit b20aa434a3.

Bug: 146403375
Reason for revert: broken build 6078429 on git_master on walleye-user

Change-Id: Idc3b1c0ad5228d63298ce84811624b23d0cea434
2019-12-17 08:53:13 +00:00
David Anderson
905ecdd374 Merge "remount: Remove the "backing" parameter to fs_mgr_overlayfs_setup." 2019-12-17 06:05:43 +00:00
David Anderson
4fe398018b fs_mgr: Move libfiemap back to fs_mgr from system/gsid.
Bug: 134949511
Test: builds
Change-Id: I07943acce5d4671975afef6d8da1bdbeef43c39d
2019-12-16 20:10:26 -08:00
Nikita Ioffe
0dda423dd0 Unmount bind-mounts on top of /data before unmounting /data
Test: adb shell setprop sys.init.userdata_remount.force_umount_f2fs 1
Test: adb shell /system/bin/vdc checkpoint startCheckpoint 1
Test: adb reboot userspace
Bug: 135984674
Bug: 143970043
Change-Id: Icd7f3ad1c42d9b21bf4eacf1dec60355c9883254
2019-12-16 23:22:55 +00:00
David Anderson
4ba68b6451 liblp: Add a VIRTUAL_AB_DEVICE flag for LpMetadataHeader.
Bug: 134949511
Test: liblp_test gtests
Change-Id: I8b376d0980e1372086ed15b980209f3726ef651a
2019-12-16 22:20:40 +00:00
Treehugger Robot
48d3b1e112 Merge "fastboot: Flashall does proper snapshot cancel" 2019-12-16 21:44:39 +00:00
Treehugger Robot
cd652ea3dc Merge "Rename unzip.cpp to ziptool.cpp." 2019-12-16 18:37:49 +00:00
David Anderson
18bb214b3f Merge "liblp: Expand the metadata header for future use." 2019-12-16 17:31:57 +00:00
Treehugger Robot
413440c5b9 Merge "Use apex name in apex_manifest.pb as the mount point" 2019-12-16 14:48:03 +00:00
Jiyong Park
648ae3a9d3 Use apex name in apex_manifest.pb as the mount point
When bind-mounting flattened APEX, use the apex name found in
apex_manifest.pb as the mount point, instead of the directory name which
might be different from apex name in case when the apex is overridden.

This allowed us to remove the special casing for the ART apex since we
/system/apex/com.android.art.release will be mounted to
/apex/com.android.art instead of /apex/com.android.art.release.

Bug: N/A
Test: m
Test: OVERRIDE_TARGET_FLATTEN_APEX=true m, device is bootable
Change-Id: Ibdde7002b9078db390e6672b0eb82c474925451d
2019-12-16 11:31:50 +09:00
Martijn Coenen
a587d69364 Merge "Have /storage always point to sdcardfs by default." 2019-12-14 09:19:03 +00:00
Yifan Hong
1af515b57c libsnapshot: add WaitForMerge
Add an API that does not initiate the merge, but only waits for it to
finish. It is different from ProcessUpdateState API in that it also
blocks when state == UNVERIFIED and booting from the new slot.
(ProcessUpdateState immediately returns in this case).

This is useful for android.os.UpdateEngine.CleanupSuccessfulUpdate().
Bug: 138808328
Test: libsnapshot_test

Change-Id: I7cc59fcaf69616e7ec7ebe6101991b5106845b65
2019-12-13 19:52:31 -08:00
Yifan Hong
c810f1091a libsnapshot: SnapshotUpdateTest::AddOperation
Reusable test code.
Test: libsnapshot_test

Change-Id: I00a1a460d84c01b0dbd24b668293df87962e8b00
2019-12-13 19:52:31 -08:00
Yifan Hong
c64cefc027 libsnapshot: add GetCurrentSlot
Factor out obscure logic that reads boot indicator path.
GetCurrentSlot() returns three states:
- None (read failure)
- Old (before reboot)
- New (after reboot)
Use these "logical" slot values for simpler code.

Test: libsnapshot_test
Change-Id: I1fa2ce4916c5a1652d25682ec1f11e101c858822
2019-12-13 19:52:31 -08:00
Treehugger Robot
babc293140 Merge "libsnapshot: snaity check overflow bit at the end of update" 2019-12-14 03:05:19 +00:00
Treehugger Robot
7f5116e581 Merge "adb: improve help for -t/-tt." 2019-12-14 02:26:36 +00:00
Elliott Hughes
8748bcc650 Rename unzip.cpp to ziptool.cpp.
It contains unzip and zipinfo, and will likely contain zip too soon.

Test: builds
Change-Id: I017df302108847f29bfdd120f20bf0fd3b9caa5b
2019-12-13 16:47:22 -08:00
Elliott Hughes
dfe6c84709 adb: improve help for -t/-tt.
Test: adb help
Change-Id: Ic75bf184dfc51e57b422666d85e3b7a5139b3853
2019-12-13 16:43:10 -08:00
Elliott Hughes
5a07ae1422 Merge "cli-test: a tool for testing command-line programs." 2019-12-14 00:41:04 +00:00
David Anderson
9f75098c60 liblp: Expand the metadata header for future use.
A few times we have wanted to stash small bits of information in the
super header, but we haven't had any bits to do so. This patch addresses
future needs in two ways:

  1. A "flags" field has been added for miscellanious bits that do not
     need a version bump.
  2. The header struct has been padded to 256 bytes to allow for future
     expansion without complicating the struct-parsing code.

This is the first time we've materially changed the format, so this
patch needs some extra explanation.

In all the places we rely on sizeof(LpMetadataHeader), we now need to
use the |header_size| field instead. To make newer versions of liblp
compatible with older headers, we read the minimum required header size
and fill in the extra bytes as needed. To make the validation and
reading logic more clear, it is now combined into a single function,
ReadMetdataHeader.

MetadataBuilder will still emit 1.0-compatible headers, to avoid
changing the on-disk format of existing devices. The new header will
only be emitted as-needed.

Bug: 134949511
Test: liblp_test gtest
      retrofit DAP device boots
      launch DAP device boots

Change-Id: I6221123768ff0057a73967ecb2ff9b006c17af88
2019-12-14 00:35:58 +00:00
Christopher Ferris
0231f4fc38 Merge "Copy necessary ipt_ULOG.h structure to source." 2019-12-13 21:39:54 +00:00
Josh Gao
607fd5424a adb: fix use after free of atransport.
libadbd_auth might report authentication success for a transport that's
already been destroyed. Fix this by storing a weak pointer to the
atransport that gets cleared upon destruction instead of a raw pointer.

Bug: http://b/144704376
Test: ./test_adb.py
Test: ./test_device.py
Change-Id: Idffe027381e6b2e37f06aa0166e97cafc98eaf3b
2019-12-13 13:28:21 -08:00
David Anderson
799f55fb01 Merge changes I9d94e252,If4a543d3,I0af7cda9
* changes:
  remount: Remove fs_mgr_overlayfs_scratch_device()
  remount: Refactor fs_mgr_overlayfs_teardown
  remount: Do not run the create-scratch logic on older devices.
2019-12-13 21:00:21 +00:00
Elliott Hughes
f276140d0f cli-test: a tool for testing command-line programs.
Not looking for other users right now, this is just enough to test
unzip/zip/zipinfo.

This includes tests for unzip and ziptool, along with a change to
unzip's behavior to fix AOSP `make dist` when using ziptool unzip.

Also add the boilerplate to run these tests on the device, in presubmit.

Fix command name in --help output.

Test: atest ziptool-tests
Change-Id: I5c0215a3ab8cb2cd5fc517ed9c188f81a7bf4520
2019-12-13 12:23:51 -08:00
Martijn Coenen
5d53bfce2d Have /storage always point to sdcardfs by default.
This is a partial revert of change
Idf851b3a42910e0ce8fdd75daea1cce91dd1aa98, and brings us back to the
state we shipped in Q.

The default behavior for now is that we want native daemons to use the
default sdcardfs view, as they did before. Zygote-spawned apps will then
get the correct view assigned to them as they get spawned.

Bug: 146189163
Test: atest AdoptableHostTest
Change-Id: I2248f39e029138962a41a6ead944431414c901ad
2019-12-13 16:52:11 +01:00