Commit graph

2366 commits

Author SHA1 Message Date
Elliott Hughes
e801a68239 Revert "Revert "android_ids: move to bionic""
This reverts commit 7b7a8074e1.

Change-Id: Icdc7221af6745084e5a4a28d851d3ad14e2a4ece
2016-12-13 23:47:16 +00:00
Jeff Sharkey
dff44709cf Define range of GIDs for cached app data.
To support upcoming disk usage calculation optimizations, this change
creates a new GID for each app that will be used to mark its cached
data.  We're allocating these unique GIDs so that we can use
quotactl() to track cached data on a per-app basis.

This change also tightens up the implementation of both the cache
and shared GID calculation to ensure that they stay inside the valid
ranges, and includes tests to verify.

Test: builds, boots, tests pass
Bug: 27948817
Change-Id: Ie4377e5aae267f2da39a165888139228995987cb
2016-12-13 13:28:08 -07:00
Treehugger Robot
b0a15d8319 Merge "Revert "android_ids: move to bionic"" 2016-12-13 00:31:26 +00:00
Elliott Hughes
7b7a8074e1 Revert "android_ids: move to bionic"
This reverts commit bc56847e84.

Change-Id: I2d00db0aaa7dfe292e36c6bdbaaa76230849e732
2016-12-12 22:11:29 +00:00
Josh Gao
e2d9732682 cutils: add adb trace tag.
Bug: http://b/31289465
Test: systrace
Change-Id: I8537731febc6629f055b86f6e19b16104208c4f8
2016-12-12 12:28:45 -08:00
Josh Gao
01937ee2b9 libutils: allow multiple ATRACE_NAMEs in a scope.
Bug: http://b/31289465
Test: m
Change-Id: Iabd97439fa55ea285ce0501dbb4fd9d07149ae61
2016-12-12 12:28:04 -08:00
Elliott Hughes
b0aa8b2369 Merge changes from topic 'fsconfig-2'
* changes:
  fs_config: add comment to header
  android_ids: move to bionic
2016-12-10 00:13:05 +00:00
Mark Salyzyn
0eeb06b932 utils: Add FastStrcmp.h
Move existing fast<str*cmp> templates for general use, pulled from
the implementation used in logd that dealt with speed through cache
locality and subroutine call mitigation.  Rename to fastcmp.

Test: logd-benchmarks and based on manual profiling from the past
Bug: 31456426
Change-Id: Ic62f4a437fc3e06ffdeaae73a6f34e197957a6b0
2016-12-09 12:40:17 -08:00
William Roberts
bc56847e84 android_ids: move to bionic
Prevent others from using android_ids and force them
to use grp.h and pwd.h family of functions.

Test: Build and boot, verify services are running properly.
Bug: 27999086

Change-Id: Idcd75cf7e91a49ef07a0ed3bdb514ad61aa82e69
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-12-08 16:57:17 -08:00
William Roberts
acdf527c52 fs_config: add comment to header
Add a comment to android_filesystem_config.h
about AID and OEM Range "scraping" done by
build/tools/fs_config.

Test: Build and boot.

Change-Id: I2d4845d91546ae967a1ee5166b73d119938faccc
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-12-08 16:57:17 -08:00
Jeff Sharkey
33d1ec216b Merge "Define GIDs for internal media file types."
am: 4b44753085

Change-Id: I95df8c122f0600e3af6306d800724d1ac9f26040
2016-12-03 04:23:24 +00:00
Jeff Sharkey
4de27c6a6d Define GIDs for internal media file types.
Currently, all internal media storage files (under /data/media) are
given the same "media_rw" GID.  To support an upcoming optimization
to disk usage calculation, this CL defines three new GIDs that can be
used to quickly identify common types: audio, video, and images.

Test: builds
Bug: 27948817
Change-Id: I8548459c3d3ccbf7d822431c6e2ebd1c2e309d70
2016-12-02 14:17:48 -07:00
Mark Salyzyn
a95e19abd2 Merge "liblog: add private android_log_write_list_buffer()"
am: 636c851f8d

Change-Id: If0c24576c69b9d2aad6637c7548d61f79173e932
2016-11-22 15:56:49 +00:00
Mark Salyzyn
d96b925d9c Merge "liblog: move android_log_event_context class to log/log_event_list.h"
am: 418558f8af

