565 Commits

Author SHA1 Message Date
Jeff Davidson
1c0c14febf Merge "NetworkStats.Bucket API polish." into nyc-dev 2016-03-14 19:30:23 +00:00
Jeff Davidson
1f7e05eda6 NetworkStats.Bucket API polish.
-Add @IntDef constants for STATE_ and ROAMING_.
-Expand docs for ROAMING_ constants.
-Use ROAMING_NO/YES instead of ROAMING_DEFAULT/ROAMING.

Bug: 27531260
Change-Id: I54ecfb4148caa549214df0bee9983036ffa4cb55
2016-03-14 11:24:12 -07:00
Makoto Onuki
d4c9e541ec Add ENCRYPTION_STATUS_ACTIVE_PER_USER to...
getStorageEncryptionStatus()
Use StorageManager APIs to get the encryption
state instead of from the system properties
directly.

Bug 26547262

Change-Id: Ic27baa9489d43a93873f8bb0428084f8886aed67
2016-03-11 15:50:04 -08:00
Makoto Onuki
7a6a05f0cc Test for ShortcutManager.updateShortcuts(), also
... fix bugs

Bug 27548047

Change-Id: Ia55d35521912dcba2fb1bb9c20588a83d1a2d004
2016-03-10 18:01:06 -08:00
Makoto Onuki
41066a61b9 Refactor ShortcutService
Move PackageShortcuts to the top level.

Change-Id: If19a7dd979f8697e54a45c3aa654bad235f6259d
2016-03-09 16:56:39 -08:00
Makoto Onuki
495d124a67 Merge "ShortcutManaegr: load config from settings, also..." into nyc-dev 2016-03-10 00:18:36 +00:00
Jeff Sharkey
93720d5729 Merge "Log when pre-N apps send too much to DropBox." into nyc-dev 2016-03-09 23:31:01 +00:00
Jeff Sharkey
b8e8a91f54 Log when pre-N apps send too much to DropBox.
Once they target N, they'll start getting exceptions, which is
intended to make sure they pay attention to data that would have
otherwise been dropped on the floor.

Bug: 27571535
Change-Id: I49163679c629cd0788327d2c3a654e757ecdcb99
2016-03-09 16:27:42 -07:00
Makoto Onuki
4362a66dba ShortcutManaegr: load config from settings, also...
support "cmd override-config" and "cmd reset-config" to help CTS.

Bug 27548047

Change-Id: Id6c9e6f41a2238856dd3470d88d88d0e7e686f26
2016-03-09 15:17:29 -08:00
Makoto Onuki
4a07c34ca8 Merge "ShortcutManager: add remaining APIs." into nyc-dev 2016-03-09 22:28:45 +00:00
Lorenzo Colitti
f55c9c1781 Don't crash if we get a DHCP packet with the wrong port.
This should only happen if we get a packet in the small time
window between binding the packet socket and programming the
BPF filter on it.

Bug: 26696823
Change-Id: I481f1bc74bbaeb9646d96e1841d2a69acdb47d62
2016-03-09 16:16:45 +09:00
Makoto Onuki
5504622fb0 ShortcutManager: add remaining APIs.
- Icons are now persisted. (under /data/system_ce, as PNGs)
- the "load icon" APIs in LauncherApps are supported.
- Implement updateShortcuts()

- Addressed all the comments on the previous CL
- @hide the newly added constructor for PersistableBundle

- Enhance incoming shortcut validation
- A lot of internal clean-up.

Bug 27548047

Change-Id: I8e3c1ccd3e0a997a6d271c84d81170f0c022b60e
2016-03-08 18:37:32 -08:00
Makoto Onuki
76cb56bb21 Merge "Implement LauncherApps.startShortcut()." into nyc-dev 2016-03-09 01:38:37 +00:00
Makoto Onuki
43204b8357 Implement LauncherApps.startShortcut().
Bug 27548047

Change-Id: I357732e22be0959fb573fd6cdaee7c6b439ef7c4
2016-03-08 17:26:28 -08:00
Sudheer Shanka
97e89c624e Merge "Update DPM.getWifiMacAddress to take admin component as argument." into nyc-dev 2016-03-08 22:52:11 +00:00
Sudheer Shanka
3cb4da16dc Update DPM.getWifiMacAddress to take admin component as argument.
Bug: 27532280
Change-Id: I3a5e9557c3c6ac43c458c911a5309bdb2655fb66
2016-03-07 18:51:49 -08:00
Makoto Onuki
6f7362d925 Introducing ShortcutManager
What's supported:
- Most APIs are implemented, except for SM.updateShortcuts(),
the icon APIs in LA, and LA.startShortcut().
- Persisting information, except for icons
- Throttling

In addition, now PersistableBundle has a public copy
constructor from a Bundle. (Do we want to @hide it?)

TODOs:
- Add icon support
- Implement missing APIs
- Listen to PACKAGE_* broadcasts and do clean-up
- Support multi-launcher apps (pinned shortcuts per launcher)
- Dev option to reset throttling
- Load throttling config from Settings
- Backup & restore
- Figure out LauncherApps permissions (BIND_APPWIDGETS??)
- Other minor TODOs in the code
- Better javadoc

Note: This requires Idf2f9ae816e1f3d822a6286a4cf738c14e29a45e

Bug 27325877

Change-Id: Ia5aa555a4759df5f79a859338f1dc5e624cd0e35
2016-03-04 15:24:49 -08:00
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