Commit Graph

2434 Commits

Author SHA1 Message Date
Jeff Sharkey
c78f85ca53 When system server goes down, crash apps more.
Apps making calls into the system server may end up persisting
internal state or making security decisions based on the perceived
success or failure of a call, or the default values returned.

The reality is that if the system process just died, init will be
along shortly to kill all running apps, so we should have no problem
rethrowing the RemoteException as a RuntimeException.

Bug: 27364859
Change-Id: Ife0bcb079636c88d54c44d17eb580409fd79028b
2016-03-01 19:29:16 -07:00
Robin Lee
829f7c72e5 ConnectivityService: listen to USER_UNLOCKED too
When the credential-encrypted private storage for the target user is
unlocked, we should try to start up VPN for them.

Bug: 27357283
Change-Id: Id9079230d00e3cea08a49ae66bd1f553416b4f54
2016-02-29 16:29:44 +00:00
Erik Kline
866306752b Delete all NetworkUtils DHCP-related code.
am: af0170a562

* commit 'af0170a562468acc53ef60f1d97c4dbd259b9af9':
  Delete all NetworkUtils DHCP-related code.
2016-02-22 09:16:16 +00:00
Erik Kline
af0170a562 Delete all NetworkUtils DHCP-related code.
Bug: 26991160
Change-Id: I2c74e0161f43f65c1b6a85dc9f294b64c8f1ae6e
2016-02-22 15:14:31 +09:00
Antonio Cansado
01cb4ff14d 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
Erik Kline
2a813d23e8 Expose measurement results to interested callers.
am: 6ba9b90805

* commit '6ba9b90805d3e9a759a9b9a364b9ac406d9d573b':
  Expose measurement results to interested callers.
2016-02-10 15:58:17 +00:00
Erik Kline
6ba9b90805 Expose measurement results to interested callers.
With this it's possible for callers to:

    Network network = ...
    LinkProperties lp = ...

    NetworkDiagnostics netdiag = new NetworkDiagnostics(network, lp, 5000);
    netdiag.startMeasurements();
    netdiag.waitForMeasurements();

    boolean result = true;
    for (Measurement m : netdiag.getMeasurements()) {
        if (!m.checkSucceeded()) {
            result = false;
            // Additional error handling here.
        }
    }

    return result;

Bug: 21832299
Bug: 26780890
Change-Id: Iaf7ff029e2c6a998b574c23d0dcde8d57a467a22
2016-02-11 00:28:27 +09:00
Jeremy Klein
ae9a289559 Remove several TetherUtil functions which are no longer needed.
Slowly chipping away at TetherUtil to clean up this code.
This CL also adds an admin check to
ConnectivityService.isTetheringSupported to get parity with the
TetherUtil function before removing it.

Change-Id: Ibe7c5c9fb420d57e5458f77dad30e8a1e751a3e2
2016-02-04 19:06:59 -08:00
Felipe Leme
e6303009b0 Merge "Created a ACTION_RESTRICT_BACKGROUND_CHANGED intent." 2016-02-02 23:59:30 +00:00
Jeff Davidson
f73c15c090 Notify NetworkStatsService of roaming status changes.
When the roaming status of the cell network changes, it is handled as
follows:

-DcActiveState gets an event (either EVENT_DATA_CONNECTION_ROAM_ON or
 EVENT_DATA_CONNECTION_ROAM_OFF) and calls
 NetworkAgent#sendNetworkInfo with updated NetworkInfo.
-ConnectivityService then gets an EVENT_NETWORK_INFO_CHANGED and calls
 updateNetworkInfo with the new info.

With the previous code, the NetworkAgent's NetworkInfo object would be
updated internally, but because the state of the connection had not
changed from CONNECTED, the change would be considered a duplicate and
otherwise ignored.

With the new code, we call notifyIfacesChanged() when the state is the
same but the roaming status has changed. That should be all that is
necessary, as roaming is not exposed as a link property or network
capability today.

