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();
}
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);
}
}
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);
}
}
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);
}
}
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;
}
Aggregations