ConnectivityManager.java revision aea743aaa43a833fd8ff3dc56205197583152d5f
1/* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.net; 18 19import static com.android.internal.util.Preconditions.checkNotNull; 20 21import android.annotation.SdkConstant; 22import android.annotation.SdkConstant.SdkConstantType; 23import android.os.Binder; 24import android.os.RemoteException; 25 26import java.net.InetAddress; 27 28/** 29 * Class that answers queries about the state of network connectivity. It also 30 * notifies applications when network connectivity changes. Get an instance 31 * of this class by calling 32 * {@link android.content.Context#getSystemService(String) Context.getSystemService(Context.CONNECTIVITY_SERVICE)}. 33 * <p> 34 * The primary responsibilities of this class are to: 35 * <ol> 36 * <li>Monitor network connections (Wi-Fi, GPRS, UMTS, etc.)</li> 37 * <li>Send broadcast intents when network connectivity changes</li> 38 * <li>Attempt to "fail over" to another network when connectivity to a network 39 * is lost</li> 40 * <li>Provide an API that allows applications to query the coarse-grained or fine-grained 41 * state of the available networks</li> 42 * </ol> 43 */ 44public class ConnectivityManager { 45 private static final String TAG = "ConnectivityManager"; 46 47 /** 48 * A change in network connectivity has occurred. A connection has either 49 * been established or lost. The NetworkInfo for the affected network is 50 * sent as an extra; it should be consulted to see what kind of 51 * connectivity event occurred. 52 * <p/> 53 * If this is a connection that was the result of failing over from a 54 * disconnected network, then the FAILOVER_CONNECTION boolean extra is 55 * set to true. 56 * <p/> 57 * For a loss of connectivity, if the connectivity manager is attempting 58 * to connect (or has already connected) to another network, the 59 * NetworkInfo for the new network is also passed as an extra. This lets 60 * any receivers of the broadcast know that they should not necessarily 61 * tell the user that no data traffic will be possible. Instead, the 62 * reciever should expect another broadcast soon, indicating either that 63 * the failover attempt succeeded (and so there is still overall data 64 * connectivity), or that the failover attempt failed, meaning that all 65 * connectivity has been lost. 66 * <p/> 67 * For a disconnect event, the boolean extra EXTRA_NO_CONNECTIVITY 68 * is set to {@code true} if there are no connected networks at all. 69 */ 70 public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE"; 71 72 /** 73 * The lookup key for a {@link NetworkInfo} object. Retrieve with 74 * {@link android.content.Intent#getParcelableExtra(String)}. 75 * 76 * @deprecated Since {@link NetworkInfo} can vary based on UID, applications 77 * should always obtain network information through 78 * {@link #getActiveNetworkInfo()} or 79 * {@link #getAllNetworkInfo()}. 80 */ 81 @Deprecated 82 public static final String EXTRA_NETWORK_INFO = "networkInfo"; 83 84 /** 85 * The lookup key for a boolean that indicates whether a connect event 86 * is for a network to which the connectivity manager was failing over 87 * following a disconnect on another network. 88 * Retrieve it with {@link android.content.Intent#getBooleanExtra(String,boolean)}. 89 */ 90 public static final String EXTRA_IS_FAILOVER = "isFailover"; 91 /** 92 * The lookup key for a {@link NetworkInfo} object. This is supplied when 93 * there is another network that it may be possible to connect to. Retrieve with 94 * {@link android.content.Intent#getParcelableExtra(String)}. 95 */ 96 public static final String EXTRA_OTHER_NETWORK_INFO = "otherNetwork"; 97 /** 98 * The lookup key for a boolean that indicates whether there is a 99 * complete lack of connectivity, i.e., no network is available. 100 * Retrieve it with {@link android.content.Intent#getBooleanExtra(String,boolean)}. 101 */ 102 public static final String EXTRA_NO_CONNECTIVITY = "noConnectivity"; 103 /** 104 * The lookup key for a string that indicates why an attempt to connect 105 * to a network failed. The string has no particular structure. It is 106 * intended to be used in notifications presented to users. Retrieve 107 * it with {@link android.content.Intent#getStringExtra(String)}. 108 */ 109 public static final String EXTRA_REASON = "reason"; 110 /** 111 * The lookup key for a string that provides optionally supplied 112 * extra information about the network state. The information 113 * may be passed up from the lower networking layers, and its 114 * meaning may be specific to a particular network type. Retrieve 115 * it with {@link android.content.Intent#getStringExtra(String)}. 116 */ 117 public static final String EXTRA_EXTRA_INFO = "extraInfo"; 118 /** 119 * The lookup key for an int that provides information about 120 * our connection to the internet at large. 0 indicates no connection, 121 * 100 indicates a great connection. Retrieve it with 122 * {@link android.content.Intent#getIntExtra(String, int)}. 123 * {@hide} 124 */ 125 public static final String EXTRA_INET_CONDITION = "inetCondition"; 126 127 /** 128 * Broadcast Action: The setting for background data usage has changed 129 * values. Use {@link #getBackgroundDataSetting()} to get the current value. 130 * <p> 131 * If an application uses the network in the background, it should listen 132 * for this broadcast and stop using the background data if the value is 133 * {@code false}. 134 */ 135 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 136 public static final String ACTION_BACKGROUND_DATA_SETTING_CHANGED = 137 "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED"; 138 139 /** 140 * Broadcast Action: The network connection may not be good 141 * uses {@code ConnectivityManager.EXTRA_INET_CONDITION} and 142 * {@code ConnectivityManager.EXTRA_NETWORK_INFO} to specify 143 * the network and it's condition. 144 * @hide 145 */ 146 public static final String INET_CONDITION_ACTION = 147 "android.net.conn.INET_CONDITION_ACTION"; 148 149 /** 150 * Broadcast Action: A tetherable connection has come or gone 151 * TODO - finish the doc 152 * @hide 153 */ 154 public static final String ACTION_TETHER_STATE_CHANGED = 155 "android.net.conn.TETHER_STATE_CHANGED"; 156 157 /** 158 * @hide 159 * gives a String[] 160 */ 161 public static final String EXTRA_AVAILABLE_TETHER = "availableArray"; 162 163 /** 164 * @hide 165 * gives a String[] 166 */ 167 public static final String EXTRA_ACTIVE_TETHER = "activeArray"; 168 169 /** 170 * @hide 171 * gives a String[] 172 */ 173 public static final String EXTRA_ERRORED_TETHER = "erroredArray"; 174 175 /** 176 * The absence of APN.. 177 * @hide 178 */ 179 public static final int TYPE_NONE = -1; 180 181 /** 182 * The Default Mobile data connection. When active, all data traffic 183 * will use this connection by default. 184 */ 185 public static final int TYPE_MOBILE = 0; 186 /** 187 * The Default WIFI data connection. When active, all data traffic 188 * will use this connection by default. 189 */ 190 public static final int TYPE_WIFI = 1; 191 /** 192 * An MMS-specific Mobile data connection. This connection may be the 193 * same as {@link #TYPE_MOBILE} but it may be different. This is used 194 * by applications needing to talk to the carrier's Multimedia Messaging 195 * Service servers. It may coexist with default data connections. 196 */ 197 public static final int TYPE_MOBILE_MMS = 2; 198 /** 199 * A SUPL-specific Mobile data connection. This connection may be the 200 * same as {@link #TYPE_MOBILE} but it may be different. This is used 201 * by applications needing to talk to the carrier's Secure User Plane 202 * Location servers for help locating the device. It may coexist with 203 * default data connections. 204 */ 205 public static final int TYPE_MOBILE_SUPL = 3; 206 /** 207 * A DUN-specific Mobile data connection. This connection may be the 208 * same as {@link #TYPE_MOBILE} but it may be different. This is used 209 * by applicaitons performing a Dial Up Networking bridge so that 210 * the carrier is aware of DUN traffic. It may coexist with default data 211 * connections. 212 */ 213 public static final int TYPE_MOBILE_DUN = 4; 214 /** 215 * A High Priority Mobile data connection. This connection is typically 216 * the same as {@link #TYPE_MOBILE} but the routing setup is different. 217 * Only requesting processes will have access to the Mobile DNS servers 218 * and only IP's explicitly requested via {@link #requestRouteToHost} 219 * will route over this interface if a default route exists. 220 */ 221 public static final int TYPE_MOBILE_HIPRI = 5; 222 /** 223 * The Default WiMAX data connection. When active, all data traffic 224 * will use this connection by default. 225 */ 226 public static final int TYPE_WIMAX = 6; 227 228 /** 229 * The Default Bluetooth data connection. When active, all data traffic 230 * will use this connection by default. 231 */ 232 public static final int TYPE_BLUETOOTH = 7; 233 234 /** 235 * Dummy data connection. This should not be used on shipping devices. 236 */ 237 public static final int TYPE_DUMMY = 8; 238 239 /** 240 * The Default Ethernet data connection. When active, all data traffic 241 * will use this connection by default. 242 */ 243 public static final int TYPE_ETHERNET = 9; 244 245 /** 246 * Over the air Adminstration. 247 * {@hide} 248 */ 249 public static final int TYPE_MOBILE_FOTA = 10; 250 251 /** 252 * IP Multimedia Subsystem 253 * {@hide} 254 */ 255 public static final int TYPE_MOBILE_IMS = 11; 256 257 /** 258 * Carrier Branded Services 259 * {@hide} 260 */ 261 public static final int TYPE_MOBILE_CBS = 12; 262 263 /** 264 * A Wi-Fi p2p connection. Only requesting processes will have access to 265 * the peers connected. 266 * {@hide} 267 */ 268 public static final int TYPE_WIFI_P2P = 13; 269 270 /** {@hide} */ 271 public static final int MAX_RADIO_TYPE = TYPE_WIFI_P2P; 272 273 /** {@hide} */ 274 public static final int MAX_NETWORK_TYPE = TYPE_WIFI_P2P; 275 276 public static final int DEFAULT_NETWORK_PREFERENCE = TYPE_WIFI; 277 278 private final IConnectivityManager mService; 279 280 public static boolean isNetworkTypeValid(int networkType) { 281 return networkType >= 0 && networkType <= MAX_NETWORK_TYPE; 282 } 283 284 /** {@hide} */ 285 public static String getNetworkTypeName(int type) { 286 switch (type) { 287 case TYPE_MOBILE: 288 return "MOBILE"; 289 case TYPE_WIFI: 290 return "WIFI"; 291 case TYPE_MOBILE_MMS: 292 return "MOBILE_MMS"; 293 case TYPE_MOBILE_SUPL: 294 return "MOBILE_SUPL"; 295 case TYPE_MOBILE_DUN: 296 return "MOBILE_DUN"; 297 case TYPE_MOBILE_HIPRI: 298 return "MOBILE_HIPRI"; 299 case TYPE_WIMAX: 300 return "WIMAX"; 301 case TYPE_BLUETOOTH: 302 return "BLUETOOTH"; 303 case TYPE_DUMMY: 304 return "DUMMY"; 305 case TYPE_ETHERNET: 306 return "ETHERNET"; 307 case TYPE_MOBILE_FOTA: 308 return "MOBILE_FOTA"; 309 case TYPE_MOBILE_IMS: 310 return "MOBILE_IMS"; 311 case TYPE_MOBILE_CBS: 312 return "MOBILE_CBS"; 313 case TYPE_WIFI_P2P: 314 return "WIFI_P2P"; 315 default: 316 return Integer.toString(type); 317 } 318 } 319 320 /** {@hide} */ 321 public static boolean isNetworkTypeMobile(int networkType) { 322 switch (networkType) { 323 case TYPE_MOBILE: 324 case TYPE_MOBILE_MMS: 325 case TYPE_MOBILE_SUPL: 326 case TYPE_MOBILE_DUN: 327 case TYPE_MOBILE_HIPRI: 328 case TYPE_MOBILE_FOTA: 329 case TYPE_MOBILE_IMS: 330 case TYPE_MOBILE_CBS: 331 return true; 332 default: 333 return false; 334 } 335 } 336 337 public void setNetworkPreference(int preference) { 338 try { 339 mService.setNetworkPreference(preference); 340 } catch (RemoteException e) { 341 } 342 } 343 344 public int getNetworkPreference() { 345 try { 346 return mService.getNetworkPreference(); 347 } catch (RemoteException e) { 348 return -1; 349 } 350 } 351 352 public NetworkInfo getActiveNetworkInfo() { 353 try { 354 return mService.getActiveNetworkInfo(); 355 } catch (RemoteException e) { 356 return null; 357 } 358 } 359 360 /** {@hide} */ 361 public NetworkInfo getActiveNetworkInfoForUid(int uid) { 362 try { 363 return mService.getActiveNetworkInfoForUid(uid); 364 } catch (RemoteException e) { 365 return null; 366 } 367 } 368 369 public NetworkInfo getNetworkInfo(int networkType) { 370 try { 371 return mService.getNetworkInfo(networkType); 372 } catch (RemoteException e) { 373 return null; 374 } 375 } 376 377 public NetworkInfo[] getAllNetworkInfo() { 378 try { 379 return mService.getAllNetworkInfo(); 380 } catch (RemoteException e) { 381 return null; 382 } 383 } 384 385 /** {@hide} */ 386 public LinkProperties getActiveLinkProperties() { 387 try { 388 return mService.getActiveLinkProperties(); 389 } catch (RemoteException e) { 390 return null; 391 } 392 } 393 394 /** {@hide} */ 395 public LinkProperties getLinkProperties(int networkType) { 396 try { 397 return mService.getLinkProperties(networkType); 398 } catch (RemoteException e) { 399 return null; 400 } 401 } 402 403 /** {@hide} */ 404 public boolean setRadios(boolean turnOn) { 405 try { 406 return mService.setRadios(turnOn); 407 } catch (RemoteException e) { 408 return false; 409 } 410 } 411 412 /** {@hide} */ 413 public boolean setRadio(int networkType, boolean turnOn) { 414 try { 415 return mService.setRadio(networkType, turnOn); 416 } catch (RemoteException e) { 417 return false; 418 } 419 } 420 421 /** 422 * Tells the underlying networking system that the caller wants to 423 * begin using the named feature. The interpretation of {@code feature} 424 * is completely up to each networking implementation. 425 * @param networkType specifies which network the request pertains to 426 * @param feature the name of the feature to be used 427 * @return an integer value representing the outcome of the request. 428 * The interpretation of this value is specific to each networking 429 * implementation+feature combination, except that the value {@code -1} 430 * always indicates failure. 431 */ 432 public int startUsingNetworkFeature(int networkType, String feature) { 433 try { 434 return mService.startUsingNetworkFeature(networkType, feature, 435 new Binder()); 436 } catch (RemoteException e) { 437 return -1; 438 } 439 } 440 441 /** 442 * Tells the underlying networking system that the caller is finished 443 * using the named feature. The interpretation of {@code feature} 444 * is completely up to each networking implementation. 445 * @param networkType specifies which network the request pertains to 446 * @param feature the name of the feature that is no longer needed 447 * @return an integer value representing the outcome of the request. 448 * The interpretation of this value is specific to each networking 449 * implementation+feature combination, except that the value {@code -1} 450 * always indicates failure. 451 */ 452 public int stopUsingNetworkFeature(int networkType, String feature) { 453 try { 454 return mService.stopUsingNetworkFeature(networkType, feature); 455 } catch (RemoteException e) { 456 return -1; 457 } 458 } 459 460 /** 461 * Ensure that a network route exists to deliver traffic to the specified 462 * host via the specified network interface. An attempt to add a route that 463 * already exists is ignored, but treated as successful. 464 * @param networkType the type of the network over which traffic to the specified 465 * host is to be routed 466 * @param hostAddress the IP address of the host to which the route is desired 467 * @return {@code true} on success, {@code false} on failure 468 */ 469 public boolean requestRouteToHost(int networkType, int hostAddress) { 470 InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress); 471 472 if (inetAddress == null) { 473 return false; 474 } 475 476 return requestRouteToHostAddress(networkType, inetAddress); 477 } 478 479 /** 480 * Ensure that a network route exists to deliver traffic to the specified 481 * host via the specified network interface. An attempt to add a route that 482 * already exists is ignored, but treated as successful. 483 * @param networkType the type of the network over which traffic to the specified 484 * host is to be routed 485 * @param hostAddress the IP address of the host to which the route is desired 486 * @return {@code true} on success, {@code false} on failure 487 * @hide 488 */ 489 public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) { 490 byte[] address = hostAddress.getAddress(); 491 try { 492 return mService.requestRouteToHostAddress(networkType, address); 493 } catch (RemoteException e) { 494 return false; 495 } 496 } 497 498 /** 499 * Returns the value of the setting for background data usage. If false, 500 * applications should not use the network if the application is not in the 501 * foreground. Developers should respect this setting, and check the value 502 * of this before performing any background data operations. 503 * <p> 504 * All applications that have background services that use the network 505 * should listen to {@link #ACTION_BACKGROUND_DATA_SETTING_CHANGED}. 506 * 507 * @return Whether background data usage is allowed. 508 */ 509 public boolean getBackgroundDataSetting() { 510 try { 511 return mService.getBackgroundDataSetting(); 512 } catch (RemoteException e) { 513 // Err on the side of safety 514 return false; 515 } 516 } 517 518 /** 519 * Sets the value of the setting for background data usage. 520 * 521 * @param allowBackgroundData Whether an application should use data while 522 * it is in the background. 523 * 524 * @attr ref android.Manifest.permission#CHANGE_BACKGROUND_DATA_SETTING 525 * @see #getBackgroundDataSetting() 526 * @hide 527 */ 528 public void setBackgroundDataSetting(boolean allowBackgroundData) { 529 try { 530 mService.setBackgroundDataSetting(allowBackgroundData); 531 } catch (RemoteException e) { 532 } 533 } 534 535 /** 536 * Return quota status for the current active network, or {@code null} if no 537 * network is active. Quota status can change rapidly, so these values 538 * shouldn't be cached. 539 */ 540 public NetworkQuotaInfo getActiveNetworkQuotaInfo() { 541 try { 542 return mService.getActiveNetworkQuotaInfo(); 543 } catch (RemoteException e) { 544 return null; 545 } 546 } 547 548 /** 549 * Gets the value of the setting for enabling Mobile data. 550 * 551 * @return Whether mobile data is enabled. 552 * @hide 553 */ 554 public boolean getMobileDataEnabled() { 555 try { 556 return mService.getMobileDataEnabled(); 557 } catch (RemoteException e) { 558 return true; 559 } 560 } 561 562 /** 563 * Sets the persisted value for enabling/disabling Mobile data. 564 * 565 * @param enabled Whether the mobile data connection should be 566 * used or not. 567 * @hide 568 */ 569 public void setMobileDataEnabled(boolean enabled) { 570 try { 571 mService.setMobileDataEnabled(enabled); 572 } catch (RemoteException e) { 573 } 574 } 575 576 /** 577 * {@hide} 578 */ 579 public ConnectivityManager(IConnectivityManager service) { 580 mService = checkNotNull(service, "missing IConnectivityManager"); 581 } 582 583 /** 584 * {@hide} 585 */ 586 public String[] getTetherableIfaces() { 587 try { 588 return mService.getTetherableIfaces(); 589 } catch (RemoteException e) { 590 return new String[0]; 591 } 592 } 593 594 /** 595 * {@hide} 596 */ 597 public String[] getTetheredIfaces() { 598 try { 599 return mService.getTetheredIfaces(); 600 } catch (RemoteException e) { 601 return new String[0]; 602 } 603 } 604 605 /** 606 * {@hide} 607 */ 608 public String[] getTetheringErroredIfaces() { 609 try { 610 return mService.getTetheringErroredIfaces(); 611 } catch (RemoteException e) { 612 return new String[0]; 613 } 614 } 615 616 /** 617 * @return error A TETHER_ERROR value indicating success or failure type 618 * {@hide} 619 */ 620 public int tether(String iface) { 621 try { 622 return mService.tether(iface); 623 } catch (RemoteException e) { 624 return TETHER_ERROR_SERVICE_UNAVAIL; 625 } 626 } 627 628 /** 629 * @return error A TETHER_ERROR value indicating success or failure type 630 * {@hide} 631 */ 632 public int untether(String iface) { 633 try { 634 return mService.untether(iface); 635 } catch (RemoteException e) { 636 return TETHER_ERROR_SERVICE_UNAVAIL; 637 } 638 } 639 640 /** 641 * {@hide} 642 */ 643 public boolean isTetheringSupported() { 644 try { 645 return mService.isTetheringSupported(); 646 } catch (RemoteException e) { 647 return false; 648 } 649 } 650 651 /** 652 * {@hide} 653 */ 654 public String[] getTetherableUsbRegexs() { 655 try { 656 return mService.getTetherableUsbRegexs(); 657 } catch (RemoteException e) { 658 return new String[0]; 659 } 660 } 661 662 /** 663 * {@hide} 664 */ 665 public String[] getTetherableWifiRegexs() { 666 try { 667 return mService.getTetherableWifiRegexs(); 668 } catch (RemoteException e) { 669 return new String[0]; 670 } 671 } 672 673 /** 674 * {@hide} 675 */ 676 public String[] getTetherableBluetoothRegexs() { 677 try { 678 return mService.getTetherableBluetoothRegexs(); 679 } catch (RemoteException e) { 680 return new String[0]; 681 } 682 } 683 684 /** 685 * {@hide} 686 */ 687 public int setUsbTethering(boolean enable) { 688 try { 689 return mService.setUsbTethering(enable); 690 } catch (RemoteException e) { 691 return TETHER_ERROR_SERVICE_UNAVAIL; 692 } 693 } 694 695 /** {@hide} */ 696 public static final int TETHER_ERROR_NO_ERROR = 0; 697 /** {@hide} */ 698 public static final int TETHER_ERROR_UNKNOWN_IFACE = 1; 699 /** {@hide} */ 700 public static final int TETHER_ERROR_SERVICE_UNAVAIL = 2; 701 /** {@hide} */ 702 public static final int TETHER_ERROR_UNSUPPORTED = 3; 703 /** {@hide} */ 704 public static final int TETHER_ERROR_UNAVAIL_IFACE = 4; 705 /** {@hide} */ 706 public static final int TETHER_ERROR_MASTER_ERROR = 5; 707 /** {@hide} */ 708 public static final int TETHER_ERROR_TETHER_IFACE_ERROR = 6; 709 /** {@hide} */ 710 public static final int TETHER_ERROR_UNTETHER_IFACE_ERROR = 7; 711 /** {@hide} */ 712 public static final int TETHER_ERROR_ENABLE_NAT_ERROR = 8; 713 /** {@hide} */ 714 public static final int TETHER_ERROR_DISABLE_NAT_ERROR = 9; 715 /** {@hide} */ 716 public static final int TETHER_ERROR_IFACE_CFG_ERROR = 10; 717 718 /** 719 * @param iface The name of the interface we're interested in 720 * @return error The error code of the last error tethering or untethering the named 721 * interface 722 * {@hide} 723 */ 724 public int getLastTetherError(String iface) { 725 try { 726 return mService.getLastTetherError(iface); 727 } catch (RemoteException e) { 728 return TETHER_ERROR_SERVICE_UNAVAIL; 729 } 730 } 731 732 /** 733 * Ensure the device stays awake until we connect with the next network 734 * @param forWhome The name of the network going down for logging purposes 735 * @return {@code true} on success, {@code false} on failure 736 * {@hide} 737 */ 738 public boolean requestNetworkTransitionWakelock(String forWhom) { 739 try { 740 mService.requestNetworkTransitionWakelock(forWhom); 741 return true; 742 } catch (RemoteException e) { 743 return false; 744 } 745 } 746 747 /** 748 * @param networkType The type of network you want to report on 749 * @param percentage The quality of the connection 0 is bad, 100 is good 750 * {@hide} 751 */ 752 public void reportInetCondition(int networkType, int percentage) { 753 try { 754 mService.reportInetCondition(networkType, percentage); 755 } catch (RemoteException e) { 756 } 757 } 758 759 /** 760 * @param proxyProperties The definition for the new global http proxy 761 * {@hide} 762 */ 763 public void setGlobalProxy(ProxyProperties p) { 764 try { 765 mService.setGlobalProxy(p); 766 } catch (RemoteException e) { 767 } 768 } 769 770 /** 771 * @return proxyProperties for the current global proxy 772 * {@hide} 773 */ 774 public ProxyProperties getGlobalProxy() { 775 try { 776 return mService.getGlobalProxy(); 777 } catch (RemoteException e) { 778 return null; 779 } 780 } 781 782 /** 783 * @return proxyProperties for the current proxy (global if set, network specific if not) 784 * {@hide} 785 */ 786 public ProxyProperties getProxy() { 787 try { 788 return mService.getProxy(); 789 } catch (RemoteException e) { 790 return null; 791 } 792 } 793 794 /** 795 * @param networkType The network who's dependence has changed 796 * @param met Boolean - true if network use is ok, false if not 797 * {@hide} 798 */ 799 public void setDataDependency(int networkType, boolean met) { 800 try { 801 mService.setDataDependency(networkType, met); 802 } catch (RemoteException e) { 803 } 804 } 805} 806