Commit Graph

13378 Commits

Author SHA1 Message Date
Makoto Onuki
079f6d7fa6 Merge "Serialize AM.getContentProvider() calls in client side" into pi-dev 2018-06-01 05:35:02 +00:00
Makoto Onuki
b6c79ea065 Serialize AM.getContentProvider() calls in client side
Th wait() call in AMS.getContentProviderImpl() can cause a deadlock when it
starts a new process for a target provider and all system server binder threads
are reaching out to the same provider at the same time, because AMS won't be
able to receive a callback from the provider process.

Let's serialize access to AM.getContentProvider() to avoid this scenario.

Longer team, we should stop waiting in the system server and instead do so in
the client side.

Bug: 74523247
Test: Boot, add a google account, and let syncs run and finish.
Test: Watch free video on Coursera

Change-Id: If5be2dc4b6f22f72d1bb3aa1b5b4d49f20c8d94d
2018-05-31 14:52:51 -07:00
Jason Monk
ce1beadc09 Don't use stable providers for slices
Because they aren't what we want.

Test: manual + existing tests
Bug: 80532760
Change-Id: Ib69799a2ef9440d0d67cea02e6b3c61844535755
2018-05-31 14:12:52 -04:00
Amith Yamasani
a1ce963743 Fix for missing location icon
OpEntry.duration was being used to indicate that the
operation was still running if -1 is returned. A recent
change caused a regression.

Adding a new mRunning field in OpEntry to explicitly
hold the running state, even when partial duration is
updated.

Change-Id: Ib29f4c903f990aaa202e84f964959aedfc24abdb
Fixes: 80242152
Test: atest FrameworksServicesTests:AppOpsActiveWatcherTest
Test: Launch maps and verify the location icon is visible
      in the status bar
2018-05-28 21:20:56 -07:00
TreeHugger Robot
64a33d695d Merge "Final cleanups to permission slices" into pi-dev 2018-05-25 22:10:20 +00:00
Selim Cinek
c4e19963f4 Merge "Fixed the behavior of group conversations when targeting P" into pi-dev 2018-05-25 20:06:52 +00:00
Jason Monk
b14dde0793 Final cleanups to permission slices
- Add icons to the right and shortcut modes
 - Add color
 - Make sure dialogs are secure

Test: manual
Bug: 79960669
Change-Id: I6d251b0ea5bd3c1b3eed32b184e4aae22c52ffb5
2018-05-25 15:42:16 -04:00
Selim Cinek
ce8794fbbc Fixed the behavior of group conversations when targeting P
Fixes an issue where the group conversation heuristic was still
applied even when the app is targeting P. We're now following
the isGroupConversation completely and only do the migration
for apps targeting < P.

Change-Id: I471d58e8a8f5e6270f0dcce8691d08a2bdd1c582
Fixes: 78450835
Test: add messaging notification, observe correct display
2018-05-25 09:16:38 -07:00
Makoto Onuki
621fd20f55 Merge "Tweak exemption for sync requests made by FG apps" into pi-dev 2018-05-24 23:22:09 +00:00
Michael Wachenschwanz
14c61286c4 Merge "Revert "Revert "Write UsageEvents Parcel data as a Blob""" into pi-dev 2018-05-24 20:45:34 +00:00
TreeHugger Robot
cf2c35dca6 Merge "Revert "WallpaperColors hint computation"" into pi-dev 2018-05-24 20:00:27 +00:00
Michael Wachenschwanz
76d03fcd7e Revert "Revert "Write UsageEvents Parcel data as a Blob""
This reverts commit 8520e56998.

Reason for revert: Bug Fixed
Bug:79860717
Bug:80215357

Change-Id: Ibaabe3c6bab72f417b24121a91ec5f953ad18ff7
2018-05-24 17:36:47 +00:00
Lucas Dupin
b5e5053ebc Revert "WallpaperColors hint computation"
This reverts commit c50f47d970.