Bug: 26545456
Change-Id: I33d32d1fa84ce41dbe01542e5b498eda4b744b74
2016-01-29 10:13:18 -08:00
Felipe Leme
d34c9af3e2 Created a ACTION_RESTRICT_BACKGROUND_CHANGED intent.
This intent will be broadcasted when:

- Global restrict background setting is changed (sent to all packages)
- An individual uid is added to or removed from the whitelist (sent just
  to the packages belonging to that uid).

This intent is only sent to registered receivers.

BUG: 26451391
Change-Id: Ic0a5771f88baa52076ad04764f29098a386463cc
2016-01-28 13:28:11 -08:00
Etan Cohen
e2131c4d88 Merge "Allow NetworkFactories to match any network specifier on a request" into mm-wireless-dev
am: 9c28a90451

* commit '9c28a90451edaf8e90d2d87f8142dc7a7ff1eb9d':
  Allow NetworkFactories to match any network specifier on a request
2016-01-28 18:24:23 +00:00
Etan Cohen
9c28a90451 Merge "Allow NetworkFactories to match any network specifier on a request" into mm-wireless-dev 2016-01-28 18:20:09 +00:00
Erik Kline
c2f41cdb10 Merge "Add the network handle to the NetworkAgentInfo#toString() output." 2016-01-28 06:44:59 +00:00
Erik Kline
3ff08372ec Add the network handle to the NetworkAgentInfo#toString() output.
This will make it possible to find nethandles via, e.g.
 "dumpsys connectivity --short".

Without this, native multinetwork API debugging requires running
"dumpsys connectivity --diag" in order to see the nethandle values.

Bug: 19537384
Change-Id: Icdd2b112523d4ecf88d5339f229e714a56d248f8
2016-01-28 15:06:56 +09:00
Lifu Tang
4cbe078ac0 Merge changes from topic '2016 GPS Changes'
* changes:
  Framework support to read newly added fields
  Added an API to query GPS hardware version info
  GPS Measurement and Navigation APIs go public
  Supported GNSS multi-constellation in frameworks
2016-01-28 02:02:17 +00:00
Jeremy Klein
5dbfe74db6 Merge "Remove the unused Looper param from Tethering constructor." 2016-01-27 20:54:01 +00:00
Shishir Agrawal
35759f9151 Unhiding MSIM APIs.
1. Unhide MSIM APIs in TelephonyManager that already have non-MSIM equivalent
   APIs public.
2. Make MSIM API naming consistent (overloaded, no suffix).
3. Unhide APIs in SubscriptionManager that are necessary for MSIM.

Bug: 26772894
Change-Id: Ibebab7379ea79c8e4812bbd190342827048e30e2
2016-01-26 13:47:27 -08:00
Jeremy Klein
d180aa7e7d Remove the unused Looper param from Tethering constructor.
Tethering just constructs its own Looper right below where it
assigns the looper param to mLooper.

Change-Id: I2d522942eff2ad3439bb3961e78ab0625d3fa9df
2016-01-26 11:10:55 -08:00
Shishir Agrawal
5b07a89b42 Merge "DO NOT MERGE : Unhiding MSIM APIs." into mm-wireless-dev
am: 45836d13e5  -s ours

* commit '45836d13e5d06c787b5039894b6c0ac7c5eb7b7b':
  DO NOT MERGE : Unhiding MSIM APIs.
2016-01-26 18:04:39 +00:00
Shishir Agrawal
77d691763f DO NOT MERGE : Unhiding MSIM APIs.
1. Unhide MSIM APIs in TelephonyManager that already have non-MSIM equivalent
   APIs public.
2. Make MSIM API naming consistent (overloaded, no suffix).
3. Unhide APIs in SubscriptionManager that are necessary for MSIM.

