448 Commits

Author SHA1 Message Date
Victor Chang
0114263a1a Merge "enforceCanSetDeviceOwnerLocked should enforce userId == USER_SYSTEM for non-split user mode" into nyc-dev 2016-03-04 13:13:27 +00:00
Victor Chang
e29cd4724f enforceCanSetDeviceOwnerLocked should enforce userId == USER_SYSTEM for non-split user mode
Bug: 27453111
Change-Id: I1acdfecdf4474696e904a6a4df189453be306aa4
2016-03-04 10:34:43 +00:00
Lorenzo Colitti
bfecba2938 Speed up ConnectivityServiceTest.
1. Override WakeupMessage with an implementation that uses
   sendEmptyMessageDelayed. This allows us to replace a
   6-second sleep with a 150ms wait.
2. Change waitFor()'s polling interval from 100ms to 50ms.

With these changes ConnectivityServiceTest goes from ~9s to ~3s.

Change-Id: Id78aab9cded90a5b17f09d7f437904e179808dd2
2016-03-02 17:01:50 +09:00
Lorenzo Colitti
b7ffb76437 Merge changes Ic366b532,I0179b45b into nyc-dev
* changes:
  Move PinningNetworkCallback out to a new NetworkPinner class.
  Use MessageUtils in ConnectivityManager.
2016-03-02 04:18:03 +00:00
Lorenzo Colitti
531a344300 Move PinningNetworkCallback out to a new NetworkPinner class.
Also add tests.

Bug: 19159232
Change-Id: Ic366b53259ee5944a8e864876425a6558c0a7216
2016-03-02 12:50:35 +09:00
Julia Reynolds
f0f629ffe4 Introduce IMPORTANCE_MIN.
Allow HUNs for >= IMPORTANCE_HIGH.
Allow full screen intents for IMPORTANCE_MAX.

Bug: 22960980
Bug: 26918284
Change-Id: Id4d2b90ea2e21563dbc716db411060d826e73699
2016-02-26 10:54:08 -05:00
Makoto Onuki
a4fae1545a Merge "Support safe mode properly." into nyc-dev 2016-02-24 22:20:08 +00:00
Makoto Onuki
889c088066 Support safe mode properly.
In safe mode, IPM.queryXxx() doesn't work.  Use IPM.getReceiverInfo()
directly instead.

Bug 27108276

Change-Id: Ice8f882559b8f0596a19ddb3a16395a4dc538a25
2016-02-24 13:12:01 -08:00
Dianne Hackborn
1085ff6ee5 Work towards issue #26390161: Throttle syncs/jobs when system is low on RAM
First, we need to make the job scheduler prioritize jobs for
foreground apps over background apps (so we will degrade well
when we are limiting the number of concurrent jobs).

So now the job scheduler keeps track of the process state of
each uid, and uses that to bump up the priority of jobs
associated with foreground uids.  Added constants for priorities
since we have different places specifying priorities.

Also cleaned up a bit of the reporting of "wrapped" jobs from
the sync manager -- there is a new tag argument that can be supplied,
to have the name and tag used in various places be based on that
instead of the useless internal class name.

Change-Id: I8781750ddfac1472a98e1873fc38c014425db3d6
2016-02-23 17:04:58 -08:00
Christopher Tate
2f36fd6fc9 Limit scheduled jobs to 100 per app
Packages that are entitled to schedule jobs on behalf of other uids
are not subject to the limit.  Also break the JobStore's monolithic
set of jobs into per-uid slices for efficiency and orthogonality.

Bug 27150350

Change-Id: I8f5f718bf200d55f9977a6fc53b7f617e7652ad9
2016-02-22 12:42:29 -08:00
Dianne Hackborn
b0001f6fb1 Remove internal locking from JobStatus.
Now all state of JobStatus is implicitly protected by the lock
of whoever is using it -- in this case the global lock for the
JobSchedulerService.  This allows us to remove all of the atomic
variables and just replace those with a simple bit field.

