Commit Graph

55429 Commits

Author SHA1 Message Date
Treehugger Robot 7f5116e581 Merge "adb: improve help for -t/-tt." 2019-12-14 02:26:36 +00:00
Elliott Hughes 96f8267eff Merge "cli-test: a tool for testing command-line programs."
am: 5a07ae1422

Change-Id: Icbbe56a2ce8dee311bc6310840bb0bffe6063643
2019-12-13 16:47:31 -08: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 f39c7b6a0e Merge "Copy necessary ipt_ULOG.h structure to source."
am: 0231f4fc38

Change-Id: I64020cf4bd9bb51eeba30ae199ea068b268e1cb0
2019-12-13 13:49:55 -08:00
Christopher Ferris 0231f4fc38 Merge "Copy necessary ipt_ULOG.h structure to source." 2019-12-13 21:39:54 +00:00
David Anderson f3a96243c9 Merge changes I9d94e252,If4a543d3,I0af7cda9
am: 799f55fb01

Change-Id: I481ba55fa66de2482286ed5f5a9c4651a99cb273
2019-12-13 13:32:21 -08: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
Ricky Wai fdc0986554 Create /mnt/data_mirror/cur_profiles in init.rc
Also, bind mount /data/misc/profiles/cur to /mnt/data_mirror/cur_profiles

Bug: 143937733
Test: Directories are created and mounted
Change-Id: Idcf73b84db84dc671ec5a5025f4b4ec1bc5fd1fc
2019-12-13 17:32:18 +00:00
Tom Cherry 7163fb158c Merge changes If7fa11e7,I345c9a5d
am: a5a6c0a0bc

Change-Id: I9d8514ff1aefc0a7650e3e5b06021a127f5149c5
2019-12-13 07:59:22 -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
Tom Cherry a5a6c0a0bc Merge changes If7fa11e7,I345c9a5d
* changes:
  liblog: have writers handle their own state
  liblog: use a rwlock for writer initialization
2019-12-13 15:34:43 +00:00
rickywai 9c62e82e95 Merge "Create /data_mirror in init.rc"
am: 3014815103

Change-Id: I8f677858ce5af28059cf600735de6d0dcd89d5ea
2019-12-13 06:25:43 -08:00
rickywai 3014815103 Merge "Create /data_mirror in init.rc" 2019-12-13 14:22:37 +00:00
Bowgo Tsai 0a9aefbe34 Merge "Adding the AVB public key for Q-Developer-GSI"
am: 8afa4a0637

Change-Id: I3938e6084348e2f1a5e20ed53e1812955575e6db
2019-12-12 19:19:48 -08:00
Treehugger Robot 8afa4a0637 Merge "Adding the AVB public key for Q-Developer-GSI" 2019-12-13 03:13:02 +00:00
Josh Gao da3c1f9bce Merge "base: avoid evaluating macro argument multiple times."
am: 00bfc4480e

Change-Id: I45e34ec43b860961be86504e721c79c47c62cebe
2019-12-12 18:30:36 -08:00
Treehugger Robot 00bfc4480e Merge "base: avoid evaluating macro argument multiple times." 2019-12-13 02:27:54 +00:00
Jack Pham 8b841946ee Merge "adbd: Update DeviceInterfaceGUID for WinUSB"
am: 7b1dbeda0c

Change-Id: I7337adcf3a2651392f70de12c7eba26060e6957e
2019-12-12 16:24:51 -08:00
Treehugger Robot 7b1dbeda0c Merge "adbd: Update DeviceInterfaceGUID for WinUSB" 2019-12-13 00:21:22 +00:00
Tom Cherry 06e0fced63 liblog: have writers handle their own state
Remove the transport available and open functions since the writers
are able to manage their own state.  Remove the initialization dance
with write_to_log, since it is unneeded once this is removed as well.

Remove the global lock around the close() functions as correct locking
has been added to the writers in a previous change.

Test: logging works, liblog-unit-tests
Change-Id: If7fa11e773763d0b5fcb2e696ad1c88ff4a4cfdf
2019-12-12 16:19:08 -08:00
Tom Cherry 2a6811b4d1 liblog: use a rwlock for writer initialization
The current system of using atomics isn't thread safe and may result
in doubly closing FDs or closing actively used FDs.  The safest way to
do this is to use a rwlock, which should not have a much higher
overhead than the atomics do, as a vast majority of the time, there
will not be writers.

