use of com.android.internal.util.AsyncChannel 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 com.android.internal.util.AsyncChannel in project android_frameworks_base by ParanoidAndroid.
the class MobileDataStateTracker method supplyMessenger.
public void supplyMessenger(Messenger messenger) {
if (VDBG)
log(mApnType + " got supplyMessenger");
AsyncChannel ac = new AsyncChannel();
ac.connect(mContext, MobileDataStateTracker.this.mHandler, messenger);
}
use of com.android.internal.util.AsyncChannel in project android_frameworks_base by ParanoidAndroid.
the class MobileDataStateTracker method setPolicyDataEnable.
@Override
public void setPolicyDataEnable(boolean enabled) {
if (DBG)
log("setPolicyDataEnable(enabled=" + enabled + ")");
final AsyncChannel channel = mDataConnectionTrackerAc;
if (channel != null) {
channel.sendMessage(DctConstants.CMD_SET_POLICY_DATA_ENABLE, enabled ? DctConstants.ENABLED : DctConstants.DISABLED);
mPolicyDataEnabled = enabled;
}
}
use of com.android.internal.util.AsyncChannel in project android_frameworks_base by ParanoidAndroid.
the class WifiManager method init.
private void init() {
synchronized (sThreadRefLock) {
if (++sThreadRefCount == 1) {
Messenger messenger = getWifiServiceMessenger();
if (messenger == null) {
sAsyncChannel = null;
return;
}
sHandlerThread = new HandlerThread("WifiManager");
sAsyncChannel = new AsyncChannel();
sConnected = new CountDownLatch(1);
sHandlerThread.start();
Handler handler = new ServiceHandler(sHandlerThread.getLooper());
sAsyncChannel.connect(mContext, handler, messenger);
try {
sConnected.await();
} catch (InterruptedException e) {
Log.e(TAG, "interrupted wait at init");
}
}
}
}
use of com.android.internal.util.AsyncChannel in project platform_frameworks_base by android.
the class ConnectivityService method handleAsyncChannelHalfConnect.
private void handleAsyncChannelHalfConnect(Message msg) {
AsyncChannel ac = (AsyncChannel) msg.obj;
if (mNetworkFactoryInfos.containsKey(msg.replyTo)) {
if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) {
if (VDBG)
log("NetworkFactory connected");
// A network factory has connected. Send it all current NetworkRequests.
for (NetworkRequestInfo nri : mNetworkRequests.values()) {
if (nri.request.isListen())
continue;
NetworkAgentInfo nai = mNetworkForRequestId.get(nri.request.requestId);
ac.sendMessage(android.net.NetworkFactory.CMD_REQUEST_NETWORK, (nai != null ? nai.getCurrentScore() : 0), 0, nri.request);
}
} else {
loge("Error connecting NetworkFactory");
mNetworkFactoryInfos.remove(msg.obj);
}
} else if (mNetworkAgentInfos.containsKey(msg.replyTo)) {
if (msg.arg1 == AsyncChannel.STATUS_SUCCESSFUL) {
if (VDBG)
log("NetworkAgent connected");
// A network agent has requested a connection. Establish the connection.
mNetworkAgentInfos.get(msg.replyTo).asyncChannel.sendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION);
} else {
loge("Error connecting NetworkAgent");
NetworkAgentInfo nai = mNetworkAgentInfos.remove(msg.replyTo);
if (nai != null) {
final boolean wasDefault = isDefaultNetwork(nai);
synchronized (mNetworkForNetId) {
mNetworkForNetId.remove(nai.network.netId);
mNetIdInUse.delete(nai.network.netId);
}
// Just in case.
mLegacyTypeTracker.remove(nai, wasDefault);
}
}
}
}
Aggregations