Commit graph

14736 commits

Author SHA1 Message Date
Daniel Rosenberg
9ef4d91267 Changed set_active to be a flag
set_active must be able to accept flag like arguments

Change-Id: I6dd162453835d2d64fd8d877f2a7b98e8dd8a907
2015-11-16 08:53:51 -08:00
Daniel Rosenberg
0ef4e444a7 Fix fastboot variable name
Change-Id: I0c2753e2b79d715f227ee314c071ce68d91779b3
2015-11-16 08:53:51 -08:00
Badhri Jagan Sridharan
c911044ff8 healthd: Read the max power supply voltage
With Type-C PD, VBUS can no longer be assumed to
to be at 5V. Read the "voltage_max" field from the
power_supply class node and export it through
BatteryProperties service.

Bug: 25229483
Change-Id: I04e32d9783a21bab375f1724758a9eeace2a047c
(cherry picked from commit 42d9133a23)
2015-11-16 08:53:51 -08:00
Rom Lemarchand
d2bbe45713 init: skip "name" DT entry
DTs have a standard "name" entry which is not to be
turned into an android property, so skip it.

Change-Id: I79f6638b4123358c8d80510c1666cf5d4561160e
(cherry picked from commit 1dcf325844)
2015-11-16 08:53:51 -08:00
Daniel Rosenberg
b4354b3615 Fastboot changes to support A/B partitioning
Introduce support for -slot option for specifying slots,
and set_active, for changing the current slot.

Change-Id: Ib3b2a75491c0d0413534dd0c1d7bcb52555bba66
(cherry picked from commit b7bd4ae529)
2015-11-16 08:53:51 -08:00
Elliott Hughes
98699eca48 Sync with master fastboot.
This brings us all the fastboot changes, plus a change we need from libbase,
and then reverts part of a libziparchive cleanup and fixes dependencies on
new changes to the build system.

Bug: http://b/25375777
Change-Id: I813464da95dc6c81b0a1dc7145152f89bb2d14cd
2015-11-16 08:53:51 -08:00
Mark Salyzyn
c48d249c37 liblog: logd: support logd.timestamp = monotonic
(cherry pick from commit b6bee33182)

if ro.logd.timestamp or persist.logd.timestamp are set to the value
monotonic then liblog writer, liblog printing and logd all switch to
recording/printing monotonic time rather than realtime. If reinit
detects a change for presist.logd.timestamp, correct the older entry
timestamps in place.

ToDo: A corner case condition where new log entries in monotonic time
      occur before logd reinit detects persist.logd.timestamp, there
      will be a few out-of-order entries, but with accurate
      timestamps. This problem does not happen for ro.logd.timestamp
      as it is set before logd starts.

NB: This offers a nano second time accuracy on all log entries
    that may be more suitable for merging with other system
    activities, such as systrace, that also use monotonic time. This
    feature is for debugging.

Bug: 23668800
Change-Id: Iee6dab7140061b1a6627254921411f61b01aa5c2
2015-11-16 08:53:51 -08:00
Mark Salyzyn
21c7686996 logd: Add support for *.logd.filter
(cherry pick from commit 932f7acc81)

- Add device (ro.logd.filter), persistent (persist.logd.filter)
  properties to control the default filters
- Allow logcat -P default to produce expected results
- Allow logcat -P disable to produce expected results

Change-Id: I651cb705373ec1e88a99e4b9086da4f9668a468a
2015-11-16 08:53:04 -08:00
Mark Salyzyn
e9252451bd logd: statistics report chatty effective percentage
(cherry pick from commit c723df805a)

Report the ESTIMATED instantaneous percentage decrease or increase
that an UID has to the logs as a result of the chatty filtration.

Bug: 22855208
Change-Id: If1e77afb81a2739a72b39bc7c57071763c1d64d8
2015-11-16 08:53:04 -08:00
Mark Salyzyn
aa5abfd84e liblog: add android_log_timestamp() private function
(cherry pick from commit 500afc7532)

