71 Commits

Author SHA1 Message Date
Danning Chen
443b3e9993 Merge "Add a JobScheduler service to prune the People Service data on a daily basis" 2020-02-14 07:41:59 +00:00
Danning Chen
c4933eb5b7 Add a JobScheduler service to prune the People Service data on a daily basis
- Refactor the class EventStore to simplify the event history access methods
- Add the prune methods to delete the data for:
  - uninstalled packages
  - event data that exceeds the retention period
  - call events data for non-dialer packages
  - SMS events data for non-SMS-app packages
  - orphan events (the annotated locus ID or phone number have  changed in the associated shortcut)
- Change the package-level events to class-level for the app share events

Bug: 146522621
Test: Manually verify the behavior on device \
    atest com.android.server.people.data.DataManagerTest \
    atest com.android.server.people.data.PackageDataTest
Change-Id: I3f17ed269fe5cb05f1d3696e44dfb0bed951678f
2020-02-13 12:45:42 -08:00
Varun Shah
0cbb6b63ee Obfuscate visibility of notification-related events.
UsageStats will return obfuscated NOTIFICATION_SEEN or
NOTIFICATION_INTERRUPTION events to callers of #queryEvents
and #queryEventsForUser if they don't hold the MANAGE_NOTIFICATIONS
permission.

Additionaly, refactor the query API in UsageStats to take in flags as
defined in UsageEvents to make future obfuscation/visibility parameters
cleaner.

Also, add the MANAGE_NOTIFICATIONS permission to shell for CTS test.

Bug: 144724524
Test: atest android.app.usage.cts.UsageStatsTest
Test: atest com.android.server.people.data.UsageStatsQueryHelperTest
Test: atest android.content.pm.cts.shortcutmanager.ShortcutManagerUsageTest
Change-Id: I118de7e589ac8dd5924d3740c70903fa484b79b5
2020-02-13 12:01:13 -08:00
Tyler Gunn
8d95abab29 Merge "API Review cleanups." 2020-02-13 16:05:53 +00:00
Tyler Gunn
754493b82f API Review cleanups.
- New @SystemApis on Conference and PhoneAccount were missing the required
permissions annotations.
- Rename PROPERTY_ASSISTED_DIALING_USED to PROPERTY_ASSISTED_DIALING
- Standardize get/setConnectionStartElapsedRealtimeMillis method naming
across Connection and Conference classes.
- Clarify Conference#sendConferenceEvent API documentation to match the
docs present for similar method in Connection; include some examples of
valid event/extras combinations.
- Update TelecomManager#getDefaultdialerPackage to use UserHandle instead
of userId.
- Move Conference#getConnectionStartElapsedRealtimeMillis to public API
since the setter is already part of the public API.

Test: Run Telecom and Telephony CTS tests.
Test: Run Telephony unit tests.
Test: Perform manual single-party-conference regression test to confirm
that conference behavior does not regress.

Bug: 147301297
Bug: 148286830
Bug: 148284863
Bug: 148284843
Bug: 148287068
Bug: 148285484
Bug: 148285560
Change-Id: I1f446d81859fa109d74af3661a42a0bd224de5aa
2020-02-12 20:44:27 -08:00
Yuliya Kamatkova
fea62a512b Restrict visibility of LOCUS_ID_SET events.
UsageStats will not return LOCUS_ID_SET events to callers
of #queryEvents and #queryEventsForUser if they don't have visibility.

Bug: 148821246
Test: manual, atest tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest
Change-Id: Ic904a97e66775ef63bc8b84e67e8f430b2a4121b
2020-02-12 11:20:22 -08:00
Trung Lam
a127fceb73 Add persistence of ConversationInfo during device reboot.
Change-Id: I01ee08eb212a42b0c19d654241adb6afd718c14b
Test: Build and run on test device.
Bug: 147782721
2020-02-08 23:42:05 -08:00
Danning Chen
44725cd285 Listen to the notification channel creation/modification/deletion events
Bug: 146522621
Test: atest com.android.server.people.data.DataManagerTest
Change-Id: I2e465627c16bc3055f784d81800f2907c2728025
2020-02-06 17:21:59 -08:00
Danning Chen
e4294d62ef Merge "Add UsageStatsQueryHelper to People Service" 2020-02-07 00:33:46 +00:00
Danning Chen
b601629811 Add UsageStatsQueryHelper to People Service
It processes these UsageStats events:
- SHORTCUT_INVOCATION
- NOTIFICATION_INTERRUPTION
- LOCUS_ID_SET
- ACTIVITY_PAUSED/STOPPED/DESTROYED

