Commit Graph

11667 Commits

Author SHA1 Message Date
Tobias Thierer
bfd4e55a48 Merge "Construct default MimeMap lazily rather than eagerly." am: 7dbc7ed543
am: 59d2c429bb

Change-Id: I023b1d784814499319c62db7e7647ce14e7c0fba
2019-10-04 10:00:29 -07:00
Tobias Thierer
59d2c429bb Merge "Construct default MimeMap lazily rather than eagerly."
am: 7dbc7ed543

Change-Id: I60c43606e536872455e8220745bf9094b0d9f56c
2019-10-04 09:47:38 -07:00
Tobias Thierer
4435606858 Construct default MimeMap lazily rather than eagerly.
A side effect of CL topic r.android.com/q/topic:bug136256059_attempt2
was that the default MimeMap instance is now loaded eagerly (pre-fork)
regardless of whether any app process ends up using it, whereas
previously it was loaded lazily (post-fork) the first time an app
process used it.

This traded off CPU and memory use post-fork vs. pre-fork. Because it
isn't known / hasn't been proven whether and how many app processes
use that instance, the net CPU and memory impact is not known: if at
least one process makes use of a relevant API, the net impact will be
neutral or positive, or else negative.

Until this can be investigated and undergo system health review, this
CL topic changes the behavior back to post-fork lazy loading of the
default MimeMap instance.

Bug: 142019040
Test: Treehugger

Change-Id: I2a3f244240c51e7ada1f41a8abadb946ebcab40b
2019-10-04 16:34:18 +00:00
Tobias Thierer
b43f746cdc Merge "Track MimeMap moving to libcore.content.type." am: 0801b7c222
am: 093c1e4eaa

Change-Id: If2b46820dc9ba3d8ba6b8f542521f3818b0074c9
2019-10-04 06:20:07 -07:00
Tobias Thierer
093c1e4eaa Merge "Track MimeMap moving to libcore.content.type."
am: 0801b7c222

Change-Id: I63889b3eedb8f98c99d71172dc5cc32025a8afd4
2019-10-04 06:07:03 -07:00
Tobias Thierer
0801b7c222 Merge "Track MimeMap moving to libcore.content.type." 2019-10-04 12:54:17 +00:00
Tobias Thierer
8edd837b79 Track MimeMap moving to libcore.content.type.
Another CL in this topic moves libcore.net.MimeMap to package
libcore.content.type. This CL updates associated references.

Bug: 136256059
Bug: 124232146
Test: Treehugger
Test: CtsMimeMapTestCases
Exempt-From-Owner-Approval: move affecting imports only
Change-Id: I30aac8b28a1740180ea01834a2bb66b61cb255d4
2019-10-04 12:52:38 +00:00
atrost
6d6dc567d7 Merge "Add UID APIs to PlatformCompat." am: 2f44b1ebbd
am: db25a1bcf4

Change-Id: Ife2d0e4ee60739fecb11035e05f9eb9bb805db28
2019-10-04 05:33:38 -07:00
atrost
db25a1bcf4 Merge "Add UID APIs to PlatformCompat."
am: 2f44b1ebbd

Change-Id: I185109ad67af2bc7ce3e62e14b12bede13afb561
2019-10-04 05:21:05 -07:00
Treehugger Robot
2f44b1ebbd Merge "Add UID APIs to PlatformCompat." 2019-10-04 11:52:54 +00:00
Josh Gao
332a53756d Merge "zygote: respond and wait for reply to --boot-completed." am: d34e18c036
am: 15f8fb42d6

Change-Id: I57ba0d7b301ac4652b3df54672c91dedfe1bb16c
2019-10-03 11:05:21 -07:00
Josh Gao
15f8fb42d6 Merge "zygote: respond and wait for reply to --boot-completed."
am: d34e18c036

Change-Id: I47819fa73d07ecc3507b03ef446f606407830b29
2019-10-03 10:58:24 -07:00
Josh Gao
273613653f zygote: respond and wait for reply to --boot-completed.
The zygote handles requests by polling on its sockets, and then handling
one request for each active socket. However, it does so by reading from
a socket via a BufferedReader, which means that if multiple requests are
written into the socket before the zygote gets a chance to read them,
the zygote reads multiple requests into its BufferedReader, it handles
one request, and then never responds to the request that's buffered,
leaving its client stuck waiting for a response that will never happen.

For most requests, this can't happen, because the client will wait for a
response to be sent from the zygote before sending another request, but
this isn't true for --boot-completed until this patch.

