Fields Summary |
---|
private static final String | LOG_TAG |
private static final boolean | DBG |
private static final int | EVENT_NETWORK_SCAN_COMPLETED |
private static final int | QUERY_READY |
private static final int | QUERY_IS_RUNNING |
public static final int | QUERY_OK |
public static final int | QUERY_EXCEPTION |
private int | mStatestate of the query service |
private com.android.internal.telephony.Phone | mPhonelocal handle to the phone object |
private final android.os.IBinder | mLocalBinder |
android.os.Handler | mHandlerLocal handler to receive the network query compete callback
from the RIL. |
final android.os.RemoteCallbackList | mCallbacksList of callback objects, also used to synchronize access to
itself and to changes in state. |
private final INetworkQueryService.Stub | mBinderImplementation of the INetworkQueryService interface. |
Methods Summary |
---|
private void | broadcastQueryResults(android.os.AsyncResult ar)Broadcast the results from the query to all registered callback
objects.
// reset the state.
synchronized (mCallbacks) {
mState = QUERY_READY;
// see if we need to do any work.
if (ar == null) {
if (DBG) log("AsyncResult is null.");
return;
}
// TODO: we may need greater accuracy here, but for now, just a
// simple status integer will suffice.
int exception = (ar.exception == null) ? QUERY_OK : QUERY_EXCEPTION;
if (DBG) log("AsyncResult has exception " + exception);
// Make the calls to all the registered callbacks.
for (int i = (mCallbacks.beginBroadcast() - 1); i >= 0; i--) {
INetworkQueryServiceCallback cb = mCallbacks.getBroadcastItem(i);
if (DBG) log("broadcasting results to " + cb.getClass().toString());
try {
cb.onQueryComplete((ArrayList<NetworkInfo>) ar.result, exception);
} catch (RemoteException e) {
}
}
// finish up.
mCallbacks.finishBroadcast();
}
|
private static void | log(java.lang.String msg)
Log.d(LOG_TAG, msg);
|
public android.os.IBinder | onBind(android.content.Intent intent)Handle the bind request.
// TODO: Currently, return only the LocalBinder instance. If we
// end up requiring support for a remote binder, we will need to
// return mBinder as well, depending upon the intent.
if (DBG) log("binding service implementation");
return mLocalBinder;
|
public void | onCreate()
mState = QUERY_READY;
mPhone = PhoneFactory.getDefaultPhone();
|
public void | onStart(android.content.Intent intent, int startId)Required for service implementation.
|