Bug: 26772894
Change-Id: Ibebab7379ea79c8e4812bbd190342827048e30e2
2016-01-26 09:29:24 -08:00
Jeremy Klein
3dabcb9434 Expose a simple tethering API which includes provision checks.
This CL exposes startTethering and stopTethering functions which also
encapsulate all provisioning check logic. Right now, only silent checks
are implemented, but UI checks will come in a follow-up CL. GTS tests
and Settings changes are under the same topic ID.

BUG: 26247383
Change-Id: I65f61d899594cb3f9035d8496366af17a57a090f
2016-01-25 16:37:09 -08:00
Lifu Tang
0a922fd0db Supported GNSS multi-constellation in frameworks
Change-Id: I82574afd3697c47e806d2cfaedc33756d0353b73
2016-01-25 15:15:14 -08:00
Felipe Leme
7e4c185b15 Fixed RestrictBackgroundStatus signature by adding @hide.
BUG: 26082535
Change-Id: I2e4b63327a8f791db01ee0c1ab090557170857fa
2016-01-25 12:09:03 -08:00
Felipe Leme
2951d4608c Merge "Created new public API so applications can customize its metered network usage while running in background." 2016-01-22 19:26:06 +00:00
Lorenzo Colitti
5841917c74 Merge "Debug logging for when getActiveNetworkInfo returns BLOCKED." into mnc-dr1.5-dev am: a6855a1faa am: d841d71593
am: ca79d59509

* commit 'ca79d59509bad091458c71cf852ffd1e13d7b8e6':
  Debug logging for when getActiveNetworkInfo returns BLOCKED.
2016-01-22 18:50:49 +00:00
Felipe Leme
3051135227 Created new public API so applications can customize its metered network
usage while running in background.

The new API is 'int getRestrictBackgroundStatus()' and returns the
following values:

 - RESTRICT_BACKGROUND_STATUS_DISABLED: no restrictions
 - RESTRICT_BACKGROUND_STATUS_WHITELISTED: restriction but app is
   whitelisted
 - RESTRICT_BACKGROUND_STATUS_ENABLED: full restriction

The proper way to interprete these values for using metered networks
while running on background is:

 - When disabled, there is no restriction and the application could use the
   metered networks freely.

 - When whitelisted, the application can use the metered network, but should try
   to minimize the usage.

 - When enabled, the application should not try to use metered networks at
   all, since the usage will be denied.

BUG: 26451391
Change-Id: If07d42bb88e4c02802df0234861f38aef2cfead7
2016-01-22 10:50:11 -08:00
Lorenzo Colitti
ca79d59509 Merge "Debug logging for when getActiveNetworkInfo returns BLOCKED." into mnc-dr1.5-dev am: a6855a1faa
am: d841d71593

* commit 'd841d71593c0c4a7c5beaf5196a22d9158c2d697':
  Debug logging for when getActiveNetworkInfo returns BLOCKED.
2016-01-22 00:14:27 +00:00
Lorenzo Colitti
ac136a020f Debug logging for when getActiveNetworkInfo returns BLOCKED.
Bug: 26488100
Change-Id: I991581732d35aed18392bed2f3d69ca8fb231f5e
2016-01-22 05:21:34 +09:00
Jeff Davidson
d6c5e33f82 Merge "Implement roaming tracking in NetworkStats summary queries." 2016-01-20 01:43:02 +00:00
Jeff Davidson
2fd68b3a3e Implement roaming tracking in NetworkStats summary queries.
Whether a network is deemed roaming or not was already being tracked
as part of the NetworkIdentitySet, so the underlying data store
already tracks roaming and native data separately. However, this data
was being aggregated together in NetworkStatsCollection#getSummary,
since the NetworkIdentitySet is converted to an iface name for the
purposes of matching, and the iface name will be identical whether or
not the iface is considered roaming. Now it is separated.

Also fixes a long-standing bug in NetworkIdentitySet where an identity
read from a saved file would always be considered roaming == false,
even if it wasn't at the time it was written.