The required constraints for a job are now statically defined
once a JobStatus is created, and don't change.  (They wouldn't
change before, but now this is absolutely specified to be the
case.)  This required tweaking the constructors a bit so that
the earliest and latest run times are computed as part of the
core class initialization.

Also clarified methods on StateController that are called with
the lock held, and took advantage of that in the various
controllers to not now redundantly re-acquire the lock.

Change-Id: I595c5e7d1bff1bd2ff906d612581af82878a25ee
2016-02-19 18:29:34 -08:00
Dianne Hackborn
33d31c5b70 Simplify job scheduler service locking.
Unify all locks to just one lock protecting the entire service.
There is really no need for more complicated locking -- there is
nothing in the code that can take a long time to complete.  And
having a single lock will allow various parts of the code to be
much simpler and easier to maintain.

This is just the first step of the change, switching all of the
locking to use one lock.  With this done, we can now start
simplifying the code.  For example, JobStatus no longer needs
to do any locking (or have atomic variables and such), it can
just rely on its callers holding the global service lock.

Change-Id: I502916ed7f2994b601750c67a59a96b1a4e95c6d
2016-02-19 16:49:47 -08:00
Julia Reynolds
73d96fb4bb Merge "Remove Notification Topics." into nyc-dev 2016-02-19 19:17:25 +00:00
Makoto Onuki
4ab36372fb Merge "Clean up on UserManagerService and DPMS" into nyc-dev 2016-02-19 00:21:48 +00:00
Makoto Onuki
2a3c3da0fc Clean up on UserManagerService and DPMS
- Avoid the ART warning about 4.1 compatibility
- Avoid integer overflow in DPMS

Bug 27243525
Bug 27242859

Change-Id: I92af323287e348fbd0eff31e6cf9823be8e41024
2016-02-19 00:20:56 +00:00
Makoto Onuki
24f62ea634 Merge "Fix bugs in user restriction migration" into nyc-dev 2016-02-18 20:26:41 +00:00
Makoto Onuki
6094928806 Fix bugs in user restriction migration
Originally I didn't know user-0 could have PO, so I excluded this case
from migration.  Now we handle it properly.

