527 Commits

Author SHA1 Message Date
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
Makoto Onuki
be73a8068f ShortcutManager: Categories should be Set, not List.
Bug 27923857

Change-Id: Ife859da8e66478174f6c4463316886a23e5aa4e0
2016-04-15 17:15:29 -07:00
Makoto Onuki
0033b2a190 Remove all icon bitmaps when a publisher is uninstalled.
- Also show the directory sizes on dumpsys.

Bug 28196831

Change-Id: I3202fcd3151da3b26b436732e8103caf93aba525
2016-04-14 17:42:32 -07:00
Gustav Sennton
95f7e8e06d Fix the behaviour for explicitly switching WebView provider
Before this CL when we tried to change WebView provider through the Dev
setting and failed we would then have the setting point to the provider
used before the change. With this CL we instead let the setting point to
the intended target but also switch to the package which the
WebViewUpdateService see as most fit (rather than just reverting back to
the original choice).

Add unit tests to verify we kill processes depending on WebView
packages when switching WebView provider.

Add unit tests to ensure we can recover from trying to change provider
when there are no providers available.

Bug: 27673076
Bug: 27635535
Change-Id: Ie7bb6afdf8acf4344cfb363947929c0b492775fb
2016-04-14 16:50:32 +01:00
Gustav Sennton
45e2966da9 Merge "Update persistent WebView packages setting only when user changes it." into nyc-dev 2016-04-14 10:58:42 +00:00
Gustav Sennton
a9159040c8 Update persistent WebView packages setting only when user changes it.
To ensure that we don't permanently change WebView implementation if the
current package is temporarily uninstalled (e.g. when being replaced) we
don't update our persistent setting unless the user explicitly changes
WebView implementation (and on boot!).

Unfortunately this will means that the Dev Setting for changing WebView
implementation will work in a slightly less intuitive way. The
persistent setting is now persistent across uninstalls and installs.
I.e. the Dev Setting shows the current WebView implementation though
that could differ to the value chosen by the user since the package
chosen by the user could be uninstalled or disabled. In this case
installing/enabling that package would again make the Dev Setting point
to it.
However, as a compromise, we do change the setting at boot so that if
the currently chosen package is not valid we will change the setting so
that it points to the package we currently use instead.

Also ensure we only use WebView packages that are available-by-default
if no WebView packages are enabled.

Add unit test to ensure that if a user-chosen provider is uninstalled we
switch back to using that provider when it is installed again.
Add unit test to ensure we switch user-chosen provider at boot if the
chosen one is uninstalled.

Bug: 27673076
Change-Id: Icd27ae302798ebf695b9ef4bd4d5fd47fe4be02c
2016-04-13 16:30:03 +01:00
Paul Jensen
3e6a6fc60e Merge "If Internet probe is redirected, pass redirect destination to NetworkAgent." into nyc-dev 2016-04-13 01:33:37 +00:00
Makoto Onuki
1d616f0d88 Merge "ShortcutManager: Address API review feedback." into nyc-dev 2016-04-12 22:34:17 +00:00
Makoto Onuki
b6d3523dfb ShortcutManager: Address API review feedback.
- "delete" -> "remove"
- add/deleteDynamicShortcut() now takes a list.
- Throttling default settings is now 2 calls / hour.

- Add categories to ShortcutInfo.
- getIconResourceId() is now public

Bug 27923857
Bug 27548047

Change-Id: I8457b30e4b2f7c63ab2988648b37178fd16ea45b
2016-04-12 10:35:20 -07:00
Ricky Wai
321cfa3791 Merge "Add tests for profile keys in LockSettingsStorage" into nyc-dev 2016-04-12 16:42:56 +00:00
Gustav Sennton
53b78241ff Add initial unit tests for WebViewUpdateService.
The logic in the WebViewUpdateService is now more complex and there
are lots of edge cases that should be tested to make sure we don't
regress anything.

Also refrain from running fallback logic on boot if fallback logic not
enabled (bug found through a failing test, yeeah buddy!).