Bug: 25813438
Change-Id: I11ab5b51182ed8da7af8fde468df065f9fdc3dad
2016-01-19 16:57:51 -08:00
Robin Lee
9b747914f3 [VPN] start lockdown before user is unlocked
Removed the dependency on KeyStore encryption by removing that flag for
VPN profiles which don't use secure credentials when saving in Settings.

Old encrypted profiles will simply fail to load untile USER_PRESENT is
sent, as before.

Bug: 26108660
Change-Id: I2677d741d54252f15cb772c94ce1b39041f1e19c
2016-01-19 16:40:20 +00:00
Robin Lee
e7a3e95319 Merge "Always-on app VPNs" 2016-01-14 11:37:18 +00:00
Robin Lee
e5d5ed5872 Always-on app VPNs
Bug: 22547950
Change-Id: I46b204170bfac58d944f39b22f815b080de71a58
2016-01-12 19:54:54 +00:00
Udam Saini
bc61def71d Merge "Makes captive portal server calculation in one place." 2016-01-12 18:40:45 +00:00
Udam Saini
cd6454606c Makes captive portal server calculation in one place.
This also creates a hidden api for the captive portal server calculation
so that the Setup Wizard can use this as well.

bug:13246857
Change-Id: I4dfd0916df97cfce13252c7cc15f7bd05ed95f77
2016-01-08 14:38:31 -08:00
Jeremy Klein
434835af8b Add a TETHER_PRIVILEGED permission and use it where needed.
BUG: 26247383
Change-Id: I73f7227d77926faa9081e83eccb83c8ddee33e08
2016-01-07 10:11:24 -08:00
Alex Cheung
803faa182b Use "merge -s ours origin/mirror-partner-mm-wireless-dev" as described in b/26154276 2015-12-23 14:48:52 -08:00
Jeff Davidson
7c16024c83 Merge "Relax permissions around NetworkStatsManager APIs." 2015-12-15 19:04:25 +00:00
Jeff Davidson
761896522d Merge "Fix bit-rotted NetworkStatsServiceTest." 2015-12-15 17:48:46 +00:00
Etan Cohen
9786d92050 Allow NetworkFactories to match any network specifier on a request
Current usage of NetworkSpecifier: network factory will match a request
if the request has either a (1) empty network specifier, or (2) a
network specifier which is identical to that of the network factory.
Note: 'matching' w.r.t. network specifier - all other matching rules
are still in effect.

