method public void unregisterDefaultNetworkActiveListener(android.net.ConnectivityManager.OnNetworkActiveListener);
method public void unregisterNetworkCallback(android.net.ConnectivityManager.NetworkCallback);
field public static final deprecated java.lang.String ACTION_BACKGROUND_DATA_SETTING_CHANGED = "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED";
+ field public static final java.lang.String ACTION_CAPTIVE_PORTAL_DETECTED = "android.net.conn.CAPTIVE_PORTAL_DETECTED";
+ field public static final java.lang.String ACTION_CAPTIVE_PORTAL_SIGN_IN = "android.net.conn.CAPTIVE_PORTAL_SIGN_IN";
+ field public static final int CAPTIVE_PORTAL_DISCONNECT = 2; // 0x2
+ field public static final int CAPTIVE_PORTAL_SIGNED_IN = 1; // 0x1
field public static final java.lang.String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
field public static final deprecated int DEFAULT_NETWORK_PREFERENCE = 1; // 0x1
field public static final java.lang.String EXTRA_EXTRA_INFO = "extraInfo";
field public static final java.lang.String EXTRA_IS_FAILOVER = "isFailover";
+ field public static final java.lang.String EXTRA_NETWORK = "network";
field public static final deprecated java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
field public static final java.lang.String EXTRA_NETWORK_TYPE = "networkType";
field public static final java.lang.String EXTRA_NO_CONNECTIVITY = "noConnectivity";
field public static final java.lang.String EXTRA_OTHER_NETWORK_INFO = "otherNetwork";
field public static final java.lang.String EXTRA_REASON = "reason";
- field public static final java.lang.String ACTION_CAPTIVE_PORTAL_DETECTED = "android.net.conn.CAPTIVE_PORTAL_DETECTED";
- field public static final java.lang.String ACTION_CAPTIVE_PORTAL_SIGN_IN = "android.net.conn.CAPTIVE_PORTAL_SIGN_IN";
- field public static final java.lang.String EXTRA_NETWORK = "network";
- field public static final int CAPTIVE_PORTAL_SIGNED_IN = 1;
- field public static final int CAPTIVE_PORTAL_DISCONNECT = 2;
field public static final int TYPE_BLUETOOTH = 7; // 0x7
field public static final int TYPE_DUMMY = 8; // 0x8
field public static final int TYPE_ETHERNET = 9; // 0x9
field public static final int TYPE_MOBILE_HIPRI = 5; // 0x5
field public static final int TYPE_MOBILE_MMS = 2; // 0x2
field public static final int TYPE_MOBILE_SUPL = 3; // 0x3
+ field public static final int TYPE_VPN = 17; // 0x11
field public static final int TYPE_WIFI = 1; // 0x1
field public static final int TYPE_WIMAX = 6; // 0x6
}
+++ /dev/null
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-import android.os.Messenger;
-import android.util.Slog;
-
-/**
- * A dummy data state tracker for use when we don't have a real radio
- * connection. useful when bringing up a board or when you have network
- * access through other means.
- *
- * {@hide}
- */
-public class DummyDataStateTracker extends BaseNetworkStateTracker {
-
- private static final String TAG = "DummyDataStateTracker";
- private static final boolean DBG = true;
- private static final boolean VDBG = false;
-
- private boolean mTeardownRequested = false;
- private Handler mTarget;
- private boolean mPrivateDnsRouteSet = false;
- private boolean mDefaultRouteSet = false;
-
- // DEFAULT and HIPRI are the same connection. If we're one of these we need to check if
- // the other is also disconnected before we reset sockets
- private boolean mIsDefaultOrHipri = false;
-
- /**
- * Create a new DummyDataStateTracker
- * @param netType the ConnectivityManager network type
- * @param tag the name of this network
- */
- public DummyDataStateTracker(int netType, String tag) {
- mNetworkInfo = new NetworkInfo(netType);
- }
-
- /**
- * Begin monitoring data connectivity.
- *
- * @param context is the current Android context
- * @param target is the Handler to which to return the events.
- */
- public void startMonitoring(Context context, Handler target) {
- mTarget = target;
- mContext = context;
- }
-
- public boolean isPrivateDnsRouteSet() {
- return mPrivateDnsRouteSet;
- }
-
- public void privateDnsRouteSet(boolean enabled) {
- mPrivateDnsRouteSet = enabled;
- }
-
- public NetworkInfo getNetworkInfo() {
- return mNetworkInfo;
- }
-
- public boolean isDefaultRouteSet() {
- return mDefaultRouteSet;
- }
-
- public void defaultRouteSet(boolean enabled) {
- mDefaultRouteSet = enabled;
- }
-
- /**
- * This is not implemented.
- */
- public void releaseWakeLock() {
- }
-
- /**
- * Report whether data connectivity is possible.
- */
- public boolean isAvailable() {
- return true;
- }
-
- /**
- * Return the system properties name associated with the tcp buffer sizes
- * for this network.
- */
- public String getTcpBufferSizesPropName() {
- return "net.tcp.buffersize.unknown";
- }
-
- /**
- * Tear down mobile data connectivity, i.e., disable the ability to create
- * mobile data connections.
- * TODO - make async and return nothing?
- */
- public boolean teardown() {
- setDetailedState(NetworkInfo.DetailedState.DISCONNECTING, "disabled", null);
- setDetailedState(NetworkInfo.DetailedState.DISCONNECTED, "disabled", null);
- return true;
- }
-
- @Override
- public void captivePortalCheckCompleted(boolean isCaptivePortal) {
- // not implemented
- }
-
- /**
- * Record the detailed state of a network, and if it is a
- * change from the previous state, send a notification to
- * any listeners.
- * @param state the new {@code DetailedState}
- * @param reason a {@code String} indicating a reason for the state change,
- * if one was supplied. May be {@code null}.
- * @param extraInfo optional {@code String} providing extra information about the state change
- */
- private void setDetailedState(NetworkInfo.DetailedState state, String reason,
- String extraInfo) {
- if (DBG) log("setDetailed state, old ="
- + mNetworkInfo.getDetailedState() + " and new state=" + state);
- mNetworkInfo.setDetailedState(state, reason, extraInfo);
- Message msg = mTarget.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
- msg.sendToTarget();
- }
-
- public void setTeardownRequested(boolean isRequested) {
- mTeardownRequested = isRequested;
- }
-
- public boolean isTeardownRequested() {
- return mTeardownRequested;
- }
-
- /**
- * Re-enable mobile data connectivity after a {@link #teardown()}.
- * TODO - make async and always get a notification?
- */
- public boolean reconnect() {
- setDetailedState(NetworkInfo.DetailedState.CONNECTING, "enabled", null);
- setDetailedState(NetworkInfo.DetailedState.CONNECTED, "enabled", null);
- setTeardownRequested(false);
- return true;
- }
-
- /**
- * Turn on or off the mobile radio. No connectivity will be possible while the
- * radio is off. The operation is a no-op if the radio is already in the desired state.
- * @param turnOn {@code true} if the radio should be turned on, {@code false} if
- */
- public boolean setRadio(boolean turnOn) {
- return true;
- }
-
- @Override
- public void setUserDataEnable(boolean enabled) {
- // ignored
- }
-
- @Override
- public void setPolicyDataEnable(boolean enabled) {
- // ignored
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer("Dummy data state: none, dummy!");
- return sb.toString();
- }
-
- /**
- * @see android.net.NetworkStateTracker#getLinkProperties()
- */
- public LinkProperties getLinkProperties() {
- return new LinkProperties(mLinkProperties);
- }
-
- public void setDependencyMet(boolean met) {
- // not supported on this network
- }
-
- @Override
- public void addStackedLink(LinkProperties link) {
- mLinkProperties.addStackedLink(link);
- }
-
- @Override
- public void removeStackedLink(LinkProperties link) {
- mLinkProperties.removeStackedLink(link);
- }
-
- @Override
- public void supplyMessenger(Messenger messenger) {
- // not supported on this network
- }
-
- static private void log(String s) {
- Slog.d(TAG, s);
- }
-
- static private void loge(String s) {
- Slog.e(TAG, s);
- }
-}