Commit Graph

36102 Commits

Author SHA1 Message Date
Mark Salyzyn 277eca138b adb: reboot: last boot command default
For reboot [reboot_arg] requests via either reboot or adb reboot,
if reboot_arg is empty then report "shell" or "adb" respectively.

Test: boot_reason_test.sh shell_reboot adb_reboot
Bug: 63736262
Change-Id: Ie613d9e62db6a705885e4e7520aede27af3aa1b9
2017-09-12 12:24:02 -07:00
Tianjie Xu e9b3a75e6f Merge "Add the Release function for TemporaryFiles" 2017-09-12 19:14:38 +00:00
Tom Cherry 698981df84 Merge "init: fix variable scope issue with ExpandArgs()"
am: 1973110355

Change-Id: I6a257ae81ee2b4a3c128f5d4f4724cf1534670c7
2017-09-12 16:37:34 +00:00
Tom Cherry 1973110355 Merge "init: fix variable scope issue with ExpandArgs()" 2017-09-12 16:31:13 +00:00
Mark Salyzyn b304f6d4e7 bootstat: introduce sys.boot.reason
Adding functionality to bootstat --record_boot_complete and
--record_boot_reason to initialize sys.boot.reason, the canonical
system boot reason.

Filter out ro.boot.bootreason oem noise into sys.boot.reason.  Add
heuristics to determine what the boot reason is, when otherwise would
be defaulting to the blunt and relatively devoid of detail catch-all
reboot reasons ("reboot", "shutdown", "cold", "warm", "hard").

boot_reason_test.sh is also a compliance test.

Test: boot_reason_test.sh all
Bug: 63736262
Change-Id: Ic9a42cccbcfc89a5c0e081ba66d577a97c8c8c76
2017-09-12 09:28:25 -07:00
dimitry 6429e20494 Recommend using pid instead of tid for gdbclient.py
Using pid allows to examine other threads after gdb
is attached to a crashing process.

Test: make
Change-Id: Ie4bab0925d7abde7f114791848fa5563db245c8e
2017-09-12 10:47:50 +02:00
Tom Cherry 5e405cacb1 init: fix variable scope issue with ExpandArgs()
ExpandArgs() was factored out of Service::Start() to clean up init,
however this introduced a bug: the scope of expanded_args ends when
ExpandArgs() returns, yet pointers to the c strings contained within
those std::strings are returned from the function.  These pointers are
invalid and have been seen to cause failures on real devices.

This change moves the execv() into ExpandArgs() and renames it
ExpandArgsAndExecv() to keep the clean separation of Service::Start()
but fix the variable scope issue.

Bug: 65303004
Test: boot fugu
Change-Id: I612128631f5b58d040bffcbc2220593ad16cd450
2017-09-11 16:08:54 -07:00
Tianjie Xu f9bc1b0571 Add the Release function for TemporaryFiles
Some tests may create a File* by calling fdopen() on the temp file's
fd. We should release the ownership of fd in this case to avoid the
double close.

Bug: 65430057
Test: libbase unit tests pass
Change-Id: I54fcce2029f9a574f53afdbdda737ee58620c73a
2017-09-11 14:08:32 -07:00
Steven Moreland 359358789a Merge changes from topic "fix-omx-dependencies"
am: 2dac833ea8  -s ours

Change-Id: I65d5872e936362b26984bd8944dcfe8523098deb
2017-09-11 21:03:42 +00:00
Steven Moreland 9fbdd4c63c Add vendor_available to liblog_headers.
am: 25db8dc21b  -s ours

Change-Id: I2f65fc3de29237cf039665dcfc4aebd5e2cccc90
2017-09-11 20:57:51 +00:00
Yifan Hong 25a9baa280 Add sys/cdefs.h to log/log_main.h.
am: e2c51809f7

Change-Id: I81851f9a039450ce53c7e60c7ce096de266898fc
2017-09-11 20:57:07 +00:00
Jin Qian 76fd6f6cf1 Merge "fs_mgr: replace make_ext4 api with e2fsprogs"
am: ff9c7c5e3e

Change-Id: I136e627d1a4a9cf72940e0dfbbcc7fa03206de96
2017-09-11 20:55:47 +00:00
Treehugger Robot 2dac833ea8 Merge changes from topic "fix-omx-dependencies"
* changes:
  Add vendor_available to liblog_headers.
  Add sys/cdefs.h to log/log_main.h.
2017-09-11 20:42:27 +00:00
Treehugger Robot ff9c7c5e3e Merge "fs_mgr: replace make_ext4 api with e2fsprogs" 2017-09-11 20:41:51 +00:00
Jin Qian 42d8137da8 fs_mgr: replace make_ext4 api with e2fsprogs
Execute mke2fs to create empty ext4 filesystem.
Execute e2fsdroid to initialize selinux context.

Test: zero-out first 4k of data partition and reboot,
      fs_mgr successfully formats /data.
Bug: 35219933
Change-Id: If6f72f62c618c64be703b83f0114a4dd0a2b079f
(cherry picked from commit f71bc0c152)
2017-09-11 18:34:32 +00:00
Christopher Ferris 5c9efd1800 Merge "Fix UnwindTest repeatability."
am: cfadedb139