Bug: http://b/141767463
Test: forrest runs of apct/text/text_native_test-cloud-tf
Change-Id: I8b7a80abfd9443d98f8cf5aedb7669b82c0cb84a
2019-10-03 17:18:04 +00:00
atrost
64cacec12b Add UID APIs to PlatformCompat.
Needed for scoped storage (to be used from MediaProvider).
IsChangeEnabled returns true if there are no installed packages for the
required UID, or if the change is enabled for ALL of the installed
packages associated with the provided UID.

Bug: 138275545
Test: Test app
Change-Id: I6785f57e4fcfb92ed7529f4da0a6db6ffe8b3ad4
2019-10-03 15:21:24 +01:00
Tobias Thierer
4b461c1588 Merge changes from topics "bug136256059_attempt2", "bug136256059_builder" am: 6ed8fce33f
am: ffd40f7bd4

Change-Id: I66ced024c5cda2ef37e62433c8e65b9d49ca9d3f
2019-09-30 02:50:20 -07:00
Tobias Thierer
effe42d0b5 Move default MimeMap implementation to frameworks. am: 878c77b704
am: 2b754d1fb3

Change-Id: I6c282aacb196189458ab5f8d715b51fa786cdfe6
2019-09-30 02:50:08 -07:00
Tobias Thierer
ffd40f7bd4 Merge changes from topics "bug136256059_attempt2", "bug136256059_builder"
am: 6ed8fce33f

Change-Id: If95ba459b29a3fd2eede6390bbab18f95f762587
2019-09-30 02:38:49 -07:00
Tobias Thierer
2b754d1fb3 Move default MimeMap implementation to frameworks.
am: 878c77b704

Change-Id: Ic8f8c2c1fc10809e3245ee6b729e69a4ecb30ffa
2019-09-30 02:38:30 -07:00
Tobias Thierer
6ed8fce33f Merge changes from topics "bug136256059_attempt2", "bug136256059_builder"
* changes:
  MimeMapImpl.createDefaultInstance() -> DefaultMimeMapFactory.create().
  Make MimeMap final and introduce MimeMap.Builder.
  Move default MimeMap implementation to frameworks.
2019-09-30 09:15:53 +00:00
Anna Trostanetski
5912d35e17 Merge "Rate limit non statsd logs." am: e8e6390829
am: c1abc25905

Change-Id: Ie6e945dbe51d8b9a871007522565c472eeffefb3
2019-09-27 09:27:19 -07:00
Tobias Thierer
af0cef987d MimeMapImpl.createDefaultInstance() -> DefaultMimeMapFactory.create().
The class no longer implements MimeMap, so the name MimeMapImpl
no longer made sense.

Test: Treehugger
Bug: 136256059
Change-Id: I2cbc70a7769232b704a9bdfde2def832c1e292b8
2019-09-27 17:25:13 +01:00
Anna Trostanetski
c1abc25905 Merge "Rate limit non statsd logs."
am: e8e6390829

Change-Id: Ib6ef1c746f26ceb384f7ed586bfc769a05da271c
2019-09-27 09:15:37 -07:00
Tobias Thierer
878c77b704 Move default MimeMap implementation to frameworks.
This is the second attempt to submit this CL. The first attempt
regressed on app startup because RuntimeInit installed the
custom MimeMap from commonInit() which runs post-fork of the zygote,
but that was fixed by installing it pre-fork.

This CL topic moves the default MimeMap implementation to frameworks.
Libcore starts with a minimal implementation sufficient to pass
CtsLibcoreTestCases,  but frameworks can inject the real implementation.
Before this CL topic, the data files and logic (MimeMapImpl) were part of
core-*.jar on device; after this CL, they instead live in framework.jar.

Tests from MimeMapTest that check behavior of that default
implementation also move to a non-libcore CTS test.

Planned work for follow-up CL:
 1. Make CTS more opinionated, with a plan to assert that all of
    the default mappings are present. How exactly the expectated
    mapping will be bundled in CTS is still TBD.
 2. Add a vendor.mime.types file (defaults to empty) where vendors
    can add additional mappings; I plan to make it such that mappings
    in that file are parsed last but never override any earlier
    mappings, as if each mime type / file extension was prefixed
    with '?'.
 3. Perhaps enforce that public APIs android.webkit.MimeTypeMap
    and java.net.URLConnection.getFileNameMap() behave consistently
    with MimeMap.getDefault().

Test: atest CtsLibcoreTestCases
Test: atest CtsMimeMapTestCases
Test: Checked that CtsLibcoreTestCases still passes on a build that
      is missing the MimeMap.setDefault() call from RuntimeInit.java.
Test: Checked that app startup time does not regress as part of this
      CL topic - see http://b/136256059#comment17
Bug: 136256059

