Commit Graph

8739 Commits

Author SHA1 Message Date
Mathew Inwood
787c193ee5 Package whitelist for hiddenapi checks.
Some packages in the system image are not built against the SDK, so
enforcing hiddenapi checks for these will break them. Add a whitelist
for such packages.

For now, just add the contacts provider to the whitelist. The list will be
further populated later.

Test: Added test app package name to whitelist to verify.

Bug: 73244707

Merged-In: I94746b7f12dd9371d5068bb235eb853f63ee4d97
Change-Id: I1cbbd220c61b1b4b767c301f97096607ee902a7b
2018-02-22 11:05:14 +00:00
Robert Sesek
602d1323ed Reparent the webview_zygote to be a child of the main app_process zygote.
This uses the new ZygoteProcess.startChildZygote() method to launch the
webview_zygote, rather than having init start it. This will share more
memory between the app_process and the webview_zygote, reducing the
overall system footprint.

Bug: 63749735
Test: m
Test: Launch "Third-party licenses" activity from Settings, and it
      renders correctly via the WebView.
Change-Id: I3e39cd8adb9c099c92ee34640428916d90cb2b8f
2018-02-20 17:00:41 -05:00
Treehugger Robot
554cfd1f1d Merge "Add Zygote.startChildZygote() to fork a new process that itself is a zygote." 2018-02-17 01:39:54 +00:00
Treehugger Robot
80ae7124f5 Merge "[DO NOT MERGE] Fix context menu position for RTL" 2018-02-16 19:54:26 +00:00
Robert Sesek
d0a190df8a Add Zygote.startChildZygote() to fork a new process that itself is a zygote.
This adds a new --start-child-zygote argument that instructs the main
zygote to create a new child process that will also be a zygote. The
system_server generates a random name in the abstract socket namespace
for it and the child-zygote to communicate over, and that is passed as
an argument to the new process.

A child-zygote bypasses the normal post-fork-child of the zygote process
in order to preserve itself as a zygote. This means not starting the
Binder threadpool nor launching into ActivityThread. Instead, a
child-zygote calls into its own main function. The main function runs a
ZygoteServer select loop, listening on the socket name specified by the
system_server when it was forked.

Unlike the system zygotes, a child-zygote can be killed without bringing
down the system. Killing a child-zygote will not terminate its child
processes, which will be reparented to init for reaping when they
eventually exit.

Bug: 63749735
Test: m (with multi-project commits landed)
Change-Id: I3e7ebbdba498f8fec1d84cdf927dc43a92be4b68
2018-02-16 14:17:41 -05:00
Calin Juravle
b981617ec7 Pass the compilation reason to dexopt
Record the compilation reason in the oat files to enable better
performance monitoring.

Test: DexoptOptionsTest
      manual
Bug: 73102540

Change-Id: Ifa487d4bc33dcd06f12af6bdd1d9a9c5f4562f4b
2018-02-15 12:49:26 -08:00
Calin Juravle
29c772cb48 [framework] Pass .dm files to dexopt at install time
(cherry picked from commit cc65194e8e)

Test: DexoptOptionsTest
      adb install foo.apk foo.dm
Bug: 30934496

Merged-In: If7e705a0efc0954a385ec3bfe7a93921c0d83351
Change-Id: If7e705a0efc0954a385ec3bfe7a93921c0d83351
2018-02-14 08:19:42 -08:00
Calin Juravle
ea6c0ffb4a [framework] Extend profile operations to take the profile name
Extend the installd profile interface to take the profile name as
argument. This shifts the responsibility for choosing the names of
profiles for primary apks completely to PackageManager. Each of the
application code paths will get an unique profile name based on their
split name.

All the profile operations will now work on a specific profile name rather
than assuming a default global name.

Also, move dumpProfiles and clearProfiles functionality to the
ArtManagerService so that we can re-use profileName computations easier.

(cherry picked from commit 6ae39fc2e5)

Test: manual (dexopt apps, merge profiles, clear profiles)
      gts GtsAndroidRuntimeManagerHostTestCases
Bug: 30934496