Change-Id: Iefbea3b1be2f97cfdeb35e5330e5495e0337215b
2015-11-16 08:53:04 -08:00
Mark Salyzyn
9cb92047e5 liblog: logcat: add epoch and monotonic format modifiers
(cherry pick from commit 4cbed02e44)

- '-v epoch' prints seconds since Jan 1 1970
- '-v monotonic' print cpu seconds since start of device
- '-T sssss.mmm...' as alternate tail time format

NB: monotonic is a best estimate and may be out by a few ms
    given the synchronization source clue accuracy.

Bug: 23668800
Change-Id: Ieb924b6d3817669c7e53beb9c970fb626eaad460
2015-11-16 08:53:04 -08:00
Mark Salyzyn
13f42ec2f1 logd: correct for number of elements in prune
(cherry pick from commit 58b8be8906)

Chatty logs would distort the average log size by elevating the
elements, but not the size. Add statistical collection for the
number of elements that report chatty, and subtract that from
the number of elements to improve the pruning estimate. Pick
minElements as 1% rather than 10% of the total with this more
accurate number of elements, to a minumum of 4.

Bug: 24511000
Change-Id: I3f36558138aa0b2a50e4fac6440c3a8505d95276
2015-11-16 08:53:04 -08:00
Mark Salyzyn
6326bb8fd2 logd: use coalesce instead of merge (cleanup)
(cherry pick from commit aaad42f47c)

- switch to coalesce instead of merge in naming of functions
  and variables. Confusing since we also to merge-sorts and
  other activities in the logger.
- define maxPrune rather than using a number in the code path.

Bug: 24511000
2015-11-16 08:53:04 -08:00
Mark Salyzyn
9bc35ef4c9 logd: clearAll by UID speedup
(cherry pick from commit 2b25c66070)

- If doing a clear, skip accounting
- Ensure for busy checking, behind a region lock for instance, only
  break out if there was something to do. Basically move the filter
  actions first, and defer checking the region lock to the ends of
  the loops.

Bug: 23711431
Change-Id: Icc984f406880633516fb17dda84188a30d092e01
2015-11-16 08:53:04 -08:00
Mark Salyzyn
5679d8d572 logd: clear return and deal with busy if readers locked
(cherry pick from commit c5dc970edc)

- Propagate to caller the clearing errors, busy blocked by reader.
- For clear, perform retries within logd with a one second lul each,
  telling readers to skip, but on final retry to kill all readers if
  problem still persists due to block reader (or high volume logspammer).

Bug: 23711431
Change-Id: Ie4c46bc9480a7f49b96a81fae25a95c603270c33
2015-11-16 08:53:04 -08:00
Mark Salyzyn
70cbe025f4 logd: update region lock after entry has passed to reader socket
(cherry pick from commit de4bb9c1a7)

- The reader region level indicates the location to protect, but once
  it has been passed to the calling reader, then allow us to go
  one beyond so that a clear or prune thread can remove the entry.

Bug: 23711431
Change-Id: I0f2389858dd8c83366c034360f67d7c363625b56
2015-11-16 08:53:04 -08:00
Mark Salyzyn
b04352e597 logd: clientHasLogCredentials false negatives
(cherry pick from commit 86eb38f3ca)

Vote three times in /proc/pid/status to look for AID_LOG group

If not, we may default to the callers UID, and the net result is
to perform the task related to that UID. For adb logcat and
shell logcat, the UID is AID_SHELL which typically has no logs,
leaving no net action taken.

Bug: 23711431
Change-Id: I2b5900a2d37173bd995eb308ee9ecafa20602b62
2015-11-16 08:53:04 -08:00
Mark Salyzyn
96c45c648d logd: object layer format statistics
(cherry pick from commit 758058ffd8)

Simplify table generation by placing the line and header formatting
into each type's (UID, PID, TID) object. Switch to const return
values for the ownership passing functions (*ToName() functions
and methods). Use longer variable names to reduce confusion.

Switch from LINES To NUM for pruned column as that more accurately
reflects what is dropped since one entry can contain several lines.

