Commit Graph

11611 Commits

Author SHA1 Message Date
Andrei-Valentin Onea
b389ffe2d9 Merge "Add extra compat change overriding methods." 2019-10-11 13:04:08 +00:00
Anna Trostanetski
2bbb78b5c0 Merge "ADD owners to compat framework code." 2019-10-10 18:42:25 +00:00
Andrei Onea
ea997f222c Add extra compat change overriding methods.
This CL adds two new methods to the IPlatformCompat binder interface for
toggling multiple compat changes at once, and for clearing all the
overrides for a given package name.

Bug: 140367850
Test: http://aosp/1113771
Change-Id: I02d08d76e42da308856408dadc2c8c73c7ff20d1
2019-10-10 17:09:02 +01:00
atrost
dd7c8025cd ADD owners to compat framework code.
Test: none
Change-Id: I4f395bbceef1face1e9bb85817ce4c78563d06e8
2019-10-10 14:32:57 +01:00
atrost
893f84d353 Reset app reporting on app launch.
Store the reported changes by app and clear the app info on app launch.
This means that changes reported to the system server would be logged
once per app launch instead of once per device boot.

Bug: 138374585
Test: flash device, run test app
Change-Id: I24f5dc125488c6af3164b6503f236bc3a24e6292
Merged-In: I24f5dc125488c6af3164b6503f236bc3a24e6292
2019-10-10 14:09:30 +01:00
Tri Vo
b9ad9a68fb KernelWakelockReader: reuse buffer when parsing
Eliminates 32 kb buffer allocation every time readKernelWakelockStats()
is called.

Test: atest FrameworksCoreTests:KernelWakelockReaderTest
Test: "dumpsys batterystats --checkin" contains kernel wake lock
information.
Change-Id: Ifc7254ab3a5272b056cbc75233aa2dfa8219ea84
2019-10-09 12:40:01 -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
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
Treehugger Robot
2f44b1ebbd Merge "Add UID APIs to PlatformCompat." 2019-10-04 11:52:54 +00: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
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
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
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
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
52efd46075 Merge "Introduce ZygoteInit.preForkInit()." 2019-09-26 18:38:39 +00: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
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
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
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
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
Martijn Coenen
3b8ca2e7ac Reconcile Zygote process name code with Q release.
Some Zygote code that was pushed to AOSP master is different from the
pushed Q release. In particular, a call to set the process name for a
Zygote child was missing, causing an app zygote test to fail.

Bug: 139535125
Test: atest android.app.cts.ServiceTest#testAppZygoteServices
Change-Id: I53b0bc0116f1573cb1e52a998e10346bd5601f67
Merged-In: I2bce277ff8f2de4614e19d5385fe6712b076f9c9
2019-09-09 02:39:26 +00:00
Jiyong Park
70fb81076e Merge changes from topic "drop_circular_dep" into stage-aosp-master
* changes:
  Cut the dependency to framework from droiddoc modules
  Remove -without-aidls filegroups for the media apex.