Catch uncaught MissingWebViewException (very timing-dependent!) and add
test for this.

Add tests for:
Some package setups (single package, non-default vs. default packages,
    valid vs. invalid packages).
Ensure correct error codes used
Switching provider through settings-method
Switching provider through adding more prioritized provider
Switching provider in the middle of already running webview preparation
Ensure fallback logic is run when enabled and not run when disabled (at
    boot, packageStateChanged, and when adding a new user).

Bug: 27635535

Change-Id: I275ecb0f6129f71258da0fa053e7f7b36a675886
2016-04-12 14:25:38 +01:00
Paul Jensen
2324373124 If Internet probe is redirected, pass redirect destination to NetworkAgent.
Transport may use the redirect to make additional determination about network
state.

Bug: 25203607
Change-Id: I07d8918f13fdcbe0b6fd757536bfc1850a2a244f
2016-04-12 08:54:36 -04:00
Ricky Wai
a46b40fd5c Add tests for profile keys in LockSettingsStorage
Bug: 27940135
Change-Id: Iade153f6607db4c75385bed6f20d3120c10674b0
2016-04-12 11:26:27 +00:00
Makoto Onuki
bc20320f7f Merge "ShortcutManager: First cut of CTS" into nyc-dev 2016-04-11 23:11:41 +00:00
Fyodor Kupolov
eeca6584cf Make AccountManagerServiceTest work again
It was broken for quite a while. Introduced the following changes:
- Use mockito to mock AppOpsManager and UserManager
- Use MockContext directly and override what is necessary.
  RenamingDelegatingContext doesn't work with absolute file names for
  database paths, which is the case for system server DBs.

Bug: 26279712
Change-Id: I9f2a3892f9bd7a882d78f0bb7beb8669f7dc8c6f
2016-04-11 15:33:45 -07:00
Makoto Onuki
5ba0d3e3a3 ShortcutManager: First cut of CTS
Bug 27548047

Change-Id: Idd7a768ea4fee44c2cf6e3bd473cea9e67f5f7cd
2016-04-11 14:48:44 -07:00
Makoto Onuki
390a81302f Merge "Add UserHandle to ShortcutInfo, and simplify LauncherApps APIs." into nyc-dev 2016-04-11 16:45:10 +00:00
Fyodor Kupolov
4c74334c44 Merge "Added getProfileIds method returning array of userIds" into nyc-dev 2016-04-11 16:40:55 +00:00
Jack Yu
2e062ab8de Merge "Excluded certain APNs (e.g. IMS) from mobile data usage." into nyc-dev 2016-04-09 03:30:31 +00:00
Makoto Onuki
abe8442951 Add UserHandle to ShortcutInfo, and simplify LauncherApps APIs.
- Also fixes the bitmap recycle bug in the service.

Fixes 28053541

Change-Id: I2b244feda0f85c60e2c15af427fcad95ad5e6da5
2016-04-08 13:28:18 -07:00
Fyodor Kupolov
7f98aa4aa9 Added getProfileIds method returning array of userIds
Previously many usages of UserManager.getProfiles and getEnabledProfiles
were only using ids of returned users. Given that the list of users needs
to be parceled and unparceled for Binder calls, returning array of ids
minimizes memory usage and serialization time.

A new method getProfileIds was introduced which returns an array of userIds.
Existing method calls were updated where appropriate.

Bug: 27705805
Change-Id: Ic5d5decd77567ba0f749e48837a2c6fa10e812c0
2016-04-07 16:41:57 -07:00
Jack Yu
66a6be3a4c Excluded certain APNs (e.g. IMS) from mobile data usage.
Added not_metered capability to a mobile network if none
of its associated APN types are metered. Also used not_metered
capability to determine if a network should be accounted for
data usage or not instead of using network type, which is
always MOBILE after refactoring. Will add VT usage support
in next phase.

