Commit Graph

10604 Commits

Author SHA1 Message Date
TreeHugger Robot
b128866274 Merge "Prepare setresuid()/setresgid() seccomp filter in AppZygote." 2019-01-18 22:10:09 +00:00
TreeHugger Robot
af102b9782 Merge "Plumb Context#mUser to TextServicesManager to TextServicesManagerService" 2019-01-18 17:19:11 +00:00
Bo Zhu
f37f0cc30a Merge "Add an optional metadata blob for recoverable application keys" 2019-01-18 17:17:53 +00:00
Yohei Yukawa
9f141ee802 Plumb Context#mUser to TextServicesManager to TextServicesManagerService
This is a follow up CL to our previous CL [1], which enabled spell
checker for background users.  In that CL, we assumed that spell
checker user ID can and should always be determined by the calling
user ID.  This assumption is not valid at least for direct-reply
notifications on System UI, because System UI always runs as user 0 no
matter who is the current active user.

In order to allow TextServicesManagerService (TSMS) connect to the
right user for such a special use case, this CL introduces a hidden
parameter "userId" to each IPC so that clients that have
INTERACT_ACROSS_USERS_FULL can override the target user ID when
necessary.

For instance, to interact with user 10's spell checker services, you
can obrain a special instance of TextServicesManager as follows.

  TextServicesManager tsmForUser10 = context
          .createPackageContextAsUser("android", 0, 10 /* userId */)
          .getSystemService(TextServicesManager.class)

If the calling process does not belong to user 10, any operations on
that TextServicesManager will result in SecurityException unless the
calling package needs to have INTERACT_ACROSS_USERS_FULL.

This CL is just a preparation.  There should be no user-visible
behavior change yet.

 [1]: I06c27ef834203a21cc445dc126602c799384527b
      06a2624049

Bug: 123043618
Test: spell checker still works
Change-Id: I31dda3ae8795190d44b0622b8335c34ddbc5dd48
2019-01-18 09:17:16 -08:00
Aurimas Liutikas
feccee99fa Merge "Remove old private constant from ResourceId." 2019-01-18 16:53:46 +00:00
Yohei Yukawa
0f5eade4a4 Introduce @hide EditorInfo#targetInputMethodUser
This is a preparation to propagate the expected IME user ID from
direct-reply notification to InputMethodManagerService (IMMS).

When per-profile IME mode [1] is enabled, IMMS basically assumes that
the IME user ID should be determined by calling process's user ID.
This works for most of apps, but does not work for direct-reply hosted
in the System UI process, which always runs as user 0.

With this CL, client apps can explicitly specify the target IME user
ID by using @hide field in EditorInfo.  For instance, to tell IMMS to
connect to user 10's IME, do this:

 @Override
 public InputConnection onCreateInputConnection(EditorInfo info) {
    InputConnection ic = super.onCreateInputConnection(info);
    info.targetInputMethodUser = UserHandle.of(10);  // user 10
    return ic;
 }

The calling process will receive SecurityException if it does not
belong to user 10 and does not have INTERACT_ACROSS_USERS_FULL.

This CL is just a preparation.  There should be no user-visible
behavior change yet.

 [1]: Ied99664d3dc61b97c919b220c601f90b29761b96
      a878b9500e

Bug: 120744418
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: Ia7ea944438d69669ccdf9111b34ba400e786a602
2019-01-18 08:48:07 -08:00
Martijn Coenen
86f08a5190 Prepare setresuid()/setresgid() seccomp filter in AppZygote.
The application zygote can run untrusted user code; since it also
has the capability to change the uid/gid of the process, we need
to ensure that any changes to the uid and/or gid stay within the
range that we have allocated for this application zygote.

For application zygotes, we install the app_zygote seccomp
filter instead of the regular app filter; the only difference
between this filter and the app one is that it allows
setuid/setgid calls.

To further limit this, pass down the allocated UID range to the
Zygote itself, which in turn installs an additional seccomp
filter that restricts setuid/setgid calls to this range.

The actual calls into seccomp are commented out until the seccomp
changes are merged; to avoid catastrophe, this will leave the
regular app filter for the app_zygote, which is more restrictive
and doesn't allow setuid at all.

