71 Commits

Author SHA1 Message Date
Jeff Sharkey
c7c4a74a78 Improve OWNERS coverage across frameworks/base/. am: fab0ab3c9c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1519383

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0211462ecbcd9ad66f66af87e31cf12e1582fc65
2020-12-08 16:01:16 +00:00
Jeff Sharkey
fab0ab3c9c Improve OWNERS coverage across frameworks/base/.
As general background, OWNERS files expedite code reviews by helping
code authors quickly find relevant reviewers, and they also ensure
that stakeholders are involved in code changes in their areas.

Some teams under frameworks/base/ have been using OWNERS files
successfully for many years, and we're ready to expand them to cover
more areas.  Here's the historical coverage statistics for the last
two years of changes before these new OWNERS changes land:

-- 56% of changes are fully covered by OWNERS
-- 17% of changes are partially covered by OWNERS
-- 25% of changes have no OWNERS coverage

Working closely with team leads, we've now identified clear OWNERS on
a per-package basis, and we're using "include" directives whenever
possible to to simplify future maintenance.  With this extensive
effort, we've now improved our coverage as follows:

-- 98% of changes are fully covered by OWNERS
-- 1% of changes are partially covered by OWNERS
-- 1% of changes have no OWNERS coverage

This specific change is automatically generated by a script from
detailed ownership information confirmed by team leads.

Bug: 174932174
Test: manual
Exempt-From-Owner-Approval: refactoring with team leads buy-in
Merged-In: I9789c97c1de8e5d962b48c29c57d82fe83729eba
Change-Id: I9789c97c1de8e5d962b48c29c57d82fe83729eba
2020-12-08 08:36:27 -07:00
Xin Li
d31ee38811 Merge rvc-qpr-dev-plus-aosp-without-vendor@6881855
Bug: 172690556
Merged-In: I78222391b83a4add8e964340ec08bb8a1306e1c6
Change-Id: I28bbf40820674675ccf765c912aa8140d3f74ab2
2020-12-02 00:38:58 -08:00
Trung Lam
f1ab984b11 Fix issue with saving protos to disk during shutdown.
Test: Built and tested on device.
Bug: 172789268
Change-Id: I9cb65e7560f92387e92234929a0b7881f84d7b8f
2020-11-09 08:27:39 +00:00
Song Hu
943c807473 DO NOT MERGE Put parameterized weights on top two sharing shortcuts of each app as per shortcuts native ranking in PeopleService Sharesheet model. am: eedf47cbf5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12684673

Change-Id: I29e0c19f954fc6ce8538a2300279a42120569106
2020-09-25 07:50:55 +00:00
Song Hu
eedf47cbf5 DO NOT MERGE Put parameterized weights on top two sharing shortcuts of each app as per shortcuts native ranking in PeopleService Sharesheet model.
By default weights are 0 which ensures ranking same as what it is now.

Bug: 168212835
Test: atest com.android.server.people.prediction.SharesheetModelScorerTest
Change-Id: I02eaa5b6a448c33b51e5f4c6acaba93e7a2bd995
2020-09-24 22:18:49 -07:00
Jeff Sharkey
05e513d1c5 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Test: none
Bug: 168334533
Exempt-From-Owner-Approval: docs updates
Change-Id: I8aa4186f44957fc69aebceeeff1e6584b4eebd5a
2020-09-14 10:00:12 -06:00
TreeHugger Robot
d5fe3bf3ac Merge "Factor native ranks provided by apps into shortcut targets ranking. This would help rank shortcuts targets properly when there is no enough sharing history on them." into rvc-dev 2020-06-11 13:56:11 +00:00
Song Hu
a4157a3b3b Factor native ranks provided by apps into shortcut targets ranking.
This would help rank shortcuts targets properly when there is no enough sharing history on them.

