Commit Graph

48314 Commits

Author SHA1 Message Date
Hridya Valsaraju dbac204e8b Do not access ext_csd register in debugfs from storaged
Starting from Android R, platform code cannot access files in debugfs
since it does not guarantee ABI stability. This CL removes the code in
storaged that accesses the EMMC's ext_csd register from debugfs as a
backup if it is unable to obtain the information from Health HAL.

Test: build and boot.
Bug: 134669095
Change-Id: I3bfeb3963de5fb5e6bb3eaa9df43baacad164816
2019-08-16 14:30:09 -07:00
David Anderson c1c6008b78 Merge "libsnapshot: Improve test reliability." 2019-08-16 14:54:22 +00:00
David Anderson f79af03011 Merge "libsnapshot: Don't compare strings for snapshot state." 2019-08-16 14:53:14 +00:00
David Anderson 3b5d5b5b8a libsnapshot: Improve test reliability.
The test suite is still quite buggy if interrupted. This fixes a number
of issues (such as bad ordering of setup calls), and refactors things to
add more ASSERTs.

Bug: 139204329
Test: libsnapshot_test gtest
Change-Id: I224608715c29f343b34512a9ac1143f0dde932e9
2019-08-15 17:42:51 -07:00
David Anderson f27c063ba9 libsnapshot: Don't compare strings for snapshot state.
Convert the string field to an enum. We still write a string back to the
state file.

Bug: N/A
Test: libsnapshot_test gtest
Change-Id: I7cc1cb597dacd7d6faaaba05fb01c0a86bd54c8f
2019-08-15 17:42:47 -07:00
Yifan Hong 536dd4292e Merge "Rename libfiemap libraries." 2019-08-15 23:52:23 +00:00
Yifan Hong f093f2173b Merge changes from topic "liblp_virtualab_prepare"
* changes:
  liblp: Don't halve super partition for virtual a/b devices
  liblp: MetadataBuilder::GetBlockDevicePartitionName
  liblp_test_static: GetMockedInstance->GetMockedPropertyFetcher
  libsnapshot: UnmapSnapshot: don't delete device that doesn't exist.
  liblp: change some functions to use string_view
2019-08-15 19:29:34 +00:00
Yurii Zubrytskyi 5f0e5e0ecc Merge "[base] Make MappedFile work with OS file handles" 2019-08-15 16:50:31 +00:00
Treehugger Robot 31f6263bc1 Merge "libsparse: replace legacy min() with std::min()" 2019-08-15 14:32:36 +00:00
Treehugger Robot 205ae55baf Merge "Initialize pointer member of LibaryNamespaces" 2019-08-15 06:47:44 +00:00
Treehugger Robot 12b0eb363d Merge "neuralnetworks namespace links to system namespace in [vendor] section" 2019-08-15 06:31:45 +00:00
cfig 946da7c528
libsparse: replace legacy min() with std::min()
this makes libsparse compile with MacOS clang++
Test: "libsparse" compiles and works fine under both Linux and MacOS

Change-Id: Ifcf018b856d2fe5f1dac7eeddd72de2810be66c5
2019-08-15 14:07:51 +08:00
Jiyong Park 1d89a7e899 neuralnetworks namespace links to system namespace in [vendor] section
This change fixes a bug that neuralnetworks namespace is linked to the
default namespace in [vendor] section. Default namespace is for
/vendor/lib in [vendor] section. System libraries are available in the
'system' namespace.

Bug: 139113342
Test: N/A
Change-Id: I1b6751e5e33522f9829f3d9ad7371efdce01b0f0
2019-08-15 09:48:07 +09:00
Jiyong Park bb710ee6e4 Initialize pointer member of LibaryNamespaces
Explicitly initialize the pointer member `app_main_namespace_` of the
class LibraryNamespaces.

Test: atest libnativeloader_tests
Change-Id: I3932e7fb3c4074a127fcdbdedbd9c88652a7e36c
2019-08-15 08:10:55 +09:00
Yifan Hong 5217c1cf0e Rename libfiemap libraries.
Update Android.bp for libfiemap library renames.

Test: builds

Change-Id: I318c5f64452726579cebb41792b95f6b9e47fbb8
2019-08-14 14:17:22 -07:00
Yifan Hong fadce1ee1f liblp: Don't halve super partition for virtual a/b devices
For Virtual A/B devices, we snapshot the partitions. Hence
there is no need to prioritize using the second half of super
partition for _b partitions.

Test: liblp_test_static
Bug: 135752105

Change-Id: I8bd669e6ffa0a4d114a1b386133179bd2819099b
2019-08-14 14:17:22 -07:00
Yifan Hong 8367b9f73a liblp: MetadataBuilder::GetBlockDevicePartitionName
Allow to retrieve name of a block device partition at
a certain index. If the index is out of range, return
empty string.