Change-Id: I4f537d4010e60b86ad4f565135804cf92fa7bd37
2016-11-22 15:56:32 +00:00
Mark Salyzyn
2ca4f49476 liblog: add private android_log_write_list_buffer()
Allows us to compose an event message for our own in-memory purposes.
Will be used to compose an event message in logd and directly write
it to just the pmsg buffer.  Provide an internal enhanced C++ wrapper
for event handling.

Test: gTest liblog-unit-tests --gtest_filter=liblog.android_log_write_list_buffer
Bug: 31456426
Change-Id: I98246898ba580f9e506baba8af2fd1b26a2a8aae
2016-11-21 09:46:39 -08:00
Mark Salyzyn
472245d962 liblog: move android_log_event_context class to log/log_event_list.h
rename class from android_log_event_context to android_log_event_list

Test: gTest logcat-unit-tests
Bug: 31992412
Bug: 31456426
Change-Id: Ib61cbca7d453837d64959c56b0e11f8c5edbfbdd
2016-11-21 09:46:34 -08:00
Mark Salyzyn
809dee506e Merge "libcutils: move cutils/files.h to cutils/android_get_control_file.h"
am: 8c41e791ed

Change-Id: Ifbc00285da734859d590153a7c6cfc8e51c014f9
2016-11-17 15:33:02 +00:00
Mark Salyzyn
52bd37e633 libcutils: move cutils/files.h to cutils/android_get_control_file.h
files.[h|cpp] is bound to be abused with junk, replace with
android_get_control_file.[h|cpp]. Plus some sundry cleanup.

Test: gTest libcutils-tests, logd-unit-tests, liblog-unit-tests,
      logcat-unit-tests and init_tests
Bug: 32450474
Change-Id: Ibd4a7aa4624ea19a43d1f98a3c71ac37805d36b5
2016-11-16 15:56:56 -08:00
Tao Bao
af2a8858c4 Merge "ziparchive: Allow ExtractEntryToFile() to work with block device."
am: 787482ecd9

Change-Id: Icdce4207cb64e084e200b6f7f8ae194831d5c4f0
2016-11-15 22:11:21 +00:00
Tao Bao
a456c21348 ziparchive: Allow ExtractEntryToFile() to work with block device.
FileWriter::Create() calls ftruncate(2) to truncate the destination
file, which doesn't work with FD that references a block device. It
leads to kIoError when calling ExtractEntryToFile() to extract an entry
to block device FD.

As a result, it fails the package_extract_file() command in OTA updates
(e.g. 'package_extract_file("boot.img",
"/dev/block/platform/soc.0/f9824900.sdhci/by-name/boot")').

This CL skips the call to ftruncate(2) if FD references a block device.

Bug: 32903624
Test: ziparchive-tests works.
Test: Build an OTA updater (m updater) and call package_extract_file().

Change-Id: Ia81116f1a8d7cab802396bdc32c6096b4cb56a3c
2016-11-15 10:19:04 -08:00
Mark Salyzyn
cacd9dc244 liblog: logcat: logprint support -v descriptive
am: 4fd0507b20

Change-Id: Idd4379d83b1d2f708451e1f2dd21cd40bfa49811
2016-11-07 22:46:45 +00:00
Mark Salyzyn
494a394545 liblog: add android_lookupEventFormat_len
am: 530711b39e

Change-Id: I62a33b249df6afdc4405a89b3f60a51a2897f98e
2016-11-07 22:46:39 +00:00
Mark Salyzyn
e133feb6b4 Merge changes I93a1c003,I283fec89
* changes:
  liblog: logcat: logprint support -v descriptive
  liblog: add android_lookupEventFormat_len
2016-11-07 22:42:08 +00:00
Dimitry Ivanov
9b1d1cb923 Merge "Allow different namespace types for different classloaders"
am: a61c48d5fd

Change-Id: Idcf998f47e8a09fbe1e56a898f23b2c82a75aa44
2016-11-07 18:08:06 +00:00
Mark Salyzyn
4fd0507b20 liblog: logcat: logprint support -v descriptive
Expand logprint feature to pull out the log tag description
fields, parse them and merge into the logging content.  Add
-v descriptive, -v colour(british, hidden) and -v help. Also
added a unit test for the descriptive format borrowing from
event tags that have been unchanged since 2009.

Had to add -v help because we have too many undocumented
formats and format adverbs.