Bug: 22855208
Change-Id: Ib110dce98a68cf5f844eb30f8a192a1f691eeba2
2015-11-16 08:53:04 -08:00
Mark Salyzyn
f9162cf711 logd: optimize code hotspots
(cherry pick from commit ddda212faa)

Discovered that we had a few libc hotspots. Adjust code to generally
reduce or nullify the number of calls to malloc, free, strlen,
strcmp, strncmp, memcmp & strncasecmp. Total gain looks to be about
3% of logd's processing time. malloc still contributes to 3%, but all
others are now total 0.5%.

Bug: 23685592
Change-Id: Ife721121667969260cdb8b055524ae90f5911278
2015-11-16 08:53:04 -08:00
Mark Salyzyn
e9451e7ef8 logd: Add LogUtils.h
(cherry pick from commit 5ac5c6b193)

Move prototypes from LogBufferElement.h to LogUtils.h

Change-Id: I55e42e17e6c997e35b2b78b87fd2f84f8f393282
2015-11-16 08:53:04 -08:00
Mark Salyzyn
4efc87e5eb logd: klogd deal with nuls in dmesg
(cherry pick from commit 151beac76d)

Switch to using string and length in all transactions, treating
trailing nuls the same as spaces.

ToDo: change dumpstate (bugreport) to use logcat -b printable _regardless_

Bug: 23517551
Change-Id: I42162365e6bf8ed79d356e7b689a673902116fdb
2015-11-16 08:53:04 -08:00
Mark Salyzyn
f9e4d0b6b5 logd: log_strtok_r deal with nuls
(cherry pick from commit ea1a241107)

Rename to log_strntok_r and change from dealing with strings
to dealing with a string and an associated length.

Bug: 23517551
Change-Id: Ia72f1305a53f55eeef9861ac378fb8205fd2378e
2015-11-16 08:53:04 -08:00
Mark Salyzyn
26499e41ae liblog: logprint: printable nul
(cherry pick from commit faa92e9915)

Change-Id: I57d1f86ce040ad196c558bb72ac0464af793c214
2015-11-16 08:53:04 -08:00
Mark Salyzyn
3f78f93302 logd: klogd: sniff for time correction on Mediatek
(cherry pick from commit 2d159bf3b5)

Need some more flexibility when parsing kernel messages
cluttered with extra fluff. This is the minimal relaxation
we can do to the rules to ensure that we work on all
possible devices and kernels when sniffing for time
correction information.

We want to minimize any future maintenance, keep in mind
klogd is a "userdebug" or "eng" feature and is disabled
in "user" builds. Manage expectations.

Bug: 23517551
Change-Id: I026d074e14fb2550e728683e85a973bd87e78a9c
2015-11-16 08:53:04 -08:00
Mark Salyzyn
540cfe8e6b logd: klogd and Mediatek part deux
(cherry pick from commit 47dba71f24)

- switch to an open coded strnrchr
- validity checking on n, taglen and b values.

Bug: 23517551
Change-Id: I568e25c5aa6d8474835454a0e83b19c2921b7986
2015-11-16 08:53:04 -08:00
Mark Salyzyn
39888aef13 liblog: logcat: Add year and zone to date on each line
(cherry pick from commit f28f6a9ba2)

- '-v year' modifier adds the four digit year prefix
- '-v <timezone>' modifier sets and prints the timezone suffix
- Only promise in logcat to support UTC as a timezone since
  all others are based on the configured environment
- '-v zone' modifier toggles the timezone suffix on or off
- '-T YYYY-MM-DD HH:MM:SS.mmm...' format is added

Bug: 23668700
Change-Id: I7521c1efb7455dc9a25434fce72a69a65dcf72ea
2015-11-16 08:53:04 -08:00
Mark Salyzyn
5c3835d943 logd: switch asprintf to std::string
(cherry pick from commit 73160acc5c)

Bug: 23350706
Change-Id: I715cdd4563a09de3680081947a3439f0cac623be
2015-11-16 08:53:04 -08:00
Mark Salyzyn
8a7f778c01 logd: white and black switch to std::string
(cherry pick commit from b332f1c427)

