Commit Graph

5950 Commits

Author SHA1 Message Date
Kweku Adams
21909c112b Merge "Moving BatterySaverPolicy into batterysaver directory." 2019-01-11 19:41:14 +00:00
Svetoslav Ganov
9a788837ef Merge "Historical app ops." 2019-01-11 18:48:55 +00:00
Alexey Kuzmin
b0e7c48c8b Merge "Split ring and notification vibration settings" 2019-01-11 13:51:16 +00:00
TreeHugger Robot
cbdbc4d9c6 Merge "Add a privileged API for capturing and consuming bugreports" 2019-01-11 12:37:33 +00:00
Svet Ganov
8455ba2341 Historical app ops.
This change is the main check in for the historical app op feature.
The idea is to store a historical data about past app op rejections,
accesses, and durations per op for any UID state indefinitely.

Keeping all operations on record is not practical as app ops are
very frequently performed. To address this we are storing aggregated
data as snapshots where we store for every UID and its packages
how many times each op was accessed, rejected, lasted as an aggregate.

To allow history scaling indefinitely we are taking a logarithmic
approach with only the most recent state stored in memory and all
preceding state stored on disk. State on disk is stored in separate
files where each preceding file, i.e. for an older period, would
cover X times longer period with X number of snapshots covering
X times longer period. Initially X is ten but can be tweaked. For
example, the first file could contain data for ten days with daily
snapshots, while the file for older period would have data
for a hundred days with snapshots every ten days, etc.

The implementation is optimized for fast history update and no impact
on system runtime performance and minimizing memory footprint. We
are lazily persisting state to disk on a dedicated thread as this is
slow. We are also reading the relevant historical files on a query
as this is very rare as opposed to state updates.

The base snapshot interval, i.e. snapshot time span, in the initial
iteration and the logarithmic step are configurable. These can be
changed dynamically and the history would be rewriten to take this
into account.

Test: atest CtsAppOpsTestCases

bug:111061782

Change-Id: I55c32c79911ba12b2ace58d2a782b8df1e6bff60
2019-01-10 19:31:31 -08:00
TreeHugger Robot
d9e60a633d Merge "Add missing @NonNull" 2019-01-10 17:41:29 +00:00
Nandana Dutt
d11850cd44 Add a privileged API for capturing and consuming bugreports
The API is mostly implemented; except for hooking up the listener
and handling an already running bugreport.

BugreportManager is the handle to the new API exposed to apps.

Generating bugreports requires root privileges. To limit the footprint
of the root access, the actual bugreport generation in Dumpstate binary,
is accessed as a oneshot service and dies after it finishes
running.

System server accesses Dumpstate via a binder interface since it does
not have root privileges.

Starting a oneshot service is done via setting a system property, which
needs to be done from system server. BugreportManagerService is the
new system server service that does this. BugreportManager calls into
BugreportManagerService via a binder interface, since the former is in
the app's process.

Both app to system server as well as system server to native service
calls are via implementations of IDumpstate binder interface.

Bug: 111441001
Test: builds. Flashed & verified it boots.
Test: wrote a test client (not included) and verified invoking
startBugreport works.

Change-Id: I4abeb753388c055c36ae0dd916af1ec8d40b7bf0
2019-01-10 17:33:58 +00:00
Alexey Kuzmin
ccdaebb5f7 Split ring and notification vibration settings
Synchronize settings between sound and accessibility menus

Bug: 116172311
Test: See accessibility vibration settings - ring and notification
settings sould be separate. Try changing vibration settings in sound and
accessibility menus - the settings should stay in sync.

Change-Id: Ia0276dfdd0efafe211c14cda140831b57f8c42b1
2019-01-10 16:36:48 +00:00
Yiwei Zhang
0c9ccbe456 Merge "GUP: Update global property for the new dev opt" 2019-01-10 00:33:39 +00:00
Jakub Pawlowski
4a89978068 Merge "Revert "Enable ANGLE-for-Android rule processing again"" 2019-01-10 00:32:15 +00:00
Jakub Pawlowski
c3174593a2 Revert "Enable ANGLE-for-Android rule processing again"
This reverts commit e674a54078.

Reason for revert: b/122509524 Random bluetooth crash observed in QP1A.190108.001