Test: gTest logcat-unit-tests --gtest_filter=logcat.descriptive
Bug: 31456426
Change-Id: I93a1c003b7a3f4c332544946fdedb7277919cec3
2016-11-04 15:22:52 -07:00
Mark Salyzyn
530711b39e liblog: add android_lookupEventFormat_len
Test: compile
Bug: 31456426
Change-Id: I283fec89431c18af788fa0477a2ab78792221878
2016-11-04 15:22:52 -07:00
Dimitry Ivanov
d836ab005a Allow different namespace types for different classloaders
An app should be able to make cross-arch calls to different apps
via other app's Context.getClassLoader()

Bug: 32542970
Test: Boot fugu. Check that there are no linker-namespace
      related errors in the log.

Change-Id: I1593f4688bcde0121a5e24a707441a4935fa7dc4
2016-11-04 15:21:13 -07:00
Mark Salyzyn
c020d3fa6e libcutils: add android_get_control_file()
am: 0b034d9d7b

Change-Id: I7d0a58c12839dba59aa43b96e5a920d3c415efcf
2016-11-04 14:42:57 +00:00
Mark Salyzyn
0b034d9d7b libcutils: add android_get_control_file()
Solve one more issue where privilege is required to open a file and
we do not want to grant such to the service. This is the client side
of the picture, init is the server. The file's descriptor was placed
into the environment as "ANDROID_FILE_<path>" where non-alpha and
non-numeric characters in the <path> are replaced with _ and this
function picks the file descriptor up.

Added definition ANDROID_FILE_ENV_PREFIX ("ANDROID_FILE_") and
android_get_control_file() prototype in a new include <cutils/files.h>

android_get_control_file() checks if the resulting file descriptor is
valid, open and matches the name reference, which on purpose will fail
if a symbolic link is in the path rather than using a fully qualified
path.  Add gTest unit test for both.

Test: gTest libcutils_test --gtest_filter=FileTest.android_get_control_file
Bug: 32450474
Change-Id: I2d0310a1727f1e393a00d9fc7e6cf5d028f27905
2016-11-03 13:34:20 -07:00
Keun-young Park
3142267ff2 Merge "Add UID for vehicle network"
am: 9112b419bd

Change-Id: Ie6111026580d97d8552fd3de1fe10e88820205c6
2016-10-28 21:09:36 +00:00
Keun-young Park
42e802c2fb Add UID for vehicle network
- Access to vehicle network is done in vehicle network service process.

Test: build
bug: 32508433
Change-Id: I340d1f4964d70b53f10d84fb15a62107e1dedc0e
2016-10-28 12:08:07 -07:00
Dimitry Ivanov
996cfc70a0 Merge "Upgrade native bridge to version 3 to support namespace"
am: 28c0c0762e

Change-Id: Ic4263e89f59b1ad34f1f8f28b52f4b45a4df351d
2016-10-26 20:11:25 +00:00
Dimitry Ivanov
28c0c0762e Merge "Upgrade native bridge to version 3 to support namespace" 2016-10-26 18:27:38 +00:00
Mark Salyzyn
171a6a4277 Merge "log/logd.h should point to log/log.h"
am: d97efe0383

Change-Id: I5fbbe7f957f303fb61d60177474f615c9f3e7c25
2016-10-25 19:24:54 +00:00
Zhenhua WANG
f2804e5985 Upgrade native bridge to version 3 to support namespace
Native bridge implements namespace related interfaces in version 3.
The namespace semantic here is same as Android dynamic linker's.
Native loader wraps library loading functions of dynamic linker and
native bridge. Thus, Android runtime is able to load native library
of different ISA on one device by calling native loader directly.

Bug: http://b/28242460
Test: mm && make test-art-host -j48
Change-Id: Idde2b9d99fb6ebe547407c716b5478a231f745a7
Signed-off-by: Zhenhua WANG <zhenhua.wang@intel.com>
2016-10-25 11:11:38 -07:00
Mark Salyzyn
57ba9c96e3 log/logd.h should point to log/log.h
Test: compile
Bug: 32395896
Bug: 30465923
Change-Id: I1ee85594a0dc6b094480161dc5dbec71eaecdfb9
2016-10-25 09:21:00 -07:00
Mark Salyzyn
28fcac705b liblog: logd: logcat: Split out log/logger.h into public and private.
am: aeaaf81c2c