Bug: 158022238
Test: atest com.android.server.people.prediction.ShareTargetPredictorTest
Change-Id: If802dcfea5c9c8442349c2c67fa71bb4b431cca9
2020-06-10 15:42:56 -07:00
Song Hu
005ce7cae6 Merge "Return empty map when queryUsageStatsForUser returns null in UsageStatsQueryHelper#queryAppUsageStats." into rvc-dev 2020-06-01 18:05:09 +00:00
Song Hu
0c1b59a83a Return empty map when queryUsageStatsForUser returns null in UsageStatsQueryHelper#queryAppUsageStats.
Bug: 157877874
Test: atest com.android.server.people.data.UsageStatsQueryHelperTest
Change-Id: Ib6574d18d42f6d2bd9041b53d43abcbb1db99323
2020-06-01 05:41:10 -07:00
Song Hu
f9d930b8e4 File 'open with' flow would trigger sharesheet with null intentFilter,
In this case, return empty list for direct share, default list for app share, skip
reporting sharing targets.

Bug: 157647326
Test: manually test File 'open with' flow
Change-Id: I3efb87a84048e5d1b2d58b1cc9669eb4568956dd
2020-05-29 16:53:51 -07:00
Mehdi Alizadeh
a3d22cec32 Adds cacheFlags parameter to cache/uncacheShortcuts() methods
Bug: 155135890
Test: atest ShortcutManagerTest1 ShortcutManagerTest11 \
            ConversationInfoTest DataManagerTest \
            NotificationManagerServiceTest
Change-Id: Idda777ba032546bd616ee3079b9c8dc8676dc589
2020-05-26 03:30:55 +00:00
Song Hu
bf9cb7e6e3 Promote frequently sharing apps as per monthly stats fetched from UsageStatsManager, in case PeopleService does not store enough sharing events when users just swicth to Sharesheet ranking in PeopleService.
Bug: 156320324
Test: atest com.android.server.people.prediction.ShareTargetPredictorTest
Test: atest com.android.server.people.prediction.SharesheetModelScorerTest
Test: atest com.android.server.people.data.UsageStatsQueryHelperTest

Change-Id: Iae7a3a8195ae4901cd1d9d673fe0cf8a27845488
2020-05-20 15:37:26 -07:00
Song Hu
c0128fa07d Merge "Changes in PeopleService to supprot ChooserTarget ranking. 1. Pass app share score from PeopleService to Aosp. 2. Skip storing ChooserTargets sharing event in PeopleService. 3. Adjust frequest used app promo decay." into rvc-dev 2020-05-05 07:08:26 +00:00
Jeff Sharkey
559130df3f Merge "Add custom Error Prone check for SDK comparisons." into rvc-dev 2020-05-04 23:10:06 +00:00
Jeff Sharkey
4d1d7b56cd Add custom Error Prone check for SDK comparisons.
Over the years we've had several obscure bugs related to how SDK level
comparisons are performed, specifically during the window of time
where we've started distributing the "frankenbuild" to developers.

Consider the case where a framework developer shipping release "R"
wants to only grant a specific behavior to modern apps; they could
write this in two different ways:

