ConnectivityManager.java revision 9b2886e24301e5d4e7052ec4a6eaff273d3f516c
19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/*
29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project
39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * you may not use this file except in compliance with the License.
69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * You may obtain a copy of the License at
79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Unless required by applicable law or agreed to in writing, software
119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * See the License for the specific language governing permissions and
149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * limitations under the License.
159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */
169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpackage android.net;
189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
19f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkeyimport static com.android.internal.util.Preconditions.checkNotNull;
20f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey
219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.annotation.SdkConstant;
229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.annotation.SdkConstant.SdkConstantType;
2342acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwaltimport android.os.Binder;
243a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkeyimport android.os.Build.VERSION_CODES;
259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.RemoteException;
26961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkeyimport android.provider.Settings;
279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
28585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwaltimport java.net.InetAddress;
29585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt
309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/**
319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Class that answers queries about the state of network connectivity. It also
329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * notifies applications when network connectivity changes. Get an instance
339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * of this class by calling
349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * {@link android.content.Context#getSystemService(String) Context.getSystemService(Context.CONNECTIVITY_SERVICE)}.
359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <p>
369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * The primary responsibilities of this class are to:
379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <ol>
389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <li>Monitor network connections (Wi-Fi, GPRS, UMTS, etc.)</li>
399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <li>Send broadcast intents when network connectivity changes</li>
409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <li>Attempt to "fail over" to another network when connectivity to a network
419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * is lost</li>
429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * <li>Provide an API that allows applications to query the coarse-grained or fine-grained
439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * state of the available networks</li>
449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * </ol>
459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */
46c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkeypublic class ConnectivityManager {
47c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey    private static final String TAG = "ConnectivityManager";
48c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey
499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * A change in network connectivity has occurred. A connection has either
519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * been established or lost. The NetworkInfo for the affected network is
529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * sent as an extra; it should be consulted to see what kind of
539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * connectivity event occurred.
549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <p/>
559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * If this is a connection that was the result of failing over from a
569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * disconnected network, then the FAILOVER_CONNECTION boolean extra is
579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * set to true.
589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <p/>
599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * For a loss of connectivity, if the connectivity manager is attempting
609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * to connect (or has already connected) to another network, the
619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * NetworkInfo for the new network is also passed as an extra. This lets
629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * any receivers of the broadcast know that they should not necessarily
639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * tell the user that no data traffic will be possible. Instead, the
649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * reciever should expect another broadcast soon, indicating either that
659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * the failover attempt succeeded (and so there is still overall data
669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * connectivity), or that the failover attempt failed, meaning that all
679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * connectivity has been lost.
689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <p/>
699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * For a disconnect event, the boolean extra EXTRA_NO_CONNECTIVITY
709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * is set to {@code true} if there are no connected networks at all.
719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
73f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey
749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
75961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey     * Identical to {@link #CONNECTIVITY_ACTION} broadcast, but sent without any
76961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey     * applicable {@link Settings.Secure#CONNECTIVITY_CHANGE_DELAY}.
77961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey     *
78961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey     * @hide
79961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey     */
80961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey    public static final String CONNECTIVITY_ACTION_IMMEDIATE =
81961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey            "android.net.conn.CONNECTIVITY_CHANGE_IMMEDIATE";
82961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey
83961e30458319cfd50e1892ba7dd14a1d0ebe4cc7Jeff Sharkey    /**
849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The lookup key for a {@link NetworkInfo} object. Retrieve with
859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link android.content.Intent#getParcelableExtra(String)}.
86f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     *
87f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     * @deprecated Since {@link NetworkInfo} can vary based on UID, applications
88f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     *             should always obtain network information through
89f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     *             {@link #getActiveNetworkInfo()} or
90f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     *             {@link #getAllNetworkInfo()}.
919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
92f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey    @Deprecated
939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final String EXTRA_NETWORK_INFO = "networkInfo";
94f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey
959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The lookup key for a boolean that indicates whether a connect event
979066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * is for a network to which the connectivity manager was failing over
989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * following a disconnect on another network.
999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Retrieve it with {@link android.content.Intent#getBooleanExtra(String,boolean)}.
1009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final String EXTRA_IS_FAILOVER = "isFailover";
1029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1039066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The lookup key for a {@link NetworkInfo} object. This is supplied when
1049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * there is another network that it may be possible to connect to. Retrieve with
1059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@link android.content.Intent#getParcelableExtra(String)}.
1069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
1089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The lookup key for a boolean that indicates whether there is a
1109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * complete lack of connectivity, i.e., no network is available.
1119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Retrieve it with {@link android.content.Intent#getBooleanExtra(String,boolean)}.
1129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final String EXTRA_NO_CONNECTIVITY = "noConnectivity";
1149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The lookup key for a string that indicates why an attempt to connect
1169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * to a network failed. The string has no particular structure. It is
1179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * intended to be used in notifications presented to users. Retrieve
1189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * it with {@link android.content.Intent#getStringExtra(String)}.
1199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final String EXTRA_REASON = "reason";
1219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The lookup key for a string that provides optionally supplied
1239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * extra information about the network state. The information
1249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * may be passed up from the lower networking layers, and its
1259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * meaning may be specific to a particular network type. Retrieve
1269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * it with {@link android.content.Intent#getStringExtra(String)}.
1279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final String EXTRA_EXTRA_INFO = "extraInfo";
129d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt    /**
130d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     * The lookup key for an int that provides information about
131d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     * our connection to the internet at large.  0 indicates no connection,
132d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     * 100 indicates a great connection.  Retrieve it with
133c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey     * {@link android.content.Intent#getIntExtra(String, int)}.
134d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     * {@hide}
135d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     */
136d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt    public static final String EXTRA_INET_CONDITION = "inetCondition";
1379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
1399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Broadcast Action: The setting for background data usage has changed
1409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * values. Use {@link #getBackgroundDataSetting()} to get the current value.
1419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <p>
1429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * If an application uses the network in the background, it should listen
1439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * for this broadcast and stop using the background data if the value is
144c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey     * {@code false}.
1459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
1469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
1479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final String ACTION_BACKGROUND_DATA_SETTING_CHANGED =
1489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED";
1499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
1501e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt    /**
1511e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt     * Broadcast Action: The network connection may not be good
1521e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt     * uses {@code ConnectivityManager.EXTRA_INET_CONDITION} and
1531e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt     * {@code ConnectivityManager.EXTRA_NETWORK_INFO} to specify
1541e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt     * the network and it's condition.
1551e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt     * @hide
1561e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt     */
1571e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt    public static final String INET_CONDITION_ACTION =
1581e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt            "android.net.conn.INET_CONDITION_ACTION";
1591e9aac2bd855f12708d3049eff4435fa4a2f4317Robert Greenwalt
16042acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    /**
161d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * Broadcast Action: A tetherable connection has come or gone
162d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * TODO - finish the doc
163d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * @hide
164d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     */
165d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    public static final String ACTION_TETHER_STATE_CHANGED =
166d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt            "android.net.conn.TETHER_STATE_CHANGED";
167d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt
168d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    /**
169d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * @hide
1702a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     * gives a String[]
171d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     */
1722a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    public static final String EXTRA_AVAILABLE_TETHER = "availableArray";
173d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt
174d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    /**
175d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * @hide
1762a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     * gives a String[]
177d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     */
1782a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    public static final String EXTRA_ACTIVE_TETHER = "activeArray";
1792a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt
1802a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    /**
1812a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     * @hide
1822a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     * gives a String[]
1832a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     */
1842a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    public static final String EXTRA_ERRORED_TETHER = "erroredArray";
185d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt
186d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    /**
187ccf83af1017b7b1eaf12f6ec3d2cb2137a7cdda9Robert Greenwalt     * The absence of APN..
188ccf83af1017b7b1eaf12f6ec3d2cb2137a7cdda9Robert Greenwalt     * @hide
189ccf83af1017b7b1eaf12f6ec3d2cb2137a7cdda9Robert Greenwalt     */
190ccf83af1017b7b1eaf12f6ec3d2cb2137a7cdda9Robert Greenwalt    public static final int TYPE_NONE        = -1;
191ccf83af1017b7b1eaf12f6ec3d2cb2137a7cdda9Robert Greenwalt
192ccf83af1017b7b1eaf12f6ec3d2cb2137a7cdda9Robert Greenwalt    /**
19342acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * The Default Mobile data connection.  When active, all data traffic
19497ab2d4f86ee9c2b661a00688e934fc7030df22eRobert Greenwalt     * will use this connection by default.
19542acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     */
19642acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    public static final int TYPE_MOBILE      = 0;
19742acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    /**
19842acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * The Default WIFI data connection.  When active, all data traffic
19997ab2d4f86ee9c2b661a00688e934fc7030df22eRobert Greenwalt     * will use this connection by default.
20042acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     */
20142acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    public static final int TYPE_WIFI        = 1;
20242acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    /**
20342acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * An MMS-specific Mobile data connection.  This connection may be the
2041bc3c3775b7b2cbaec50cd377db437f284478de0Robert Greenwalt     * same as {@link #TYPE_MOBILE} but it may be different.  This is used
20542acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * by applications needing to talk to the carrier's Multimedia Messaging
20642acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * Service servers.  It may coexist with default data connections.
20742acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     */
20842acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    public static final int TYPE_MOBILE_MMS  = 2;
20942acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    /**
21042acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * A SUPL-specific Mobile data connection.  This connection may be the
2111bc3c3775b7b2cbaec50cd377db437f284478de0Robert Greenwalt     * same as {@link #TYPE_MOBILE} but it may be different.  This is used
21242acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * by applications needing to talk to the carrier's Secure User Plane
21342acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * Location servers for help locating the device.  It may coexist with
21442acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * default data connections.
21542acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     */
21642acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    public static final int TYPE_MOBILE_SUPL = 3;
21742acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    /**
21842acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * A DUN-specific Mobile data connection.  This connection may be the
2191bc3c3775b7b2cbaec50cd377db437f284478de0Robert Greenwalt     * same as {@link #TYPE_MOBILE} but it may be different.  This is used
22042acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * by applicaitons performing a Dial Up Networking bridge so that
22142acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * the carrier is aware of DUN traffic.  It may coexist with default data
22242acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * connections.
22342acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     */
22442acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    public static final int TYPE_MOBILE_DUN  = 4;
22542acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    /**
22642acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * A High Priority Mobile data connection.  This connection is typically
2271bc3c3775b7b2cbaec50cd377db437f284478de0Robert Greenwalt     * the same as {@link #TYPE_MOBILE} but the routing setup is different.
22842acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * Only requesting processes will have access to the Mobile DNS servers
22942acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     * and only IP's explicitly requested via {@link #requestRouteToHost}
230c849cdf5cfde007ce591838c4e2b777fb4843c8dRobert Greenwalt     * will route over this interface if a default route exists.
23142acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt     */
23242acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt    public static final int TYPE_MOBILE_HIPRI = 5;
2338214deb542392f48b6c3fdc377fdf976c0b17a32jsh    /**
2348214deb542392f48b6c3fdc377fdf976c0b17a32jsh     * The Default WiMAX data connection.  When active, all data traffic
23597ab2d4f86ee9c2b661a00688e934fc7030df22eRobert Greenwalt     * will use this connection by default.
2368214deb542392f48b6c3fdc377fdf976c0b17a32jsh     */
2378214deb542392f48b6c3fdc377fdf976c0b17a32jsh    public static final int TYPE_WIMAX       = 6;
238da3d5e6587c1476d489495ac93e84ebf223024c9Robert Greenwalt
23915c7439acb22ab079dd2ebe42bdf0d2ffd525c5dJaikumar Ganesh    /**
24097ab2d4f86ee9c2b661a00688e934fc7030df22eRobert Greenwalt     * The Default Bluetooth data connection. When active, all data traffic
24197ab2d4f86ee9c2b661a00688e934fc7030df22eRobert Greenwalt     * will use this connection by default.
24215c7439acb22ab079dd2ebe42bdf0d2ffd525c5dJaikumar Ganesh     */
24315c7439acb22ab079dd2ebe42bdf0d2ffd525c5dJaikumar Ganesh    public static final int TYPE_BLUETOOTH   = 7;
24415c7439acb22ab079dd2ebe42bdf0d2ffd525c5dJaikumar Ganesh
2456081084e8831d12d2dd5a9a340ee7d35a54edb8aRobert Greenwalt    /**
2466081084e8831d12d2dd5a9a340ee7d35a54edb8aRobert Greenwalt     * Dummy data connection.  This should not be used on shipping devices.
2476081084e8831d12d2dd5a9a340ee7d35a54edb8aRobert Greenwalt     */
24815c7439acb22ab079dd2ebe42bdf0d2ffd525c5dJaikumar Ganesh    public static final int TYPE_DUMMY       = 8;
2499d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville
2506081084e8831d12d2dd5a9a340ee7d35a54edb8aRobert Greenwalt    /**
25197ab2d4f86ee9c2b661a00688e934fc7030df22eRobert Greenwalt     * The Default Ethernet data connection.  When active, all data traffic
25297ab2d4f86ee9c2b661a00688e934fc7030df22eRobert Greenwalt     * will use this connection by default.
2536081084e8831d12d2dd5a9a340ee7d35a54edb8aRobert Greenwalt     */
254e12aec941dfc93b76b5efb9bc9f30d2ba3469434Robert Greenwalt    public static final int TYPE_ETHERNET    = 9;
2556081084e8831d12d2dd5a9a340ee7d35a54edb8aRobert Greenwalt
2569d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville    /**
2579d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     * Over the air Adminstration.
2589d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     * {@hide}
2599d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     */
2609d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville    public static final int TYPE_MOBILE_FOTA = 10;
2619d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville
2629d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville    /**
2639d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     * IP Multimedia Subsystem
2649d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     * {@hide}
2659d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     */
2669d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville    public static final int TYPE_MOBILE_IMS  = 11;
2679d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville
2689d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville    /**
2699d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     * Carrier Branded Services
2709d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     * {@hide}
2719d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville     */
2729d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville    public static final int TYPE_MOBILE_CBS  = 12;
2739d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville
274aea743aaa43a833fd8ff3dc56205197583152d5frepo sync    /**
275aea743aaa43a833fd8ff3dc56205197583152d5frepo sync     * A Wi-Fi p2p connection. Only requesting processes will have access to
276aea743aaa43a833fd8ff3dc56205197583152d5frepo sync     * the peers connected.
277aea743aaa43a833fd8ff3dc56205197583152d5frepo sync     * {@hide}
278aea743aaa43a833fd8ff3dc56205197583152d5frepo sync     */
279aea743aaa43a833fd8ff3dc56205197583152d5frepo sync    public static final int TYPE_WIFI_P2P    = 13;
280aea743aaa43a833fd8ff3dc56205197583152d5frepo sync
2819d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville    /** {@hide} */
282aea743aaa43a833fd8ff3dc56205197583152d5frepo sync    public static final int MAX_RADIO_TYPE   = TYPE_WIFI_P2P;
2839d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville
2849d7d62801ddb206d2ea96d74864a9edfe54d2eeeWink Saville    /** {@hide} */
285aea743aaa43a833fd8ff3dc56205197583152d5frepo sync    public static final int MAX_NETWORK_TYPE = TYPE_WIFI_P2P;
2869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int DEFAULT_NETWORK_PREFERENCE = TYPE_WIFI;
2889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
289c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey    private final IConnectivityManager mService;
2909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
291d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey    public static boolean isNetworkTypeValid(int networkType) {
29242acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt        return networkType >= 0 && networkType <= MAX_NETWORK_TYPE;
2939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
2949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
295d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey    /** {@hide} */
296d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey    public static String getNetworkTypeName(int type) {
297d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey        switch (type) {
298d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE:
299d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "MOBILE";
300d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_WIFI:
301d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "WIFI";
302d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_MMS:
303d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "MOBILE_MMS";
304d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_SUPL:
305d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "MOBILE_SUPL";
306d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_DUN:
307d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "MOBILE_DUN";
308d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_HIPRI:
309d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "MOBILE_HIPRI";
310d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_WIMAX:
311d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "WIMAX";
312d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_BLUETOOTH:
313d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "BLUETOOTH";
314d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_DUMMY:
315d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "DUMMY";
316d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_ETHERNET:
317d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "ETHERNET";
318d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_FOTA:
319d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "MOBILE_FOTA";
320d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_IMS:
321d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "MOBILE_IMS";
322d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_CBS:
323d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return "MOBILE_CBS";
324aea743aaa43a833fd8ff3dc56205197583152d5frepo sync            case TYPE_WIFI_P2P:
325aea743aaa43a833fd8ff3dc56205197583152d5frepo sync                return "WIFI_P2P";
326d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            default:
327d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return Integer.toString(type);
328d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey        }
329d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey    }
330d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey
331d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey    /** {@hide} */
332d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey    public static boolean isNetworkTypeMobile(int networkType) {
333d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey        switch (networkType) {
334d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE:
335d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_MMS:
336d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_SUPL:
337d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_DUN:
338d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_HIPRI:
339d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_FOTA:
340d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_IMS:
341d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            case TYPE_MOBILE_CBS:
342d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return true;
343d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey            default:
344d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey                return false;
345d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey        }
346d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey    }
347d2a458750e5a3d490af09cecb5c28370baf0a913Jeff Sharkey
3489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void setNetworkPreference(int preference) {
3499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
3509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            mService.setNetworkPreference(preference);
3519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
3529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
3539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
3549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public int getNetworkPreference() {
3569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
3579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return mService.getNetworkPreference();
3589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
3599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return -1;
3609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
3619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
3629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public NetworkInfo getActiveNetworkInfo() {
3649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
3659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return mService.getActiveNetworkInfo();
3669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
3679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return null;
3689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
3699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
3709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
371c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey    /** {@hide} */
372c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey    public NetworkInfo getActiveNetworkInfoForUid(int uid) {
373c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey        try {
374c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey            return mService.getActiveNetworkInfoForUid(uid);
375c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey        } catch (RemoteException e) {
376c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey            return null;
377c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey        }
378c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey    }
379c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey
3809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public NetworkInfo getNetworkInfo(int networkType) {
3819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
3829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return mService.getNetworkInfo(networkType);
3839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
3849066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return null;
3859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
3869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
3879066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
3889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public NetworkInfo[] getAllNetworkInfo() {
3899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
3909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return mService.getAllNetworkInfo();
3919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
3929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return null;
3939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
3949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
3959066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
396c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey    /** {@hide} */
397d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt    public LinkProperties getActiveLinkProperties() {
398d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt        try {
399d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt            return mService.getActiveLinkProperties();
400d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt        } catch (RemoteException e) {
401d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt            return null;
402d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt        }
403d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt    }
404d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt
405c006f1aec15454782c35e028ad64d79a5c161cc1Jeff Sharkey    /** {@hide} */
406d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt    public LinkProperties getLinkProperties(int networkType) {
407d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt        try {
408d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt            return mService.getLinkProperties(networkType);
409d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt        } catch (RemoteException e) {
410d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt            return null;
411d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt        }
412d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt    }
413d192dad69e9e5a820c5c11d8cd34460c9cc2ed11Robert Greenwalt
4149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /** {@hide} */
4159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public boolean setRadios(boolean turnOn) {
4169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
4179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return mService.setRadios(turnOn);
4189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
4199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return false;
4209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
4219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
4229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /** {@hide} */
4249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public boolean setRadio(int networkType, boolean turnOn) {
4259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
4269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return mService.setRadio(networkType, turnOn);
4279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
4289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return false;
4299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
4309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
4319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
4339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Tells the underlying networking system that the caller wants to
4349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * begin using the named feature. The interpretation of {@code feature}
4359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * is completely up to each networking implementation.
4369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param networkType specifies which network the request pertains to
4379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param feature the name of the feature to be used
4389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return an integer value representing the outcome of the request.
4399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The interpretation of this value is specific to each networking
4409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * implementation+feature combination, except that the value {@code -1}
4419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * always indicates failure.
4429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
4439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public int startUsingNetworkFeature(int networkType, String feature) {
4449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
44542acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt            return mService.startUsingNetworkFeature(networkType, feature,
44642acef37339afe6ac608c842f1637870ee9c4f6cRobert Greenwalt                    new Binder());
4479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
4489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return -1;
4499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
4509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
4519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
4539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Tells the underlying networking system that the caller is finished
4549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * using the named feature. The interpretation of {@code feature}
4559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * is completely up to each networking implementation.
4569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param networkType specifies which network the request pertains to
4579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param feature the name of the feature that is no longer needed
4589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return an integer value representing the outcome of the request.
4599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * The interpretation of this value is specific to each networking
4609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * implementation+feature combination, except that the value {@code -1}
4619066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * always indicates failure.
4629066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
4639066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public int stopUsingNetworkFeature(int networkType, String feature) {
4649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
4659066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return mService.stopUsingNetworkFeature(networkType, feature);
4669066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
4679066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return -1;
4689066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
4699066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
4709066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4719066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
4729066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Ensure that a network route exists to deliver traffic to the specified
4739066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * host via the specified network interface. An attempt to add a route that
4749066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * already exists is ignored, but treated as successful.
4759066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param networkType the type of the network over which traffic to the specified
4769066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * host is to be routed
4779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param hostAddress the IP address of the host to which the route is desired
4789066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return {@code true} on success, {@code false} on failure
4799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
4809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public boolean requestRouteToHost(int networkType, int hostAddress) {
481585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt        InetAddress inetAddress = NetworkUtils.intToInetAddress(hostAddress);
482585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt
483585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt        if (inetAddress == null) {
484585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt            return false;
485585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt        }
486585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt
487585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt        return requestRouteToHostAddress(networkType, inetAddress);
488585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt    }
489585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt
490585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt    /**
491585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     * Ensure that a network route exists to deliver traffic to the specified
492585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     * host via the specified network interface. An attempt to add a route that
493585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     * already exists is ignored, but treated as successful.
494585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     * @param networkType the type of the network over which traffic to the specified
495585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     * host is to be routed
496585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     * @param hostAddress the IP address of the host to which the route is desired
497585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     * @return {@code true} on success, {@code false} on failure
498585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     * @hide
499585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt     */
500585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt    public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) {
501585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt        byte[] address = hostAddress.getAddress();
5029066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        try {
503585ac0fc8dde3fe35ec4c71c8f215f2c84139b8bRobert Greenwalt            return mService.requestRouteToHostAddress(networkType, address);
5049066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        } catch (RemoteException e) {
5059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            return false;
5069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
5079066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
5089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
5109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Returns the value of the setting for background data usage. If false,
5119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * applications should not use the network if the application is not in the
5129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * foreground. Developers should respect this setting, and check the value
5139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * of this before performing any background data operations.
5149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * <p>
5159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * All applications that have background services that use the network
5169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * should listen to {@link #ACTION_BACKGROUND_DATA_SETTING_CHANGED}.
5173a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey     * <p>
5183a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey     * As of {@link VERSION_CODES#ICE_CREAM_SANDWICH}, availability of
5193a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey     * background data depends on several combined factors, and this method will
5203a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey     * always return {@code true}. Instead, when background data is unavailable,
5213a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey     * {@link #getActiveNetworkInfo()} will now appear disconnected.
5226fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang     *
5239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return Whether background data usage is allowed.
5249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
5253a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey    @Deprecated
5269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public boolean getBackgroundDataSetting() {
5273a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey        // assume that background data is allowed; final authority is
5283a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey        // NetworkInfo which may be blocked.
5293a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey        return true;
5309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
5319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
5329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
5339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * Sets the value of the setting for background data usage.
534c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     *
5359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @param allowBackgroundData Whether an application should use data while
5369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     *            it is in the background.
537c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     *
5389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @attr ref android.Manifest.permission#CHANGE_BACKGROUND_DATA_SETTING
5399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @see #getBackgroundDataSetting()
5409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @hide
5419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
5423a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey    @Deprecated
5439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void setBackgroundDataSetting(boolean allowBackgroundData) {
5443a844fcf5a0e70a19c38dc500306b9ebe4e1413bJeff Sharkey        // ignored
5459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
546c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt
547c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt    /**
548f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     * Return quota status for the current active network, or {@code null} if no
549f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     * network is active. Quota status can change rapidly, so these values
550f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     * shouldn't be cached.
551f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey     */
552f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey    public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
553f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey        try {
554f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey            return mService.getActiveNetworkQuotaInfo();
555f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey        } catch (RemoteException e) {
556f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey            return null;
557f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey        }
558f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey    }
559f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey
560f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey    /**
561c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     * Gets the value of the setting for enabling Mobile data.
562c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     *
563c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     * @return Whether mobile data is enabled.
564c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     * @hide
565c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     */
566c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt    public boolean getMobileDataEnabled() {
567c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt        try {
568c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt            return mService.getMobileDataEnabled();
569c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt        } catch (RemoteException e) {
570c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt            return true;
571c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt        }
572c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt    }
573c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt
574c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt    /**
575c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     * Sets the persisted value for enabling/disabling Mobile data.
576c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     *
5775a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     * @param enabled Whether the mobile data connection should be
578c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     *            used or not.
579c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     * @hide
580c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt     */
581c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt    public void setMobileDataEnabled(boolean enabled) {
582c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt        try {
583c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt            mService.setMobileDataEnabled(enabled);
584c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt        } catch (RemoteException e) {
585c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt        }
586c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt    }
587c03fa5014912684367174ff3cce664deb29f5e0eRobert Greenwalt
5889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
5899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * {@hide}
5909066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
5919066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public ConnectivityManager(IConnectivityManager service) {
592f0ceede8fff5df24e5c98701d81c2b71eb138aa9Jeff Sharkey        mService = checkNotNull(service, "missing IConnectivityManager");
5939066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
594d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt
595d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    /**
596d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * {@hide}
597d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     */
598d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    public String[] getTetherableIfaces() {
599d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        try {
600d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt            return mService.getTetherableIfaces();
601d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        } catch (RemoteException e) {
602d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt            return new String[0];
603d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        }
604d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    }
605d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt
606d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    /**
607d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * {@hide}
608d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     */
609d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    public String[] getTetheredIfaces() {
610d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        try {
611d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt            return mService.getTetheredIfaces();
612d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        } catch (RemoteException e) {
613d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt            return new String[0];
614d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        }
615d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    }
616d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt
617d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    /**
618d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * {@hide}
619d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     */
6205a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public String[] getTetheringErroredIfaces() {
6215a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt        try {
6225a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt            return mService.getTetheringErroredIfaces();
6235a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt        } catch (RemoteException e) {
6245a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt            return new String[0];
6255a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt        }
6265a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    }
6275a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt
6285a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /**
6295a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     * @return error A TETHER_ERROR value indicating success or failure type
6305a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     * {@hide}
6315a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     */
6325a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public int tether(String iface) {
633d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        try {
634d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt            return mService.tether(iface);
635d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        } catch (RemoteException e) {
6365a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt            return TETHER_ERROR_SERVICE_UNAVAIL;
637d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        }
638d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    }
639d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt
640d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    /**
6415a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     * @return error A TETHER_ERROR value indicating success or failure type
642d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     * {@hide}
643d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt     */
6445a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public int untether(String iface) {
645d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        try {
646d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt            return mService.untether(iface);
647d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        } catch (RemoteException e) {
6485a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt            return TETHER_ERROR_SERVICE_UNAVAIL;
649d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt        }
650d0e18ffb82b59d38aeaf0e552f48e734202719abRobert Greenwalt    }
6512a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt
6522a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    /**
6532a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     * {@hide}
6542a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     */
6552a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    public boolean isTetheringSupported() {
6562a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        try {
6572a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt            return mService.isTetheringSupported();
6582a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        } catch (RemoteException e) {
6592a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt            return false;
6602a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        }
6612a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    }
6622a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt
6632a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    /**
6642a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     * {@hide}
6652a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     */
6662a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    public String[] getTetherableUsbRegexs() {
6672a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        try {
6682a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt            return mService.getTetherableUsbRegexs();
6692a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        } catch (RemoteException e) {
6702a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt            return new String[0];
6712a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        }
6722a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    }
6732a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt
6742a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    /**
6752a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     * {@hide}
6762a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt     */
6772a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    public String[] getTetherableWifiRegexs() {
6782a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        try {
6792a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt            return mService.getTetherableWifiRegexs();
6802a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        } catch (RemoteException e) {
6812a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt            return new String[0];
6822a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt        }
6832a091d7aa0c174986387e5d56bf97a87fe075bdbRobert Greenwalt    }
6845a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt
6856fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang    /**
6866fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang     * {@hide}
6876fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang     */
6886fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang    public String[] getTetherableBluetoothRegexs() {
6896fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang        try {
6906fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang            return mService.getTetherableBluetoothRegexs();
6916fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang        } catch (RemoteException e) {
6926fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang            return new String[0];
6936fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang        }
6946fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang    }
6956fdd0c6274c81b337ad35b70480f881daf7354c3Danica Chang
6966c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood    /**
6976c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood     * {@hide}
6986c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood     */
6996c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood    public int setUsbTethering(boolean enable) {
7006c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood        try {
7016c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood            return mService.setUsbTethering(enable);
7026c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood        } catch (RemoteException e) {
7036c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood            return TETHER_ERROR_SERVICE_UNAVAIL;
7046c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood        }
7056c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood    }
7066c2260b3af3a9243aa7f04cf03106f31817cb4c1Mike Lockwood
7075a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7085a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_NO_ERROR           = 0;
7095a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7105a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_UNKNOWN_IFACE      = 1;
7115a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7125a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_SERVICE_UNAVAIL    = 2;
7135a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7145a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_UNSUPPORTED        = 3;
7155a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7165a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_UNAVAIL_IFACE      = 4;
7175a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7185a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_MASTER_ERROR       = 5;
7195a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7205a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_TETHER_IFACE_ERROR = 6;
7215a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7225a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_UNTETHER_IFACE_ERROR = 7;
7235a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7245a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_ENABLE_NAT_ERROR     = 8;
7255a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7265a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_DISABLE_NAT_ERROR    = 9;
7275a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /** {@hide} */
7285a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public static final int TETHER_ERROR_IFACE_CFG_ERROR      = 10;
7295a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt
7305a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    /**
7315a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     * @param iface The name of the interface we're interested in
7325a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     * @return error The error code of the last error tethering or untethering the named
7335a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     *               interface
7345a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     * {@hide}
7355a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt     */
7365a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt    public int getLastTetherError(String iface) {
7375a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt        try {
7385a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt            return mService.getLastTetherError(iface);
7395a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt        } catch (RemoteException e) {
7405a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt            return TETHER_ERROR_SERVICE_UNAVAIL;
7415a73506cdd466f2b96686ced3ff0f7ca224d1143Robert Greenwalt        }
74214f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt    }
74314f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt
74414f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt    /**
74514f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt     * Ensure the device stays awake until we connect with the next network
74614f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt     * @param forWhome The name of the network going down for logging purposes
74714f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt     * @return {@code true} on success, {@code false} on failure
74814f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt     * {@hide}
74914f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt     */
75014f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt    public boolean requestNetworkTransitionWakelock(String forWhom) {
75114f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt        try {
75214f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt            mService.requestNetworkTransitionWakelock(forWhom);
75314f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt            return true;
75414f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt        } catch (RemoteException e) {
75514f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt            return false;
75614f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt        }
75714f2ef4c9da27a3d58d65dc9f684c5f764ee279aRobert Greenwalt    }
758ca4306c976d393c3cd04270bc2de0af2f4f30fa5Robert Greenwalt
75967fd6c92922a94f46c7b6793a808f473a43eddd3Robert Greenwalt    /**
760d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     * @param networkType The type of network you want to report on
761d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     * @param percentage The quality of the connection 0 is bad, 100 is good
762d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     * {@hide}
763d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt     */
764d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt    public void reportInetCondition(int networkType, int percentage) {
765d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt        try {
766d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt            mService.reportInetCondition(networkType, percentage);
767d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt        } catch (RemoteException e) {
768d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt        }
769d7085fcf6567452a9d6fc69b0c6b1bf556f4c1b9Robert Greenwalt    }
770434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt
771434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    /**
772434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     * @param proxyProperties The definition for the new global http proxy
773434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     * {@hide}
774434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     */
775434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    public void setGlobalProxy(ProxyProperties p) {
776434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        try {
777434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt            mService.setGlobalProxy(p);
778434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        } catch (RemoteException e) {
779434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        }
780434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    }
781434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt
782434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    /**
783434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     * @return proxyProperties for the current global proxy
784434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     * {@hide}
785434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     */
786434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    public ProxyProperties getGlobalProxy() {
787434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        try {
788434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt            return mService.getGlobalProxy();
789434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        } catch (RemoteException e) {
790434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt            return null;
791434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        }
792434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    }
793434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt
794434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    /**
795434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     * @return proxyProperties for the current proxy (global if set, network specific if not)
796434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     * {@hide}
797434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt     */
798434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    public ProxyProperties getProxy() {
799434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        try {
800434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt            return mService.getProxy();
801434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        } catch (RemoteException e) {
802434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt            return null;
803434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt        }
804434203a277cd2f237a71508a3d5a7d1602126cd5Robert Greenwalt    }
805d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt
806d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt    /**
807d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt     * @param networkType The network who's dependence has changed
808d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt     * @param met Boolean - true if network use is ok, false if not
809d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt     * {@hide}
810d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt     */
811d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt    public void setDataDependency(int networkType, boolean met) {
812d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt        try {
813d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt            mService.setDataDependency(networkType, met);
814d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt        } catch (RemoteException e) {
815d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt        }
816d55a6b498d66d8fc415908ecf63e50f46cce67e8Robert Greenwalt    }
8179b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt
8189b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt    /**
8199b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * Returns true if the hardware supports the given network type
8209b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * else it returns false.  This doesn't indicate we have coverage
8219b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * or are authorized onto a network, just whether or not the
8229b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * hardware supports it.  For example a gsm phone without a sim
8239b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * should still return true for mobile data, but a wifi only tablet
8249b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * would return false.
8259b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * @param networkType The nework type we'd like to check
8269b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * @return true if supported, else false
8279b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     * @hide
8289b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt     */
8299b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt    public boolean isNetworkSupported(int networkType) {
8309b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt        try {
8319b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt            return mService.isNetworkSupported(networkType);
8329b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt        } catch (RemoteException e) {}
8339b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt        return false;
8349b2886e24301e5d4e7052ec4a6eaff273d3f516cRobert Greenwalt    }
8359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
836