Change-Id: I124c69673c30bb5f2259849792ed4ca99f4d6b60
2016-10-24 22:53:11 +00:00
Mark Salyzyn
9fd2ffc145 Merge "liblog: restructure log/log.h and android/log.h"
am: 11a7165ecf

Change-Id: I6ebdebdd82e8a59a711ee0fe41056abdacb084b3
2016-10-24 20:46:08 +00:00
Mark Salyzyn
aeaaf81c2c liblog: logd: logcat: Split out log/logger.h into public and private.
log/logger.h pieces moved into log/log.h.  Correct for some
minor Android Coding standards.

Test: gTests liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I0a19fd8788eec20a582e72e4c62c04534bdb1b9a
2016-10-24 11:12:49 -07:00
Mark Salyzyn
749a298dfd liblog: restructure log/log.h and android/log.h
We went too far, so this is a partial revert, part deux.

Keep general purpose logging macros in android/log.h for the NDK.
More internal features like Radio, System and Events logging are
moved back to log/log.h.  Correct liblog ndk symbols.  Correct for
some Android Coding standards.

Test: compile
Bug: 31992412
Change-Id: Id3731496fa226e8c170305d0d2a1859e8cf67e14
2016-10-24 11:03:49 -07:00
Mark Salyzyn
8a7297a09f Merge "system/core: preparation to pull back interfaces from android/log.h"
am: 27d2d49f48

Change-Id: I604bb1d4cf62636663fa92e3d14a55887dbcae23
2016-10-20 18:03:57 +00:00
Mark Salyzyn
cfd5b080af system/core: preparation to pull back interfaces from android/log.h
Point to log/log.h where necessary, define LOG_TAG where necessary.
Accept that private/android_logger.h is suitable replacement for
log/logger.h and android/log.h.

Correct liblog/README

Effectively a cleanup and controlled select revert of
'system/core: drop or replace log/logger.h' and
'system/core: Replace log/log.h with android/log.h'.

Test: compile
Bug: 30465923
Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
2016-10-20 08:11:39 -07:00
Mark Salyzyn
8806766621 Merge "liblog: Add private interfaces for buffer size properties"
am: 094004bf42

Change-Id: I81c6ff947b0f0939b41ea59dae153c5584ac9049
2016-10-18 23:29:28 +00:00
Mark Salyzyn
094004bf42 Merge "liblog: Add private interfaces for buffer size properties" 2016-10-18 23:22:18 +00:00
Tianjie Xu
b2ca85184b Merge "Add functions in recovery/minzip to libziparchive"
am: 4bc51d1ea4

Change-Id: Ica94e8050286bed1c5bc23a33305050ab8da8ec5
2016-10-18 21:57:30 +00:00
Tianjie Xu
4bc51d1ea4 Merge "Add functions in recovery/minzip to libziparchive" 2016-10-18 17:30:02 +00:00
Mark Salyzyn
e455373b57 liblog: Add private interfaces for buffer size properties
Add private function __android_logger_get_buffer_size() to read
properties and compose the default buffer size.  This interface
complements the existing android_looger_get_size() which returns
the logd setting which can differ at runtime.  For use in logd
and dumpstate.  Side effect is we also add the private functions
__android_logger_property_get_bool() and
__android_logger_valid_buffer_size() for reuse in logd.

Test: gTest liblog-unit-test, logd-unit-tests and logcat-unit-tests in
      combination with commit 'logd: Use private interfaces for
      buffer size properties'
Bug: 31750617
Change-Id: Id95cb68f775ef6b427c122e10f6f8291d336d184
2016-10-18 09:48:55 -07:00
Mark Salyzyn
3132543d83 Merge "liblog: LIBLOG_ABI_PRIVATE __android_log_is_debuggable()"
am: 915d620359

Change-Id: I66547a2d32c96b9baffccb8a391a15a155faf123
2016-10-17 21:57:22 +00:00
Treehugger Robot
915d620359 Merge "liblog: LIBLOG_ABI_PRIVATE __android_log_is_debuggable()" 2016-10-17 21:46:37 +00:00
Tianjie Xu
18c25920c2 Add functions in recovery/minzip to libziparchive
Add two functions libziparchive that libminzip has. And create
corresponding unit tests.
1. Open a zip archive from a memory mapped region.
2. A new writer that takes a call back function pointer.
(Used by the OTA updater to stream the data.)

