527 Commits

Author SHA1 Message Date
Makoto Onuki
aa8b94aa79 Improve ShortcutSrvice
- Delayed save
- Reset logic update

Bug 27548047

Change-Id: Ibd52f90a7986991974301b7ff1f1d8520f9ef0d9
2016-03-17 14:37:14 -07:00
Makoto Onuki
fb3f3f5b28 Merge "Support multi-launcher" into nyc-dev 2016-03-17 17:27:10 +00:00
Lorenzo Colitti
5eaaf747b4 Fix IdleableHandlerThread.
Occasionally, ConnectivityServiceTest fails with "BUG: only one
idle handler allowed". I have not been able to reproduce this
consistently, but code inspection reveals an unsafe access to
mIdleHandler inside queueIdle. Wrap that in a synchronized block.

Change-Id: I27307e2e55fa8d937d7f043bd436894091c3c667
2016-03-17 10:52:57 +09:00
Makoto Onuki
de66737ae9 Support multi-launcher
Each launcher can have its won set of pinned shortcuts.
- Shortcuts pinned by others should look like not pined to this
  launcher.  This affects how ShortcutQueryFLAG_GET_PINNED works,
  as well as what ShortcutInfo.isPinned() returns.

- When pinning a shortcut, it should be a visible one to itself --
  a non-dynamic shortcut that's pinned by another launcher but
  not by the caller is not visible, so this launcher cannot pin it
  either.

- Also clean up the dynamic shortcut adding.

Bug 27548047

Change-Id: Ia478a2ea19b7d35557ec6ea42384c79a84d6b8de
2016-03-15 16:55:04 -07:00
Makoto Onuki
ed1b89878b Merge "Fix launcher side callback" into nyc-dev 2016-03-15 21:02:48 +00:00
Mahaver Chopra
1216ae5d02 Update DPM.reboot with new restriction
DPM.reboot() should not be called when there is an ongoing call on the
device.

Bug:27531799
Change-Id: Idc1fa4c7aa79b20ec9c2afcccf855455ee316787
2016-03-15 19:46:05 +00:00
Makoto Onuki
4dbe0ded4a Fix launcher side callback
- Fix crash in work profile case
- Calculate shortcuts for each caller
- Add tests

Bug 27548047

Change-Id: I1a5b6a96956abac75d01eb5cc1cec9a9e8e379a3
2016-03-15 12:38:41 -07:00
Makoto Onuki
4554d0e5b6 Make "reset-throttling" per-user
Also don't reset the counter when the time is invalid

Bug 27549307

Change-Id: Ib9ad030e348ec5e32936709f1284e3c76e88e254
2016-03-14 15:53:59 -07:00
Makoto Onuki
49f6fbcd1f Merge "Implement the launcher side permission." into nyc-dev 2016-03-14 22:12:16 +00:00
Makoto Onuki
2d5b465fa9 Implement the launcher side permission.
Only the default launcher can call the LauncherApps shortcut APIs.

Bug 27548047

Change-Id: I6d597fcad80c5201a2f93b8cbecd567fc79926d8
2016-03-14 15:00:58 -07:00
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