Bug: 23350706
Change-Id: I92f21aee0a9702f63e8465851d0f35007b0469a7
2015-11-16 08:53:04 -08:00
Mark Salyzyn
2a2b0d1c6e logd: statistics switch to std::string
(cherry pick from commit decbcd9c41)

Bug: 23350706
Change-Id: I5564898c4f67b8fcc43cee64604855f789409482
2015-11-16 08:53:04 -08:00
Andreas Gampe
244f32fa2d Logd: Handle unused variable and fields
(cherry pick from commit d75564f9b8)

For build-system CFLAGS clean-up.

Bug: 18632512
Change-Id: If81d6705b44e9a29f64c44c56ea633c031e831b7
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
ff1160b28f rootdir: Allow board specific folders and symlinks in root directory
Building without ramdisk requires a way to specify board specific
directoryies and symlinks in the root directory at build time.

Change-Id: I11301e98228bc4761f3aee177a546146651b9f25
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
a852aacb56 Fix "adb remount" for when the root directory is in system.img
When the root directory has been built into system.img, it is
mounted at /.

Change-Id: If01d12efeaa53b4ae59e801a6e9b802a9ae5882d
2015-11-16 08:53:04 -08:00
Tao Bao
096c4f2d8a Set mode bits for /system/etc/recovery.img.
/system/etc/recovery.img defaults to 0644. Change it to 0440.

Bug: 22641135
Change-Id: I45cdb0cc1b58f35fbcd0f16e7cc6c4eef63b0b74
(cherry picked from commit b602e6f9a3)
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
fd2f0b4dc4 fs_mgr: Add support for A/B partitions
Allow partitions to be marked as A/B partitions
using the slotselect flag in fstab. The partitions
can be identified by appending the correct suffix
to the block device listed in the fstab. The suffix
is provided by the bootloader through a command line
parameter or the device tree, and can be found in
ro.boot.slot_suffix or read from the boot_control HAL.

Change-Id: I6846d80e857f95bfb8f282f4ab81167394613bbe
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
6a5a81a3d6 rootdir: Create symlinks in Android.mk
system.img may contain the root directory as well. In that case, we
need to create some symlinks init.rc would during the build.

Change-Id: I4e7726f38c0f9cd9846c761fad1446738edb52c0
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
c906751994 Skip mounting /, just mark block device as ro if needed.
Change-Id: I7fbb636d296abc1caab6c7bf88017684c9df7759
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
c97e1cb39d Remove creation of root directory folders
Folders in the root directory are now created during the build,
as we may be building without a ramdisk, and when we do that,
the root directory will be read-only.  With those changes,
these mkdirs will never need to run.

Change-Id: I49c63e8bfc71d28e3f938ed41f81d108359fa57a
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
4c9c516d20 rootdir: Create cache folder in Android.mk
system.img may contain the root directory as well. In that case, we
need to create some folders init.rc would during the build.

Change-Id: I312104ff926fb08d98ac8256b76d01b0a90ea5e5
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
9262546184 rootdir: Create folders in Android.mk
system.img may contain the root directory as well. In that case, we
need to create some folders init.rc would during the build.

Change-Id: I157ccbebf36bee9916f3f584551704ec481ae1d1
2015-11-16 08:53:04 -08:00
Daniel Rosenberg
a39317ca94 libcutils: fs_config: Add folders normally created in init.rc
When the ramdisk is built into the system image, we need to create
those folders during the build.

Change-Id: I40881940c75e379d7599dc1f743b35fbc7cc66e8
2015-11-16 08:53:04 -08:00
Todd Kjos
ed60788968 Actively mangage EAS schedtune nodes
Move foreground tasks to /sys/fs/cgroup/stune/boost/tasks (boosted
weight in EAS scheduler). Move background tasks to
/sys/fs/cgroup/stune/tasks (default weight). For services started
with init, set "foreground" services to boosted.

