Commit Graph

52589 Commits

Author SHA1 Message Date
Anatol Pomozov 2df2d458fa Merge "Add header that declares memcpy function"
am: 239439b787

Change-Id: I932a8302ff9ad38dd174740e9a06ff80d7a56204
2019-08-09 19:21:35 -07:00
Anatol Pomozov 8eb5b3e610 Merge "Add header that defines strerror()"
am: 7eca57a20e

Change-Id: Iaacd6a2d5c07970c1303eed0e005be0a75adf61e
2019-08-09 19:21:02 -07:00
Anatol Pomozov 239439b787 Merge "Add header that declares memcpy function" 2019-08-10 01:57:25 +00:00
Anatol Pomozov 7eca57a20e Merge "Add header that defines strerror()" 2019-08-10 01:56:27 +00:00
Anatol Pomazau 60509705e6 Add header that declares memcpy function
It fixes following issue when compiling adb with host libraries:

In file included from core/adb/client/adb_install.cpp:31:
In file included from core/adb/adb.h:30:
In file included from core/adb/socket.h:28:
core/adb/types.h:237:9: error: use of undeclared identifier 'memcpy'; did you mean 'wmemcpy'?
        memcpy(copy->data(), first_block->data() + begin_offset_, copy->size());
        ^~~~~~
        wmemcpy