Change-Id: I716914bf1a7e6205e539f0551f010615dacb17a8
2019-09-27 16:53:15 +01:00
atrost
a8f3c48495 Rate limit non statsd logs.
Limit 1 log per app launch as the statd logs as this is spamming logs.
Consider increasing in the future to once every x minutes/seconds if
needed.

Bug: 138374585
Bug: 141714588
Test: flash device
Change-Id: I3ed696fb557527d807d03aecc64c0207d7b93f08
2019-09-27 11:25:06 +00:00
Jeongik Cha
6a46c5315a Merge changes from topic "system_ext" am: a828ee6442
am: dee02a0fae

Change-Id: If2cc7cfe20182578b4e3c515f42209d9446f6a68
2019-09-26 15:53:32 -07:00
Jeongik Cha
dee02a0fae Merge changes from topic "system_ext"
am: a828ee6442

Change-Id: I2b636d0c54c932342586de47a38c16e93bf978e8
2019-09-26 15:40:26 -07:00
Treehugger Robot
a828ee6442 Merge changes from topic "system_ext"
* changes:
  Consider overlay in system_ext as system's
  Support /system_ext partition
2019-09-26 22:18:07 +00:00
Tobias Thierer
023ae56991 Merge "Introduce ZygoteInit.preForkInit()." am: 52efd46075
am: 4edffff80a

Change-Id: Ifc0061d8cf9ee3c5860f31fa9ad821bfcd0b6a88
2019-09-26 12:20:55 -07:00
Tobias Thierer
4edffff80a Merge "Introduce ZygoteInit.preForkInit()."
am: 52efd46075

Change-Id: I5bc25ca924624283126a584917f5adb6ff6eed03
2019-09-26 12:08:06 -07:00
Tobias Thierer
52efd46075 Merge "Introduce ZygoteInit.preForkInit()." 2019-09-26 18:38:39 +00:00
atrost
604f8002d8 Merge "Refactor ChangeReporter and rate limit stats logging." am: 9a253e12cc
am: 76191fa6b0

Change-Id: I8c853fb3e09a83ad877f02132608884cfaba966f
2019-09-26 10:45:54 -07:00
atrost
76191fa6b0 Merge "Refactor ChangeReporter and rate limit stats logging."
am: 9a253e12cc

Change-Id: I33b14641d259efea6bf7038da264a3483e71f955
2019-09-26 10:39:31 -07:00
Tobias Thierer
a45917eb77 Introduce ZygoteInit.preForkInit().
Until recently, I and apparently some others were under the assumption
that RuntimeInit.commonInit() runs before the Zygote fork. Actually, it
does not.

This CL introduces a method ZygoteInit.preForkInit() which runs before
the Zygote fork. For now, only enableDdms() moves into it and can become
private. This should not alter behavior since enableDdms() is called
from the same places as before, and because enableDdms() (now private)
was already not part of any API surface.

The CL also removes the qualifier "final" from the (static) method
enableDdms(), because it is redundant.

Note: This CL was uploaded with --no-verify because of preexisting
import ordering issues in RuntimeInit.java

Test: Treehugger
Change-Id: I8f637e160a2d7810feb43b6a43ec7d628af18fb8
2019-09-26 16:08:59 +01:00
atrost
6624ffa207 Refactor ChangeReporter and rate limit stats logging.
Only log once per change-package-state(resets every app launch if used
from within the app process).

Next: reset every app launch for server usage as well.

Test: using the test app.
Bug: 138374585
Change-Id: I5587f7138cf2cd8d144e88cf294e65c14bb32bfb
2019-09-26 12:59:19 +01:00
Anna Trostanetski
0a96b3aff3 Merge "Add package name based APIs to PlatformCompat." am: ef530d9fa4
am: 29a23e753a

Change-Id: I1872639b936ddd40a0b4aa75b418faec4d04f308
2019-09-25 12:21:48 -07:00
Anna Trostanetski
29a23e753a Merge "Add package name based APIs to PlatformCompat."
am: ef530d9fa4

Change-Id: Ib6e31e0439efd856cc834ee5590e2419c25f3197
2019-09-25 12:04:33 -07:00
atrost
12d0da3179 Add package name based APIs to PlatformCompat.
The APIs behave the same as the AppInfo APIs, and returns the change is
enabled if there is no installed package with the provided name.

Test: flashed device, used the test app, and made the API use the new
      per-package API.
Bug: 138275545

Change-Id: Ic925751dddc6c2e0996fe195a208f5c689554839
2019-09-25 16:32:07 +01:00
Jeongik Cha
f6629839d1 Support /system_ext partition
This commit is mainly from I7a6a30bf8e8db9f2738594d187bb9148f138b8da, so
test cases and features are mostly same.