Change-Id: I089e30665edf70275d4190bac0577329b4f016a9
2019-01-10 00:24:34 +00:00
Kweku Adams
7fb72a4a83 Moving BatterySaverPolicy into batterysaver directory.
This should make adding new methods that shouldn't be public easier.

Bug: 119261320
Test: atest com.android.server.power.PowerManagerServiceTest
and com.android.server.power.batterysaver.BatterySaverPolicyTest
and com.android.server.power.batterysaver.BatterySaverStateMachineTest

Change-Id: I8fdba4257be3d5602a738d2fffd55385775c3f81
2019-01-09 14:38:52 -08:00
John Reck
13f08e69b7 Add missing @NonNull
Change-Id: I343dd13a7f8518959c7b75162c5cebc5f933ae6f
Fixes: 122549813
Test: n/a
2019-01-09 11:16:28 -08:00
Nikita Ioffe
0800858b02 Merge "Add Binder.getCallingUidOrThrow method" 2019-01-09 16:07:56 +00:00
Nikita Ioffe
a929cf01cf Add Binder.getCallingUidOrThrow method
Binder.getCallingUidOrThrow is a pure java method which uses
Binder.isHandlingTransaction @CriticalNative method.

Binder.isHandlingTransaction itself is not exposed a public API.

Bug: 62253865
Fix: 62253865
Test: Added a testcase to BinderTest.java to verify ISE is thrown
Change-Id: I93a1b6c24a4747b8b70c32d291b4706b6159a3d0
2019-01-09 13:15:56 +00:00
TreeHugger Robot
75d4db712d Merge "Add systrace tag for RRO" 2019-01-08 22:33:55 +00:00
Alex Kershaw
cb577bca43 Merge "Map error code 51 to an incorrect OS error." 2019-01-08 16:32:23 +00:00
TreeHugger Robot
b7343581aa Merge "Enable ANGLE-for-Android rule processing again" 2019-01-08 00:44:43 +00:00
Martijn Coenen
01e719bebb Allocate isolated UID ranges for app zygote and its children.
Introduce a new range of app-zygote isolated UIDs, [90000..98999].
For each app that uses an application Zygote, allocate a range of
100 isolated UIDs. The application Zygote for an app will get a
UID out of that range, and all other children that are forked
from that zygote will get a UID from the same range.

Bug:  111434506
Test: app Zygote and its children run in the new range of
      isolated UIDs (with SELinux disabled). New set of
      tests for UID allocators pass.

Change-Id: I7a6883a5ddb95683932c93ea77f4e52d8f37fa4f
2019-01-07 09:10:31 +00:00
Martijn Coenen
7e6fa6727c Initial support for application Zygote.
When an application has requested isolated services to be spawned
from an app zygote, we need to spawn the app zygote itself, and then
ask it to fork an isolated service.

The application zygote currently only creates the class loader, and
doesn't do much else. We keep track of the isolated services that
use the app zygote, and when the last isolated service goes away,
we stop the app zygote itself (after a timeout).

The app zygote itself runs with the app's UID and under the app
seccomp filter. That last one is too restricted, so this currently
only works with SELinux disabled.

Future CLs will add an application callback for preloading.

Test: start multiple isolated services with useAppZygote="true",
      verify app_zygote starts, services start as a child of
      app_zygote. Stopping all services stops app_zygote as well.

Bug: 111434506

Change-Id: I10ee1d4bd148c9298974d434fbc5e5eccbec16cb
2019-01-07 09:10:31 +00:00
Jeff Sharkey
a1767a290a Grant/revoke legacy "Storage" permissions.
The new isolated storage model we're building in Q introduces new
strongly-typed media permissions which replace the broad "Storage"
runtime permission.

That legacy "Storage" permission is marked as being "removed", and
it also splits into the new media permissions, but apps are confused
when they request the "Storage" permission, which no longer appears
as granted when the user accepts the new split media permissions.

After discussing with the permissions team, the best short-term
solution is to add special-case logic that grants the legacy
permissions when *any* of the new media permissions have also been
granted.  Only when the user revokes *all* of the new media
permissions is the legacy permission then revoked.  (MediaProvider
is already internally filtering the relevant content based on what
new media permissions the caller holds.)