Merged-In: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
Change-Id: Ie65d45eed7de0844edf4b7af918d7eaa74ec1f2c
2018-02-14 08:19:42 -08:00
Calin Juravle
011603ab76 Support installation of DexMetadata files (.dm)
Add support in the package installer to install dex metadata files
alongside the application apks (base or splits).

During installation or update the dex metadata files will need to have a
matching apk file. The matching is done by checking the file extension
(e.g. base.apk -> base.dm, split_a.apk -> split.dm).

On disk, the metadata files are placed next to the apks.

The .dm files will be used during install-time optimizations and passed
verbatim to dex2oat.

Test: adb shell am instrument -w \
1) adb shell am instrument -w \
  -e class android.content.pm.DexMetadataHelperTest

com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

2) adb install-multiple CtsClassloaderSplitApp.apk
CtsClassloaderSplitApp.dm CtsClassloaderSplitAppFeatureA.apk
CtsClassloaderSplitAppFeatureA.dm CtsClassloaderSplitAppFeatureB.apk

3) gts-tradefed -m GtsAndroidRuntimeManagerHostTestCases

(cherry picked from commit 3fc56c3000)

Bug: 30934496
Merged-In: I86f0a8307705ff3d6a5a85c2fcaae085dd62d4af
Change-Id: I86f0a8307705ff3d6a5a85c2fcaae085dd62d4af
2018-02-14 08:00:56 -08:00
David Brazdil
b3a4aab310 Refactor runtime hidden API flag from negative to positive
There are only two situations in which we want to enable hidden API
access flag checks. Turning the flag from DISABLE_ to ENABLE_
simplifies logic in ART and reduces the number places where the flag
had to be passed down to ART.

Bug: 64382372
Test: boot device, install and run apps, check log messages

(cherry picked from commit f7e31c0a2b)

Change-Id: Ib2f70696d98c6e1500d1d419d6acf0a8d0487213
2018-02-14 10:13:06 +00:00
yuanhuihui
e669ac2520 fix misleading FATAL EXCEPTION IN SYSTEM PROCESS log
There will be the following situations about mApplicationObject:

1) fork app process will invoke ActivityThread.main(),
then set mApplicationObject.

2) fork system_server, don't set mApplicationObject value.

3) using app_process fork process except zygote, will inovke RuntimeInit,
don't set mApplicationObject value。

For example using command as below:
app_process /system/bin com.android.commands.am.Am "$@",

if this process throw uncaught exception,will output FATAL EXCEPTION IN SYSTEM PROCESS log,
it's not in system process but in normal process。

so should add condition: Process.SYSTEM_UID == Process.myUid()

BUG: 72759350
Test: manual

Change-Id: Ie8d769e4149cd9b938577058de871c4f8db9efe5
Signed-off-by: yuanhuihui <yuanhuihui@xiaomi.com>
2018-02-13 12:52:38 +00:00
Treehugger Robot
1a535ba4b9 Merge "BootReceiver: changed deprecated Build.RADIO to Build.getRadioVerison to get non-empty radio firmware version in SYSTEM_LAST_KMSG." 2018-02-07 01:24:36 +00:00
Hugo Benichi
771e229a23 Merge "Update OWNER files for connectivity" 2018-02-04 23:18:52 +00:00
Hugo Benichi
1c8756154a Update OWNER files for connectivity
Test: no functional change
Change-Id: I25276c769468c37970cb1915660fee29e589008c
2018-02-02 12:49:45 +09:00
Siyuan Zhou
4b1e6c3b2f BootReceiver: changed deprecated Build.RADIO to Build.getRadioVerison to get non-empty radio firmware version in SYSTEM_LAST_KMSG.
Test: Manually verified on Pixel 2 XL, Nexus 5X and 6P devices.
BUG:70934228
Change-Id: I40da7e659619e06587409c6b83c655b46bcbd5b2
2018-01-31 16:17:12 -08:00
Vladislav Kaznacheev
b6ec1be492 [DO NOT MERGE] Fix context menu position for RTL
Based on https://android-review.googlesource.com/574843.
Added APCT coverage to verify the fix and prevent regressions.