bug: 20888836
Change-Id: Id692cb856be9a47d0e918371112630128965b1bb
2016-04-07 10:07:31 -07:00
Robin Lee
1b83651e7f Merge "Internal API for system apps to determine default network for other apps" into nyc-dev 2016-04-07 16:43:15 +00:00
Robin Lee
d2baf792f8 Internal API for system apps to determine default network for other apps
Callers with CONNECTIVITY_INTERNAL permission can read off the netId
that an application is assigned to by default.

Necessary for making connections as the default network for a client
app eg. when downloading stuff on its behalf.

Bug: 27074270
Change-Id: I8d35e8e99126875f55f3c545090326f3e9be43fb
2016-04-07 14:55:59 +00:00
Dianne Hackborn
141f11c82a More work on issue #26390151: Add new JobScheduler API...
...for monitoring content providers

- Improve media provider change reporting so that observers can
  avoid spurious reports of the top-level content directory changing.
- Fix a bug where collected content changes while a job was running
  were not being properly propagated to the next job.

Change-Id: I29e3c2960e6fec75b16ee3ee6588d47342bf8c75
2016-04-05 15:58:42 -07:00
Makoto Onuki
ac21497f17 ShortcutManager: More command for CTS, more tests..
and fix flakey tests.

Bug 27548047

Change-Id: Ia5f189278f6111850277ca16aa747469f48c5f14
2016-04-04 11:02:06 -07:00
Makoto Onuki
b1a684c646 Merge "ShortcutManager: implement backup & restore" into nyc-dev 2016-04-01 23:18:43 +00:00
Makoto Onuki
2e210c4d0f ShortcutManager: implement backup & restore
Also:
- Fix cross profile pinning.  Now ShortcutLauncher correctly keeps
track of target package user IDs.

- Add performance stats for package manager calls and show them on
dumpsys.

Bug 27548047

Change-Id: I2472980b2955b6c70947aaaa9b76f75d0616db6e
2016-04-01 14:06:56 -07:00
Chris Wren
b38fa4e724 Merge "actually cancel sounds when we get a quiet update" into nyc-dev 2016-04-01 19:58:46 +00:00
Chris Wren
93bb8b8006 actually cancel sounds when we get a quiet update
Also add some tests to the notification manager service
to make the refactor more palatable.

Bug: 27742532
Change-Id: I745915299aa2b92ab077e0c801d47864cb562325
2016-04-01 14:13:57 -04:00
Lorenzo Colitti
f5120236c4 Merge "Honour the DHCP MTU option." into nyc-dev 2016-04-01 00:55:08 +00:00
Victor Chang
e04ac3d7d2 Merge "Unit test for isProvisioningAllowed" into nyc-dev 2016-03-31 17:04:38 +00:00
Lorenzo Colitti
77fdf23d6f Honour the DHCP MTU option.
Bug: 25590369
Bug: 27719279
Change-Id: I473b5ec9c13f0d74e1ddd55e9d4abcff374a83ef
2016-03-31 23:51:32 +09:00
Victor Chang
3e794afb82 Unit test for isProvisioningAllowed
Note:
DevicePolicyManagerService is changed to inject ContentObserver notifier

Test: all test cases in DevicePolicyManagerTest pass

BUG: 25710621
Change-Id: I347cec71769d0e9dd6a334d7d6339d5ce6a3fa6a
2016-03-30 20:27:22 +01:00
Makoto Onuki
e3ae7ec14a ShortcutManager: Support secondary text field.
Bug 27548047

Change-Id: I2d184bab2c26e351b7326945fa0cacf826f16d1e
2016-03-29 16:42:12 -07:00
Makoto Onuki
9da23fc6ac ShortcutManager: proper work profile support
Bug 27548047

Change-Id: I8acea3355f8974a551f53814624dec30732f7b2f
2016-03-29 14:42:02 -07:00
Makoto Onuki
590096a0e3 Extract signature related utilities
So that they can be used from services/core.

Bug 27548047

Change-Id: I610e267cba320418e766c0e609fa26c485dc6e1f
2016-03-29 10:09:43 -07:00
Makoto Onuki
d99c6f04bb ShortcutManager: Fix work profile
- Pinned shortcuts need to know not only which package
has pinned them, but also on which user's, due to work profile.