Bug: 111434506
Test: atest CtsSeccompHostTestCases passes
Change-Id: I112419629f5ee4774ccbf77e2b1cfa5ddcf77e73
2019-01-18 16:37:09 +01:00
Mehdi Alizadeh
b4367b7bab Merge changes from topic "shortcuts-for-sharing"
* changes:
  Disable the use of new share target API in ShareSheet
  Loads direct share targets from ShortcutManager in ShareSheet
2019-01-18 02:42:32 +00:00
Bo Zhu
c704834cb6 Add an optional metadata blob for recoverable application keys
This metadata, if present, will be authenticated (but unencrypted)
together with the application key material.

Bug: 112191661
Test: atest FrameworksCoreTests:android.security.keystore.recovery
      atest FrameworksServicesTests:com.android.server.locksettings.recoverablekeystore
      atest -m RecoveryControllerHostTest RecoverableKeyStoreEndtoEndHostTest RecoverySessionHostTest

Change-Id: I2846952758a2c1a7b1f0849e1adda1f05a3e305e
2019-01-17 17:38:19 -08:00
Mehdi Alizadeh
3c335a2213 Disable the use of new share target API in ShareSheet
Bug: 111698461
Test: Manual test using test app
Change-Id: Ibd77a55d879bb301d96b81fe42e5b70311cea7e4
2019-01-17 16:03:19 -08:00
Aurimas Liutikas
d8ebfefcee Remove old private constant from ResourceId.
Bug: 122967079
Test: make -j builds
Change-Id: I3e999044df02549e84208d38bb77d2ce1d1bd73b
2019-01-17 12:51:58 -08:00
TreeHugger Robot
db11760580 Merge "Log Content Capture and Augmented Autofill requests." 2019-01-17 20:01:46 +00:00
Mehdi Alizadeh
406e8b36a1 Loads direct share targets from ShortcutManager in ShareSheet
Bug: 111698461
Test: Manual test using test app
Change-Id: I4f315d186363cc76578ee551cc55349e3e266593
2019-01-17 11:52:39 -08:00
Lucas Dupin
842af1ecd6 Merge "Add support to SLPI tap gestures" 2019-01-17 02:38:09 +00:00
Zhi An Ng
11b63629de Defer sending of ACTION_CHARGING
ACTION_CHARGING is sent when the device is in a good enough charging
state for power-heavy work to be done. It was sent immediately when this
determination was done:
1. plugged in and level >= 90
2. plugged in and level is increasing
However this lead to many jobs being ungated when this happen, and
defeats the purpose of plugging in your device to get a quick boost.

In the case of 2. we defer the sending of ACTION_CHARGING by a
configurable time, defaulting to 15minutes, after said determination.

The adb command to play with this is:

adb shell settings put global battery_stats_constants battery_charged_delay_ms=90000

Bug: 111360323
Test: Set the delay to 15s, then cmd battery unplug and reset,
verify that broadcast is sent in dumpsys activity broadcasts
Change-Id: I71f8d06604041efeba12fbdfd0374aaff2f04807
2019-01-16 23:53:17 +00:00
Lucas Dupin
d43bf70c58 Add support to SLPI tap gestures
This CL introduces a new configurable sensor type: config_dozeTapSensorType

Test: atest SystemUITests
Test: set config_dozeTapSensorType to double tap gesture on overlay
Bug: 121198822
Bug: 111414690
Change-Id: I54f3c20473a6d97c860ee02f324edbcf89ba85d1
2019-01-16 11:45:40 -08:00
Felipe Leme
930f324b10 Log Content Capture and Augmented Autofill requests.
Test: manual verification
Bug: 111276913
Bug: 111330312

Change-Id: I84c23a60ed83d429b72600145e3c3877835ebe78
2019-01-15 17:17:09 -08:00
TreeHugger Robot
bf4dd15b37 Merge "Use networkStatsService to get detailed network uid stats." 2019-01-15 20:08:44 +00:00
TreeHugger Robot
b3b4662226 Merge "Fix issue #122854187: Need to report page fragmentation in procstats protobuf" 2019-01-15 08:46:59 +00:00
Dianne Hackborn
9f669bf27d Fix issue #122854187: Need to report page fragmentation in procstats protobuf
Add the page fragmentation data to the current protobuf.