We change product_services partition name to "system_ext" because this
partition's purpose changes.

 - installing a RRO package for framework from /system_ext/overlay
 - installing apps from /system_ext/app
 - installing priv-apps from /system_ext/priv-app
 - installing permissions from
   /system_ext/etc/[default-permissions|permissions|sysconfig]

Bug: 134359158
Test: `mma` under frameworks/base/tests/[libs|privapp]-permissions
      adb sync && adb reboot
      adb shell cmd package list libraries
        => confirmed com.android.test.libs.system_ext library
      adb shell cmd package dump \
        com.android.framework.permission.privapp.tests.system_ext
        => confirmed that the package is a priv-app

Change-Id: Ibbccbba64156a7bc464ffb3785fb8fe69ebb973c
Merged-In: Ibbccbba64156a7bc464ffb3785fb8fe69ebb973c
(cherry picked from commit 9ec059ac1d)
2019-09-23 22:00:50 +00:00
Anna Trostanetski
44b8ba5095 Merge "Implement stats logging for Compatibility API." into stage-aosp-master
am: 81e186ab99

Change-Id: I48e2e3cdc23cdfcc541a5912aec20435ebc4c0c8
2019-09-18 03:42:49 -07:00
atrost
e36b1a142f Implement stats logging for Compatibility API.
Add a new atom and log from both the app process API and the system server API
Bug: 136794938
Bug: 138378110
Test: statsd_testdrive 228

Change-Id: I80f07d0beb30c779c4bce70bebf2bb4ab22f6bfe
Merged-In: I80f07d0beb30c779c4bce70bebf2bb4ab22f6bfe
2019-09-16 14:55:53 +01:00
atrost
1516d5290c Implement stats logging for Compatibility API.
Add a new atom and log from both the app process API and the system server API
Bug: 136794938
Bug: 138378110
Test: statsd_testdrive 228

Change-Id: I80f07d0beb30c779c4bce70bebf2bb4ab22f6bfe
Merged-In: I80f07d0beb30c779c4bce70bebf2bb4ab22f6bfe
2019-09-16 14:54:44 +01:00
TreeHugger Robot
ad324a3d7e Merge "Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master" into stage-aosp-master 2019-09-11 20:31:32 +00:00
Siarhei Vishniakou
5f703ccf7b Merge "Add uhid group to system_server" am: 3a49014ca0
am: 5cfc2c3e7f

Change-Id: I63649dd5951be990d8404f3bbc53f4ece26cf030
2019-09-11 03:09:39 -07:00
Treehugger Robot
3a49014ca0 Merge "Add uhid group to system_server" 2019-09-11 09:31:23 +00:00
Treehugger Robot
980681e525 Merge "Reconcile Zygote process name code with Q release." 2019-09-10 18:48:31 +00:00
Xin Li
d57e959e71 Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master
Bug: 135460123
Change-Id: I65906d82b14125c0893d5cde0cfebb73bf9e38ab
Merged-In: I1f2564837c33cd4c6c3db6aac3cbaf8c09707da9
2019-09-10 11:16:29 -07:00
Mathieu Chartier
3f75400059 Merge "Rename profileSystemServer to shouldProfileSystemServer" am: f7335ffb9a
am: 2b3e8ad368

Change-Id: I067e44ed65cda267edc60f3bf3845cb80d9b3434
2019-09-10 08:51:20 -07:00
Mathieu Chartier
0db66b5621 Merge "Add phenotype property for profiling system server" am: 62b8a2a216
am: d3d25941f6

Change-Id: Ie1a3cf73a1e43007fd54e96deccc90f2b33fe5dd
2019-09-09 13:26:07 -07:00
Mathieu Chartier
3b05e4d74c Rename profileSystemServer to shouldProfileSystemServer
Makes it clearer and addresses previous CR comment.

Bug: 139883463
Test: make
Change-Id: I7c1a1d99cf307b89ee8f2c5c906168d196b35d0e
2019-09-09 13:05:31 -07:00
Mathieu Chartier
77aca50b6f Add phenotype property for profiling system server
Added the property profilesystemserver in the RUNTIME_NATIVE_BOOT
namespace. This property is overrides the system one if it is
present.

Bug: 139883463
Test: set the property manually and verify that system server is started
Test: with profiling

(cherry picked from commit 7b31c74ddb)

Merged-In: Ifd69530e52a717a381b3f91b15a74329614906f2
Change-Id: I00594949b845a75152c7ab3c94aa84a55b072776
2019-09-09 16:25:35 +00:00