Bug: 121227859
Test: manual
Change-Id: Ic87f7f93a816e91f7189509386255a260378c255
2019-01-05 12:59:06 -07:00
Ian Elliott
e674a54078 Enable ANGLE-for-Android rule processing again
Test: Manual testing of various programs
Test: cts-tradefed run singleCommand cts -m CtsAngleIntegrationHostTestCases
Bug: b/121153494
Change-Id: Ie6065da7a5365d825639fa6c2fcc8a7b1b33ff50
2019-01-04 14:10:19 -07:00
Junyu Lai
864ead76b1 Merge "Ignore ipv6 tx traffic on clat uid." am: bd73798585 am: cb53e78f56
am: 3c6bc9b14d

Change-Id: I1ac85ac863026ea99117c5b0115bcc0c9144fb7b
2019-01-04 08:47:41 -08:00
Junyu Lai
3c6bc9b14d Merge "Ignore ipv6 tx traffic on clat uid." am: bd73798585
am: cb53e78f56

Change-Id: I0f289ce46462f494adb99628bd504cafb584eeeb
2019-01-04 08:30:44 -08:00
Alex Kershaw
7bcb2fa2dc Map error code 51 to an incorrect OS error.
Error code 51 is given when trying to downgrade a device, so this is
required to fix our broken CTS test and give an accurate error code to
the admin.

Change-Id: I436fb7a605dc47dc5388c78c67d7db08ffcf867a
Fixes: 120896091
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.DeviceOwnerTest#testInstallUpdate
2019-01-04 15:18:46 +00:00
Dario Freni
2b9930d0b7 Merge "Write staged sessions to /data/staging." 2019-01-04 10:20:23 +00:00
Junyu Lai
bd73798585 Merge "Ignore ipv6 tx traffic on clat uid." 2019-01-04 09:29:10 +00:00
Yiwei Zhang
51015a756b GUP: Update global property for the new dev opt
We updated the development opt in mechanism for GUP. Now we have
GUP_DEV_OPT_IN_APPS for applications selected to use GUP and
GUP_DEV_OPT_OUT_APPS for applications selected not to use GUP.

Bug: 119221883
Test: Build, flash and boot, verify with prototype
Change-Id: I52869ecf9e411a8dbdc1146f00c82023ba41bebf
2019-01-04 11:01:19 +08:00
TreeHugger Robot
a449853e6e Merge "Rename updatable graphics driver to Game Update Package." 2019-01-03 23:06:35 +00:00
Mårten Kongstad
5668589f69 Add systrace tag for RRO
Introduce a new systrace tag, TRACE_TAG_RRO, for use with runtime
resource overlay.

Bug: 119761810
Test: builds
Change-Id: I7b883d107a9ae2b12bbda04b74001a68e2a904aa
2019-01-03 07:24:28 -08:00
Peiyong Lin
3a1be746c0 [GUP] Hard code the name of the whitelist file.
Allowing customized whitelist filename could result in inconsistency and
fragmentations in toolings.

BUG: 120870520
Test: Build, flash and boot
Change-Id: Ibe9337b358b6a67600048f1661d73574d7bea607
2019-01-02 17:46:55 -08:00
Peiyong Lin
b33ffca825 Rename updatable graphics driver to Game Update Package.
We have rebranded this project to Game Update Package, and GUP for short.

BUG: 119221883
Test: Build, flash and boot. Verify by going to developer options.
Change-Id: If284bd3e0b29cb025833be29fa33179011c151d7
2019-01-02 17:00:00 -08:00
Dario Freni
a8f4b13166 Write staged sessions to /data/staging.
If a session is marked as isStaged, write the package files directly on
a directory named /data/staging/session_${SESSION_ID}, instead of the
/data/app temporary directory. This allows us to set different SELinux
policy (e.g. allowing apexd to read that directory), and to persist the
data across reboots without altering the existing code.

To ensure we cover existing workflows, in this CL we try as much as
possible to re-use existing code to create staging directories and wire
data into them.

Bug: 118865310
Test: Verified that adb install --staged file.apk successfully creates a
/data/staging/session_SESSION_ID/base.apk file. If --apex is passed, the
file is named base.apex.
Change-Id: Iacfd7cfb90b738eeb752fec3e6a4e38ea307259a
2019-01-02 23:38:57 +00:00
Mathew Inwood
8501ae1763 Merge "Limit access to suspected false positives." am: aeda49d185
am: 152d5a5dcd