Test: Unit tests passed
Bug: 19472796
Change-Id: I2b2daec71174afe221030357e39bff5faea51e72
2016-10-15 23:16:34 -07:00
Elliott Hughes
091113ec6c Merge "Remove socket_loopback_client."
am: 5171bebf41

Change-Id: I28080f043ba5a042573e81a6da3f5be83c7a4251
2016-10-14 20:37:06 +00:00
Treehugger Robot
5171bebf41 Merge "Remove socket_loopback_client." 2016-10-14 18:21:38 +00:00
Mark Salyzyn
9ea359fce0 liblog: LIBLOG_ABI_PRIVATE __android_log_is_debuggable()
Allow our own libraries to use this privately instead of
running the less efficient get_properties and doing the math.

Test: compile and boot smoke test
Bug: 27566046
Bug: 31456426
Change-Id: I2f677276d27fbcb6af01b600ac1d9891c8938d43
2016-10-14 08:00:41 -07:00
Tao Wu
4b9774fe97 Merge "Fallback to IPv6 when IPv4 is not available in adb" am: c32d7fd66f am: 5b7c6772b0
am: 27c6c4cf04

Change-Id: I2ceb40b4589dfc2721197065ae5a85e9dc83b907
2016-10-14 01:51:54 +00:00
Tao Wu
27c6c4cf04 Merge "Fallback to IPv6 when IPv4 is not available in adb" am: c32d7fd66f
am: 5b7c6772b0

Change-Id: I63e945622d47ab1cbcbdd82d00cfdf3d51c95564
2016-10-14 01:46:26 +00:00
Treehugger Robot
c32d7fd66f Merge "Fallback to IPv6 when IPv4 is not available in adb" 2016-10-14 01:35:43 +00:00
Elliott Hughes
dd92a0a812 Remove socket_loopback_client.
Bug: http://b/31537253
Test: builds
Change-Id: If02c8107206fb60e4622f8937bee0d0a362e1c7d
2016-10-13 16:51:46 -07:00
Chia-I Wu
7e671b343f Merge "Add native_handle_init" am: d790aae4bc am: 28423b86fe
am: bf72cf21dc

Change-Id: I5d4cc013421350dd30fa13d168112d30ad93e7cd
2016-10-13 22:32:57 +00:00
Chia-I Wu
bf72cf21dc Merge "Add native_handle_init" am: d790aae4bc
am: 28423b86fe

Change-Id: Ied7a062c6ce40864ea181819f5da21e64cae04de
2016-10-13 22:26:11 +00:00
Tao Wu
7b700763f5 Fallback to IPv6 when IPv4 is not available in adb
Test: manual - make sure it works in both IPv4/IPv6 env.
BUG: 31537253
Change-Id: Ica492bff34a8c0441516a213d0e8b78fcdfd3282
Signed-off-by: Tao Wu <lepton@google.com>
2016-10-13 08:54:43 -07:00
Chia-I Wu
b843791b61 Add native_handle_init
HIDL requires file descriptors to be wrapped in native_handle_t.  We want
a low overhead way to do that when the number of file descriptors is known
at compile time.  Instead of

  // wrap an fd in native_handle_t
  native_handle_t* fd_handle = native_handle_create(1, 0);
  if (!fd_handle) {
    // clean up and return error
  }
  fd_handle->data[0] = fd;

  hidl_cb(..., fd_handle);

  native_handle_delete(fd_handle);

this change adds native_handle_init to allow for

  // wrap an fd in native_handle_t
  NATIVE_HANDLE_DECLARE_STORAGE(fd_storage, 1, 0);
  native_handle_t* fd_handle = native_handle_init(fd_storage, 1, 0);
  fd_handle->data[0] = fd;

  hidl_cb(..., fd_handle);

Test: make libcutils
Bug: 32021609
Change-Id: If1fd07482243d37492fdea57c602a1b13c8953cc
2016-10-12 18:04:41 -07:00
Mark Salyzyn
144abd8cb2 Merge "liblog: adb: move security interfaces to private" am: 09dac589f1 am: 586c6985cf
am: 4b5456eacc

Change-Id: Id78628d7e7abfa16f1ada16f894f9616a2dc469b
2016-10-10 23:34:54 +00:00
Mark Salyzyn
4b5456eacc Merge "liblog: adb: move security interfaces to private" am: 09dac589f1
am: 586c6985cf