Also fix bugs in how it was being collected...  the data in the kernel
didn't match what it was collecting (it was combining node and zone
together in a zone int...  but node is an int, zone is a separate
string).

Example new output:

vailable pages by page size:
Node   0 Zone     DMA       Unmovable      0     1     1     1     0     1     1     0     0     0     0
Node   0 Zone     DMA     Reclaimable      1     1     0     1     1     1     1     1     1     0     0
Node   0 Zone     DMA         Movable      1     1     0     0     1     0     1     0     1     1   291
Node   0 Zone     DMA             CMA      1     1     0     0     0     1     1     1     1     1    35
Node   0 Zone     DMA         Reserve      0     0     0     0     0     0     0     0     0     0     1
Node   0 Zone     DMA         Isolate      0     0     0     0     0     0     0     0     0     0     0
Node   0 Zone  Normal       Unmovable      1     9     3     2     1     0     1     0     1     0     0
Node   0 Zone  Normal     Reclaimable      0    15     3     3     1     0     1     0     1     0     0
Node   0 Zone  Normal         Movable      0     1     1     1     0     0     1     1     0     1   338
Node   0 Zone  Normal             CMA      0     0     0     0     0     0     0     0     0     0     0
Node   0 Zone  Normal         Reserve      0     0     0     0     0     0     0     0     0     0     2
Node   0 Zone  Normal         Isolate      0     0     0     0     0     0     0     0     0     0     0

Change-Id: I029d59b8d088b20fafaea04dde766012c3d448cd
Fixes: 122854187
Test: manual
2019-01-14 16:40:56 -08:00
Chenbo Feng
e62e287511 Use networkStatsService to get detailed network uid stats.
The native implementation of network stats no longer keep a persistent
stats since boot. Everytime networkStatsService read the detail stats,
the data will be cleaned for performance reason. For the service that
are directly calling networkStatsFactory, the results are no longer
accurate anymore. Use the binder interface provided by
networkStatsService instead to get a cumulative detailed uid stats since
device boot.

Bug: 111441138
Test: android.app.usage.cts.NetworkUsageStatsTest
Change-Id: I230c1edbf64cfeb3dbb560db368b5e420f7b79a4
2019-01-14 11:35:27 -08:00
TreeHugger Robot
4a09436a63 Merge "Remove scheduled unbind if service died" 2019-01-14 18:26:54 +00:00
Shubang Lu
726a71c0db Merge changes Iac5d191d,Ia090bd70,I61f7bf38,Ibc9b7071,I889b6cdc, ...
* changes:
  Add launchDeviceDiscovery when devices just plugged into the current device or the current device just conneted to a TV.
  Fix pathToPort logic in HdmiControlService
  Update the power status of an existing hdmi device with TIF once receive Report Power Status or Active Source from the existing device.
  Add HDMI device info into TIF once receive report Physical Address or Set Osd Name from a new device.
  Change the pathToPort(int path) method in HdmiControlService to apply to not only TV device.
  Modify on hotPlug logic for Audio devices
  Add array and add/remove methods to track connected device info
  Modify doManualPortSwitching logic in Audio System
  Add HdmiSwitchClient and move isSwitch property to system ro property
  Wake up device when device is in dozing but CEC power status is on.
2019-01-14 18:17:43 +00:00
Mady Mellor
344731a8aa Merge "Closer to notification model & updates on bubbles" 2019-01-14 17:28:31 +00:00
Philip P. Moltmann
26f8b80d92 Remove scheduled unbind if service died
Otherwise the handleUnbind will try to unbind from a dead service
which causes an IAE.

Bug: 117779333
Test: Killed service-app while service was bound. Save death, but not
      IAE anymore
