Commit Graph

39069 Commits

Author SHA1 Message Date
Luis Hector Chavez 095792c300 adb: Modernize the service creation
This change removes the void* argument passing and instead uses C++11
features to avoid having to handle memory manually.

Bug: None
Test: python ./system/core/adb/test_device.py

Change-Id: I6380245b2ca583591810e3e363c67c993a107621
2018-07-18 20:38:10 -07:00
Luis Hector Chavez c20c85008d adb: Preserve the original mount flags when remounting
This change preserves any additional flags mount flags (e.g. MS_NODEV)
that any of the mounts would have. This avoids unnecessarily opening up
permissions, and also allows kernels that have additional restrictions
about what mount flags can be used to be happy with the remounts.

Bug: 111618714
Test: `adb remount` works in Chrome OS
Test: `adb remount` works in sailfish_aosp

Change-Id: I20d9f2feaf3a47b93bfcdfb4164ee61546ec0b68
2018-07-18 19:48:08 -07:00
Treehugger Robot 54f40303d5 Merge "liblp: Allow specifying a custom block size when building sparse images." 2018-07-18 21:08:16 +00:00
Tom Cherry bd130567f8 Merge "ueventd: add a test for ueventd_parser.cpp" 2018-07-18 16:56:04 +00:00
Joel Fernandes 5fd5be33e6 Merge "libcutils: ashmem: Avoid doing fd checks for ashmem calls" 2018-07-18 02:14:54 +00:00
David Anderson ce483b6f06 liblp: Allow specifying a custom block size when building sparse images.
liblp currently creates sparse files with a block size of 512 bytes.
Unfortunately devices can reject sparse files that don't have a specific
block size. To accomodate this, SparseBuilder now requires that
partition metadata be built with an explicit block size, and the device
alignment must be a multiple of that block size.

This change also modifies SerializeGeometry to automatically include
0-padding to 4096 bytes.

Bug: 79173901
Test: lpmake -S can be flashed with fastboot to walleye
Change-Id: Iab04f6f55bb373e21767963335c85ad1119a65a7
2018-07-17 18:37:46 -07:00
Joel Fernandes 56cd651e7a libcutils: ashmem: Avoid doing fd checks for ashmem calls
Callers already verify that they are calling ashmem API on a valid fd by
calling ashmem_valid first. Lets make the fstat syscall only if the
ioctl returns -ENOTTY. This means in the regular case, only 1 syscall is
needed (ioctl) vs the current 2 (fstat+ioctl).

Some data to show improvements in reduction of vfs_getattr calls in the
kernel by 10x when doing a camera.

Test: Boot and camera CTS
Bug: 111418894
Change-Id: I992620bbe44355e54ba19eeac81da586c5e5a6e0
Signed-off-by: Joel Fernandes <joelaf@google.com>
2018-07-17 17:02:44 -07:00
Jerry Zhang cb140c04c9 Merge changes I31e444f3,If07ff05f,If3ba190d
* changes:
  adb: Add io size and zero packet to usb_handle
  adb: Have device usb_handle return io size
  adb: Expose device usb_handle through libadbd
2018-07-17 22:35:36 +00:00
Tom Cherry 5f0198bfbb ueventd: add a test for ueventd_parser.cpp
Test: this unit test
Change-Id: Ib23f23ea5b362bb458adf8208573e5dc80ad6cf0
2018-07-17 15:28:51 -07:00
Jerry Zhang cda7c3b27c adb: Add io size and zero packet to usb_handle
Fastboot protocol doesn't include zero packets,
so make it possible to configure that.

Allow fastbootd to see how many bytes the handle
can read/write at once.

Test: adb works
Bug: 78793464
Change-Id: I31e444f384d9d0cdf1ea936439b2028f8151c3b8
2018-07-17 11:54:38 -07:00
Jerry Zhang 16b78db945 adb: Have device usb_handle return io size
Previously, read and write would return 0
on success. Now it will return the number
of bytes read/write. This is more consistent
with other usb handles and is needed in order
to handle partial packets (for fastbootd).

Update usb_write in other usb handles
to return amount written.

Change transport_usb accordingly.

Test: adb works
Bug: 78793464
Change-Id: If07ff05fbc8120343f20661475d34f4e5ff805de
2018-07-17 11:53:30 -07:00
Jerry Zhang b156c60ad4 adb: Expose device usb_handle through libadbd
Fastbootd will reuses adb's functionfs transport
implementation.