/usr/include/wchar.h:262:17: note: 'wmemcpy' declared here
extern wchar_t *wmemcpy (wchar_t *__restrict __s1,

Change-Id: I233e533fa7a5e2ed98190e34e32ddbaddc528558
2019-08-09 22:20:15 +00:00
Anatol Pomazau cb0bd19b35 Merge "Add header that declares atomic primitives"
am: 3e59c847cc

Change-Id: I1f3f883354c06c90d9cbf7a7aa2c59526d4e9dcc
2019-08-09 14:48:25 -07:00
Treehugger Robot 3e59c847cc Merge "Add header that declares atomic primitives" 2019-08-09 21:36:41 +00:00
Christopher Ferris 7fdc80f6ec Fix incorrect closing of fds.
Test: Ran unit tests without fdsan aborts.
Change-Id: I4a060739c61e93364b9aabe3ae1d6cbc3639d310
2019-08-09 14:03:30 -07:00
David Anderson da0dc33788 Merge changes I5e93fcbf,I9d4c8bcf,Icd580aae,I7b2399a4
am: 5b9832748f

Change-Id: I54b572fa308ddc906896f5dc05771ff14b510bcd
2019-08-09 12:58:20 -07:00
David Anderson 5b9832748f Merge changes I5e93fcbf,I9d4c8bcf,Icd580aae,I7b2399a4
* changes:
  libsnapshot: Implement merge flow.
  libsnapshot: Unmap COW devices when deleting snapshots.
  libsnapshot: Eliminate per-snapshot flocks.
  libsnapshot: Improve first test-run and test cleanup.
2019-08-09 19:34:52 +00:00
Vic Yang d4cb489434 libutils: Introduce StaticString16
This is a backward compatible implementation of compile time
constructed String16 support.

As much as we'd like a regular constexpr constructor for String16, we
want to make sure the regular non-static String16 does not regress.
We also need to make sure prebuilts built with previous version of
String16 still works with new libutils.  This means we cannot change
the size of String16 objects and we cannot make anything virtual.

To add a flag to indicate whether a String16 is static without
increasing the size of non-static String16 objects, we repurpose a
reserved field in SharedBuffer as "for client use".  With this, we can
tag every String16 and perform memory operation differently based on
how the underlying buffers are allocated.

By using StaticString16, we are able to eliminate the runtime
construction of a String16 and move it out of .bss section.

Bug: 138856262
Test: Run newly added unit tests.
Change-Id: I72bb8dc27a59b9ef34e0d934bc1e00b0f675855a
2019-08-09 11:01:37 -07:00
Mark Salyzyn 2a2c596c19 Merge "fs_mgr: overlayfs: dig harder for /dev/root equivalent"
am: 2edc7a5128

Change-Id: I4f4798579892a32a3fcec0a1dcf93f04fea4e8bd
2019-08-09 08:28:34 -07:00
Mark Salyzyn 2edc7a5128 Merge "fs_mgr: overlayfs: dig harder for /dev/root equivalent" 2019-08-09 15:11:54 +00:00
Songchun Fan 25fc86357a Merge "[adb] Cache features set inside the client process"
am: 6e861740ff

Change-Id: I150ca16badd7eb07e2706d3832504adebad68005
2019-08-08 18:05:21 -07:00
Songchun Fan 3487d983d4 Merge "[adb] Speed up the streaming install"
am: 82834f1264

Change-Id: I9705ccd0b9e524b79039d52bcf60bc52af3b514c
2019-08-08 18:03:53 -07:00
Elliott Hughes aa96e8898c libcutils: remove unused "jstring.h".
Test: treehugger
Change-Id: I56989862a51a6c8785f22f783027d50c42be650c
2019-08-08 17:45:48 -07:00
Songchun Fan 6e861740ff Merge "[adb] Cache features set inside the client process" 2019-08-09 00:40:51 +00:00
Songchun Fan 82834f1264 Merge "[adb] Speed up the streaming install" 2019-08-09 00:38:50 +00:00
Anatol Pomazau fd41f9a579 Add header that defines strerror()
It helps to fix a compilation issue with host libc:

core/base/errors_unix.cpp:25:10: error: use of undeclared identifier 'strerror'
  return strerror(error_code);
         ^

Change-Id: I71d4221cc1bfa6f0cc764b40b6b28159994b8e04
2019-08-08 23:31:36 +00:00
Anatol Pomazau 7b2ff6debc Add header that declares atomic primitives
It fixes a compilation issue:

/fdevent/fdevent_poll.cpp -o core/adb/fdevent/fdevent_poll.cpp.o
In file included from core/adb/fdevent/fdevent_poll.cpp:20:
In file included from core/adb/fdevent/fdevent_poll.h:29:
core/adb/fdevent/fdevent.h:106:10: error: no template named 'atomic' in namespace 'std'
    std::atomic<bool> terminate_loop_ = false;
    ~~~~~^

Change-Id: I5305a69a50e2638f514c5a7d47a9612b8ee38c69
2019-08-08 23:30:42 +00:00
Yurii Zubrytskyi 709dfc3524 [adb] Add a getter for native Win32 file handle
+ adb_pread() and adb_pwrite() functions for simpler cross
  platform file operations

Test: builds
Change-Id: I7e2b23e1da79acd7be974a3d7e1be0fb77d7d2c6
2019-08-08 15:52:21 -07:00
Josh Gao 479627b823 Merge changes I4d6bda45,I72576e1f
am: 6c4cfd6af5

Change-Id: I83c66644227840376d8ee31dfa250539a24f3315
2019-08-08 13:54:00 -07:00
Elliott Hughes d32e7e2c05 Rewrite libpackagelistparser.
I was happy to ignore this as long as it wasn't being touched, but it's
been modified twice in the last year. Time to just throw it out and
rewrite it.

Also add some basic tests and put them in presubmit.

Bug: http://b/127686429
Test: new tests
Change-Id: Ie7e9406521291de0eab3138f55068cee6aaf365a
2019-08-08 13:53:20 -07:00
Josh Gao 6c4cfd6af5 Merge changes I4d6bda45,I72576e1f
* changes:
  adb: fix transport acquisition for forward, reverse.
  adb: don't manually construct device selection prefix in forward.
2019-08-08 20:38:15 +00:00
Yurii Zubrytskyi 6eca0e6999 [adb] Speed up the streaming install
1. Use bigger buffer for transfers - 64kb is the default size
   for push, so let it be the same in streaming

2. Use abb when it's available for lower overhead

3. Add a posix_fadvise() on the source APK

4. Increase buffer sizes for the socketpair that's transferring
the data from adbd.

Overall this saves about 25% time for streaming installations
and makes it faster than the legacy push (at last!)

Test: manual
Change-Id: Ieb84284da2058944815e062ef6e4389b842565fa
2019-08-08 12:55:51 -07:00
Tom Cherry 4389117af7 Merge "liblog: Remove stdbool.h from .cpp files"
am: ca94d79753

Change-Id: I0f78ec9e4f0d11afe7785a94d59a9babae23c221
2019-08-08 12:54:56 -07:00
Elliott Hughes 498163c28a Merge "Remove more dead code."
am: 0c2dab9adf

Change-Id: I52dbcba34d893573b3452c7b084af8840e5c1ec1
2019-08-08 12:40:55 -07:00
Tom Cherry ca94d79753 Merge "liblog: Remove stdbool.h from .cpp files" 2019-08-08 19:34:41 +00:00
Elliott Hughes 0c2dab9adf Merge "Remove more dead code." 2019-08-08 19:10:40 +00:00
Mark Salyzyn 31c14e15b9 fs_mgr: overlayfs: dig harder for /dev/root equivalent
Check for A/B /dev/block/by-name/system<slot> and also non-A/B
/dev/block/by-name/system to discover what /dev/root can be when
evaluating candidates for using overlayfs.

This is to handle a misconfigured (or legacy) system-as-root device.
It is recommended that the default fstab specifically mentions the
root mount's device node to prevent going down this path.

Test: adb-remount-test.sh
Bug: 138407617
Change-Id: I3853d203b9376d0f848cb490150ff00cc4ed3d5f
2019-08-08 11:50:36 -07:00
Elliott Hughes addd852165 logcat: switch to <regex>.
This was the only user of the google3 additions to external/pcre.

Test: adb logcat --grep camera
Change-Id: Iaa9dae38d30f60470f6a65b0a0fdd93e01abfc99
2019-08-08 08:53:59 -07:00
vichang d9153800b4 Merge "Move ICU .dat"
am: ef0bc63043

Change-Id: I263e6dd27acf9c322756bb0111873f7efe156d5c
2019-08-08 04:24:56 -07:00
vichang ef0bc63043 Merge "Move ICU .dat" 2019-08-08 11:06:53 +00:00
David Anderson 5312c466b9 libsnapshot: Implement merge flow.
This implements InitiateMerge() and WaitForMerge(). InitiateMerge() is
meant to be called after an update has been marked successful.
WaitForMerge() is designed to be called either: immediately after
InitiateMerge, or during each subsequent boot where merging has not
completed.

InitiateMerge converts each snapshot device to a snapshot-merge device.

WaitForMerge polls each snapshot-merge device until no device reports a
"merging" state. One of the following states can result from this:
 - MergeFailed. This will happen if any device failed to merge, or we
   were unable to poll, or any other system-level failure occurred.
 - MergeNeedsReboot. This will happen if a snapshot-merge device has
   completed merging, but we were unable to clean it up due to something
   holding a resource open.
 - MergeCompleted. This indicates that all snapshots completed merging
   and were cleaned up.

If WaitForMerge() returns MergeCompleted, then all snapshots have been
removed and a new update can begin. GetUpdateState() will return None.

MergeFailed and MergeNeedsReboot, on the other hand, are "sticky". They
indicate a merge is still pending. When called again, WaitForMerge()
will poll again to attempt to make more progress in the merge. For
NeedsReboot, a single reboot will ensure all resources are released and
the next WaitForMerge() will successfully finish cleanup. In the failure
case, it is unlikely the next WaitForMerge will succeed, but we always
retry anyway (there is no harm in doing so, and if we get lucky, the
device can take more OTAs).

Bug: 136678799
Test: libsnapshot_test gtests
Change-Id: I5e93fcbffee1973da5ff76363df12d6317a7a7c7
2019-08-07 18:42:23 -07:00
David Anderson 986095036c libsnapshot: Unmap COW devices when deleting snapshots.
When we stopped unmapping snapshots in DeleteSnapshot, this also stopped
unmapping the COW device. Of course, the caller has no way to unmap this
since it's an implementation detail. Therefore unmap it in
DeleteSnapshot.

This scenario can arise after rewriting or removing a snapshot-merge
device.

Bug: 136678799
Test: manual test
Change-Id: I9d4c8bcfbb95b4454edd1cf0853d51b441e895fa
2019-08-07 18:42:22 -07:00
David Anderson d986fefa3b libsnapshot: Eliminate per-snapshot flocks.
Per-snapshot locks don't solve any problems and add a great deal of
complexity. Instead, refactor the Read/WriteSnapshotStatus methods so
the caller just needs the snapshot name, and is not responsible for
opening a file.

As part of this change, callers of WriteSnapshotStatus must always take
an exclusive flock on the update state file. This is enforced by adding
a helper method to LockedFile to check the lock mode.

Bug: 136678799
Test: libsnapshot_test gtest
Change-Id: Icd580aaec7dfc916b3eed174d86b26688cd2291b
2019-08-07 18:42:22 -07:00
David Anderson 3cb682e369 libsnapshot: Improve first test-run and test cleanup.
This CL fixes a bug where libsnapshot_test failed on the first run. It
also fixes bugs where it could not run if it died in the middle of a
test.

Previously, libsnapshot_test relied on CancelUpdate() to perform
cleanup, which cannot run in certain states. Instead, manually delete
dm devices and COW image files, and forcefully erase any lingering data.

Bug: 136678799
Test: libsnapshot_test gtest
Change-Id: I7b2399a403b387eb47184626e71dcf8674f6ab89
2019-08-07 18:42:21 -07:00
Josh Gao 5ae4a90400 adb: windows: fix writev on sockets.
Bug: http://b/139078301
Test: treehugger
Change-Id: I000c12ef9dedad530a166175cf089df45378f759
2019-08-07 18:26:47 -07:00
Yifan Hong 629fc64dec Merge "liblp: refactor MetadataBuilder::NewForUpdate"
am: d97c946d37

Change-Id: I6f61a3dcec7b59c8e09fc0e45111b95469bd66d8
2019-08-07 17:10:38 -07:00
Treehugger Robot d97c946d37 Merge "liblp: refactor MetadataBuilder::NewForUpdate" 2019-08-07 23:54:27 +00:00
Elliott Hughes 1547e4a316 Remove more dead code.
Test: treehugger
Change-Id: I2b7f606241cde2c2743d8021fad00d30f7e0b0de
2019-08-07 14:52:16 -07:00
Tom Cherry d00b3affda liblog: Remove stdbool.h from .cpp files
We're C++ now, so we don't need stdbool.h

Test: build
Change-Id: I2c65f0d3edddaf77256bd0bc3d60378bcfaef180
2019-08-07 14:30:41 -07:00
David Anderson b8089c639c Merge "libsnapshot: Don't force-unmap in DeleteSnapshot()."
am: 36acd1d246

Change-Id: I256f80b5bdbb1330438a16f2e28f5551de02a7bd
2019-08-07 13:42:06 -07:00
David Anderson 36acd1d246 Merge "libsnapshot: Don't force-unmap in DeleteSnapshot()." 2019-08-07 20:24:46 +00:00
Yifan Hong 8644f52338 Merge changes from topic "liblp_virtualab_prepare"
am: 68aae7d748

Change-Id: I0af79e752e346460e8af8fd20f5a65b34750f6b9
2019-08-07 13:17:40 -07:00
Yifan Hong 68aae7d748 Merge changes from topic "liblp_virtualab_prepare"
* changes:
  liblp: Expose kDefaultGroup.
  liblp: Add PropertyFetcher.
2019-08-07 19:45:44 +00:00
Yifan Hong 6079cd014a liblp: refactor MetadataBuilder::NewForUpdate
Move the logic for retrofit DAP to its new function. The new flow
in NewForUpdate is:
    metadata = ReadMetadata();
    if (retrofit dap) UpdateMetadataForOtherSuper(metadata)
    return metadata;

Test: liblp_test_static
Change-Id: I6890fff3a7c44ebe2004de96b2ccbe1e8ce37546
2019-08-07 12:44:19 -07:00
Vic Yang c1ed1ebac7 Merge "fs_mgr: Make kDefaultAndroidDtDir constexpr"
am: ef06b4fc7a

Change-Id: I553ca2e8a81b6b48a156c7a3a4843925b6804ac1
2019-08-07 10:47:39 -07:00
Steve Muckle c4e5646b35 Merge changes from topic "toolbox-modprobe"
am: b02f9b549c

Change-Id: I2da6f431a80fe82070fdd2e1c87c027c81d9bf53
2019-08-07 10:44:50 -07:00
Steve Muckle e6bf24912a libmodprobe: add verbose mode
am: ded44c06be

Change-Id: I4696ec3115a46806d5a829142902b94b413e7223
2019-08-07 10:44:32 -07:00