Bug: 70920189
Test: android.view.menu.ContextMenuTest
Change-Id: Id9ee500751fe6f3da07bf10fb510ac49487104d0
2018-01-31 16:14:49 -08:00
David Srbecky
156ed92c94 Propagate the "dalvik.vm.minidebuginfo" property to ART run-time.
Change-Id: I27e230fe91490defde4cc38ca8cbc3aa0765fed1
2018-01-30 14:37:37 +00:00
David Brazdil
071bcaa906 Set Zygote.DISABLE_HIDDEN_API_CHECKS for system apps
When forking a process for a system app, pass a flag to ART that
will disable enforcement of hidden API access checks.

Test: manual
Bug: 64382372
Change-Id: I5ba81d84a44c9467613f060428b11e1d9d725bd3
2018-01-24 21:42:28 +00:00
David Brazdil
7c48e0e074 Set DEXOPT_DISABLE_HIDDEN_API_CHECKS for system apps
For now, system apps will be exempt from hidden API access checks.
Pass the appropriate flag to dexopt.

Test: manual
Bug: 64382372
Bug: 72305689
Merged-In: I5676ffa3a5ba680bf5f6bab0b62f0acf4a933097
Change-Id: Idc3067d2c6040f15fe0f051090ba45efe591ebae
2018-01-24 14:12:33 +00:00
Chenbo Feng
93afbf258f Use /proc/net/dev to get stats summary
If the qtaguid proc file is no longer exist, the device is running new
eBPF module to do traffic accounting. So the NetworkStatsFactory need to
use the proc/net/dev interface to get the per interface traffic stats
summary. Also, adding a test to verify the helper function work properly

Bug: 30950746
Test: run NetworkStatsFactoryTest
Change-Id: Ia36808bf02f1637dd41a3e7c50917b91b1a77524
2018-01-23 00:35:02 -08:00
Chenbo Feng
828f1b45fb Add bpf support for NetworkStatsFactory
Add the native method used to read the detail information of network
stats from bpf maps. The native method of NetworkStatsFactory should
choose the correct implementation to get the stats detail depending on
the kernel version. Currently the bpf result is printed as a reference
and the actual behavior of NetworkStatsFactory should not change.

Test: NetworkStatsFactory related cts test should not fail.
Bug: 30950746
Change-Id: I4715a23559b5b2306bd556cea0431f0ed172a993
2018-01-23 00:34:53 -08:00
Lorenzo Colitti
ada23ed56a Add the default network to NetworkStats and NetworkStatsCollection.
This allows us to maintain NetworkStats entries that track
whether the traffic was on the default network.

At the moment, the stats collection code always passes in
DEFAULT_NETWORK_NO. However, this value is a no-op, since it is
not persisted to disk. Only the ident, the uid/set/tag, and the
packet/byte/operation counters are persisted.

A future change will add defaultNetwork to the ident and start
persisting it.

Bug: 35142602
Test: runtest frameworks-net
Change-Id: Ifa291c62c0fa389b88e5561086a29dcd7cee2253
2018-01-19 19:49:16 +09:00
Victor Hsieh
c8176efe2e Reland: Move zygote's seccomp setup to post-fork
Before this change, seccomp filter setup is as early as in zygote's main
function.  To make it possible to split app and system server's filter,
this postpone the setup to after fork.  It also starts to call app
specific and system server specific setup function.

The filter setup is done in Zygote's ForkAndSpecializeCommon.  This is
because adding a seccomp filter must be done when either the caller has
CAP_SYS_ADMIN or after the PR_SET_NO_NEW_PRIVS bit is set.  Given that
setting PR_SET_NO_NEW_PRIVS breaks SELinux domain transition
(b/71859146), this must be done after Zygote forks but before
CAP_SYS_ADMIN is droppped.

Test: (cts) -m CtsSecurityTestCases -t android.security.cts.SeccompTest
Test: no selinux denial flood in dmesg with selinux enforced
Test: debuggerd -b `pidof com.android.phone`  # logcat shows tombstoned
      received crash request
Bug: 63944145
Bug: 71859146

