Commit graph

53921 commits

Author SHA1 Message Date
Treehugger Robot
0a4fcfb9cf Merge "libcutils: update fs_config tests for current behavior" 2019-11-06 23:23:07 +00:00
Elliott Hughes
56b266686a Merge "libbase: add a README.md covering the most frequent question." 2019-11-06 22:01:41 +00:00
Tom Cherry
f8baa897ec libcutils: update fs_config tests for current behavior
Update fs_config tests for the new behavior in
a8eb00720c.

Before the above CL, fs_config_cmp() would match any partition prefix
to any path, even if there is not a logical relationship between them.
For example, these two lines in the test the demonstrate the changed
behavior:

{ true,  "vendor/lib",             "system/vendor/lib/hw",    true },
{ true,  "system/vendor/lib",      "vendor/lib/hw",           true },

The first line should match and does; it is testing that files located
at system/vendor/lib/hw are matched by an fs_path_config entry
specified as vendor/lib.  This is to allow for applying the policy we
have for the vendor partition to files in /system/vendor in the case
that there is no vendor partition.

The second line should not match.  This is testing that a file
that's located at vendor/lib/hw is matched by an fs_path_config entry
specified as system/vendor/lib.  This is backwards; we do not want to
have policy specified for system/vendor to impact policy for the
vendor partition.

Also, we never have any relationships from /system/oem to /oem or
/system/odm to /odm, so these are logically unrelated and should fail
to match.  We do however have a relationship from /vendor/odm to /odm,
so this test is added.

Test: libcutils unit tests pass on CF
Change-Id: I026f0233e00bbd0aad9bc0fb701aef000d2a037c
2019-11-06 09:40:33 -08:00
Elliott Hughes
10dc4ca3cd libbase: add a README.md covering the most frequent question.
Test: N/A
Change-Id: Iebea3e74bb7d59778fa0d2342e51bb4ffc5450a3
2019-11-06 09:38:21 -08:00
Daniel Colascione
2aabeed1fd Merge "Properly finish daemon init when initial USB scan complete" 2019-11-05 23:44:25 +00:00
Josh Gao
e24a4b37b4 Merge changes from topic "adbd_apex"
* changes:
  Move adbd to an apex.
  adbd: use libadbd_auth for authentication.
2019-11-05 23:36:39 +00:00
Tianjie Xu
7cfb77ed8d Merge "Grant adb auth under recovery for unlocked & userdebug devices" 2019-11-05 21:37:07 +00:00
Elliott Hughes
4b3e5e1de8 Merge "Darwin: include <libgen.h> for basename(3)." 2019-11-05 05:05:38 +00:00
Elliott Hughes
f1b255a6ad Darwin: include <libgen.h> for basename(3).
Test: treehugger
Change-Id: I11858430f13cbb22895c9dd0befb8054308efb19
2019-11-04 19:27:33 -08:00
Tianjie Xu
a933b43c02 Grant adb auth under recovery for unlocked & userdebug devices
During automatic tests, we sometimes want to reboot the device out of
the rescue party remotely. And per http://go/recovery-adb-access, we
need to grant the adb authorization to enable the adb access. The auth
are only granted for userdebug devices and those with an unlocked
bootloader. Since the user can always flash a custom recovery image if
the bootloader is unlocked.

This cl ignores the ro.adb.secure property under recovery. The other
option is to default this property to 0 when building the boot/recovery
image.

Bug: 141247819
Test: unlock bootloader, run adb under recovery in user build
Change-Id: I424cfed5bf51a1e31d8687256ae4c6eaaa5e6249
2019-11-04 16:12:00 -08:00
Josh Gao
594f70ffb8 Move adbd to an apex.
Test: adb shell "su 0 readlink /proc/\`pidof adbd\`/exe"
Change-Id: I84dfe4d1b28b619f98c03a2c8eeef2c783d30af2
2019-11-04 15:52:16 -08:00
Josh Gao
275232667d adbd: use libadbd_auth for authentication.
Bug: http://b/137798163
Test: for i in `seq 1 100000`; do echo $i; adb wait-for-device shell "su 0 stop; su 0 start; sleep 10"; adb disconnect; done
Change-Id: Ie481e79a48c4aabf18ef797317ba18f207808c63
2019-11-04 15:46:20 -08:00
Yifan Hong
50e102c51d Merge changes from topic "libsnapshot_flash"
* changes:
  libsnapshot: Fix MergeCannotRemoveCow
  libsnapshot: fix re-flash after update
  [REFACTOR] libsnapshot: Add InitiateMergeAndWait
