577 Commits

Author SHA1 Message Date
Makoto Onuki
d6e1f3bec1 Shortcut: Reset throttling upon inline reply
When the user does an "inline reply", we consider the notification
publisher app is "activated" and reset the shortcut throttling.

Bug 28705275

Change-Id: Ic9ffa13635274ead7e9d1e832cd31dea997830aa
2016-06-14 14:12:07 -07:00
Makoto Onuki
3bb4366006 Merge "ShortcutManager: deal with changing resource IDs on app update" into nyc-mr1-dev 2016-06-08 17:00:00 +00:00
Makoto Onuki
3e27d1254b Merge "ShortcutManager: Optimize package scanning" into nyc-mr1-dev 2016-06-08 16:16:40 +00:00
TreeHugger Robot
3e2bfbd135 Merge changes Ic98e3bcb,Idb0c55fc,Ia8649061,I5e7e5a87 into nyc-mr1-dev
* changes:
  Give WakeupMessage the ability to transport an object as well.
  Don't treat the lingerExpired broadcast specially.
  Add a test for mobile data always on.
  Add a FakeSettingsProvider and use it in ConnectivityServiceTest.
2016-06-08 06:35:32 +00:00
Lorenzo Colitti
9acda9c825 Don't treat the lingerExpired broadcast specially.
NetworkMonitor no longer uses the broadcast for lingering, it
uses WakeupMessage instead.

Bug: 23113288
Change-Id: Idb0c55fc68cb8f45b3213c7134213904f227852e
2016-06-08 14:09:07 +09:00
Lorenzo Colitti
762ea7aab7 Add a test for mobile data always on.
Bug: 23113288
Change-Id: Ia8649061a797367d135bb5576600a7cdc85a822e
2016-06-08 14:08:59 +09:00
Lorenzo Colitti
6d553f6dfd Add a FakeSettingsProvider and use it in ConnectivityServiceTest.
This class makes it easier to test code that uses Settings:

1. Real device or emulator settings don't affect the code under
   test; all settings always start off empty.
2. It's possible to change settings from the test without
   affecting system settings.
3. No changes are needed to the code under test. The changes to
   the tests are simple: just add a fake ContentResolver to
   whatever mock Context is already used by the test, and make
   that ContentResolver use the fake provider.

Bug: 23113288
Change-Id: I5e7e5a87571444ae49ccf551705620675a36cd17
2016-06-08 14:05:55 +09:00
Makoto Onuki
157b1628fd ShortcutManager: deal with changing resource IDs on app update
- When an app is upgraded, all the resource IDs may change.  So
if a shortcut is previously published with an icon for res ID 100
and the publisher is upgraded, resource #100 may refer to something
different.

- So now the service also remembers resource names for icon resources,
as wells as string resources.  When an app is updated, the service
fetch the updated resource IDs by name.

- Also extract all string resources when a shortcut is published
and persist them, so that even when the original string resources are
removed from the app, the launcher can still show the extracted strings.

- When the system locale changes, re-extract all string resources.

- Also really hide the constants in ShortcutInfo that were
accidentally made public.

Change-Id: I23c29b45c1de5d76175229190a1533c9c62c5960
2016-06-07 16:11:30 -07:00
Makoto Onuki
6dd9fb7004 ShortcutManager: Optimize package scanning
SM needs to check all packages when a user is unlocked in case
any apps have been upgraded while the user was not running,
in which case it'll publish the manifest shortcuts.

Currently it actually scans all apps' manifests.

This CL optimizes it by remembering the last scan time (for each user)
and checks only the packages that have been updated since then.

Bug 29069154

Change-Id: Id10b6be8915fe7c1e26daccde7951ddbd01ea452
2016-06-07 10:32:19 -07:00
Makoto Onuki
ac042501c8 ShortcutManager: Implement usage report API
Bug 28536054

Change-Id: I293e8eaad523e3b0d76d562fc381601633451ed3
2016-06-02 15:57:40 -07:00
Makoto Onuki
51ab2b3fd0 ShortcutManager: Break down unit tests
The test file is getting too big and making the IDE very slow.
Now it's split into multiple files

Change-Id: I50ed89f19defd3809f327bc21e7d9ea790dcde4e
2016-06-02 14:00:34 -07:00
Makoto Onuki
7001a61540 ShortcutManager: Implement max # of shortcuts
- Each activity (launcher icon) can have at most 5 dynamic +
manifest shortcuts.

Bug 28536066

Change-Id: Id34371d51c4a1c5e3df7debe3b71b535eb157b6c
2016-06-02 10:47:37 -07:00
Makoto Onuki
eddbfecb8d ShortcutManager: API rename
The words "title" and "text" implies that "text" is a secondary label
that's shown with the title, but it turned out the launcher would show
only one of those depending on how much space it has.