Change-Id: I4ca22b4c132353cad19af362c1f59d743220433e
2017-09-08 03:24:00 +00:00
Christopher Ferris cfadedb139 Merge "Fix UnwindTest repeatability." 2017-09-08 03:15:24 +00:00
George Burgess IV 12f6c4809e Merge "libsync: Fix a double-free."
am: 16dd491aac

Change-Id: I3df91f1d203423dd5f0ca6335812630c25d8bc01
2017-09-07 21:48:36 +00:00
Treehugger Robot 16dd491aac Merge "libsync: Fix a double-free." 2017-09-07 21:39:53 +00:00
Luis Hector Chavez 721b2d6035 Merge "init: Allow clean system shutdown upon SIGTERM"
am: 61cb88add2

Change-Id: If0a495fa067440f0b59969ac0dbc010b4687b52f
2017-09-07 20:06:58 +00:00
Treehugger Robot 61cb88add2 Merge "init: Allow clean system shutdown upon SIGTERM" 2017-09-07 19:59:29 +00:00
Luis Hector Chavez 9f97f47940 init: Allow clean system shutdown upon SIGTERM
This allows Android to cleanly shutdown when running in a PID namespace
in a way that does not rely on adbd running. This is useful to allow
Android to be running in a container and its lifetime managed by an
OCI-compliant tool.

Bug: 65415372
Test: `kill -TERM 1` as root is correctly dropped.
Test: `kill -TERM 1` from the init PID namespace causes init to cleanly shutdown.
Change-Id: Ia66ebdb436221919081bc4723337c0c7f1e53b09
2017-09-07 10:47:04 -07:00
Christopher Ferris 4044c9ad9f Merge "Add a method to share the process memory object."
am: 18149b6764

Change-Id: I28ca654337aea1549f9d8e7f9f700b90ec01d2f7
2017-09-07 00:16:42 +00:00
Christopher Ferris edccd84763 Fix UnwindTest repeatability.
- Rewrite some of the UnwindTest tests to properly wait for the process
  to be ready.
- Add a TestScopedPidReaper to make sure that fork process get killed even
  if the test fails. Add this to all tests that fail.
- Create a quiesce function to be used by all of the tests that will
  wait after attaching to a process.

Bug: 65287279

Test: Ran unit tests on hikey960 board and on host repeatedly.
Change-Id: I57084120396f34d8dfb852f3d814bef2056f1b54
2017-09-06 17:08:44 -07:00
Josh Gao b63a60fe83 libbacktrace: make Backtrace::FormatFrameData static.
Backtrace::FormatFrameData doesn't depend on anything from its
instance. Make it static so that callers that don't have a Backtrace*
available can format frames.