Change-Id: I8c54bdc1a3582be1fc7c4a9be83b555624fcb0a3
2016-10-10 23:29:55 +00:00
Mark Salyzyn
6debf985aa liblog: adb: move security interfaces to private
Test: Compile & adb functioning
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I7ad8963bcca3d8b5c37b547c11d163b652d35556
2016-10-10 15:15:45 +00:00
Chia-I Wu
ebebf0198d Merge "Add native_handle_clone" am: e8f6c7398b am: 462e087e40
am: cb52dc258e

Change-Id: I011555d429120a26e61fbce5f7a125ce96fadb3f
2016-10-08 01:39:01 +00:00
Chia-I Wu
cb52dc258e Merge "Add native_handle_clone" am: e8f6c7398b
am: 462e087e40

Change-Id: I745341bf4c76fc8c75f36e578cf1086808119426
2016-10-08 01:34:05 +00:00
Chia-I Wu
e8f6c7398b Merge "Add native_handle_clone" 2016-10-08 01:25:35 +00:00
Elliott Hughes
c9dc124e2f Merge "Test for _WIN32 in instead of USE_MINGW." am: ec99158580 am: 2e7e065db9
am: 04819403d6

Change-Id: I03fc482f4d0aab72991b351e855b8e240ed3abd9
2016-10-05 18:38:10 +00:00
Elliott Hughes
04819403d6 Merge "Test for _WIN32 in instead of USE_MINGW." am: ec99158580
am: 2e7e065db9

Change-Id: I9c7bee42bf1d7522d4dd95b5bb8a925841f96624
2016-10-05 18:35:40 +00:00
Treehugger Robot
ec99158580 Merge "Test for _WIN32 in instead of USE_MINGW." 2016-10-05 18:30:06 +00:00
Elliott Hughes
34a4f0b8c7 Test for _WIN32 in instead of USE_MINGW.
Bug: http://b/23392815
Test: builds
Change-Id: I7fce8de1f0e2314170cce456cd49346dcee9d134
2016-10-05 09:37:44 -07:00
Mark Salyzyn
74ba3b0ce6 Merge "system/core: drop or replace log/logger.h" am: 1f90485804 am: cb670780be
am: 6e5ffe2680

Change-Id: I4c1351fb61b3357d059a8e1da4ce14e3701e17af
2016-10-04 18:37:14 +00:00
Mark Salyzyn
6e5ffe2680 Merge "system/core: drop or replace log/logger.h" am: 1f90485804
am: cb670780be

Change-Id: I532a0f6143511f53f3303751f95de115ac034cd7
2016-10-04 18:33:44 +00:00
Mark Salyzyn
37c9451349 system/core: drop or replace log/logger.h
debuggerd does not require log/logger.h, can use android/log.h
In some cases, mark why log/logger.h was required.

Test: Compile and boot smoke test
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: Ia34987e25a01d81971ec8d785415f732b8376c4f
2016-10-04 09:09:10 -07:00
Mohan Srinivasan
96eba22338 Merge "liblog: logd: Add android_lookupEventTag_len()" am: 093951a230 am: aed39f1f3d
am: 2acb41b46c

Change-Id: Ifd5da3780cf05863b71fad9583b1b83f4962b46f
2016-10-03 22:47:51 +00:00
Mohan Srinivasan
2acb41b46c Merge "liblog: logd: Add android_lookupEventTag_len()" am: 093951a230
am: aed39f1f3d

Change-Id: If1615c62df20df58eda2910455f2a1e05268fba7
2016-10-03 22:42:20 +00:00
Mark Salyzyn
807e40ecc9 liblog: logd: Add android_lookupEventTag_len()
Allows us to mitigate the impact of MAP_PRIVATE and copy on write by
calling android_lookupEventTag_len instead of android_lookupEventTag,
and delaying the copy on write impact to the later.  We return a
string length in a supplied location along with the string pointer
with android_lookupEventTag_len(const EventTagMap* map, size_t* len,
int tag).  The string is not guaranteed to be nul terminated.  Since
android_lookupEventTag() called even once can cause the memory
impact, we will mark it as deprecated, but we currently have no
timeframe for removal since this is a very old interface.

Add an API for __android_log_is_loggable_len() that accepts the non
null terminated content and fixup callers that would gain because the
length is known prior to the call either in the compiler or at
runtime.  Tackle transition to android_lookupEventTag_len() and
fixup callers.

On any application that performs logging (eg: com.android.phone)

/proc/<pid>/smaps before:

xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 463 /system/etc/event-log-tags
Size:                 20 kB
Rss:                  20 kB
Pss:                   1 kB
Shared_Clean:          0 kB
Shared_Dirty:         20 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            0 kB
Anonymous:            20 kB
AnonHugePages:         0 kB
Swap:                  0 kB
SwapPss:               0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB
VmFlags: rd wr mr mw me ac

/proc/<pid>/smaps after:

xxxxxxxxxx-xxxxxxxxxx rw-p 00000000 fd:00 1773 /system/etc/event-log-tags
Size:                 20 kB
Rss:                  20 kB
Pss:                   1 kB
Shared_Clean:         20 kB  (was 0kB)
Shared_Dirty:          0 kB  (was 20kB)
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:           20 kB  (was 0kB)
Anonymous:             0 kB  (was 20kB)
AnonHugePages:         0 kB
Swap:                  0 kB
SwapPss:               0 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Locked:                0 kB
VmFlags: rd wr mr mw me ac

Added liblog-unit-tests --gtest_filter=liblog.event_log_tags to
check for Shared_Clean: to not be 0 and Anonymous: to be 0 for
all processes referencing event-log-tags.  Which can include multiple
references to /system/etc/event-log-tags and future possible refs to
/data/misc/logd/event-log-tags and /dev/event-log-tags.  We want
failure messages to help point to errant code using the deprecated
interface.

This change saves 1/4MB of memory or more on a typical system.

Test: gTest liblog-unit-tests
Bug: 31456426
Change-Id: I9e08e44d9092bd96fe704b5709242e7195281d33
2016-10-03 11:08:34 -07:00
Mark Salyzyn
9f6b98dec0 system/core Replace log/log.h with android/log.h am: ff2dcd9af9 am: cac331afd9
am: 0308b0eabd

Change-Id: I4d631d53b4fc27e1a02d412bae21fffad6635258
2016-09-30 22:18:18 +00:00
Mark Salyzyn
0abff8fc61 system/core Replace cutils/log.h with android/log.h am: 66ce3e08c5 am: eb189f147b
am: 16f7786032

Change-Id: I26939d55686b6182c9fae5fc74f3e7ed92132cdb
2016-09-30 22:18:03 +00:00
Mark Salyzyn
9bb1f2f915 libcutils: Replace cutils/log.h with android/log.h am: 23ed4c242a am: f56fce0240
am: 9fd2eaf827

Change-Id: If01fd686fc15aaf74b6f06b7e661eb46e127d51b
2016-09-30 22:17:30 +00:00
Mark Salyzyn
2156aae1d5 liblog: Replace log/log.h with android/log.h am: 6584d0a35a am: 499a33d6dc
am: c528ac0fe8

Change-Id: I2e6eb5782ccd27e47e8302381d790611fd58a1d7
2016-09-30 22:17:20 +00:00
Mark Salyzyn
ea3c6d1029 liblog: logcat: Replace log/logd.h with log/log.h am: a166708d15 am: 772ed1c63c
am: 2b42b87d8c

Change-Id: I4a977e248d0ea7e3b8ed31aed0643752aaab4e1c
2016-09-30 22:17:14 +00:00
Mark Salyzyn
a06a6509d9 liblog: logd: logcat: deprecate log/log_read.h am: 004cd3c55d am: 78a459a8c8
am: 13c68b09d9

Change-Id: Icaab3eedecad8f55d8d1291b3414da5c12cec287
2016-09-30 22:17:08 +00:00
Mark Salyzyn
519bdbf0b4 liblog: Add C++ wrapper for C event log handler am: 8eaaac0103 am: 8b4cab3f69
am: 848da90978

Change-Id: I215d1da28c1d4e0377097f49493d1e9c5fc9ee75
2016-09-30 22:17:02 +00:00
Mark Salyzyn
0308b0eabd system/core Replace log/log.h with android/log.h am: ff2dcd9af9
am: cac331afd9

Change-Id: I95c6a64bc35a041688303fcee4d506865d0a19a4
2016-09-30 22:13:00 +00:00
Mark Salyzyn
16f7786032 system/core Replace cutils/log.h with android/log.h am: 66ce3e08c5
am: eb189f147b

Change-Id: I3f2b13e259d9bbb7bc714f21eab7181fa72c35bf
2016-09-30 22:12:55 +00:00
Mark Salyzyn
9fd2eaf827 libcutils: Replace cutils/log.h with android/log.h am: 23ed4c242a
am: f56fce0240