So now we change them to "shortLabel" and "longLabel"

Note we're only changing the API surface -- in order to mimimize
the impact to the code, internally we'll keep using the old names.

- Also remove "shortcutRank" while I'm here -- it should be implied
from the order of the XML elements.

Bug 29057378

Change-Id: I3203f63b0318c7462c1c61fef43cf9755fa8c008
2016-06-01 10:09:10 -07:00
Makoto Onuki
22fcc68e6b ShortcutManager: Support manifest shortcuts
- Now apps can publish shortcuts via AndroidManifest.xml
(Sample: I5b127150)

- Rename some APIs per API council feedback

- Publishers can now "disable" shortcuts.
(https://docs.google.com/presentation/d/1raUn1QBURDb1yrd6mSmVxII9ezNh3MWukODdtufJ29U/edit#slide=id.g13ef592464_7_39)

Bug 28785283
Bug 28536066

Change-Id: I4a126841e43e40139bb4baa6d0f98ad7b3a75ac1
2016-05-27 09:40:58 -07:00
Paul Jensen
e8b8f1b48e Merge "Don\'t drop IPv4 broadcast packets when WiFi multicast lock is held" into nyc-dev
am: 83e50327fc

* commit '83e50327fcf24e4d17a341cc2efaafc95046a8f9':
  Don't drop IPv4 broadcast packets when WiFi multicast lock is held

Change-Id: Ib76e96a84820fa36357d820ef6845f6155ec902c
2016-05-27 15:03:48 +00:00
Paul Jensen
f8a01e8431 Don't drop IPv4 broadcast packets when WiFi multicast lock is held
IPv4 broadcast packets can be very common (e.g. every 2s) so they
need to be dropped in the general case.  They also may be critical
for certain discovery protocols, so allow them through with APF
when the WiFi multicast lock is held.

Bug: 26238573
Change-Id: I03e09a2b9c779da5da775e78b95e9e0339720eaf
2016-05-27 09:18:56 -04:00
Sudheer Shanka
c32abe8646 Fix usermanager related tests.
- Fix failing test
- Updates to include in continuous test execution

Fixes: 28938682
Change-Id: I17dd9ca5cf2579f0649f3939b00b08fa71a106cf
2016-05-24 14:40:59 -07:00
Tony Mak
18b1826a8c Merge "Fix first notification of each app is not shown" into nyc-dev
am: ed353f1738

* commit 'ed353f173852551f0dc0b360512a9abc5c77c28e':
  Fix first notification of each app is not shown

Change-Id: Ib3702c334b7d41b75684720d36caaa62cc52f074
2016-05-24 20:16:08 +00:00
Tony Mak
ed353f1738 Merge "Fix first notification of each app is not shown" into nyc-dev 2016-05-24 19:46:12 +00:00
Tony Mak
fd30332708 Fix first notification of each app is not shown
When app tries to post its first notification,
value of now is equal to that of mLastEventTime.
And hence getRate return a very large number.

Bug: 28902358

Change-Id: If5b5b3c46e2bb80a9b40988ba7f7d777e40cc8e7
2016-05-24 18:57:50 +01:00
Lorenzo Colitti
09a2690f91 Merge "Support IPv6 multicast filtering in APF." into nyc-dev
am: d954c6368f

* commit 'd954c6368fc6e591385e608fa6ebb42dc7606074':
  Support IPv6 multicast filtering in APF.

Change-Id: I6123c2390aa9641652fd200adcc16f9724799aab
2016-05-24 03:19:29 +00:00
Lorenzo Colitti
d954c6368f Merge "Support IPv6 multicast filtering in APF." into nyc-dev 2016-05-24 03:14:38 +00:00
Lorenzo Colitti
11e13e2175 Support IPv6 multicast filtering in APF.
For now this just drops all non-ICMPv6 packets to ff00::/8 when
mMulticastFilter is true. Multicast ICMPv6 is already mostly
dealt with by other filters - the L2 multicast filter, the RA
filter, the multicast NA filter, and ND offload.

Bug: 28393601
Change-Id: Ia7b0d4f00fac6710093befe6a726b46677a5f20b
2016-05-24 00:02:07 +09:00
Chris Wren
4ca84fa6b5 Merge "rate limit notification enqueues" into nyc-dev
am: 585ff8bd12

* commit '585ff8bd126ffac98164a87d24a9add5c23f9597':
  rate limit notification enqueues

Change-Id: I48a05345b210a68e507e648402a2ff19da44b7fc
2016-05-20 16:11:34 +00:00
TreeHugger Robot
585ff8bd12 Merge "rate limit notification enqueues" into nyc-dev 2016-05-20 16:04:50 +00:00
Chris Wren
c8673a88fe rate limit notification enqueues
This is distinct from and in addition to the limit on the number of
distinct notifications. This includes many updates to a single
notification.

Bug: 28693065
Change-Id: I5ec0911716cace91d3ad85435a5c6123b290b3a2
2016-05-20 10:40:26 -04:00
Robin Lee
43fbfbf94c Merge "Lock down networking when waiting for always-on" into nyc-dev
am: d171df660e

* commit 'd171df660e19bdba4d188beeb8b6023874712413':
  Lock down networking when waiting for always-on

Change-Id: I34fffb119eecef0052be673f307ef63c94fc58ee
2016-05-18 23:42:40 +00:00
Robin Lee
d171df660e Merge "Lock down networking when waiting for always-on" into nyc-dev 2016-05-18 23:37:24 +00:00
Robin Lee
17e6183b85 Lock down networking when waiting for always-on
Fix: 26694104
Fix: 27042309
Fix: 28335277
Change-Id: I47a4c9d2b98235195b1356af3dabf7235870e4fa
2016-05-19 00:26:53 +01:00
Makoto Onuki
8295332d83 Merge "ShortcutManager: API changes for DR" into nyc-mr1-dev 2016-05-17 18:01:29 +00:00
Robin Lee
0867543a06 Merge "Make some of the UID-based VPN code reusable" into nyc-dev
am: 4920698e17

* commit '4920698e17dc8aacd1b0743d313383a8ee1a3400':
  Make some of the UID-based VPN code reusable

Change-Id: I0e5b9aa4552ee11ae5ec2d2206cc58487fb9cd4c
2016-05-17 17:39:14 +00:00
TreeHugger Robot
4920698e17 Merge "Make some of the UID-based VPN code reusable" into nyc-dev 2016-05-17 17:30:01 +00:00
Makoto Onuki
20c95f854e ShortcutManager: API changes for DR
See https://goto.google.com/shortcutmanager-spec-dr for
the details.

This CL contains changes to ShortcutInfo and all the new API
entry points, but not the implementation of the new APIs.

- ShortcutInfo.activityComponent is now mandatory.
- Publishers can now disable shortcuts.  ShortcutInfo can now have
"disabled message".
- ShortcutInfo now supports string resources for all the String
fields.
  -> When launcher fetches shortcuts, ShortcutService will
  automatically load resources and expose as strings.
- LauncherApps now supports getShortcutIconDrawable() and
getShortcutBadgedIconDrawable() to be consistent with
LauncherActivityInfo.

- ShortcutInfo.weight is replaced with "rank".

- Added ShortcutManager.reportShortcutUsed(), which will be used for
usage tracking / suggestion.

Bug 28536054
Bug 28536066
Bug 28564134
Bug 28594168

Change-Id: Ib8245b39bb1e753991a9de89c0b73accacd90355
2016-05-16 16:25:50 -07:00
Robin Lee
4d03abcd49 Make some of the UID-based VPN code reusable
By changing some member refs into arguments and having one of the
functions create the UID range instead of adding to mVpnUsers.

This will be useful for other layers of UID filtering like having
UIDs explicitly blocked from the VPN.

Deleted one broken line of code that cleared the status intent when
a restricted profile is removed. Other than that, this commit shouldn't
change any behaviour. If it does, that's a bug.

Bug: 26694104
Change-Id: Ieb656835d3282a8ba63cc3f12a80bfae166bcf44
2016-05-13 16:03:11 +00:00
Paul Jensen
771d9fe0b6 Merge "ApfFilter unit test" into nyc-dev
am: b742495cf5

* commit 'b742495cf54c09c5780c7c22f4d389b92e22449d':
  ApfFilter unit test

Change-Id: Ib0595b9cd72efaa408028983287fea0b81b3bee6
2016-05-13 14:38:11 +00:00
Paul Jensen
b742495cf5 Merge "ApfFilter unit test" into nyc-dev 2016-05-13 14:33:25 +00:00
Makoto Onuki
538c440c33 Remove ShortcutManager
Bug 28704708

Change-Id: If7b739adeec38d81d554fc1cf34c81194f5d67b9
2016-05-11 14:25:55 -07:00
Makoto Onuki
c51b2876ec Refactoring ShortcutManager + bug fixes.
- Don't pass the ShortcutService instance as an argument.  This tiny
optimization is no longer meaningful now that PackageShortcut and
PackageLauncher have reference to ShortcutUser.

- Rename mLauncherComponent to mDefaultLauncherComponent for clarity.

- Don't instantiate ShortcutPackage instances when not needed.

- Don't allow intents with a null action.

- Also improve javadoc.

Bug 28592642
Bug 28474517
Bug 28557169

Change-Id: I8790d3494bf3b92c143c02824b0ed0e514504baa
2016-05-10 14:28:31 -07:00
Antonio Cansado
de224ba451 Merge "Addressing API council comments on NetworkStatsManager." into nyc-dev
am: dc5f558640

* commit 'dc5f558640da8785fabc274167ec37a0fda30cd6':
  Addressing API council comments on NetworkStatsManager.

Change-Id: I9d884ed999b507ab172418f068c10483422643d3
2016-05-10 21:05:16 +00:00
Makoto Onuki
3ff4120047 Merge "Clean up dangling bitmaps." into nyc-mr1-dev 2016-05-10 20:57:04 +00:00
Antonio Cansado
6965c1869a Addressing API council comments on NetworkStatsManager.
Callbacks
 - DataUsageCallback renamed to UsageCallback
 - DataUsagePolicy removed; passing in params directly to register method
 - making it an abstract class
 - passing in (networkType, subscriberId) that reached its threshold
 - renaming onLimitReached to onThresholdReached to match existing naming
 - only monitor single network,subscriberId
 - no monitoring of specific uids; using device or user wide instead

Tags
 - only owner uid can read its tags
 - exposing only TAG_NONE to match service side

BUG: 27530098

Change-Id: I2b2664da71806868a1e937d2bf4d1f234637509b
2016-05-10 13:24:16 -07:00
Paul Jensen
9132f34976 ApfFilter unit test
Bug: 26238573

Change-Id: I5171038228782bd54e91f5bcc663cc529d2c1150
2016-05-10 11:54:42 -04:00
Makoto Onuki
8569452603 ShortcutManaegr: bug fixes
Fixes 28590035
Fixes 28586105

Change-Id: Ia11d29e4996ad5b47b279a3c04d9586695cdc0a5
2016-05-04 13:00:41 -07:00
Makoto Onuki
6c1dbd577b Clean up dangling bitmaps.
Bug 28471799

Change-Id: I48785ccc533a7499d46e35264c6a0cbf0c5398d5
2016-05-03 16:14:22 -07:00
Makoto Onuki
4d36b3a8c5 ShortcutManager: finishing touches
- Change back the throttling quota to 10 calls / day
- Foreground apps are no longer throttled, and when an app comes to
foreground the call counter will be reset.
- When the system locale changes, reset throttling for all packages
for all users.
  See LocalService.onSystemLocaleChangedNoLock() for how it's performed.
  Because the reset must happen before any other apps have a chance to
  publish shortcuts, the logic is not straightforward.

- Added an internal API to reset the throttling upon inline-reply
from a notification.

- Stop supporting icons from "content:" URIs
- Improved javadoc on several APIs.

Also internal refactor needed to this:
- ShortcutUser.getAllPackages()/getAllLaunchers() are no longer
accessible to outer code to prevent accidentally adding/removing the
content.  Outer code should use forAllPackages() / forAllLaunchers().

Bug 27923857

Change-Id: I002511193d1d33718163bb1dabe77610bde58198
2016-05-02 12:02:19 -07:00
Makoto Onuki
9ac59d0438 ShortcutManager: When app's data is cleared, remove all shortcuts,
as if it's uninstalled.

Fixes 28196831

Change-Id: I1a410372f9e344a10567b00057fa0770eac9fd76
2016-04-28 10:52:02 -07:00
Makoto Onuki
711ffe620e Merge "When app is updated, save the new version code, and update shortcuts with resource based icons." into nyc-dev 2016-04-26 00:07:59 +00:00
Paul Jensen
3f45105353 Merge "Cap number of NetworkRequests a UID can make to 100" into nyc-dev 2016-04-21 13:47:13 +00:00
Fyodor Kupolov
390802b6d3 Test coverage for new FBE functionality
Added testRemovedAccountSync, which removes account when the user is locked,
and verifies that syncDeCeAccountsLocked works as expected.

Added testPreNDatabaseMigration to test that pre-N database with existing
data is properly upgraded and migrated.

Bug: 26279712
Change-Id: I3846c626f616b1c4830965c9f0cb27fa32ce6f54
2016-04-20 10:47:58 -07:00
Paul Jensen
4e1d3fdf7a Cap number of NetworkRequests a UID can make to 100
This prevents DoSing ConnectivityService with too many requests.

Fixes: 27253080
Change-Id: Id0480d220b2f01b9ef1146bef8ead2fc8287e28d
2016-04-20 10:52:47 -04:00