This is needed for an hypothetical edge case when an
intersection of two LinearExtent needs to be computed,
and the two metadata have a different list of block
device names. In reality, Virtual A/B devices are always
launched with dynamic partitions, so it will always return
"super" for index 0 and "" otherwise.

Test: liblp_test_static
Bug: 135752105

Change-Id: I9ea59edefdc41d0e69e3644aa2452676372938b4
2019-08-14 14:17:22 -07:00
Treehugger Robot 19b68a66e5 Merge "Fix more endian.h issues" 2019-08-14 21:06:28 +00:00
Yifan Hong 4644f84208 liblp_test_static: GetMockedInstance->GetMockedPropertyFetcher
Rename it to be a better name.
Test: run it

Change-Id: Idcf271e84f8758737a98a4f6c18ea6744b91f79b
2019-08-14 13:33:59 -07:00
Yifan Hong 94da8944f5 libsnapshot: UnmapSnapshot: don't delete device that doesn't exist.
Otherwise, DeleteDevice will just return false and it will
be stuck here.

Test: apply OTA after first boot, update_engine can unmap system_b
Bug: 135752105

Change-Id: If2b00336f4b948ba5f57a5e129fc070a739848fa
2019-08-14 13:33:59 -07:00
Yifan Hong b278e013b9 liblp: change some functions to use string_view
Converting all of them to string_view requires some
non-trivial amount of refactoring (because there is not
an implicit conversion from string_view to string), and
hence may be done later if necessary.

Test: builds
Bug: 135752105
Change-Id: I936ae7117500fadc7b34a5b91b279bc863d9919d
2019-08-14 13:33:59 -07:00
Yurii Zubrytskyi d77c99ebc3 [base] Make MappedFile work with OS file handles
adb uses its own implementation of Windows HANDLE->int mapping,
and it doesn't play well with _get_osfhandle() function used in
MappedFile::FromFd().

This CL adds another function that accepts raw handle, so adb
can pass it directly

+ make constant functions 'const'
+ make the MappedFile movable, as nothing prevents it from being
  one

Test: libbase_test

Change-Id: Ifde4a4094b910e9c7b431126ecf3fef5aa3bb4a6
2019-08-14 10:04:32 -07:00
Treehugger Robot 61bffa5fc0 Merge "[adb] Use STL for ParseUInt() implementation" 2019-08-14 06:32:44 +00:00
Kiyoung Kim a91d84b6c4 Merge "Remove unused link from postinstall section" 2019-08-14 05:16:06 +00:00
Jiyong Park 085a0b4404 Merge "Don't create anonymous namespace" 2019-08-14 01:21:30 +00:00
Josh Gao edf8040152 Merge "adb: use shell for remount to forward return codes." 2019-08-14 00:26:04 +00:00
Colin Cross 888c1b9de5 Fix more endian.h issues
__BIONIC__ is defined in sys/cdefs.h, __GLIBC__ is defined in
features.h (which is included from sys/cdefs.h).  If sys/cdefs.h
was not included before android-base/endian.h it was always falling
back to the Windows definitions.

mingw defines LITTLE_ENDIAN, BIG_ENDIAN and BYTE_ORDER in
sys/params.h, use those definitions to avoid conflicts.

glibc uses different names for letoh*, add compatibily #defines.

Test: m checkbuild
Change-Id: I0709a964cc8f20dd9fa4f03064cc67d97ae6c525
2019-08-13 15:27:00 -07:00
David Anderson 6ecedd2040 Merge "libsnapshot: Track the source slot across reboots." 2019-08-13 20:39:23 +00:00
Songchun Fan 93619e373a Merge "[adb] Add a getter for native Win32 file handle" 2019-08-13 19:51:01 +00:00
Tom Cherry 53620ca1b1 Merge "Actually add README contents for ueventd" 2019-08-13 14:48:04 +00:00
Treehugger Robot b85c72caed Merge "init: first stage init tie stdout and stderr to /dev/kmsg" 2019-08-13 12:48:40 +00:00
Zimuzo Ezeozue 6c62ae7adb Merge "Allow switching between sdcardfs and FUSE mounts" 2019-08-13 09:23:58 +00:00
Josh Gao 8c2198c809 adb: use shell for remount to forward return codes.
Bug: http://b/25842395
Test: manual
Change-Id: I719c86bdf573db14ca2a0bdf608065ad63f573c1
2019-08-12 18:31:45 -07:00
Treehugger Robot cbd1af9db0 Merge "fs_mgr: adb-remount-test: non-verity recovery" 2019-08-13 00:40:17 +00:00
David Anderson 3c0fea923b libsnapshot: Track the source slot across reboots.
The purpose of this is twofold. First, we need a way to detect whether
the device has booted into the new slot after an update. Second, we need
a quick-and-dirty test for first-stage init so it can avoid searching
for snapshots if it doesn't need to.