Change-Id: I588c3a252594e1ecd4b34242217cf23c84e4af67
2016-09-30 22:12:45 +00:00
Mark Salyzyn
c528ac0fe8 liblog: Replace log/log.h with android/log.h am: 6584d0a35a
am: 499a33d6dc

Change-Id: If28b70b199b4bbf99f853d6c6d14b73a72fafacb
2016-09-30 22:12:41 +00:00
Mark Salyzyn
2b42b87d8c liblog: logcat: Replace log/logd.h with log/log.h am: a166708d15
am: 772ed1c63c

Change-Id: Ibd14ac6a57994019e188e6ec138682b50d1f7e69
2016-09-30 22:12:36 +00:00
Mark Salyzyn
13c68b09d9 liblog: logd: logcat: deprecate log/log_read.h am: 004cd3c55d
am: 78a459a8c8

Change-Id: If1a76043e7941191b3c6ba07ca0277b7f9b7f2e6
2016-09-30 22:12:32 +00:00
Mark Salyzyn
848da90978 liblog: Add C++ wrapper for C event log handler am: 8eaaac0103
am: 8b4cab3f69

Change-Id: I2760c8480818f30dd126e7cfbb900a0f5796c8b1
2016-09-30 22:12:28 +00:00
Mark Salyzyn
ff2dcd9af9 system/core Replace log/log.h with android/log.h
Should use android/log.h instead of log/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
2016-09-30 12:47:05 -07:00
Mark Salyzyn
66ce3e08c5 system/core Replace cutils/log.h with android/log.h
Should use android/log.h instead of cutils/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I2c9cbbbd64d8dccf2d44356361d9742e4a9b9031
2016-09-30 12:47:05 -07:00
Mark Salyzyn
23ed4c242a libcutils: Replace cutils/log.h with android/log.h
Replace references to cutils/log.h and log/log.h with android/log.h.
Point cutils/log.h to android/log.h. Adjust header order to comply
with Android Coding standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I4b00c0dff3a0a50cbb54301fdc5a6c29c21dab65
2016-09-30 12:47:05 -07:00
Mark Salyzyn
6584d0a35a liblog: Replace log/log.h with android/log.h
Move all liblog related content into android/log.h, and make
log/log.h points to android/log.h.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I858e0ebe047b86f2a8530a99bc9c380d3d58edbb
2016-09-30 12:47:05 -07:00
Mark Salyzyn
a166708d15 liblog: logcat: Replace log/logd.h with log/log.h
Should use log/log.h and in some cases android/log.h instead. Can
not remove file because still in use by partners, so log/logd.h
points to log/log.h.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I3580d46154617abb7231027a44f4ab9ee023febf
2016-09-30 12:47:05 -07:00
Mark Salyzyn
004cd3c55d liblog: logd: logcat: deprecate log/log_read.h
Always used in combination with log/logger.h except in log_time.cpp,
and not used externally.  As a result liblog has to support stl, a
small price to pay since goal is to convert liblog to C++ internally.

Test: compile
Bug: 31456426
Bug: 26552300
Bug: 31289077
Change-Id: I72828ec807d0a2c8e40bbdebd7a69f147a7ca5a9
2016-09-30 12:47:05 -07:00
Mark Salyzyn
8eaaac0103 liblog: Add C++ wrapper for C event log handler
Add android_log_event_context class.

Test: in context of 'logd: add getEventTag command and service'
Bug: 31456426
Bug: 26552300
Bug: 31289077
Bug: 19235719
Change-Id: Icf918b443f01e04040c8d3efe0cdb7a8e70be10c
2016-09-30 12:47:05 -07:00
Miodrag Dinic
53be7eb3d0 Merge "[qemu]: Fix payload size format in qemu_pipe_frame_send()" am: e5976bea7a am: 8c274361fb
am: f610eaac14

Change-Id: I890fbb885044e82d4ec66a5a400240124003ac25
2016-09-30 18:00:16 +00:00
Miodrag Dinic
f610eaac14 Merge "[qemu]: Fix payload size format in qemu_pipe_frame_send()" am: e5976bea7a
am: 8c274361fb

Change-Id: I7c80343b0002ec68ef9cde40dad2202aa9b70c00
2016-09-30 17:49:11 +00:00