Test: mma
Change-Id: Id0ca93bbef19da488305374e58b25c7ca9d0e518
2017-09-06 17:02:26 -07:00
Christopher Ferris 18149b6764 Merge "Add a method to share the process memory object." 2017-09-07 00:01:10 +00:00
Steven Moreland 25db8dc21b Add vendor_available to liblog_headers.
Renamed NDK headers to "liblog_ndk_headers"
(these names aren't used anywhere).

libutils_headers now properly export liblog_headers.

Test: with BOARD_VNDK_VERSION=current
Change-Id: I7b2d9e77e313e3f2ef362a19a03f4c23874d589a
Merged-In: I3a85385f588b84393c57fd6d1bcac620f708f0f1
2017-09-06 12:55:32 -07:00
Yifan Hong e2c51809f7 Add sys/cdefs.h to log/log_main.h.
for liblog.vendor. __ANDROID_API__ is __ANDROID_API_FUTURE__
with BOARD_VNDK_VERSION=current, so we need it defined.

Bug: 33241851
Test: BOARD_VNDK_VERSION=current m libgui.vendor
      (that uses liblog.vendor)

Change-Id: I340ec048094c027828f516d891250651e0c88eea
Merged-In: I340ec048094c027828f516d891250651e0c88eea
2017-09-06 12:54:41 -07:00
Tom Cherry c1968fb0c9 Merge "Log pid for writes to sys.powerctl"
am: 2827106d7d

Change-Id: I2fb780c5809d4c18950c114c07a7363723aa121a
2017-09-06 17:09:08 +00:00
Tom Cherry 2827106d7d Merge "Log pid for writes to sys.powerctl" 2017-09-06 16:58:23 +00:00
Jiyong Park bc3ae0aaea Merge "Mark libgrallocusage as vendor_available"
am: 9c8781f479  -s ours

Change-Id: I448037b8c228190df54d7e39b2ad05fc7511302e
2017-09-06 15:59:02 +00:00
Jiyong Park 18e92a5495 Merge "Don't rely on transitively included headers"
am: 45eeea2dcd

Change-Id: I1d822d54a1da50b99c1153335b03d68c331b8d4d
2017-09-06 15:56:53 +00:00
Treehugger Robot 9c8781f479 Merge "Mark libgrallocusage as vendor_available" 2017-09-06 15:52:22 +00:00
Treehugger Robot 45eeea2dcd Merge "Don't rely on transitively included headers" 2017-09-06 15:51:46 +00:00
Ting-Yuan Huang 2ee27bfd0d Merge "Suppress false-positive static analyzer warnings"
am: 0c89aaec1f

Change-Id: Ifa3e4010ee1ce152f17bdc14f4e73d647c05a76a
2017-09-06 05:09:15 +00:00
Treehugger Robot 0c89aaec1f Merge "Suppress false-positive static analyzer warnings" 2017-09-06 05:04:29 +00:00
Jiyong Park bab16584ce Don't rely on transitively included headers
One must explicitly include what it need.
time.h for clock_gettime

Bug: 37629934
Test: build
Change-Id: I992eac637f373b204aa161b0b26f5563e952c27e
2017-09-06 13:04:57 +09:00
Ting-Yuan Huang 249bd05038 Suppress false-positive static analyzer warnings
by hinting the analyzer with assertions.

Test: built without seeing warnings.
Change-Id: I0d43d4ceafd7f68be89cad6c930c85ee7b6d5165
2017-09-05 16:46:40 -07:00
George Burgess IV 4ff5ff29d2 libsync: Fix a double-free.
sync_file_info, the only caller of legacy_fence_info_to_sync_file_info,
unconditionally frees legacy_info after
legacy_fence_info_to_sync_file_info is called. So, if this calloc
fails, we'll end up freeing legacy_info twice.

Bug: 27101951
Test: mma. Static analyzer complaint about double-free is gone.
Change-Id: I43bf820af9aadf30cb8eabce57416f69a8fccf89
2017-09-05 16:26:36 -07:00
Jiyong Park e2bd601fd2 Mark libgrallocusage as vendor_available
libgrallocusage is used by libui which will be vendor_available: true.

Test: BOARD_VNDK_VERSION=current m libgrallocusage is successful
Change-Id: I476768d8b103033f3b8e5b09f53f4ac422ae377c
Merged-In: I476768d8b103033f3b8e5b09f53f4ac422ae377c
2017-09-05 14:49:53 -07:00
Christopher Ferris 5f118519fd Add a method to share the process memory object.
New function to create the process memory object. This allows for
a future where different remote process memory objects could be created
depending on the way remote memory can be created. Even different local
memory objects that access memory without doing any checks.

It also allows MemoryRange objects to share one single process memory object
and could help if the process memory object caches data.

Small changes to MapInfo::CreateMemory to when some errors are detected.
- Always check if the map is a device map, instead of only if the name
  is not empty.
- Check if a memory map is readable before creating the memory from process
  memory.

Bug: 23762183

Test: Ran unit tests, unwound on device using the new code.
Change-Id: I12a93c2dc19639689a528ec41c67bfac74d431b3
2017-09-05 14:30:22 -07:00
Tom Cherry a84e14da1e Log pid for writes to sys.powerctl
Unless a process logs that it is requesting a device to reboot, there
are no logs to show which process triggered a reboot.  This change
introduces such a log in property service such that system initiated
reboots can be clearly blamed back to a calling process.

Bug: 64214361
Test: reboot and check kernel log for reboot string
Change-Id: I18de33d2a0933d20bdb581025b78020c88c5c6eb
2017-09-05 12:47:08 -07:00
Justin Yun 221d3b4c75 Merge "Add vndk tag for libunwindstack which must be a vndk-sp"
am: 6139592321

Change-Id: Ibb4bec5fd4060ac6050beac1fd97cc9497df4ee6
2017-09-05 18:24:51 +00:00
Treehugger Robot 6139592321 Merge "Add vndk tag for libunwindstack which must be a vndk-sp" 2017-09-05 18:19:30 +00:00
kaichieh 1aecf73b43 Merge "Add odm sepolicy support to selinux.cpp"
am: f899548cdb

Change-Id: I33f7ded656fa2e61e130f158a2d8915f68524b91
2017-09-04 04:55:58 +00:00
Treehugger Robot f899548cdb Merge "Add odm sepolicy support to selinux.cpp" 2017-09-04 04:45:33 +00:00
Wei Wang df9ac65c75 Merge "init: add option to read file fully on readahead"
am: d97a1710b8

Change-Id: I2a49bd384b1fe621314916c1f325c03b7fa43162
2017-09-02 03:01:14 +00:00
Treehugger Robot d97a1710b8 Merge "init: add option to read file fully on readahead" 2017-09-02 02:53:53 +00:00
Wei Wang 02628f3b23 init: add option to read file fully on readahead
Bug: 62413151
Test: boottime, dumpcache
Change-Id: I1a7b69f0619428e4db31c5a7639c5d895c89ecdb
2017-09-01 15:15:51 -07:00
Josh Gao 8577f499b6 Merge "libdebuggerd: cleanup."
am: 2b8a95a2a7

Change-Id: Icf6a347c23771894af164265538d3f90e3ecd940
2017-09-01 19:56:17 +00:00