Change-Id: I8215c8530d3d0de504a270488f8e29635805e8b0
2018-01-17 09:30:44 -08:00
David Brazdil
3d44ed0dfe Pass targetSdkVersion to installd
Dex2oat now accepts targetSdkVersion as a parameter to determine
whether ART should treat the app as "legacy" and allow or restrict
access to private APIs.

We also bump arguments of otapreopt to v4 to accommodate the new value.

Bug: 64382372
Test: manual
Change-Id: Iae3867325dfaf8deaba51626ab04b97ad797d3b6
2018-01-16 22:36:41 +00:00
Treehugger Robot
54da93b981 Merge "Revert "Move zygote's seccomp setup to post-fork"" 2018-01-10 18:46:36 +00:00
Victor Hsieh
fe6a51fcb5 Revert "Move zygote's seccomp setup to post-fork"
This reverts commit 6a4a339832.

Reason for revert: caused some SELinux error

Bug: 71768585
Change-Id: I0ef270ec6fed1d5d96b4257ec1a2dd6a55a816ed
Merged-In: Ic1b81e146b52b68445ba634de39657f199107da3
2018-01-10 17:22:55 +00:00
Treehugger Robot
5d33c10a96 Merge "Move zygote's seccomp setup to post-fork" 2018-01-09 21:41:19 +00:00
Victor Hsieh
6a4a339832 Move zygote's seccomp setup to post-fork
Before this change, seccomp filter setup is as early as in zygote's main
function.  To make it possible to split app and system server's filter,
this postpone the setup to after fork.  It also starts to call app
specific and system server specific setup function.

In terms of performance since this happens at fork, the measure shows
the overhead is negligible.  Assuming 130 instruction in the BPF, on
walleye, even when running on little core with fixed low frequency, each
setup took about 60.9us on average.  When it runs on big core with
higher frequency, it took about 39.3us.

Test: (cts) -m CtsSecurityTestCases -t android.security.cts.SeccompTest
Bug: 63944145

Change-Id: I748735b478405098beac1e200d911c13ea60e380
Merged-In: I748735b478405098beac1e200d911c13ea60e380
2018-01-09 20:16:01 +00:00
gaochong
cbe2c55a69 Fix ResolverActivity don't show items
ResolverActivity sort the list resolved intent with AsyncTask.
The method sort hold CountDownLatch to wait the time-consuming
operation. In some case, the operation doesn't end and the
CountDownLatch can't be released.The default excutor of AsyncTask
is serial. There should release CountDownLatch in destroy()
to avoid this case.

Change-Id: Ie10126f735d9f511dfe086c21f3f5ffaeb831086
Signed-off-by: gaochong <gaochong@xiaomi.com>
Test: manual - repeatedly test ResolverActivity show correctly
Bug: 71730061
2018-01-09 14:02:23 +08:00
Hugo Benichi
959ee4a7b1 Extend connectivity OWNERS
Also remove 'build.master@android.com' which is deprecated, not
declared by anybody else, and makes the linter unhappy.

Bug: 70394432
Test: built
Merged-In: I9c0ba41386129379f82259fcc5e745562b014fae

(cherry pick from commit 626eed2ac8)

Change-Id: Ie802113d61f693d73f7234b44ac2a9bd462b3fbf
2017-12-14 09:56:56 +09:00
Treehugger Robot
403c8f72e3 Merge "Fixed button bar alignment issue in RTL languages" 2017-12-11 19:10:46 +00:00
Siyuan Zhou
070e318501 BootReceiver: Added an event log after the dropbox file copy is successful.
The log can be used to test if LAST KMSG or other items are copied
to dropbox successfully, especially in user builds without root
privilege.

BUG: 69685635

Test: manually verified the desired log from bugreport on user
and userdebug builds.

Change-Id: I6570d95538d678c98d261690ca3c20416d7a31c6
Merged-In: Ie6033bf04c7f79fc596761ab751aa5fcea2c1130
(cherry-picked from commit bafcd7b595)
2017-12-08 22:51:23 +00:00
susanta.patra
1b0b22ce08 Fixed button bar alignment issue in RTL languages
Buttons should be aligned opposite to English in RTL languages.

Test: 1. RTL language
      2. Create an alert dialog having positive, negative and neutral button.
      3. Check the button bar alignment