2019-11-04 22:10:05 +00:00
Daniel Colascione
3aef5c82f7 Properly finish daemon init when initial USB scan complete
Call adb_notify_device_scan_complete when we finish enumerating USB
devices. The original intent of the code appears to have been to have
adb_wait_for_device_initialization return as soon as we've finished
looking around at the system USB environment on daemon startup, but at
some point, we forgot to actually notify the init thread that we
finished scanning all the USB devices, forcing the wait on init_cv to
time out after three seconds on every daemon initialization.

After this change, the daemon starts in a few milliseconds on my Linux
machine

Test: killall adb && sleep 1 && time adb server && adb shell ls
Change-Id: I0bc1da7a597d2077dd2b591560d03798b05905b7
2019-11-04 11:43:20 -08:00
Nikita Ioffe
57292aa684 Merge "Fix typo in userspace-reboot-requested trigger" 2019-11-04 18:25:37 +00:00
Elliott Hughes
2ea7c7d39f Merge "unzip: fix Mac build." 2019-11-04 05:23:39 +00:00
Elliott Hughes
bcd810622b unzip: fix Mac build.
Turns out the Mac doesn't have <error.h>. Add our own "die" function
instead, and use it everywhere so the Mac isn't using an untested
codepath.

One upside to this is that we'll now call ourselves "unzip" even when
run as `ziptool unzip ...`, which was awkward to fix with <error.h> but
trivial if we're rolling our own anyway.

Test: still works on Linux
Change-Id: I9cb1922595a21cd9f6d55a70d67e30090f8b7f21
2019-11-03 08:30:33 -08:00
Yifan Hong
daabad7cd8 Merge "healthd: Remove libhealthd dependency from charger" 2019-11-01 23:46:31 +00:00
Treehugger Robot
7933195a36 Merge "Update OWNERS for libstatssocket" 2019-11-01 22:08:28 +00:00
Mark Salyzyn
283e41de76 Merge "first_stage_init: if console enabled allow for errors in module loading" 2019-11-01 21:52:42 +00:00
Mark Salyzyn
552bbdde38 Merge "libmodprobe: add strict bool argument to LoadListedModules" 2019-11-01 21:52:26 +00:00
Nikita Ioffe
ac692148e5 Fix typo in userspace-reboot-requested trigger
It should userspace-reboot-requested, not userspace-reboot

Test: adb reboot userspace
Bug: 135984674
Change-Id: I1e844b7705eb70ee3702a1dc0432644592666364
2019-11-01 20:56:33 +00:00
Ruchir Rastogi
2aa3d903da Update OWNERS for libstatssocket
Test: m -j libstatssocket compiles
Change-Id: I57bce83a88de51a7671b452afb5e251e9a61ffb3
2019-11-01 13:25:31 -07:00
Yifan Hong
94f476b01e Merge "init: hack for /charger symlink" 2019-11-01 18:23:46 +00:00
Jooyung Han
b435f68fd2 Merge "Use soong-generated vndk*libraries.txt files" 2019-11-01 01:57:50 +00:00
Yifan Hong
ace7795804 libsnapshot: Fix MergeCannotRemoveCow
The test is broken because now ProcessUpdateState
checks UPDATED flag as well, and partition "test-snapshot"
does not exist in super partition metadata.

Rewrite the test to mimic the update flow and use
as many public APIs as possible.

Test: libsnapshot_test
Bug: 143551390

