Search in sources :

Example 86 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class DummyDataStateTracker method setDetailedState.

/**
     * 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();
}
Also used : Message(android.os.Message)

Example 87 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class EthernetDataTracker method disconnect.

public void disconnect() {
    NetworkUtils.stopDhcp(mIface);
    mLinkProperties.clear();
    mNetworkInfo.setIsAvailable(false);
    mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, mHwAddr);
    Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo);
    msg.sendToTarget();
    msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo);
    msg.sendToTarget();
    IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
    INetworkManagementService service = INetworkManagementService.Stub.asInterface(b);
    try {
        service.clearInterfaceAddresses(mIface);
    } catch (Exception e) {
        Log.e(TAG, "Failed to clear addresses or disable ipv6" + e);
    }
}
Also used : IBinder(android.os.IBinder) Message(android.os.Message) INetworkManagementService(android.os.INetworkManagementService) RemoteException(android.os.RemoteException)

Example 88 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class MobileDataStateTracker method enableMobileProvisioning.

/**
     *  Inform DCT mobile provisioning has started, it ends when provisioning completes.
     */
public void enableMobileProvisioning(String url) {
    if (DBG)
        log("enableMobileProvisioning(url=" + url + ")");
    final AsyncChannel channel = mDataConnectionTrackerAc;
    if (channel != null) {
        Message msg = Message.obtain();
        msg.what = DctConstants.CMD_ENABLE_MOBILE_PROVISIONING;
        msg.setData(Bundle.forPair(DctConstants.PROVISIONING_URL_KEY, url));
        channel.sendMessage(msg);
    }
}
Also used : Message(android.os.Message) AsyncChannel(com.android.internal.util.AsyncChannel)

Example 89 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class MobileDataStateTracker method setDependencyMet.

/**
     * carrier dependency is met/unmet
     * @param met
     */
public void setDependencyMet(boolean met) {
    Bundle bundle = Bundle.forPair(DctConstants.APN_TYPE_KEY, mApnType);
    try {
        if (DBG)
            log("setDependencyMet: E met=" + met);
        Message msg = Message.obtain();
        msg.what = DctConstants.CMD_SET_DEPENDENCY_MET;
        msg.arg1 = (met ? DctConstants.ENABLED : DctConstants.DISABLED);
        msg.setData(bundle);
        mDataConnectionTrackerAc.sendMessage(msg);
        if (VDBG)
            log("setDependencyMet: X met=" + met);
    } catch (NullPointerException e) {
        loge("setDependencyMet: X mAc was null" + e);
    }
}
Also used : Message(android.os.Message) Bundle(android.os.Bundle)

Example 90 with Message

use of android.os.Message in project android_frameworks_base by ParanoidAndroid.

the class MobileDataStateTracker method isProvisioningNetwork.

/**
     * Return if this network is the provisioning network. Valid only if connected.
     * @param met
     */
public boolean isProvisioningNetwork() {
    boolean retVal;
    try {
        Message msg = Message.obtain();
        msg.what = DctConstants.CMD_IS_PROVISIONING_APN;
        msg.setData(Bundle.forPair(DctConstants.APN_TYPE_KEY, mApnType));
        Message result = mDataConnectionTrackerAc.sendMessageSynchronously(msg);
        retVal = result.arg1 == DctConstants.ENABLED;
    } catch (NullPointerException e) {
        loge("isProvisioningNetwork: X " + e);
        retVal = false;
    }
    if (DBG)
        log("isProvisioningNetwork: retVal=" + retVal);
    return retVal;
}
Also used : Message(android.os.Message)

Aggregations

Message (android.os.Message)3198 Handler (android.os.Handler)347 RemoteException (android.os.RemoteException)263 Bundle (android.os.Bundle)210 Test (org.junit.Test)144 Intent (android.content.Intent)130 IOException (java.io.IOException)124 Point (android.graphics.Point)86 HashMap (java.util.HashMap)77 SomeArgs (com.android.internal.os.SomeArgs)67 SmallTest (android.test.suitebuilder.annotation.SmallTest)64 Messenger (android.os.Messenger)63 ArrayList (java.util.ArrayList)59 View (android.view.View)52 File (java.io.File)50 MediumTest (android.test.suitebuilder.annotation.MediumTest)43 TextView (android.widget.TextView)41 IBinder (android.os.IBinder)38 Map (java.util.Map)37 PendingIntent (android.app.PendingIntent)33