Change-Id: Iff91feaf0656a349ba38391ea9294bda49e3e61a
2019-01-14 17:08:26 +00:00
Philip P. Moltmann
883ff1a65d Automatically unbind for AbstractRemoteService
No need for services to think about unbinding anymore. Now the
AbstractRemoteService counts how many requests are not yet finished and
once the number of unfinished requests drops to zero, schedules an
unbind.

Bug: 117779333
Test: - Started settings which makes many calls to
        PermissionControllerManager. Saw the automatic unbind to eventually
        happen.
      - atest CtsContentCaptureServiceTestCases (with content capture
        enabled and with content capture disabled)
      - atest CtsAutoFillServiceTestCases (4 tests out of WebViewActivityTest fail without and with this change)
Change-Id: Ief2f3512df5a1c55694c0c6b449079a49089bcde
2019-01-12 19:13:28 +00:00
Amy
17ee20fc66 Add HdmiSwitchClient and move isSwitch property to system ro property
ag/5246742

Test: local tested
Bug:112478040
Change-Id: I62b33b0a4c69a0c4b3760706b48b63cf858e435b
2019-01-11 16:20:56 -08:00
Eugene Susla
40335c1be9 Merge "Mirgate default SMS app handling to RoleManager" 2019-01-11 21:23:34 +00:00
Mady Mellor
3f2efdbf5d Closer to notification model & updates on bubbles
* Introduces BadgedImageView / BadgeRenderer for icon & badging
  -> These are both semi-temporary until I move things over to using
     icon library

* Introduces "shouldShowInShade" bit on NotificationData, this is used
  to indicate whether a bubble's notification should display in the
  shade or not
* BubbleController uses NotificationEntryListener to annotate notifs
  bubble state & add / update / remove bubbles
* Cleans up expansion / dismissing / visibility in BubbleController

General notif / dot / bubble behaviour:
* When a bubble is posted, the notification is also in the shade and
  the bubble displays a 'dot' a la notification dots on the launcher
* When the bubble is opened the dot goes away and the notif goes away
* When the notif is dismissed the dot will also go away
* If the bubble is dismissed with unseen notif, we keep the notif in shade

go/bubbles-notifs-manual has more detailed behavior / my manual tests

Bug: 111236845
Test: manual (go/bubbles-notifs-manual) and atest BubbleControllerTests
Change-Id: Ie30f1666f2fc1d094772b0dc352b798279ea72de
2019-01-11 12:53:32 -08:00
Svetoslav Ganov
9a788837ef Merge "Historical app ops." 2019-01-11 18:48:55 +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
Kevin Chyn
1bafe67c78 Merge changes from topic "face-small"
* changes:
  2/n: Add BiometricPrompt implicit UI
  1/n: Add BiometricPrompt#setRequireConfirmation(bool) API
2019-01-10 22:50:08 +00:00
Kevin Chyn
e191271230 2/n: Add BiometricPrompt implicit UI
In small mode, tapping the gray are is ignored. Combined
StatusBar#showBiometricTryAgain into onBiometricAuthenticated(bool)

We now create a new BiometricDialogView object for each BiometricPrompt
authenticate call. This makes the view's lifecycle much easier to manage.

Bug: 111461540

Test: Small -> Big when error or rejected
Test: Small -> Authenticated looks good
Test: Try again button is shown when rejected
Test: Icon spacing looks good after animation
Test: Big/small state persists across configuration change

Change-Id: Id0157a7506cea9b0e7de079c43f8bd5ba3cbd8c5
2019-01-10 11:11:27 -08:00
Eugene Susla
4ab9511993 Mirgate default SMS app handling to RoleManager
This includes laying down some groundwork to make the remaining migrations
more straightforward

Bug: 110557011
Test: atest RoleManagerTest && atest SmsManagerTest
Change-Id: Ie96abd73751d10f521756c9dcdab2a5710ca2045
2019-01-10 10:41:10 -08:00
Lucas Dupin
03270e1f37 Merge "Config to disable rounded corners" 2019-01-10 17:44:31 +00:00
TreeHugger Robot
26d4ca07c9 Merge "Fix 2 issues related to caption." 2019-01-10 00:12:51 +00:00
Lucas Dupin
f36d0dcfca Config to disable rounded corners
Some devices shouldn't render rounded corners because of graphics
limitations.