Bug: 70363698

Change-Id: I783dfdcf9cb3f85402a4ff3fa4c2d1d1caf5c3da
Signed-off-by: susanta.patra <susanta.patra@lge.com>
2017-12-08 11:55:40 +05:30
Xin Li
220871a697 Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.

Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
2017-11-14 12:31:11 -08:00
con
5c7de22a06 Merge "Fix StateMachine init/quit race." 2017-11-02 20:05:09 +00:00
Calvin On
f5b9f7b50e Fix StateMachine init/quit race.
The quitNow method places the SM_QUIT_CMD at the front
of the queue. This can cause StateMachine to throw exception
if it has not yet processed the SM_INIT_CMD from start().

Bug: 67370902
Test: make checkbuild
Test: StatMachineTest unittest
Change-Id: I409242845854e70b77ad9b2378b69faed076847c
Merged-In: I7cec7bb91e0447e3c565d33cb7c34ccf59566639
2017-11-02 11:40:47 -07:00
Calin Juravle
7ba73dd509 [framework] Add check that classpath is up to date to getDexOptNeeded
(cherry picked from commit 576e6c0cbb)

Bug: 62269291
Test: manual, install new apk/splits and force updates.
I used com.android.cts.classloadersplitapp as the test app.
1) install-multiple split apks with dependency: Base -> A -> B
2) push an update for A
3) adb shell cmd package compile
4) check that A & B got recompiled and that B was because a class loader
context mismatch (e.g. "ClassLoaderContext classpath element checksum
mismatch for position 1.").

Merged-In: I4092562966413dc8976c9d41b26a90bbb9e37e1e
Change-Id: I4092562966413dc8976c9d41b26a90bbb9e37e1e
2017-11-01 08:39:01 -07:00
Shubham Ajmera
3aeca17aa9 Reduce app size by downgrading inactive apps
This will trigger when the device will have low space.
Active apps here refer to the apps which were either active
in foregrond or in background and also used by other packages.
Apps which are inactive for X days downgraded to verify. X is
determined by sysprop pm.dexopt.unopt_after_inactive_days

If the system properties are not set, no effect will take place.

The above operations will take place in background dexopt service.
If user uses the app again, it will again be speed-compiled when
background dexopt service starts next time.

(cherry picked from commit 246dccf932)

Bug: 36598475
Test: manual
* Remove the check in the code that allows downgrade only when
  the space is low on the device.
* adb root
* Set pm.dexopt_unopt_after_inactive_days to 600
* Make sure the current time of the device is correctly set
* Install 2 non system apps - B, C
* Downgrade B to extract
* Upgrade a system apps to speed-profile - E
* Downgrade a system app to quicken - G
* adb shell cmd package bg-dexopt-job

Expected Results:
* Extract - B
* Verify - C
* There should not be any entries for apps E an G
  in dalvik_cache

Merged-In: I68f9f617d6722a7ba8b00aa2181cb38a165cfc51
Change-Id: I68f9f617d6722a7ba8b00aa2181cb38a165cfc51
2017-10-31 14:51:57 -07:00
Mathieu Chartier
c477ab141f Add property for system server compiler filter
The property is dalvik.vm.systemservercompilerfilter, this changes
if dexopt is needed.

(cherry picked from commit 5e07a0d9ca)

Bug: 62356545
Test: adb shell setprop dalvik.vm.systemservercompilerfilter quicken
Test: adb shell stop && adb shell start

Merged-In: I2ef3737f24816a4cb75e718abf274a891eb9fda1
Change-Id: I2ef3737f24816a4cb75e718abf274a891eb9fda1
2017-10-31 11:28:43 -07:00
Jeff Sharkey
1285cfd48f Change storage migration to use quota APIs.
New quota APIs are much faster than trying to measure manually, and
removing this last user of calculateDirectorySize() means we can
remove it once and for all.

(cherry picked from commit c8b29ac6f0)

Bug: 36056324
Test: builds, boots
Merged-In: Ibdf1ee4e8885680e106df6a9269b6309ddc61af8
Change-Id: Ibdf1ee4e8885680e106df6a9269b6309ddc61af8
2017-10-31 09:50:50 -07:00
Tobias Thierer
66d1933ce0 OWNERS: Prefer Jeff Sharkey's @android.com account over @google.com
He prefers to use his @android.com account.

Test: Treehugger
Bug: 63673347
Exempt-From-Owner-Approval: Allow @android.com to approve this CL :)