Also make sure only restrictions that can actually be set by each
owner moves to the owner restriction.  (Because of this, we no longer
have to have DISALLOW_WALLPAPER in the exception list, because
owners can't set DISALLOW_WALLPAPER.)

Bug 27225996

Change-Id: I6ad79d90e6c4400abbb1e4feba6ba59e3b650815
2016-02-18 12:09:30 -08:00
Antonio Cansado
12d7ea815b Merge "Implementation of data usage callbacks." into nyc-dev 2016-02-18 19:43:42 +00:00
Julia Reynolds
ef37f28436 Remove Notification Topics.
Bug: 23220370
Change-Id: Ifbcdbab1cf6974c192483091512f75762784a98e
2016-02-18 08:55:33 -05:00
Antonio Cansado
cd42acd951 Implementation of data usage callbacks.
NetworkStatsService will register data usage requests
and keep data usage stats scoped to the request.

There are different types of data usage requests
- scoped to a set of NetworkTemplate; these are restrictred to
device owners and carrier apps and allow the caller to monitor
all activity on the specified interfaces.
- scoped to all uids visible to the user, if the user has
android.Manifest.permission#PACKAGE_USAGE_STATS permission.
The set of uids may change over time, so we keep track of that.
- scoped to a set of uids given by the caller, granted that
the caller has access to those uids.
- scoped to the caller's own data usage. This doesn't require
PACKAGE_USAGE_STATS.

Bug: 25812785
Change-Id: Ie11f35fc1f29d0dbe82f7fc924b169bb55c76708
2016-02-17 18:43:53 -08:00
Makoto Onuki
184db600df Ensure DO/PO are also DA.
Bug 24503508

Change-Id: Ib957b84d5bee185501636c406d9aaf4985a79d8d
2016-02-17 15:35:01 -08:00
Makoto Onuki
dafec11e69 Merge "Don't allow deactivating DAs when the user is not unlocked" into nyc-dev 2016-02-16 20:47:10 +00:00
Shreyas Basarge
b55fa08c74 Merge "Fixes JobScheduler not persisting flex and sourcePackage" into nyc-dev 2016-02-16 14:55:44 +00:00
Shreyas Basarge
8e64e2e6a4 Fixes JobScheduler not persisting flex and sourcePackage
There was a bug with persisteing and restoring flex and
sourcePackage. Fixed it and added tests.

Change-Id: Ie8e4714b4727ecef4254773fd4339b28f4a47c01
2016-02-15 15:51:52 +00:00
Makoto Onuki
1a5ee776ee Don't allow deactivating DAs when the user is not unlocked
Bug 27149570

Change-Id: I772d9cbd6edc822c8f7b1988905b702e05e674cd
2016-02-12 16:04:42 -08:00
Rubin Xu
ed1928a981 Fix testApplicationRestrictionsManagingApp unit test
The API now requires the app restriction manager app to exist
on the current user when it is called.

Change-Id: I809816d4f5d73378c23b18d7b74ebb282b7dc444
2016-02-11 17:23:06 +00:00
Shreyas Basarge
2b4c8f926f SyncManager sync blow up fix
Duplicates for periodic syncs would be
created just after boot and when a
periodic sync was delayed. This CL fixes
the behavior.

Bug: 26954967
Change-Id: I2440961629d443a62f96360563d435af9137857b
(cherry picked from commit 1675400a7cd0b56e5adc5606fb4fea77f8d24ea5)
2016-02-10 19:09:44 +00:00
Svet Ganov
354cd3ce22 Multi packages per APK
This change introduces the ability to have multiple packages per
APK. The feature is currently restricted to privileged apps and
updates to such apps.

In essence the manifest can have multiple child package declarations.
A child package can declare everything an Android package can except
some tags or attributes that are not applicable and instead inherited
from the parent when needed. For example, the target SDK of the parent
applies to all children.

A child package can be updated only through the parent package.
A package with multiple child packages is installed, uninstalled
atomically - no partial installs where some child packages are not
installed.

The remaining work is to ensure broadcasts are also sent for child
packages. This will come in a subsequent change.

Sample app:ag/848432

Design doc: https://docs.google.com/document/d/18nFWtJuZchLxrHf5SBbJW03-Ky9Rh_G0-OVB14b6u78

Change-Id: I6fd021d981bf5786290e0c53502724a14c97358c
2016-02-08 15:14:07 -08:00
Paul Jensen
0ab80e6c26 Fix FrameworksServicesTests.apk to include libc++.so
am: 5f3dec374f

* commit '5f3dec374fac97365ec95ec407a1cffc2c3907c9':
  Fix FrameworksServicesTests.apk to include libc++.so
2016-02-08 11:41:25 +00:00
Paul Jensen
5f3dec374f Fix FrameworksServicesTests.apk to include libc++.so
libc++.so is no longer accessible to the app, so it must be
bundled in the app. This should get ApfTest passing again.

Change-Id: Ide004cb84f7f50feffb8f5acb46b7001dcffd208
2016-02-07 21:58:09 -05:00
Amith Yamasani
046cc21b75 Merge "Rewrite app standby stats" 2016-02-05 19:41:04 +00:00
Amith Yamasani
a93542f9d3 Rewrite app standby stats
Don't mix up with usage stats. Keep a separate db and history
based on elapsed time and screen on time.

Unit tests for AppIdleHistory class.

Bug: 26989006
Change-Id: If343785b46da1db67f7c1c1263854c2732a232c6
2016-02-05 11:38:29 -08:00
Esteban Talavera
5eec76504f Merge "Fix unit tests" 2016-02-05 13:31:10 +00:00
Paul Jensen
44278472d8 Fix FrameworksServicesTests.apk to include libnativehelper.so
am: 514a3bfde6

* commit '514a3bfde6ccc8ca80f3bacdd370e2d4672b3d85':
  Fix FrameworksServicesTests.apk to include libnativehelper.so
2016-02-05 01:50:07 +00:00
Esteban Talavera
8375fcec62 Fix unit tests
http://ag/858485 added a new flag and the mockito didn't match
the call any more

Change-Id: I8f99b1b6063488aeced08513b11c79bf0162006e
2016-02-04 18:25:22 +00:00
Paul Jensen
514a3bfde6 Fix FrameworksServicesTests.apk to include libnativehelper.so
libnativehelper.so is no longer accessible to the app, so it must be
bundled in the app. This should get ApfTest passing again.

Change-Id: Ie4fe66e44d46ddb12b3c7ac5c91118a69a8ebe2e
2016-02-04 09:11:40 -05:00
Paul Jensen
8514a8131f Merge "Android packet filtering program interpreter test & program generator" into mm-wireless-dev
am: 44307adcf3

* commit '44307adcf371bacad4de6925a9207bdbfdc6f874':
  Android packet filtering program interpreter test & program generator
2016-02-03 17:12:47 +00:00
Paul Jensen
44307adcf3 Merge "Android packet filtering program interpreter test & program generator" into mm-wireless-dev 2016-02-03 16:48:43 +00:00
Paul Jensen
d38fb7662d Android packet filtering program interpreter test & program generator
Change-Id: I17951bd6320b9eb3b6c43f2ae37f62c2025705c1
2016-02-03 10:19:13 -05:00
Makoto Onuki
90b896533e DO / PO Shouldn't be removed as active admin...
even if they asked.

Also clear(Device|Profile)Owner should remove them as the active admin
too.

Also add some more unit tests.

Bug 26858840

Change-Id: I7b3ed92e1b4cbe803381ed6e3f64d8de17b2ebb0
2016-02-02 14:54:06 -08:00
Rubin Xu
49caead1c2 Call SecurityLog methods via Injector
This is to make sure the unit test can mock them out.

Bug: 26911599
Change-Id: I07a1a8b43ad5716a4b667bc5266b3b03997268c5
2016-02-02 18:00:28 +00:00
Makoto Onuki
3f3657a61b Fix DPM unit tests
Bug 26911599

Change-Id: I874c9cd4f63c79bc984777ef3b1b654a414c4911
2016-02-01 15:21:49 -08:00
Shreyas Basarge
a491c07f36 Merge "SyncManager on JobScheduler" 2016-02-01 15:32:58 +00:00
Shreyas Basarge
8c834c0767 SyncManager on JobScheduler
SyncManager now uses JobScheduler for scheduling
and persistence purposes.

Change-Id: I38c92aedbf4d891ca297644d0b706835aaedfcd6
2016-01-29 22:15:15 +00:00
Fyodor Kupolov
7b9f2e1d86 Merge "Added SystemApi for getting serial numbers of users" 2016-01-28 18:58:05 +00:00
Fyodor Kupolov
940e8577a1 Added SystemApi for getting serial numbers of users
Also added UserHandle version of queryBroadcastReceiversAsUser.

Bug: 25844894
Change-Id: I78ecbef186e4ced10425ae2899db72c2d91c5792
2016-01-28 10:55:28 -08:00
Etan Cohen
e496c555b9 Merge "Allow NetworkFactories to match any network specifier on a request" into mm-wireless-dev
am: bd0858ba67

* commit 'bd0858ba679cced35bda55a643707ad69e4caa34':
  Allow NetworkFactories to match any network specifier on a request
2016-01-28 18:24:23 +00:00
Julia Reynolds
92d456e9a6 Show app level settings when an app doesn't use topics.
Change-Id: I205062868ac3a44aa24a29bcb82a9374026287a7
2016-01-26 15:43:10 -05:00
Alan Treadway
44a1808154 Merge "Add explicit and persistent user provisioning state." 2016-01-26 09:59:40 +00:00
Benjamin Franz
6d00903727 Add SmallTest annotation to DevicePolicyManagerTest
Adding this annotation makes sure that the tests get picked up by
continuous integration tests.

Change-Id: Ia9166898803dd0037f6bb20cb6a12333ed347fd3
2016-01-26 09:49:51 +00:00