This moves us further away from using the transport interface, which
will be removed.  Each writer should be self contained, without a
separate open or available function.

Also, keep the pmsg fd open if it is opened by
__android_log_pmsg_file_write().  This fd was closed due to issues
with zygote, but it looks like it is only called by recovery now, so
there is no reason to close this fd at the end of that function.

Test: logging works, liblog-unit-tests
Change-Id: I345c9a5d18c55b11a280c8362df854784abf46fd
2019-12-12 16:19:08 -08:00
Josh Gao 81e316b3a2 base: avoid evaluating macro argument multiple times.
Previously, in the regex test helpers, we would evaluate the haystack
expression again to generate the error message, which leads to
nonsensical errors if the expression returns a different value on the
second call (e.g. functions like dlerror which return null on subsequent
calls).

Test: bionic-unit-tests with a failure
Test: treehugger
Change-Id: I2126cefeb45e26638194af8a82d0f2a9d7196edf
2019-12-12 14:25:45 -08:00
David Anderson b20aa434a3 remount: Remove the "backing" parameter to fs_mgr_overlayfs_setup.
This is always null, and is otherwise unused.

Bug: 134949511
Test: builds
Change-Id: I94a0da037a7036b3390e54b1bf70700cb1944895
2019-12-12 14:13:41 -08:00
David Anderson 2d79a4365e remount: Remove fs_mgr_overlayfs_scratch_device()
This is no longer needed now that GetScratchDevice exists. The cache can
go away too, since it only existed to avoid libdm spam. The spam is
avoided by checking GetState before calling GetDmDevicePathByName.

Bug: 134949511
Test: adb remount and adb_remount_test.sh
Change-Id: I9d94e2523af9de394a811d0b398fe20415708a6b
2019-12-12 14:13:40 -08:00
David Anderson 43d9f1833f remount: Refactor fs_mgr_overlayfs_teardown
This pulls code for mapping the scratch device into a separate function.
It also avoids implicitly failing by passing an empty device string.
Finally, it calls GetScratchDevice, to remove a caller of the deprecated
method fs_mgr_overlayfs_scratch_device().

Bug: 134949511
Test: adb remount and adb_remount_test.sh
Change-Id: If4a543d3fa26af3f8578ec8b236859c8e4d9bfd8
2019-12-12 14:13:40 -08:00
David Anderson a3bf8478a3 remount: Do not run the create-scratch logic on older devices.
The prologue of fs_mgr_overlayfs_create_scratch() will implicitly
succeed on physical block devices, and implicitly fail if for some
reason they can't be accessed.

This patch makes the success and failure cases explicit. The logic
specific to DAP has been moved to CreateDynamicScratch.

fs_mgr_overlayfs_create_scratch now calls GetScratchStrategy, and only
calls CreateDynamicScratch for DAP-launch devices. In the case a
physical block device can be used, no action is taken.

Bug: 134949511
Test: adb remount and adb_remount_test.sh
Change-Id: I0af7cda9bc551416c9e2ffca5a36305f89d3bf46
2019-12-12 14:13:39 -08:00
David Anderson 24b57af864 Merge "remount: Refactor fs_mgr_overlayfs_scratch_device()."
am: 40a8b07e4d

Change-Id: I67ec497f2bc56f444ad4cd2d06b477b046fd0e87
2019-12-12 11:40:15 -08:00
David Anderson 40a8b07e4d Merge "remount: Refactor fs_mgr_overlayfs_scratch_device()." 2019-12-12 19:35:18 +00:00
Elliott Hughes 1b5d3f8041 Merge "shell-and-utilities: add bc."
am: 8a8d7af69b

Change-Id: I6468c6c78a4b1f479bbd2ae4d584c65f946070bc
2019-12-12 08:33:30 -08:00
Elliott Hughes 8a8d7af69b Merge "shell-and-utilities: add bc." 2019-12-12 16:30:26 +00:00
Tom Cherry 1e707d3c74 Merge "liblog: do not check loggability of event logs before sending to logd"
am: 3a64c148ed