Change-Id: Ie80cc7864de7b91ae44ad57f0bae9b859d034803
2017-10-30 17:53:11 +00:00
Etan Cohen
d870cd33f5 Merge "Add Runnable mechanism to WakeupMessage"
am: 5964b55654

Change-Id: Iab0414f644223d69602e8e93a636eaa46137d873
2017-10-21 02:17:30 +00:00
Etan Cohen
1861ea9df4 Add Runnable mechanism to WakeupMessage
The WakeupMessage object provides a mechanism to create an Alarm
which will wake-up the device and deliver a message to a Handler.

Add a Runnable mechanism as an alternative to the message.

Bug: 67276378
Test: unit test
Change-Id: Icf5f03b2b25a340273f9d3fcd09f182216ea6238
2017-10-20 13:32:00 -07:00
Tobias Thierer
07efe116b1 Merge "Framework: Prefer android.system.Os over libcore.io.Libcore.os"
am: 5f04db96b3

Change-Id: If85216d03022708787a7218e494434453d5548e3
2017-10-19 14:25:12 +00:00
Tobias Thierer
6217e37d30 Framework: Prefer android.system.Os over libcore.io.Libcore.os
This is a pure refactoring with no a behavior change other than
that these calls now go through android.system.Os, which immediately
delegates to Libcore.os.

This is a first step towards separating framework (via
android.system.Os) vs. libcore (via Libcore.os) clients of these
low level APIs. Separating these is a prerequisite towards moving
the API parts of android.system into framework, and moving the
rest into a different package in libcore.

Test: Treehugger
Bug: 67901714

Change-Id: Ifd8349ec5416e5693f40dba48fdf2bef651b7d81
Merged-In: Ifd8349ec5416e5693f40dba48fdf2bef651b7d81
2017-10-18 14:53:57 +01:00
Bookatz
20e22f6248 Batterystats handles nested unoptimized ble scans
When a ble scan starts, it tells batterystats whether that scan is
unoptimized. When the scan stops, batterystats is not informed of
whether the stopped scan was unoptimized. Because the ble scan call
could not be nested (couldn't call start twice without stopping first),
this was fine, but now nesting is possible, so batterystats needs to
know whether the stopped ble scan is unoptimized.

Bug: 63456783
Test: runtest -x frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
Test: no new errors when run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.BatteryStatsValidationTest#testUnoptimizedBleScans

Change-Id: Ia73f294cf1807ddaf20f1c0bcc28add001cac78c
Merged-In: Ia73f294cf1807ddaf20f1c0bcc28add001cac78c
(cherry picked from commit 94c5a313d7)
2017-10-16 23:18:30 +00:00
Patrik Torstensson
7528452f57 Merge "Incorporate slab reclaimable into meminfo" into oc-mr1-dev
am: 20fb01eb23

Change-Id: Ia6afee63376c98552c3a5a0ee249fa751c3d3603
2017-10-13 07:35:04 +00:00
Patrik Torstensson
20fb01eb23 Merge "Incorporate slab reclaimable into meminfo" into oc-mr1-dev 2017-10-13 01:30:40 +00:00
Robert Benea
5e099800f8 Incorporate slab reclaimable into meminfo
Instead of using the whole slab mem for kernel usage, split the
unreclaimable to kernel and reclaimable to cache (since is freed
under mem. pressure).

Test: tested on gobo
Bug:67753120
Change-Id: I0f5a310bb88603ad7bb28e5398ea57c249c04fc2
2017-10-13 00:41:47 +00:00
Andreas Gampe
245ecc9a95 Merge "LoggingPrintStream: Make visible for testing" am: 7d1789867b am: dcb8cf8732
am: 0db4c361e3

Change-Id: I10e61d65cd05c8d93d43a2fefee841023ec35889
2017-10-10 21:29:12 +00:00