Change-Id: I105bad8bb589616b304c511c64be902d4297bda7
2019-10-31 18:40:46 -07:00
Yifan Hong
46002d5c21 libsnapshot: fix re-flash after update
If device takes an update from slot A to
B, immediately flashes the B slot, and reboot
into B slot, libsnapshot incorrectly considers
the device booted into the new slot and refuses
to clear update states. Fix this by checking
the UPDATED flag in super partition metadata.

Test: libsnapshot_test
Bug: 143551390
Change-Id: I3cd7bb19b394da6399d4bf2f9d013bfaa7f186f1
2019-10-31 18:40:46 -07:00
Yifan Hong
8fb7f773f0 init: hack for /charger symlink
Legacy symlink from /charger to /system/bin/charger is
removed. Instead, all Android R devices are required
to use /system/bin/charger instead.

See hardware/interfaces/health/2.1/README.md for details.

Bug: 142286265
Test: charger mode
Change-Id: Ib478a864ef68647bc9fc14650ca3d382952b80c8
2019-10-31 18:37:02 -07:00
Yifan Hong
4913d7af12 [REFACTOR] libsnapshot: Add InitiateMergeAndWait
Move snapshot_ctl's merge command to SnapshotManager::
InitiateMergeAndWait function so that tests can use
it too.

Test: libsnapshot_test
Bug: 143551390

Change-Id: I0936c262afaca7ba445ee18465dca4e16b9416ad
2019-10-31 17:06:28 -07:00
Treehugger Robot
8578a8a8ec Merge "trusty-ut-ctrl: link statically to libtrusty" 2019-10-31 23:03:54 +00:00
Treehugger Robot
9495cda53b Merge "Update OWNERS based on Trusty team membership" 2019-10-31 22:40:33 +00:00
Matthew Maurer
d35f685a7c Update OWNERS based on Trusty team membership
Change-Id: Iafad614b6568e53209752b1c45f0f0209c95684b
2019-10-31 13:32:20 -07:00
Mark Salyzyn
a7144f7eb2 first_stage_init: if console enabled allow for errors in module loading
Allow for module load errors if first stage console is enabled, userdebug
development builds, load what you can and continue.

Test: compile
Bug: 141311820
Change-Id: I30f3ee1129373f6ffedcf03807c212c60d4c39aa
2019-10-31 10:30:45 -07:00
Mark Salyzyn
d478271b2b libmodprobe: add strict bool argument to LoadListedModules
Continue loading remaining modules after error if strict flag false.

Test: libmodprobe_test
Bug: 141311820
Change-Id: Ib21d4eade1254b16621e7bf2c9efaa173092e7c7
2019-10-31 10:30:35 -07:00
Elliott Hughes
4645210097 Merge "Remove Mac/Windows quick_exit() implementation." 2019-10-31 14:44:20 +00:00
Tom Cherry
0ae1272269 Merge changes from topic "logcatd-shell"
* changes:
  logcat: fix logpersist.stop and logpersist.clear
  logcat: fix logcatd / logpersist
2019-10-31 13:45:21 +00:00
Tom Cherry
2249b07eb8 logcat: fix logpersist.stop and logpersist.clear
Test: these work
Change-Id: Ib0b0b5408c93a05f39d1b585256a2c7c34736e7e
2019-10-31 06:43:47 -07:00
Tom Cherry
98c6c3304a logcat: fix logcatd / logpersist
Removing the rest of liblogcat broke logcatd since LogcatPanic() now
actually calls exit(), whereas logcatd relied on it to return
normally.

We can achieve the expected behavior with a small shell script, so
this change does that as well.

Test: logcatd / logpersist work
Change-Id: Icde36a4811a0db987a801978485e1af1dfc3d38c
2019-10-31 06:43:47 -07:00
Treehugger Robot
e88b568442 Merge "COW device initialized by zeroing the whole first chunk" 2019-10-31 11:19:56 +00:00
Paul Crowley
7df60cee92 Merge "fs_mgr: Add stable_inodes flag to encrypted ext4" 2019-10-31 03:17:23 +00:00
Jooyung Han
a18363cb97 Use soong-generated vndk*libraries.txt files
linkerconfig reads vndk-related libraries.txt files. Now these files are
generated by soong.