1. if (targetSdkVersion > Build.VERSION_CODES.Q) {
2. if (targetSdkVersion >= Build.VERSION_CODES.R) {

The safer of these two options is (2), which will ensure that
developers only get the behavior when *both* the app and the
platform concur on the specific SDK level having shipped.

Consider the breakage that would happen with option (1) if we
started shipping APKs that are based on the final R SDK, but are
then installed on earlier preview releases which still consider R
to be CUR_DEVELOPMENT; they'd risk crashing due to behaviors that
were never part of the official R SDK.

Bug: 64412239
Test: ./build/soong/soong_ui.bash --make-mode services RUN_ERROR_PRONE=true
Exempt-From-Owner-Approval: trivial blueprint changes
Change-Id: Ia20181f8602451ac9a719ea488d148e160708592
2020-05-04 23:09:48 +00:00
Song Hu
7e134c22eb Changes in PeopleService to supprot ChooserTarget ranking.
1. Pass app share score from PeopleService to Aosp.
2. Skip storing ChooserTargets sharing event in PeopleService.
3. Adjust frequest used app promo decay.

Bug: 151112858
Test: atest com.android.server.people.prediction.ShareTargetPredictorTest
Test: atest com.android.server.people.prediction.SharesheetModelScorerTest
Change-Id: If27d0c914b9f156403950e7ea601b4a7ad35b27f
2020-05-04 15:58:26 -07:00
Danning Chen
f4ba1c22a6 Uncache the shortcuts when Android system shuts down if the notification settings are not changed
Change-Id: Ib7e23f4b15ccca9c162cea187a26e7d89b8976a8
Test: Manual test
Test: atest DataManagerTest
Bug: 153357090
2020-04-30 23:37:56 -07:00
Danning Chen
28410f3def Cache the shortcut when the associated notifications are posted and uncache when they are gone
Change-Id: Ia569f9b31a0fe73242f2e6350805afe7c06d2cdf
Bug: 153357090
Test: Manual test
Test: atest DataManagerTest
Test: atest NotificationManagerServiceTest
2020-04-23 13:52:44 -07:00
Danning Chen
07cfaa6b08 Keep the conversation shortcut criteria in People Service consistent with the one in Notification Manager
Before this change, People Service uses the presence of the Person object
in ShortcutInfo as the criteria of conversation shortcut. This changes
the criteria that the shortcut needs to be a share shortcut instead of having Person object.

Change-Id: I1ea52a50c909ca96365c1d4e55af97931d048d8f
Test: atest ShortcutHelperTest
Test: atest DataManagerTest
Bug: 154254830
2020-04-21 10:51:20 -07:00
Susi Kharraz-Post
dde9c3afc8 Add sharesheet statsd logging
Add a Logger for sharesheet and add calls into ChooserActivity.java

Bug: 147508495
Test: manual testing and added unit tests into ChooserActivityTests.
Change-Id: I0024b5020f47475a28c4745af4d8ef268e5f85be
2020-04-03 11:07:19 +00:00
Song Hu
1d73eaf431 Factor freqeuncy and mimetype of past sharings, foreground app into
sharesheet model. Promote most frequent sharable apps to tackle cold
start issue when device doesn't hold enough sharing history.

Bug: 149822311
Test: manual test Sharesheet ranking on device
Test: atest com.android.server.people.prediction.ShareTargetPredictorTest
Test: atest com.android.server.people.prediction.SharesheetModelHelperTest
Test: atest com.android.server.people.data.UsageStatsQueryHelperTest
Change-Id: I6eb764448c0619cbc3b320b5f6432f559d1a15e1
2020-03-26 06:18:52 -07:00
Danning Chen
161f57512f Run PeopleService#onUserStopping on a background thread
Bug: 151481286
Test: atest com.android.server.people.data.DataManagerTest
Change-Id: If2b9215597ef280600c8834f414de780e3ef4f0b
2020-03-18 21:11:47 -07:00
Danning Chen
13b2112c8a Merge "Run PeopleService.onUserUnlocked() on worker thread instead of main thread" into rvc-dev 2020-03-11 05:51:26 +00:00
Dmitri Plotnikov
261d5d65fd Allow PeopleService to make blocking binder calls
Bug: 149788799
Test: presubmit

Change-Id: Ia23c96ce34942e95b029240e0d087b614e19b0f4
2020-03-10 22:59:05 +00:00
Danning Chen
a44febc6e2 Run PeopleService.onUserUnlocked() on worker thread instead of main thread
This change is targeting on reducing the latency to unlock a user. It
includes these changes:
(1) In DataManager.onUserUnlocked(), execute the listeners registration
code on a worker thread.
(2) Merge the usage stats service query and data persistence to one thread.
(3) Adjust the query events max age from 1 day to 5 mins because we
already persist those events in PeopleService. No need to re-query those
events.

With this change, PeopleService.onUserUnlocked() execution is reduced
from ~200 ms to <1ms. And listeners are set up after conversations being
loaded from the disk. This ensures at the events query time (such as
UsageStatsService query), all the conversations are already available in
People Service to avoid missing some events (events without an
associated conversation are dropped).

Change-Id: I5248afa2771588a2434c335867de4e2d1a2eb6f3
Test: atest com.android.server.people.data.DataManagerTest
Test: atest com.android.server.people.data.ConversationStoreTest
Test: atest com.android.server.people.data.PackageDataTest
Bug: 150733302
2020-03-09 17:50:19 -07:00
Danning Chen
18fecf78d3 Fix the bug that queries UsageStatsService for locked users
In addition to the bug fix, this also changes the user lifecycle callbacks People Service is using:

1) onUserUnlocking() -> onUserUnlocked()
2) onUserStopped() -> onUserStopping()