We can solve both of these problems by storing the source slot in
/metadata/ota/snapshot-boot. The existence of the file implies a more
complex check is needed, and the file stores the source slot.

Test: libsnapshot_test gtest
Bug: 139204329
Bug: 139089801
Change-Id: I919dd1c27a65734c61f3a9bdffefb32bdebd723b
2019-08-12 17:10:21 -07:00
Treehugger Robot 92a3594b12 Merge "libpackageparser: C rules for bools." 2019-08-12 23:45:36 +00:00
Christopher Ferris b5d064f5c6 Merge "Fix incorrect closing of fds." 2019-08-12 23:44:24 +00:00
Elliott Hughes e5abcddf4e Merge "Use as much of the macOS endian support as we can." 2019-08-12 23:00:47 +00:00
Tom Cherry 79896d8880 Merge "init: Allow matching empty property values" 2019-08-12 22:35:31 +00:00
Treehugger Robot 3d0ecde28f Merge "adb: windows: fix writev on sockets." 2019-08-12 22:33:44 +00:00
Zim c9f8e5dfed Allow switching between sdcardfs and FUSE mounts
This change is part of enabling upcoming platform changes that are
described in the bug linked below.

Bug: 135341433
Test: builds, boots successfully and external storage remains
an sdcardfs mount by default and works correctly
Test: cat /proc/1/mountinfo is unchanged

Change-Id: Idf851b3a42910e0ce8fdd75daea1cce91dd1aa98
2019-08-12 21:37:12 +01:00
Tom Cherry aefb141c67 Actually add README contents for ueventd
A long time coming

Test: n/a
Change-Id: I6050e74d7497d5a7760f615fe2ad7d5c78a66ab9
2019-08-12 13:13:57 -07:00
Anatol Pomozov 0fe1b4bd8c Merge "Add header that declares memcpy()" 2019-08-12 20:09:34 +00:00
Elliott Hughes 38b6297bac libpackageparser: C rules for bools.
I don't see any reason to carry around code to be more fussy than we
need to be.

Test: treehugger
Change-Id: I548f76fc4e06fadefb9173827872fd7f39f300fd
2019-08-12 12:43:34 -07:00
Elliott Hughes 8c711a5384 Merge "Rewrite libpackagelistparser." 2019-08-12 19:26:12 +00:00
Elliott Hughes f86ea02de6 Use as much of the macOS endian support as we can.
Turns out that although there's no <endian.h> or <sys/endian.h>, there
are <machine/endian.h> and <sys/_endian.h>, and they're included by
other system headers such as <dirent.h>.

Reuse the contents of <sys/_endian.h> here for better interop.

Bug: http://b/139203733
Test: treehugger
Change-Id: Ic0e9bfa1a5b56d05e9e542839d237b6ceae4aa8c
2019-08-12 12:11:42 -07:00
Anatol Pomazau 6b2ea1ca70 Add header that declares memcpy()
It helps to fix a compilation issue with host libc:

core/fs_mgr/liblp/reader.cpp:252:9: error: use of undeclared identifier 'memcpy'; did you mean 'wmemcpy'?
        memcpy(&partition, cursor, sizeof(partition));
        ^~~~~~
        wmemcpy

Change-Id: I68f9c5b815b09f846aeba67bce0290f6829c80cf
2019-08-12 18:34:49 +00:00
Elliott Hughes a22599df58 Merge "Reland "libcutils: remove unused "jstring.h"." 2019-08-12 18:21:27 +00:00
Mark Salyzyn ae8b8a4e00 fs_mgr: adb-remount-test: non-verity recovery
For devices that do not have verity, or start the test with
verity disabled, but are using overlayfs, use a 'secret' surgical
technique to revert the device back to original state.

adb enable-verity will carry risk in that if the device did not
arrive with verity enabled, we can not guarantee it will boot
if we turn on verity.

Test: atest adb-remount-sh
Bug: 138649540
Change-Id: If6d55c57fb9daca9305c42a4df2c18c7f8c5eefa
2019-08-12 10:14:18 -07:00
Tom Cherry 6fd8d3bb1b init: Allow matching empty property values
When we have a property match along with an event trigger, we
currently don't allow matching empty property values, in other words,
properties that are unset.  For example, the below trigger would never
be run:

on zygote-start && property:persist.sys.fuse=""

That doesn't make sense though, it should be possible to match an
empty property value, so this change allows that trigger to match when
persist.sys.fuse is either empty or not set.

This continues to not match a '*' to an empty property, so

on zygote-start && property:persist.sys.fuse=*

will not run if persist.sys.fuse is empty or unset.

Test: the above triggers run appropriately
Change-Id: Ia57de7b96ad352590d0c82ff4ae95060b7361976
2019-08-12 09:31:42 -07:00