Bug: 142963962
Bug: 141450808
Test: m && device boots && TH
Change-Id: I98c2f934815238cacd4ec8536ce2f9f24bbf1b32
2019-10-31 11:40:22 +09:00
David Anderson
c399ccb345 Merge "fastboot: Implement helper commands for Virtual A/B." 2019-10-31 01:11:49 +00:00
David Anderson
ab8f466107 fastboot: Implement helper commands for Virtual A/B.
This introduces two new commands to the fastboot protocol:

  - getvar snapshot-update-status - Return "none", "snapshotted", or
    "merging" depending on the current status set by the boot control
    HAL.
  - snapshot-update [cancel] - Cancel any pending snapshot-based updates
    via the boot control HAL. After this, the HAL should return
    MergeStatus::CANCELLED and "update-merge-status" should be "none".
    If no argument is specified, the snapshot-update-status is returned
    via an INFO response.

Bootloaders are expected to implement this in a manner consistent with
the boot control HAL.

Fastboot-based tooling should expect wipes of userdata to fail when
update-merge-status returns "merging". Thus, the force flag now cancel
any pending snapshots.

Bug: 139154945
Test: fastboot getvar snapshot-update-status
      fastboot snapshot-update cancel
      fastboot snapshot-update

Change-Id: Idc423fe7656b212e929e64eb0e6b85b453e0e8dc
2019-10-31 01:11:16 +00:00
Yifan Hong
7dcf7b0639 healthd: Remove libhealthd dependency from charger
Clean up charger's libhealthd dependency.

- Charger uses libhealthloop to maintain an infinite
  loop, similar to all health 2.x services.
- Charger tries to open up health 2.1 HAL implementation
  to retrieve health info. If it failed, it falls back
  to the legacy code path where a default BatteryMonitor
  is used, *except* that it won't depend on libhealthd's
  healthd_board_init() and healthd_board_battery_update()
  anymore.
- Remove global static variables because they are hard to
  track.
- Modernize code by converting charger_state in to a C++
  Charger class, transforming all functions into methods,
  and moving all other global states into the class.

- Devices that matches all of the following:
  - have a customized libhealthd (search for modules
    named libhealthd.xxxx)
  - uses charger from system image (look for "class charger"
    in device init.rc scripts; if you see the binary is named
    "/charger" or "/system/bin/charger" then you are using
    charger from system image)
  ... must implement health 2.1 passthrough implementation
  properly in order to have charger continue to work.

See hardware/interfaces/health/2.1/README.md for details.

Test: charger test
Test: manual charger mode
Bug: 127677771
Bug: 142286265

Change-Id: I0f26e5c1fe2be6b5952fc019224457c8419e43e4
2019-10-30 13:48:08 -07:00
Paul Crowley
7160fc1139 fs_mgr: Add stable_inodes flag to encrypted ext4
Also put libfscrypt into fs_mgr via whole_static_libs
since it's now a dependency.

Bug: 143307095
Test: we can use the inline policy on it
Change-Id: I82d7d5330abef76ce82accea25d2663748e87a8b
2019-10-30 13:35:48 -07:00
Elliott Hughes
f16a98165b Merge "unzip: add -Z for "zipinfo mode"." 2019-10-30 18:45:57 +00:00
Treehugger Robot
33eecb8f82 Merge "libmodprobe: Do not reload modules previously instantiated" 2019-10-30 18:31:35 +00:00
Alessio Balsini
3ab9f1f85b COW device initialized by zeroing the whole first chunk
To be compliant with lvm, instead of just zeroing the first 32 bit of
the COW device, force to zero the whole first chunk.
Also switch to std::vector to store the zeroes, reducing the stack
growth.

Test: libsnapshot_test
Bug: 139202197
Change-Id: I2d98549528a222d6c27bb566c68477b5ec3add20
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-10-30 17:50:59 +00:00
Christopher Ferris
2ff3c44304 Merge "Fix potential bad info in eh_frame_hdr." 2019-10-30 17:18:59 +00:00
Tom Cherry
e901d3a3ee Merge "logcat: modernize the code" 2019-10-30 15:56:45 +00:00