Move it to daemon/include as well so it can be accessed
with "adbd/usb.h". Otherwise usb.h will conflict with
other imports.

Test: adb builds and works
Bug: 78793464
Change-Id: If3ba190d5c74b5f3633411f0484195e5a2a34d44
2018-07-17 11:53:06 -07:00
Yi Kong a63b3309ff Merge "[adb] Modernize codebase by replacing NULL with nullptr" 2018-07-17 17:45:30 +00:00
Yi Kong ab3203f383 Merge "[libutils] Modernize codebase by replacing NULL with nullptr" 2018-07-17 16:55:08 +00:00
Christopher Ferris 17a02a33bb Merge "Clean up logging code." 2018-07-17 01:18:03 +00:00
Yi Kong e1731a4f2e [libutils] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
2018-07-16 18:11:34 -07:00
Treehugger Robot fcc16c53e1 Merge "fastboot: Refactor string constants to constants.h" 2018-07-16 23:48:49 +00:00
Tom Cherry b504f38d7e Merge "ueventd: let scripts provide firmware directories" 2018-07-16 23:00:53 +00:00
Christopher Ferris c637ada7e4 Clean up logging code.
Test: Verify that tombstones still contain the log message data.
Change-Id: I303dec944e58a0c4f5edfed22caaf1f2462ea3e8
2018-07-16 15:57:38 -07:00
Jerry Zhang 769a9c1d11 fastboot: Refactor string constants to constants.h
This allows them to be shared between host and device
implementations.

Test: fastboot works
Bug: 78793464
Change-Id: I79271687850ade2a904fd03d6a97dad1a9ab8e1c
2018-07-16 14:18:41 -07:00
Treehugger Robot 895acebe94 Merge "libbatterymonitor: vendor_available" 2018-07-16 20:16:02 +00:00
Yifan Hong 3da9f08903 libbatterymonitor: vendor_available
libbatterymonitor is a static library.
Also removed unused libbinder dependency.

Test: pass
Bug: 111454508
Merged-In: I1f17ee643e6ed1bb2c11a6f3189a448dba2927ac
Change-Id: I1f17ee643e6ed1bb2c11a6f3189a448dba2927ac
(cherry picked from commit ffff9aae02)
2018-07-16 11:26:04 -07:00
Treehugger Robot 97d3fd8fb0 Merge "liblp: Add a method to create sparse images of the super partition." 2018-07-16 17:17:54 +00:00
Treehugger Robot fcb0ef9c98 Merge "liblp: Move image reading/writing functions to a new cpp file." 2018-07-16 17:11:03 +00:00
Treehugger Robot 474990089a Merge "liblp: Force more sizes to be a multiple of the sector size." 2018-07-16 17:08:49 +00:00
Treehugger Robot f78c9643e0 Merge "liblp: Add block device size to LpMetadataGeometry." 2018-07-16 17:07:58 +00:00
Yi Kong 39e7a1c981 Merge "libcutils: remove rather than fix the mutex." 2018-07-14 21:18:54 +00:00
Yi Kong 2a989cf525 Merge "[logd] Modernize codebase by replacing NULL with nullptr" 2018-07-14 02:48:17 +00:00
Yi Kong aed415cc47 [adb] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: Ia8c4deacafed2f3b7dbc3d4c3c77c6c632e3de81
2018-07-13 18:21:00 -07:00
David Anderson b36db4ba0e liblp: Add a method to create sparse images of the super partition.
This change enables flashing of the super partition without using
lpflash or adding explicit fastboot support for the liblp image format.

Bug: 79173901
Test: image can be flashed to device and read by liblp
Change-Id: Id6c5e595ba831644364b7335b58cf6a43d5833c3
2018-07-13 18:17:56 -07:00
David Anderson 62cd1e06ab liblp: Move image reading/writing functions to a new cpp file.
This is in preparation for adding sparse image support, to avoid
cluttering the more critical reading and writing logic.

Bug: 79173901
Test: N/A
Change-Id: Icdddb849aebba4adf18a3e63ffbd3f36adda812d
2018-07-13 18:17:56 -07:00
David Anderson 8cf1e38b21 liblp: Force more sizes to be a multiple of the sector size.
This makes offset calculations and library interactions much easier.