- Launcher can always launch shortcuts that it has pinned.

Bug 27548047

Change-Id: I23b4e7dfbb6ecc42099d31008bcfd61d44e2c7fb
2016-03-28 18:47:39 -07:00
Makoto Onuki
905e8855e7 ShortcutManager: Cleanup package info handling
Bug 27548047

Change-Id: I598b25d1901230cec6fb3760fe5efeff3b3fef96
2016-03-28 10:46:08 -07:00
Makoto Onuki
0acbb14574 ShortcutManager: Handle package broadcasts.
- Do a cleanup when an app is gone.
- Record the app version and signatures.
- Also make saveToXml() capable of saving for backup.

Bug 27548047

Change-Id: I7eb2bbec7665b4d625630e7312c0f2a8b03c5ffa
2016-03-25 15:39:38 -07:00
Felipe Leme
771d0c2be4 Merge "Refactored NetworkManagerService to support Data Saver." into nyc-dev 2016-03-25 20:39:59 +00:00
Felipe Leme
65be3025fd Refactored NetworkManagerService to support Data Saver.
Netd provides 2 bandwidth control rules to restrict which uids can use
metered networks:

- bw_penalty_box is a blacklist-based firewall chain used to determine
  which uids do not have access to metered interfaces.

- bw_happy_box is whitelist-based firewall chain used to determine which
  uids have access to metered interfaces.

Currently, both NetworkManagerService (NMS) and
NetworkPolicyManagerService (NPMS) uses just the bw_penalty_box rule,
which makes turning Data Saver mode on / off too slow (since NPMS needs
to build the bw_penalty_box on demand); this CL adds support for both
rules on NMS, although NPMS doesn't take advantage of it yet (it will be
refactored in a separate CL).

BUG: 27127112
BUG: 26685616
Change-Id: Ib954574f7c86269fc9b4cf8ce4ba72ba5878c23d
2016-03-25 12:33:47 -07:00
Erik Kline
1d511ab13d Request vendor info option (43) to get metered hint
Bug: 26241591
Change-Id: I688029826a79f9cbf0116fb197f82026980788af
2016-03-25 11:55:19 +09:00
Makoto Onuki
3145924596 ShortcutManager: Extract helper classes.
Bug 27548047

Change-Id: I08656291a8dd509fde169f229ca9c503362254f3
2016-03-22 11:24:53 -07:00
Erik Kline
a2d29407d0 Support registering a request for the default network
Change-Id: I079f5be97b585cf5692dd4c7a144b993d168a9a5
2016-03-22 15:44:16 +09:00
Makoto Onuki
cdc78f7137 ShortcutManager: Clean up for uninstalled packages.
Bug 27548047

Change-Id: I95ca832af496fbf71023eb27a7e2647c124ffb86
2016-03-21 15:54:27 -07:00
Victor Chang
d3c0cf50b6 Merge "Api change of DPM.setApplicationRestrictionsManagingPackage()" into nyc-dev 2016-03-21 13:08:14 +00:00
Victor Chang
cd14c0a9da Api change of DPM.setApplicationRestrictionsManagingPackage()
Throws NameNotFoundException instead of IllegalArgumentException

Can't throw NameNotFoundException directly from DPMS as
aidl doesn't support checked exception

Bug: 27532565
Change-Id: I202721f41057f92ad2dd851d4769ba4502a8f9b3
2016-03-18 16:44:21 +00:00
Suprabh Shukla
07317df6ab Merge "Added a unit test for TaskPersister" into nyc-dev 2016-03-18 02:19:40 +00:00
Suprabh Shukla
f50b458e71 Added a unit test for TaskPersister
Added a simple unit test which checks the methods used to save and load the set
of taskids to file. The test creates a user, adds some task ids to the
set of taskids for that user, saves it and loads it to see whether the
set loaded is the same as the one that was saved.

Change-Id: If92be8abf9a7e3ef90630a3786867f0e1ba12f3e
2016-03-17 18:14:15 -07:00