Bug: 122347746
Test: swipe up on multiple types of devices: walleye, sailfish, blueline
Change-Id: I93fcb4283ed1aa3df5569454483a8867a3bfd06b
2019-01-09 11:52:09 -08:00
Chenbo Feng
ccee30ed1b Merge "Adjust map names due to new bpfloader" am: 9613bfd2a4 am: 59ce36a44d
am: 5fb25b6389

Change-Id: Iedbb541ba2fa5916048e3f40d5cc128a83d0dc6b
2019-01-09 11:34:54 -08:00
Chenbo Feng
5fb25b6389 Merge "Adjust map names due to new bpfloader" am: 9613bfd2a4
am: 59ce36a44d

Change-Id: I28a2e41a354abdd8b2113c927a6489ea8710b431
2019-01-09 11:15:44 -08:00
Treehugger Robot
9613bfd2a4 Merge "Adjust map names due to new bpfloader" 2019-01-09 18:34:49 +00:00
Garfield Tan
3b9613c257 Fix 2 issues related to caption.
1. This change ignores immersive mode request if the window is not in
fullscreen mode in terms of caption visibility;
2. Update caption visibility when app changes system UI visibility.

This change also consolidates the visibility logic into DecorView.

Bug: 119388201
Test: Manual test. Also test that split screen and PIP don't have
caption.

Change-Id: Ia5051d2f53455be2c21e1933b002d07b25c0b74b
2019-01-09 10:17:39 -08:00
Felipe Leme
c0c15a3f90 Moved AutofillManager.SyncResultReceiver to an internal utility package
Bug: 121047489
Test: atest CtsAutoFillServiceTestCases # which is crashing due to unrelated issue

Change-Id: I4aba260e9878b1b420dfb7290f2389199c32a82f
2019-01-08 11:18:05 -08:00
Shafik Nassar
c4530c80b5 Merge "Display Default Browser on top in ResolverActivity" 2019-01-07 11:47:48 +00:00
Martijn Coenen
2ce0d86a77 Call into application to do AppZygote preloading.
For now, assume a class named <package_name>.ZygotePreload
exists, with a method named doPreload() to do the preload.

This should probably be replaced by having an entry in
the manifest.

Bug: 111434506
Test: preload called
Change-Id: Id632e46087eb5c719e6b310ffe007f76d3cbaf7d
2019-01-07 09:10:31 +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
Shubang Lu
00b976a7df Forward volume keys when system audio mode off and property set
cherry-pick ag/4968405

Bug: 80296335
Test: make; local tests
Change-Id: I04b7cd0958c9300a76f6337ee891b5f4947484ad
2019-01-04 22:11:05 +00:00
Chenbo Feng
6880d632ab Adjust map names due to new bpfloader
With the new loader support added. The bpf map format is defined by bpf
kernel program as well. Change the netd bpf program to the new format.

Test: CtsUsageStatsTestCases
Bug: 112334572
Change-Id: I34e38e0a8cf0cca54dc52ec897771452f9d90525
2019-01-04 12:06:35 -08:00
shafik
6cbef1973e Display Default Browser on top in ResolverActivity
This fix is a continuation for fixing 116610086
ResolverComparator identifies that it's dealing with a http/https scheme
The original behaviour was to prefer native apps that can handle that
specific URL over browser apps. This behaviour is preserved with the
exception of the Default Browser, as it will be preferred over all other
apps and will be displayed on top, then will be followed by native apps.

In addition, removed unused imports in ResolverComparator (import
ERRORs that prevented the pre-upload repo hook scripts from passing)

Bug: 116610086
Test: manually tested on device (Pixel 2XL) with multiple users
Test: atest ResolverListControllerTest
Change-Id: Ifd5da932c6f9d9cb4bf0a97985d0f9fb7bc2cb69
2019-01-04 14:49:24 +00:00
Rhed Jao
9aa8aa1c06 Merge "Refine spoken feedback string for a11y shortcut dialog" 2019-01-04 08:05:51 +00:00