The user lifecycle callback changes are based on a recent callback API
change in ag/10396717. This change will make the service run safer: it
avoids performing queries on locked users.

Change-Id: I4d0ebdb80f2181b5eb5a636d345c53a01c7df210
Test: Manual test
Test: atest com.android.server.people.data.DataManagerTest
Bug: 150882079
2020-03-05 16:38:25 -08:00
Trung Lam
d28d403f8f Merge "Fix events/<key> folders not being deleted during onDestory." into rvc-dev 2020-03-02 19:31:56 +00:00
Trung Lam
a23db05da5 Merge "Fix unit tests for people service." into rvc-dev 2020-03-02 19:31:43 +00:00
Trung Lam
070b71cfa4 Fix events/<key> folders not being deleted during onDestory.
Change-Id: Ib9eb9d493d7e6b216d1182b15807e028b9f42bed
Test: Built and tested on device.
Bug: 150395599
2020-02-27 15:04:58 -08:00
Trung Lam
2dcfcc1dee Fix unit tests for people service.
Change-Id: I27f46b65055880f53fccc0e8a609c520fa0ef053
Test: Built and tested on device.
Bug: 150242664
2020-02-27 15:04:06 -08:00
Trung Lam
8839aaee6d Merge "Implement backup and restoration of conversation infos." into rvc-dev 2020-02-27 19:56:29 +00:00
Trung Lam
b213fca0ed Implement backup and restoration of conversation infos.
Change-Id: I2cc08c54b714b4ab65762ae261cf8a50d7f258fd
Test: Built and tested on device.
Bug: 147512341
2020-02-25 14:32:25 -08:00
Trung Lam
9d298d4d7c Merge "Delete package directory when app is uninstalled." into rvc-dev 2020-02-25 21:43:03 +00:00
Felipe Leme
339b7149af Improved user callbacks on SystemService:
* Renamed:

  onStartUser() -> onUserStarting()
  onStopUser() -> onUserStopping()
  onSwitchUser() -> onUserSwitching()
  onUnlockUser() -> onUserUnlocking()
  onCleanupUser() -> onUserStopped()
  isSupportedUser() -> isUserSupported()

* Added:

  onUserUnlocked()

Tested on automotive, which uses the callbacks to dump user metrics:

$ adb shell dumpsys car_service --user-metrics
adb shell dumpsys car_service --user-metrics
* User Metrics *
  no users starting
  no users stopping
Last 10 started users
  2020-02-21T19:44:47.101 - user=0 start=2020-02-21 19:44:45.357 unlocking=+885ms unlocked=+1s122ms
  2020-02-21T19:44:56.376 - user=10 start=2020-02-21 19:44:47.380 switch=+209ms unlocking=+8s262ms unlocked=+8s994ms
  2020-02-21T20:00:08.792 - user=11 start=2020-02-21 20:00:04.634 switch(from 10)=+351ms unlocking=+4s44ms unlocked=+4s156ms
Last 10 stopped users
  2020-02-21T20:00:48.323 - user=10 stop=2020-02-21 20:00:16.741 shutdown=+31s581ms

Test: m update-api
Test: atest BackupManagerServiceTest
Test: manual verification (see above)
Fixes: 150001654

Exempt-From-Owner-Approval: approved on master right before rvc split