Change-Id: I0e489fad9510727c13e6754dabaf311c2391f395
2015-11-16 08:53:04 -08:00
Mark Salyzyn
1589fa1bda logcat: continue where we left off
am: 5b0d59dde8

* commit '5b0d59dde85162fa9ef3a32464c0f1b81d7e05cb':
  logcat: continue where we left off
2015-11-12 23:44:18 +00:00
Mark Salyzyn
5b0d59dde8 logcat: continue where we left off
Issue introduced as part of new logcatd functionality in
commit f3555d9427

Faulty logic, add a gTest to confirm.

Bug: 19608716
Change-Id: Ic1b97def25e03e69faae4398a3dff2ff0f88545e
2015-11-12 11:51:41 -08:00
Jon Larimer
7b5fa175fa Merge "Add macro to call event logger for errors. DO NOT MERGE" into klp-dev am: 809d5a0158 am: fd56dc41c7 -s ours am: 362f13d74a am: 702fe6d486 -s ours am: ea1e6a59e7 am: 088639a20f -s ours am: 55263d2ae3
am: 99cd21ef5c

* commit '99cd21ef5c3548613d8a614551b858a5c47985fc':
  Add macro to call event logger for errors. DO NOT MERGE
2015-11-11 20:52:49 +00:00
Jon Larimer
ae1f2bfe92 Merge "Add macro to call event logger for errors. DO NOT MERGE" into lmp-dev am: 5280061b56 am: 442a830e9b -s ours am: 93a3871abb am: 089ad5e98a -s ours am: 2f1562eb10
am: 9f1b1caa78

* commit '9f1b1caa787fdb9f66f32eda38d46f1b4e75b209':
  Add macro to call event logger for errors. DO NOT MERGE
2015-11-11 20:52:44 +00:00
Jon Larimer
ec73aeaaab Merge "Add macro to call event logger for errors. DO NOT MERGE" into lmp-mr1-dev am: f84eef3fca -s ours am: d0ed7943b8 -s ours am: a1da204980
am: 7755770ac9

* commit '7755770ac930c8a7bf14a140e92330cee382fd16':
  Add macro to call event logger for errors. DO NOT MERGE
2015-11-11 20:52:38 +00:00
Jon Larimer
99cd21ef5c Merge "Add macro to call event logger for errors. DO NOT MERGE" into klp-dev am: 809d5a0158 am: fd56dc41c7 -s ours am: 362f13d74a am: 702fe6d486 -s ours am: ea1e6a59e7 am: 088639a20f -s ours
am: 55263d2ae3

* commit '55263d2ae3696baaa574ee896e3a8b0546aa5628':
  Add macro to call event logger for errors. DO NOT MERGE
2015-11-11 20:45:04 +00:00
Jon Larimer
9f1b1caa78 Merge "Add macro to call event logger for errors. DO NOT MERGE" into lmp-dev am: 5280061b56 am: 442a830e9b -s ours am: 93a3871abb am: 089ad5e98a -s ours
am: 2f1562eb10

* commit '2f1562eb10279531524f54ca7c129ead66ab3673':
  Add macro to call event logger for errors. DO NOT MERGE
2015-11-11 20:44:57 +00:00
Jon Larimer
7755770ac9 Merge "Add macro to call event logger for errors. DO NOT MERGE" into lmp-mr1-dev am: f84eef3fca -s ours am: d0ed7943b8 -s ours
am: a1da204980

* commit 'a1da204980891f9e59a41d7a41d510f3f05d34bf':
  Add macro to call event logger for errors. DO NOT MERGE
2015-11-11 20:44:50 +00:00
Jon Larimer
55263d2ae3 Merge "Add macro to call event logger for errors. DO NOT MERGE" into klp-dev am: 809d5a0158 am: fd56dc41c7 -s ours am: 362f13d74a am: 702fe6d486 -s ours am: ea1e6a59e7
am: 088639a20f  -s ours

* commit '088639a20fc388e8d4dcf1ed471b31086c43bc83':
  Add macro to call event logger for errors. DO NOT MERGE
2015-11-11 20:41:08 +00:00