Change: add rule (3) or the network specifier of the network factory
is the special string (which is defined as "*" and which user-facing
network requests aren't allowed to use).

Rationale: allows on-demand network creation.

Example:
- Can specify a Wi-Fi NetworkRequest with NetworkSpecifier="ssid"
- It will match a Wi-Fi network factory specifying NetworkSpecifier="*"
- That network factory will bring up a Wi-Fi network, connecting to the
  specified SSID.
- Once the network is created it will create a NetworkAgent which will
  now have a NetworkSpecifier matching that of the request (not the
  match-all special string!)

That final step of making sure that the NetworkAgent matches the request
and not the match-all is critical to delivering any subsequent callbacks
correctly. I.e. your network will only get callbacks which match it.

Bug: 26192833
Change-Id: I49e3b492e0bb48a3f6e9a34e3f94f0e1cf89741f
2015-12-15 08:06:54 -08:00
Lorenzo Colitti
eadb751c84 Merge "Remove defunct EVENT_SEND_STICKY_BROADCAST_INTENT." 2015-12-15 13:24:52 +00:00
Jeff Davidson
aa65e9c069 Relax permissions around NetworkStatsManager APIs.
Currently, access to network usage history and statistics requires a
signature|privileged permission, an AppOps bit (associated with the
PACKAGE_USAGE_STATS permission), or device/profile ownership. Once
access is granted via one of these mechanisms, it generally applies to
any UID running in the same user as the caller.

This CL expands access as follows:

-Any app can access its own usage history with no extra requirements.
-Carrier-privileged applications can access usage history for the
entire device.
-Device owners can access per-UID breakdowns for usage. Previously
they could access the summary for the whole device, but not the
individual breakdowns.

We simplify the permission model by defining three access levels -
DEFAULT (own app only), USER (all apps in the same user), and DEVICE
(all apps on the device), and propagate these levels throughout.

Finally, this CL fixes an apparent bug in
NetworkStatsSerice#hasAppOpsPermissions - if the AppOp bit was in
MODE_DEFAULT, hasAppOpsPermission would always return false instead of
falling back to the PackageManager permission check.

Bug: 25812859
Bug: 25813856
Change-Id: Ic96e0776e2a4215a400163872acea1ededfaced9
2015-12-14 17:16:37 -08:00
Jeff Davidson
b3a88669ef Fix bit-rotted NetworkStatsServiceTest.
Breakages:

-ag/574873 - Renders testReportXtOverDev obsolete as this is no longer
             a supported mode. Test has been removed.
-ag/600223 - Tests were sending a CONNECTIVITY_ACTION bcast to trigger
             a call to updateIfaces(), but the listener was removed.
             Tests now call forceUpdateIfaces() directly.
-ag/648284 - Calls to get VPN info were not mocked.

Change-Id: I309f2b5d006549104cb1d3cb83e99363dd6dac16
2015-12-14 13:05:30 -08:00
Baligh Uddin
d64c967d37 empty commit to trigger build
Change-Id: I3ec926126a0d9ee7d64ffc70ca7aa7c6c9e2a9c6
2015-12-13 18:01:17 +00:00
Tyler Gunn
dd8e195a4a Merge commit 'da131290ae5e476691e05e5eb4ac6d507012a0ac' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 20:05:46 -08:00
Tyler Gunn
1550e91dd8 Merge commit '70da83381f77e0ee9ada47eafaae395038ff77ad' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 20:04:17 -08:00
Tyler Gunn
a4d27c4b69 Merge commit '98bd72181e176cdc5536b9709127a71cca082bbf' into mncvtdev-to-mmwirelessdev-merge-2015-12-10 2015-12-10 19:59:27 -08:00
Christopher Tate
98048cdb2b DO NOT MERGE Introduce direct listener API for alarm delivery
The Alarm Manager now supports a set() variant that takes a listener
callback to invoke at alarm trigger time rather than a PendingIntent.
This is much lower overhead and has guaranteed low delivery latency
from the trigger time.  The tradeoff is that the app must be running
*continuously* from the time the alarm is set to the time it is
delivered.  If the app exits for any reason before the alarm fires,
the listener becomes invalid and the alarm will be dropped.  This is
more or less equivalent to setting an alarm with a broadcast
PendingIntent that matches only a runtime-registered receiver.

The app's alarm listener can be any object that implements the new
AlarmManager.OnAlarmListener interface and implements its onAlarm()
method.  There is no data delivered at alarm trigger time: whatever
state needs to be associated with the specific alarm instance should
simply be packaged inside the OnAlarmListener instance.

An alarm using OnAlarmListener can request that the onAlarm() method
be called on an arbitrary handler.  If the program passes 'null' for
this parameter when setting the alarm, the callback occurs on the
application's main Looper thread.

Cherry-picked from a75b36178d
Bug 20157436

Change-Id: I2eb030a24efdd466a2eee1666c5231201b43684b
2015-12-10 16:06:50 -08:00
Jan Nordqvist
6e0af2ced5 DO NOT MERGE Hotspot 2.0 relase 2 first cut.
CP mods to take a URL as a parameter, and new ScanInfo object.

Cherry-picked from 032e267212
Change-Id: Idbb2d4751c575ba07a56942771e2b2955b624635
2015-12-10 16:06:50 -08:00