Merged-In: I8774c57620030b9aa8e7ec039a6a758ad56db368
Change-Id: I8774c57620030b9aa8e7ec039a6a758ad56db368
(cherry picked from commit 58e7458ac7204992c5408eb2d6420d767afc4eb8)
2020-02-24 16:44:52 +00:00
Trung Lam
3ef69f7e7f Delete package directory when app is uninstalled.
Test: Built and test on device.
Bug: 149946247
Change-Id: I57cbd3d853dad7a4d291427c53e0ef1b61274893
2020-02-23 19:12:51 -08:00
Danning Chen
bbf1b376c1 Merge "Listen to the shortcut add/update/delete changes from PeopleService" 2020-02-21 00:55:54 +00:00
Trung Lam
c554fff4ee Merge "Add direct reading/writing of contact phone number after PDD apporoval." 2020-02-20 23:36:38 +00:00
Danning Chen
3fc66d03ef Listen to the shortcut add/update/delete changes from PeopleService
Bug: 146522621
Bug: 149556516
Test: atest com.android.server.people.data.DataManagerTest
Change-Id: I8752b50179c0fb67880324da79e51276c67d0ee9
2020-02-20 22:36:52 +00:00
Song Hu
78b3cd5775 Merge "Implement sharesheet ranking in PeopleService. Ranking is only based on recency of past sharing for the moment." 2020-02-20 12:41:41 +00:00
Trung Lam
92b8a72db8 Add direct reading/writing of contact phone number after PDD apporoval.
Test: Built and tested on device.
Bug: 147782721
Change-Id: I496e39c447a02ebfb7bb1d3668656eada6a2a59f
2020-02-19 22:10:19 -08:00
Song Hu
ba132e4f26 Implement sharesheet ranking in PeopleService. Ranking is only based on
recency of past sharing for the moment.

Bug: 149822311
Test: atest com.android.server.people.data.DataManagerTest
Test: atest com.android.server.people.data.ShareTargetPredictorTest
Change-Id: I90d1b3f488b34fede7d577dc04832b976f4a1bbb
2020-02-19 18:39:06 -08:00
Trung Lam
e66d38a61c Implement onDestroy for ConversationStore for when an app gets
uninstalled.

Change-Id: I8ad6ec2987c509d6713abdd4244c314cb05e79a1
Test: Built and tested on device.
Bug: 149789130
2020-02-19 15:54:36 -08:00
Trung Lam
88961798e6 Add persistence of Event and EventIndex during device reboot.
Change-Id: Ic6c403a000a776eca2a3e9678c25862693a04c2e
Test: Built on device and unit tests.
Bug: 149356114
2020-02-19 15:54:24 -08:00
Danning Chen
6fb9750619 Keep the event information in EventIndex for at most 63 days instead of 64 days
Bug: 149758587
Bug: 146522621
Test: atest com.android.server.people.data.EventIndexTest
Change-Id: I0cae2a5c958d88aab9f76a7ee198fc2e6d69971c
2020-02-19 21:40:06 +00:00
Danning Chen
91f90e0fd6 Add getShareTargets() to ShortcutServiceInternal and get caller's user ID from AppPredictionSessionId
Previously, the caller's user ID was got from Binder. But
AppPredictionManager clears caller's identity. The only way to get the
caller's user ID is to get it from session ID.

Bug: 146522621
Test: atest com.android.server.people.data.DataManagerTest
Test: atest com.android.server.people.data.ShareTargetPredictorTest
Change-Id: Ia0dc35879084110849e06e919ff3b3c7241c46fd
2020-02-18 13:23:04 -08:00
Danning Chen
1cc7197864 Cache the shortcut if the user has changed the conversation's notification settings
Change-Id: Ic4125e5fa510e82d13a578f7c7aa03c397b80354
Bug: 146522621
Test: atest com.android.server.people.data.DataManagerTest
Test: atest com.android.server.people.data.ConversationInfoTest
2020-02-14 12:20:46 -08:00
Danning Chen
7af601e8ed Listen to the notification posted events from NotificationListenerService instead
UsageStats NOTIFICATION_INTERRUPTION events are only created if a
conversation has its own conversation-specific notification channel
created. Switch to NotificationListenerService so that we could get the notification posted events from all conversations.

Bug: 146522621
Test: atest com.android.server.people.data.DataManagerTest
Test: atest com.android.server.people.data.UsageStatsQueryHelperTest
Change-Id: Iaa120567891144a952707deb5cea1321aa28341c
2020-02-14 10:59:52 -08:00
Danning Chen
94580df0a8 Move the initialization of Call/SMS/MMS content observers out of the DataManager constructor
This change is to speed up the system boot time. The people service
start time will be reduced from ~1.5 ms to ~0.5 ms.

Bug: 149245782
Test: Manual run with System.nanoTime() logged
Change-Id: I9114b3c9e3637b2498618220665cd98df1d1f994
2020-02-14 10:59:52 -08:00