The in-app conversation is counted from the LOCUS_ID_SET event to the
next LOCUS_ID_SET event, or the associated Activity is
paused/stopped/destroyed.

Change-Id: I5ecb78e61f9f69129e7fa9cc67e9e94b2148fcda
Test: Manual tests \
    atest com.android.server.people.data.UsageStatsQueryHelperTest \
    atest com.android.server.people.data.DataManagerTest \
    atest com.android.server.people.data.CallLogQueryHelperTest \
    atest com.android.server.people.data.ConversationInfoTest \
    atest com.android.server.people.data.ConversationStoreTest
Bug: 146522621
2020-02-06 14:41:35 -08:00
Mehdi Alizadeh
7a2b81b7d3 Merge "Adds locus Id to ShortcutQuery to find shortcuts based on LocusId" 2020-02-06 02:50:38 +00:00
Mehdi Alizadeh
ae808ff765 Adds locus Id to ShortcutQuery to find shortcuts based on LocusId
Bug: 148085173
Test: atest com.android.server.pm.ShortcutManagerTest1 \
            com.android.server.pm.ShortcutManagerTest2 \
            com.android.server.pm.ShortcutManagerTest3 \
            com.android.server.pm.ShortcutManagerTest4 \
            com.android.server.pm.ShortcutManagerTest5 \
            com.android.server.pm.ShortcutManagerTest6 \
            com.android.server.pm.ShortcutManagerTest7 \
            com.android.server.pm.ShortcutManagerTest8 \
            com.android.server.pm.ShortcutManagerTest9 \
            com.android.server.pm.ShortcutManagerTest10
Test: atest DataManagerTest

Change-Id: Ie789582a43db6d53130f4a0e5bff646a3c08c71e
2020-02-05 13:53:47 -08:00
Danning Chen
b3f852127e Fix the NPE when reading the call log or SMS if a device has multiple user profiles
Change-Id: Iec6485653367f2f005c2b7e17f23ab611e39e13b
Bug: 148918224
Test: atest com.android.server.people.data.DataManagerTest
2020-02-05 11:52:50 -08:00
Danning Chen
dea8db3d54 Merge "Listen to the new calls and SMS/MMS messages and store the derived events in the People Service event store" 2020-02-03 23:58:53 +00:00
Danning Chen
c82e0d4e5c Merge "Create ShareSheetPredictor in People Service." 2020-02-03 21:10:03 +00:00
Danning Chen
be2c1552d2 Create ShareSheetPredictor in People Service.
Change-Id: I93a14fb8172131c8bf8c9cf7d58d99fa13c80aa3
Test: Build and run on a test device and unit tests
Bug: 146522621
2020-01-31 13:21:02 -08:00
Danning Chen
e84ee5f9e2 Listen to the new calls and SMS/MMS messages and store the derived events in the People Service event store
Change-Id: I1b409fab255ba9d733e4ca482de0e329c523515a
Test: Build and verify the behavior on a test device, and unit tests
Bug: 146522621
2020-01-31 11:48:58 -08:00
Danning Chen
001eb8f4d9 Update the method signature for queryEventsForUser()
Change-Id: I9ed16e6164493915dba48366249c61dc49214e5a
Test: atest com.android.server.people.data.DataManagerTest
Bug: 148627336
2020-01-31 09:40:30 -08:00
Danning Chen
a1bf86d516 People Service data layer main structure
Change-Id: I53bf5f1bce3234da7e1dcf8cfdd293120781aef4
Test: Build and run on a test device
Bug: 146522621
2020-01-28 15:30:31 -08:00
Trung Lam
d7cf8f2968 Added PeopleBackupHelper and skeleton backup/restore methods on
PeopleServiceInternal.

Change-Id: I3d4c63fe6779b5cb8d7bc6e79ee8fe72cc39797e
Bug: 147512341
Test: Code builds and runs successfully.
2020-01-10 16:05:49 -08:00
Danning Chen
20b32edbfe Add the skeleton code for People Service which is a new system service with only internal APIs
Change-Id: I78b1b362735d5da40c49a344ae3063ea0df0759f
Bug: 146522621
Test: Code builds and runs successfully
2020-01-01 13:46:38 -08:00