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