Fixes: 79465234
Reason for revert: Google still does it using private APIs and apps were relying on this behavior, not good for the ecosystem.

Change-Id: I62e2b4cd1e6e562fcdd89c97e599bcdade83381a
2018-05-24 16:33:14 +00:00
Michael Wachenschwanz
d55c618340 Merge "Revert "Write UsageEvents Parcel data as a Blob"" into pi-dev 2018-05-24 15:54:05 +00:00
Michael Wachenschwanz
8520e56998 Revert "Write UsageEvents Parcel data as a Blob"
This reverts commit f5bae21c5e.

Reason for revert:
Bug: 79860717
Fixes: 80215357

Change-Id: I0768e5ce0a95afe7ff091c0035335437bb33c46c
2018-05-24 15:45:17 +00:00
Makoto Onuki
d5f25d2cd8 Tweak exemption for sync requests made by FG apps
Exemption given to a sync request made by a foreground app (including
PROCESS_STATE_IMPORTANT_FOREGROUND).
At the schedule time, we promote the sync adapter app for a higher bucket:
- If the device is not dozing (so the sync will start right away)
  promote to ACTIVE for 1 hour.
- If the device is dozing (so the sync *won't* start right away),
promote to WORKING_SET for 4 hours, so it'll get a higher chance to be started once the
device comes out of doze.
- When the sync actually starts, we promote the sync adapter app to ACTIVE for 10 minutes,
so it can schedule and start more syncs without getting throttled, even when the first
operation was canceled and now we're retrying.

Test: atest cts/tests/tests/syncmanager/
Test: Manual test with "requestsync -f" and "am set-standby-bucket", while checking
"dumpsys usagestats"
Test: settings put global app_idle_constants \
  exempted_sync_scheduled_nd_duration=1,exempted_sync_scheduled_d_duration=2,exempted_sync_start_duration=3
  and check "dumpsys usagestats" and make sure the constants are properly updated.
Fixes: 72443754

Change-Id: I233d8e4be85769150830bac798abc04810f4cc7b
2018-05-23 14:50:05 -07:00
TreeHugger Robot
452936192f Merge "DO NOT MERGE Allow cross user usage event queries" into pi-dev 2018-05-23 21:49:56 +00:00
TreeHugger Robot
615f8039af Merge "Write UsageEvents Parcel data as a Blob" into pi-dev 2018-05-23 21:38:48 +00:00
Chalard Jean
ccf93b2792 Merge "Fix: ConnectivityManager is initialized with a wrong context" into pi-dev 2018-05-23 17:59:59 +00:00
Julia Reynolds
20e682910d DO NOT MERGE Allow cross user usage event queries
For multipackage requests, caller must be system uid or hold
interact_across_users if not requesting fate for the same user.

For single package requests, caller must be system uid or the
same package and hold interact_across_users if not requesting data
for the current user.

In both cases the caller must have the usagestats permission.

Test: couldn't find automated tests for this file; manual
Bug: 79142791
Change-Id: I8d650f8e875e0e4578cb48c9ba42e821342852a0
2018-05-23 09:51:13 -04:00
TreeHugger Robot
d018bc4346 Merge "Hiding the icon of notifications that were replied to" into pi-dev 2018-05-23 05:51:30 +00:00
TreeHugger Robot
9e3d7d6378 Merge "Allowing the notification to be a bit bigger for the remote input history" into pi-dev 2018-05-23 05:43:16 +00:00
Selim Cinek
b0dc61b503 Hiding the icon of notifications that were replied to
Because those notifications now stay around but the user
has already seen them, were hiding the icon instead.

Change-Id: I6b8590e31295ed79218698b1ac54df33b273d38c
Fixes: 78486801
Test: add notification, reply, observe icon gone
2018-05-22 19:48:37 -07:00
Selim Cinek
bee4e074bb Allowing the notification to be a bit bigger for the remote input history
This also fixed the squishing when heads-upped by only allowing
one remote input text to be visible when heads upped.

Change-Id: I0c77931233b452420dee4dcf4772092d96d214c9
Fixes: 78877946
Test: add inbox style with 6 entries, reply a few times, observe no squishing
2018-05-22 19:00:35 -07:00
TreeHugger Robot
4245b12ef9 Merge "Marks deprecated StatsManager APIs." into pi-dev 2018-05-22 17:20:34 +00:00
Steven Wu
a14c6b9cad Do not throw IllegalArgumentException in slice manager.
Test: manual
Bug: 80087497
Change-Id: Ic05c812f41d0153c8745b08718513d4e095ab27b
2018-05-22 09:08:22 -04:00
TreeHugger Robot
31ec39297c Merge "Reduce LoadedApkAssets LRU cache size." into pi-dev 2018-05-22 11:09:18 +00:00
Richard Uhler
7bd7a369e4 Reduce LoadedApkAssets LRU cache size.
The cached apk assets can take up multiple megabytes of .apk mmap and
native memory for associated data structures. Reduce the cache size
for potential multi-megabyte memory savings with hopefully no
noticeable performance impacts.

In particular, rough estimates of the memory and performance impacts
of this change were evaluated by starting the launcher app,
sampling system server PSS with dumpsys meminfo and cache stats using
dumpsys activity for a few different cache sizes:

LRU Size   1: cached apks: total= 1 created=0 evicted=33 hit= 0 miss=34 max=1    TOTAL PSS=187542
LRU Size   3: cached apks: total= 3 created=0 evicted=12 hit=19 miss=15 max=3    TOTAL PSS=190606
LRU Size  15: cached apks: total=15 created=0 evicted= 0 hit=19 miss=15 max=15   TOTAL PSS=199350
LRU Size 100: cached apks: total=15 created=0 evicted= 0 hit=19 miss=15 max=100  TOTAL PSS=201416

Comparing cache stats after launching the settings app:

LRU Size   3: cached apks: total=3 created=0 evicted=5 hit=14 miss=8 max=3
LRU Size  15: cached apks: total=6 created=0 evicted=0 hit=18 miss=6 max=15

Running performance tests locally to ensure no clear regression in app
startup:

app-startup/benchmark-app-hermetic/cold-dropcache-test:
LRU                15        3        3
activityStart:    40.47    38.53    39.27
bindApplication:  24.40    24.53    24.93
draw:              4.27     4.33     4.07
layout:            0.73     1.07     0.73
onCreate:          9.40     9.00     8.53
totalLaunchTime: 183.13   183.27   187.07

app-startup/hermetic-apps/cold-dropcache-test:

LRU                   15       15          3         3
Calculator_avg:      333.9    333.1      343.3      334.6
Calculator_max:      345.0    360.0      370.0      363.0
Calculator_median:   333.5    331.5      343.5      333.5
Calculator_min:      320.0    317.0      320.0      311.0
Calculator_std_dev:    6.62    13.26      18.22      16.51
Clock_avg:           510.0    511.2      509.2      512.6
Clock_max:           529.0    528.0      530.0      529.0
Clock_median:        510.5    509.0      503.5      512.0
Clock_min:           498.0    495.0      487.0      492.0
Clock_std_dev:         7.70    11.71      15.25      11.07
Contacts_avg:        457.7    527.3      507.3      543.9
Contacts_max:        602.0    622.0      591.0      588.0
Contacts_median:     410.5    568.5      568.0      580.0
Contacts_min:        390.0    374.0      366.0      394.0
Contacts_std_dev:     85.64    96.80      88.80      72.97
Phone_avg:          6073.1    6109.7    6110.8     6115.8
Phone_max:          6196.0    6208.0    6180.0     6222.0
Phone_median:       6070.0    6117.5    6100.0     6133.5
Phone_min:          5982.0    5990.0    6061.0     5994.0
Phone_std_dev:        61.49     67.35     34.55      60.17
Settings_avg:        457.9     446.6     451.6      428.7
Settings_max:        487.0     468.0     494.0      449.0
Settings_median:     460.0     450.0     444.5      424.0
Settings_min:        423.0     421.0     431.0      420.0
Settings_std_dev:     21.21     12.02     20.46       9.71

Bug: 79115008
Test: Device boots.
Test: dumpsys activity all shows ResourcesManager max cache size of 3.

Change-Id: I7225b6978fac6197c27bec23d2b477fb1f5aee43
2018-05-22 10:52:40 +01:00
Michael Wachenschwanz
f5bae21c5e Write UsageEvents Parcel data as a Blob
If too many events are queried from UsageStats, the Parcel will be too
big for a transaction. If the data is written as a Blob, the Parcel will
store too large data in ashmem.

Test: atest android.app.usage.cts.UsageStatsTest
Test: manual (create 1MB in UsageEvents and queryEvents)
Bug: 79860717
Change-Id: Ieb4bd486c83a9cc11fdff55e8fa457a9bdca7395
2018-05-21 21:16:18 -07:00
David Chen
f94b4936b4 Marks deprecated StatsManager APIs.
Marking some API's as deprecated, so users avoid getting confused.

Test: Test that build works.
Bug: 80099023
Change-Id: I4b3d4e4fa1ee3d706e49b8180aa4d0ad0e7d6eeb
2018-05-21 17:40:56 -07:00
TreeHugger Robot
c81ed627ab Merge "Allow UiAutomation being used off the main thread" into pi-dev 2018-05-21 20:03:10 +00:00
Svet Ganov
452dbebd0e Allow UiAutomation being used off the main thread
Test: cts-tradefed run cts -m CtsUiAutomationTestCases
      cts-tradefed run cts -m CtsAccessibilityServiceTestCases
      cts-tradefed run cts-instant -m CtsAccessibilityServiceTestCases

bug:80024164

Change-Id: I72c565d28f4cbcf6775535fb846b268b785a6b34
2018-05-21 09:55:32 -07:00
Jorim Jaggi
6b8014f5c8 Merge "Schedule trimMemory after drawing the frame" into pi-dev 2018-05-18 18:26:03 +00:00
Jorim Jaggi
b29e318e03 Schedule trimMemory after drawing the frame
Fixes jank issues where trimMemory gets scheduled during an
animation. trimMemory likely hits code that is not in the
page cache anymore, leading to high execution time because of page
misses. Scheduling it after the next frame has been drawn
minimizes the risk that this page miss actually causes jank.

Test: Boot, switch between a couple of apps.
Bug: 78611607
Change-Id: Ia1fc411fbe6ca07861183ae484124406681118e5
2018-05-18 18:26:30 +02:00
Kenny Guy
8cc15d2ebf Keep notification when sending smart reply.
If an app cancels a notification while we are
sending a smart reply then don't dismiss the
notification.

Bug: 79120026
Test: atest NotificationEntryManagerTest
Test: atest SmartReplyControllerTest
Test: atest statusbar.NotificationListenerTest
Test: atest NotificationRemoteInputManagerTest

Change-Id: Ibbc0014ae0aeb12b58be13c041d720903251490f
2018-05-17 20:16:25 +01:00
TreeHugger Robot
5f8e42f7f0 Merge "Adde back check to make sure Activity.recreate() is called on main thread." into pi-dev 2018-05-17 05:01:33 +00:00
Wale Ogunwale
0527d9129d Adde back check to make sure Activity.recreate() is called on main thread.
Change-Id: Id8fa7e1c17ee3d42a19c82dc8cc1fec2de1757d1
Fixes: 79703568
Test: Existing test pass.
2018-05-16 17:23:48 -07:00
Dianne Hackborn
cd835ba418 Merge "More app ops fg/bg tuning" into pi-dev 2018-05-16 19:48:54 +00:00
TreeHugger Robot
0689312acb Merge "Add some null checks to slices" into pi-dev 2018-05-16 14:27:42 +00:00
Daniel Sandler
4da6e1f3b0 Merge "Improved notification interruptiveness calculation." into pi-dev 2018-05-16 14:23:38 +00:00
Dan Sandler
7d67bd4fd7 Improved notification interruptiveness calculation.
Apparently comparing Spannables is dangerous because
the various Span classes do not implement .equals() in any
meaningful way, so all CharSequences must be converted to
flat Strings before being compared.

Lots of additional debug code remains, for the next time we
don't understand why an innocuous notification update
appears to be interruptive.

Test: atest com.android.server.notification.NotificationManagerServiceTest
      atest com.android.server.notification.NotificationTest
Bug: 78643290
Change-Id: I1c282238687f28b5b197e28a4b878dc697049f4d
2018-05-16 08:32:09 -04:00
Jason Monk
8938932a0a Add some null checks to slices
It'll make developer debugging experience sooo much nicer.

Test: manual
Bug: 79773776
Change-Id: Ie0a826c5572752e2bb50db7669374a1698333770
2018-05-15 21:13:16 -04:00
TreeHugger Robot
33da7043af Merge "Add shell command to get slice permissions" into pi-dev 2018-05-16 00:12:32 +00:00
Jason Monk
7f01f3b619 Add shell command to get slice permissions
Lets shell/root get a list of pkgs that have access to any slices
within an authority.

Test: manual
Bug: 78136892
Change-Id: Id33fd458ed5ad73b30f69b3a464676428344e446
2018-05-15 18:55:49 -04:00
Kodlee Yin
4b3a547107 Update RemoteInput#setChoices documentation
The behavior that #setChoices didn't render on mobile devices from apps
that target SDK < P went undocumented. Because this is changing in P and
above, this documentation needs to point out this behavior.

Also updated formatting and style of docs to improve interop with
kotlin.

Test: none
Bug: 79244189
Change-Id: Iabfe3b2ddcc369e5ec15f9773481468cbc48dabb
2018-05-15 19:46:57 +00:00
TreeHugger Robot
c1eddaed6e Merge "Rethrow SecurityExceptions in UsageStatsManager" into pi-dev 2018-05-15 17:40:32 +00:00
Dianne Hackborn
e93ab41d2a More app ops fg/bg tuning
- Only report that something has changed when a uid changes between
  the restricted and unrestricted states.  (Adds new constant that
  defines this important division point.)

- Have different settle times for different key transitions: (a)
  out of the top state, (b) out of any other unrestricted state,
  (c) down to a lower background state.

- But, don't apply any settle time when transitioning from top to
  another unrestricted state...  there is no need to.

Bug: 78480444
Test: manual
Change-Id: Ife772858009a6da5c286e285a4059aea3ad3f6c7
2018-05-15 10:27:40 -07:00
TreeHugger Robot
c46279aa98 Merge "Fix crash when loading resources without code" into pi-dev 2018-05-15 16:33:20 +00:00
Jason Monk
2544c6917a Fix crash when loading resources without code
Should use default appComponentFactory, not the actual one from the
app because we have no code.

Test: manual
Change-Id: I982967543c4cf5c28b19b36b6d183a30052bf602
Fixes: 78883500
2018-05-15 11:30:09 -04:00
Chalard Jean
100df0a66c Fix: ConnectivityManager is initialized with a wrong context
ActivityThread#setHttpProxy uses a system context to get
a ConnectivityManager instance. If it's not already cached, the
system service registry will cache this instance initialized
with the system context, and subsequent calls to get this service
will return the bad instance.
This patch uses the application context instead, unless it's
not available for some unlikely reason.

A possible symptom of this issue is to have Bluetooth tethering
failing with a security exception, because it's requested by
the "android" package without system uid.

Bug: 73572062
Test: manual
Change-Id: I745707e4ffe564f6d201ec259fa6b5ee32fbeda6
2018-05-15 23:18:05 +09:00