Change-Id: I444baa616c420309833080af9fdfa9e6e96b8466
2019-12-12 07:38:39 -08:00
Tom Cherry 3a64c148ed Merge "liblog: do not check loggability of event logs before sending to logd" 2019-12-12 15:30:58 +00:00
Ricky Wai 3cca270e95 Create /data_mirror in init.rc
Mount a tmpfs on top of it, and serve as a mirror of /data/data
and /data/user_de, which will be used when zygote forks and
overlay its CE and DE storage to prevent app can see other applications.

Also, changed /data/user/0 from symlink to bind mount, so
/data_mirror/data_ce/null can just bind to /data/user directly.

Bug: 143937733
Test: Directories are created and mounted
Change-Id: Ic72c47c9d3dc0ffc98510f5bb351eccf76524232
2019-12-12 14:44:44 +00:00
Jack Pham b310da608b adbd: Update DeviceInterfaceGUID for WinUSB
The MS OS extended property descriptor is used to convey additional
information to Windows hosts, in this case the DeviceInterfaceGUID
which allows the inbox WinUSB driver to get automatically installed.

However, the ADB windows client looks for USB devices by enumerating
devices with a specific GUID {F72FE0D4-CBCB-407D-8814-9ED673D0DD6B},
and as a result fails to find the device since it was installed with
a different DeviceInterfaceGUID. Update the OS descriptor to pass
back the same GUID the client already uses.

Change-Id: If664cdd9be821c502e8c2048ff79e79e311936f5
2019-12-12 00:13:56 -08:00
David Anderson 864021fbf6 remount: Refactor fs_mgr_overlayfs_scratch_device().
This splits fs_mgr_overlayfs_scratch_device into two new methods. The
first, GetScratchStrategy, returns an enum detailing exactly how the
device will find space for scratch:
 - via system_<other>,
 - via super_<other>, or
 - via a dynamic partition.

The second method, GetScratchDevice, uses the strategy to either return
the underlying block device, or look up a dynamic partition.

fs_mgr_overlayfs_scratch_device will be removed completely in a separate
patch.

Bug: 134949511
Test: adb remount and adb_remount_test.sh
Change-Id: Ic7e3815ada4adaf5fd7c19b84dc22249f3dcc881
2019-12-12 03:06:21 +00:00
Haibo Huang 4a2a6c537f Merge "Add a name for all test suites"
am: b773897b01

Change-Id: I27d9d62cfbdc7b78e01967d439be629237b98c3f
2019-12-11 18:47:54 -08:00
Nikita Ioffe bf06dc17c4 Merge "Move `setprop sys.usb.configfs 0` to `on init` action"
am: 5183983af2

Change-Id: I6285fa0e0b997bcee30a835946a3408b4f8679fe
2019-12-11 18:45:53 -08:00
Treehugger Robot b773897b01 Merge "Add a name for all test suites" 2019-12-12 02:44:26 +00:00
Nikita Ioffe 5183983af2 Merge "Move `setprop sys.usb.configfs 0` to `on init` action" 2019-12-12 02:41:16 +00:00
Josh Gao c01a10f1b6 Merge changes I6ff85723,Ia7d743d5
am: f4ddee0f32

Change-Id: If80e3c463f93ac6eb6785664bc019b3c68b0c648
2019-12-11 18:07:05 -08:00
Josh Gao 2ad160be37 Merge "adb: remove atransport ref counting."
am: d692530a71

Change-Id: I31ab516e0d45a8d14ad1011ae6663a3c07988104
2019-12-11 18:05:27 -08:00
Josh Gao f4ddee0f32 Merge changes I6ff85723,Ia7d743d5
* changes:
  adb: add ls_v2.
  adb: rename syncmsg::*::time to mtime.
2019-12-12 01:39:20 +00:00
Treehugger Robot d692530a71 Merge "adb: remove atransport ref counting." 2019-12-12 00:47:28 +00:00
Bowgo Tsai 58eeaa4272 Merge "Using a dir /avb for DSU avb keys"
am: 1ef36b7491

Change-Id: Ibe5da14c8e8845dcaf59f5f0becacd5c352e2e33
2019-12-11 16:04:43 -08:00
Elliott Hughes d29f94cda8 shell-and-utilities: add bc.
We accidentally dropped this when it moved out of toybox.

Test: treehugger
Change-Id: I7bc0fc2d3fe3822232531465d2c13d306381c4ef
2019-12-11 15:58:38 -08:00