Bug: 79173901
Test: liblp_test gtest
Change-Id: I595c5435bd6bc166693a434ecdcd2d098185f963
2018-07-13 18:17:56 -07:00
David Anderson 4813823e73 liblp: Add block device size to LpMetadataGeometry.
This makes it easier to validate the device and make assumptions about
the device layout without having actual access.

Bug: 79173901
Test: liblp_test gtest
Change-Id: I53d24684020ec9210c8a17d155e738b3b2405806
2018-07-13 18:17:55 -07:00
Yi Kong c8d09ddceb [logd] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I15ccb9cfc9967dae4320d9690f5097bc2f7d5bfe
2018-07-13 17:50:55 -07:00
Yi Kong dc8483cc04 Merge "Remove execute bit for source files" 2018-07-14 00:50:32 +00:00
Yi Kong 760a35a91c Remove execute bit for source files
Test: ls -l
Change-Id: Id09514a03f82c89e6350a5f9e34b9ef8bfe27b7e
2018-07-13 17:45:39 -07:00
Yi Kong 9154fbc8df Merge "Modernize codebase by replacing NULL with nullptr" 2018-07-14 00:20:38 +00:00
Tom Cherry 7421fa1aed ueventd: let scripts provide firmware directories
Since some vendors will have firmware in mount points in
/mnt/vendor/..., we extend the ueventd script language to allow
specifying the firmware directories.

Also, move the existing 4 directories to ueventd.rc as a primary user
of this mechanism.

Bug: 111337229
Test: boot sailfish; firmwares load
Change-Id: I0854b0b786ad761e40d2332312c637610432fce2
2018-07-13 15:34:25 -07:00
Yi Kong c1a1562548 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning for binder.

Test: m
Bug: 68236239
Change-Id: I8184bd6aa4ebff1bd8c88dad16886e98df853b03
2018-07-13 15:28:59 -07:00
Elliott Hughes 51a2cacbb9 libcutils: remove rather than fix the mutex.
Bug: 68236239
Test: ran tests
Change-Id: I53e47f99e6963bedcb0be30cf10c9187da8a047d
2018-07-13 14:53:51 -07:00
Elliott Hughes dda5fe46ac Merge "cutils: move hashmap to <pthread.h>." 2018-07-13 19:58:45 +00:00
Tom Cherry a8df2b95cb Merge "init: actually remount /sys when changing network namespaces" 2018-07-13 19:57:52 +00:00
Tom Cherry 9bb0a4de46 init: actually remount /sys when changing network namespaces
Fix a typo from before.

Bug: 73334854
Test: build
Change-Id: I66631a6f251960be0e02d8a119fa0ff7a00fb24c
2018-07-13 11:07:11 -07:00
Elliott Hughes 9d12725cad cutils: move hashmap to <pthread.h>.
Bug: N/A
Test: builds
Change-Id: I16a470265a17ea5bd47ef76ec234907cf7ec3e4f
2018-07-13 10:54:49 -07:00
Elliott Hughes 40ad8e2ade Merge "libbase: return different result depend on the errno" 2018-07-13 15:02:49 +00:00
Treehugger Robot a73ea65c5a Merge "liblp: Rename the metadata partition name to "super"." 2018-07-13 02:07:35 +00:00
liwugang c63cb07063 libbase: return different result depend on the errno
In the RemoveFileIfExists it always return true even if error appeared
when using stat function.

It should distinguish different error. Such as ENOENT and ENOTDIR
we exactly know the file does not exist. But EACCES(current user has not
all search permission in the file path) and other errors appeared
we can't know whether file exits. So we should return false indicate
there are some error appeared.

Test: ran unit tests
Change-Id: I75788bf0621040812413d52596b5effb628fd0b1
Signed-off-by: liwugang <liwugang@xiaomi.com>
2018-07-12 17:35:17 -07:00
Treehugger Robot b399456303 Merge "liblp: Clean up public headers." 2018-07-12 22:55:35 +00:00
Christopher Ferris 5dce8ce747 Merge "Remove Memory::ReadField." 2018-07-12 22:37:18 +00:00
David Anderson b3fc16c5f3 liblp: Rename the metadata partition name to "super".
Bug: 79173901
Test: N/A
Change-Id: I99ccb095030c82cbc4bb89b40bff333decd35532
2018-07-12 14:08:42 -07:00