Java Code Examples for android.net.ConnectivityManager#TETHER_ERROR_NO_ERROR

The following examples show how to use android.net.ConnectivityManager#TETHER_ERROR_NO_ERROR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TetherInterfaceStateMachine.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public TetherInterfaceStateMachine(
        String ifaceName, Looper looper, int interfaceType, SharedLog log,
        INetworkManagementService nMService, INetworkStatsService statsService,
        IControlsTethering tetherController,
        TetheringDependencies deps) {
    super(ifaceName, looper);
    mLog = log.forSubComponent(ifaceName);
    mNMService = nMService;
    mNetd = deps.getNetdService();
    mStatsService = statsService;
    mTetherController = tetherController;
    mInterfaceCtrl = new InterfaceController(ifaceName, nMService, mNetd, mLog);
    mIfaceName = ifaceName;
    mInterfaceType = interfaceType;
    mLinkProperties = new LinkProperties();
    mDeps = deps;
    resetLinkProperties();
    mLastError = ConnectivityManager.TETHER_ERROR_NO_ERROR;
    mServingMode = IControlsTethering.STATE_AVAILABLE;

    mInitialState = new InitialState();
    mLocalHotspotState = new LocalHotspotState();
    mTetheredState = new TetheredState();
    mUnavailableState = new UnavailableState();
    addState(mInitialState);
    addState(mLocalHotspotState);
    addState(mTetheredState);
    addState(mUnavailableState);

    setInitialState(mInitialState);
}
 
Example 2
Source File: TetherInterfaceStateMachine.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean processMessage(Message message) {
    logMessage(this, message.what);
    switch (message.what) {
        case CMD_TETHER_REQUESTED:
            mLastError = ConnectivityManager.TETHER_ERROR_NO_ERROR;
            switch (message.arg1) {
                case IControlsTethering.STATE_LOCAL_ONLY:
                    transitionTo(mLocalHotspotState);
                    break;
                case IControlsTethering.STATE_TETHERED:
                    transitionTo(mTetheredState);
                    break;
                default:
                    mLog.e("Invalid tethering interface serving state specified.");
            }
            break;
        case CMD_INTERFACE_DOWN:
            transitionTo(mUnavailableState);
            break;
        case CMD_IPV6_TETHER_UPDATE:
            updateUpstreamIPv6LinkProperties((LinkProperties) message.obj);
            break;
        default:
            return NOT_HANDLED;
    }
    return HANDLED;
}
 
Example 3
Source File: TetherInterfaceStateMachine.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void enter() {
    super.enter();
    if (mLastError != ConnectivityManager.TETHER_ERROR_NO_ERROR) {
        transitionTo(mInitialState);
    }

    if (DBG) Log.d(TAG, "Local hotspot " + mIfaceName);
    sendInterfaceState(IControlsTethering.STATE_LOCAL_ONLY);
}
 
Example 4
Source File: TetherInterfaceStateMachine.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public void enter() {
    super.enter();
    if (mLastError != ConnectivityManager.TETHER_ERROR_NO_ERROR) {
        transitionTo(mInitialState);
    }

    if (DBG) Log.d(TAG, "Tethered " + mIfaceName);
    sendInterfaceState(IControlsTethering.STATE_TETHERED);
}
 
Example 5
Source File: TetherInterfaceStateMachine.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public void enter() {
    mLastError = ConnectivityManager.TETHER_ERROR_NO_ERROR;
    sendInterfaceState(IControlsTethering.STATE_UNAVAILABLE);
}