Change-Id: I8e10322e69d2d479079df5cf8fec0287c7c117f1
2019-01-02 05:00:54 -08:00
Mathew Inwood
55418eada5 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 14:26:35 +00:00
Mathew Inwood
31755f94e1 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 11:50:04 +00:00
Remi NGUYEN VAN
708c409598 Merge "Add NetworkStack app" am: d01eaecbd2 am: e1922923fc
am: 5673820f9b

Change-Id: Idcd7b9b6eb50a98bcee67f89b0112b91cd1b40fb
2018-12-25 17:21:18 -08:00
Remi NGUYEN VAN
5673820f9b Merge "Add NetworkStack app" am: d01eaecbd2
am: e1922923fc

Change-Id: Iebe5aa5ea7cd235b8a6e734bde0f9a14dce5acdc
2018-12-25 17:09:42 -08:00
Remi NGUYEN VAN
c094a5402c Add NetworkStack app
The app is not started yet, and does not contain any service for now.

Test: built, booted
Bug: b/112869080
Change-Id: Id5a0fd02c891100e85d86b1040e53beec3581950
2018-12-25 11:42:42 +09:00
Tim Van Patten
6a297058eb Merge "Refactor for Better Resource Management" 2018-12-20 19:28:23 +00:00
TreeHugger Robot
7fa78c545b Merge "Add StorageVolume#createOpenDocumentTreeIntent" 2018-12-20 15:49:11 +00:00
Tim Van Patten
a7577bfa7a Refactor for Better Resource Management
The GraphicsEnvironment/GraphicsEnv code is being refactored to allow
for better resource management related to open files and file
descriptors and reducing the amount of times the rules files are parsed.

This is also laying the groundwork for other modules to query if ANGLE
will be loaded or not, for example to display a dialog box to the user
when ANGLE is selected for an app.

Bug: 120910315
Test: Verify CtsAngleIntegrationHostTestCases passes.
Change-Id: Iedd4e8cd3c79c6656bc824def228213f76ef9849
2018-12-20 15:47:09 +00:00
Tim Van Patten
e8a25e3dbc Merge "Use intent-filter to enforce that only a single ANGLE APK is present" 2018-12-19 21:00:23 +00:00
TreeHugger Robot
3a84b83f27 Merge "ParcelFileDescriptor: updates for O_CLOEXEC (API >= Q)" 2018-12-19 00:49:35 +00:00
Nick Kralevich
0c48b94e61 ParcelFileDescriptor: updates for O_CLOEXEC (API >= Q)
For apps which target Q or above, add the O_CLOEXEC flags to
ParcelFileDescriptors.

O_CLOEXEC is essential for ensuring that file descriptors do not leak
across an exec() boundary. Setting O_CLOEXEC ensures that file
descriptors can't linger around unnecessarily in an exec()ed process
which doesn't use them, making more efficient use of resources.
Additionally, O_CLOEXEC is important in ensuring that untrusted
exec()ed code cannot take advantage of leaked file descriptors.

Test: Android compiles and boots
Bug: 120983106
Change-Id: Idb3eb8f0e43968396a3b3a8bddc26a8d94c55bde
2018-12-18 14:46:20 -08:00
Jeff Sharkey
0b6adaab7a Merge "Snapshot isolated storage feature flag at boot." 2018-12-18 20:23:44 +00:00
Nick Kralevich
8190c6b625 Merge "NativeHandle.java: dup() with O_CLOEXEC" am: 760e074e50 am: d5a101dd7f
am: 558bf26377

Change-Id: I0b26064af01eae55df2717b9b71bf37026b2161a
2018-12-18 12:21:08 -08:00
Nick Kralevich
558bf26377 Merge "NativeHandle.java: dup() with O_CLOEXEC" am: 760e074e50
am: d5a101dd7f

Change-Id: If4b615a9a2d35d4f9c294bffa470fe6aed90a9f6
2018-12-18 11:46:53 -08:00
Ken Chen
21afd86c39 Merge "Remove 'hasDns' parameter" am: 3176e8be7a am: c7af83f4ff
am: d8dec0ca80

Change-Id: Id10bcc14ad837b8a358e8be70f36a6cfc94620ab
2018-12-18 11:08:50 -08:00
Ken Chen
d8dec0ca80 Merge "Remove 'hasDns' parameter" am: 3176e8be7a
am: c7af83f4ff

Change-Id: I43080dc7922ab6b8b1c61f7a2542dd8cead45bc5
2018-12-18 10:50:11 -08:00