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