2019-08-30 05:14:21 +00:00
Jiyong Park
5366ea2089 Cut the dependency to framework from droiddoc modules
droiddoc modules for the SDK API documentation and stubs library
generations have depended on the 'framework' (which was recently changed
to framework-minus-apex' module to get the list of Java source files to
be processed.

This however caused a circular dependency when we tried to modularize
some classes in the framework library as a separate library. The
separate java library depended on the stubs library (because it should
only use SDK APIs) and the stubs library depended on the framework
library. The framework library itself depended on the separated library
(or its stub) to use APIs from the separated library, thus forming a
circular dependency.

This change fixes the problem by directly giving the framework source
files via a filegroup `framework-sources-to-document` where all Java
and AIDL files that are to be documented are included in.

This change also put the generated R.java and Manifest.java files from
framework-res into the filegroup for framework sources.

Bug: 70046217
Bug: 135922046
Test: m

Exempt-From-Owner-Approval: Approved internally
Merged-In: I09ad88da47540d31ad089aad5e1151a4b6877ec2
(cherry picked from commit 20426538f8)
Change-Id: I09ad88da47540d31ad089aad5e1151a4b6877ec2
2019-08-30 05:14:08 +00:00
Mathieu Chartier
5b2da73fa3 Merge "Clean up class preloading"
am: 4082bc010b

Change-Id: I719d2a223a1ab17aed832b618e26091cb3e368e8
2019-08-29 15:23:26 -07:00
Mathieu Chartier
83bea97333 Clean up class preloading
Remove logic to set heap target utilization to 0.8. The default is
0.75 and this should not have any fragmentation benefit since the
GC is compacting.

Removed some unused logging and a variable.

Test: TH

Change-Id: Ife7219e94fa0aa7f489569e16248cdd23d09089a
2019-08-29 12:03:09 -07:00
Tobias Thierer
2d7cc3acf3 Merge changes from topic "bug136256059_revert"
am: aff95e5e7c

Change-Id: I7b1caa27badbe5f77a0c12704d0050a6c15eb178
2019-08-29 03:25:10 -07:00
Tobias Thierer
f4cbf933b7 Revert "Tweak RuntimeInit docs around MimeMap registration."
am: 89bcfa5a21

Change-Id: I0ded17aa79749bd189f9149563787d9f56f7bf20
2019-08-29 03:24:59 -07:00
Tobias Thierer
aff95e5e7c Merge changes from topic "bug136256059_revert"
* changes:
  Revert "Move default MimeMap implementation to frameworks."
  Revert "Tweak RuntimeInit docs around MimeMap registration."
2019-08-29 10:05:20 +00:00
Tobias Thierer
f83bd777f3 Revert "Move default MimeMap implementation to frameworks."
This reverts commit 53f15f39f8.

Reason for revert: Caused slower app startup (I don't know why).

Change-Id: Id9e3811078bc435073f42996767589a711172400
2019-08-28 22:43:33 +00:00
Tobias Thierer
89bcfa5a21 Revert "Tweak RuntimeInit docs around MimeMap registration."
This reverts commit 098a533e78.

Reason for revert: Base CL caused slower app startup (I don't know why).

Change-Id: Ib67852b900ff2baeb34f5d553fb0d233f5475888
2019-08-28 22:43:06 +00:00
Sehee Park
b849d1fe35 Merge "Define TAG_SYSTEM_DNS"
am: fdc37666cb

Change-Id: I8509280254eb207fe0e97ac5fb74abe599f692e6
2019-08-25 20:07:04 -07:00
Treehugger Robot
fdc37666cb Merge "Define TAG_SYSTEM_DNS" 2019-08-26 02:57:06 +00:00
Xin Li
a770df1d2e DO NOT MERGE - Merge build QP1A.190711.019 into stage-aosp-master
Bug: 139893257
Change-Id: I94fce9c5c0b35cbb88ee27fa4cd037927964d2cd
2019-08-24 05:22:23 +00:00
Siarhei Vishniakou
c0216a1107 Add uhid group to system_server
Ensure that uhid group (AID_UHID) is added to system_server, which would
allow it to read/write /dev/uhid and /dev/uinput nodes. This will allow
ATV devices to inject events.

Bug: 138311400
Test: none
Change-Id: Ie20fef5b5facff109bc4e068e648f335dd3a1e2c
2019-08-23 13:24:15 +01:00
Anna Trostanetski
81af0fc8bb Merge "Rename android.compat.IPlatformCompat"
am: ee716a23a2

Change-Id: I88fd93b46bcaa5ed782c407f2a9e9469fb0f5f0e
2019-08-23 02:26:15 -07:00
Tobias Thierer
41438c3730 Merge "Tweak RuntimeInit docs around MimeMap registration."
am: bc6371727c

Change-Id: I4c3cee161fec5f8065e4ea77f1bf5aa694909874
2019-08-23 02:25:10 -07:00
Tobias Thierer
3f1d5d92fc Merge "Move default MimeMap implementation to frameworks."
am: 19c3bdc88a

Change-Id: I4bb456d64ad27dabb7db920d6e40dd32c92af900
2019-08-23 02:13:28 -07:00
Anna Trostanetski
ee716a23a2 Merge "Rename android.compat.IPlatformCompat" 2019-08-21 19:46:39 +00:00
Treehugger Robot
bc6371727c Merge "Tweak RuntimeInit docs around MimeMap registration." 2019-08-21 18:38:41 +00:00
Treehugger Robot
19c3bdc88a Merge "Move default MimeMap implementation to frameworks." 2019-08-21 16:39:33 +00:00
atrost
a6a4d60ae0 Rename android.compat.IPlatformCompat
To com.android.internal.compat.IPlatformCompat. This solves a java9
issue because libcore exported api has the same package android.compat.

Test: EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true make framework
Change-Id: I0918344f670669cecb04f1e9e54dbcb471b587d5
2019-08-21 17:07:11 +01:00
Tobias Thierer
098a533e78 Tweak RuntimeInit docs around MimeMap registration.
Bug: 136256059
Test: Treehugger

Change-Id: I3f82a1684f47d96630badef4c13b3f507f30eaa5
2019-08-21 16:55:48 +01:00
Tobias Thierer
53f15f39f8 Move default MimeMap implementation to frameworks.
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.

Specifically, the logic and android.mime.types now live in
frameworks/base/mime. The default implementation is injected
into libcore from RuntimeInit. I chose to use a separate directory
(frameworks/base/mime/) and build java_library target ("mimemap")
in order to keep this as separate as possible from the rest of
frameworks code, to make it as easy as possible to factor this
out into a separate APEX module if we ever choose to do so.

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
Bug: 136256059
Change-Id: Ib955699694d24a25c33ef2445443afb7c35ed9e7
2019-08-21 14:46:50 +01:00