public void onServiceDisconnected(ComponentName className) { if (DBG) log("Proxy object disconnected"); mService = null; if (mServiceListener != null) { mServiceListener.onServiceDisconnected(); } }
public void onServiceDisconnected(ComponentName className) { if (DBG) Log.d(TAG, "Proxy object disconnected"); mService = null; if (mServiceListener != null) { mServiceListener.onServiceDisconnected(BluetoothProfile.HEALTH); } }
public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) log("Proxy object connected"); mService = IBluetoothPbap.Stub.asInterface(service); if (mServiceListener != null) { mServiceListener.onServiceConnected(); } }
public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) Log.d(TAG, "Proxy object connected"); mService = IBluetoothHealth.Stub.asInterface(service); if (mServiceListener != null) { mServiceListener.onServiceConnected(BluetoothProfile.HEALTH, BluetoothHealth.this); } }
public void onServiceConnected(ComponentName className, IBinder service) { if (DBG) Log.d(TAG, "Proxy object connected"); mService = IBluetoothInputDevice.Stub.asInterface(service); if (mServiceListener != null) { mServiceListener.onServiceConnected( BluetoothProfile.INPUT_DEVICE, BluetoothInputDevice.this); } }
private void refreshToken() { Bundle requestData = new Bundle(); requestData.putString(TOKEN, mAccessToken); Message request = Message.obtain(); request.setData(requestData); request.replyTo = messageReceiver; try { messageSender.send(request); } catch (RemoteException e) { serviceListener.onError(new Error("Service connection error")); } }
/** Create a BluetoothA2dp proxy object for interacting with the local Bluetooth A2DP service. */ /*package*/ BluetoothA2dp(Context mContext, ServiceListener l) { IBinder b = ServiceManager.getService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE); mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); if (b != null) { mService = IBluetoothA2dp.Stub.asInterface(b); if (mServiceListener != null) { mServiceListener.onServiceConnected(BluetoothProfile.A2DP, this); } } else { Log.w(TAG, "Bluetooth A2DP service not available!"); // Instead of throwing an exception which prevents people from going // into Wireless settings in the emulator. Let it crash later when it is actually used. mService = null; } }
public void onServiceDisconnected(ComponentName arg) { serviceListener.onError(new Error("Service disconnected")); // We returned an error so there's no point in // keeping the binding open. mAuthActivity.unbindService(TokenRefreshServiceConnection.this); }
/** * Bottom level event dispatcher for the BundleContext. * * @param originalListener listener object registered under. * @param l listener to call (may be filtered). * @param action Event class type * @param object Event object */ public void dispatchEvent(Object originalListener, Object l, int action, Object object) { // save the bundle ref to a local variable // to avoid interference from another thread closing this context AbstractBundle tmpBundle = bundle; Object previousTCCL = setContextFinder(); try { if (isValid()) /* if context still valid */ { switch (action) { case Framework.BUNDLEEVENT: case Framework.BUNDLEEVENTSYNC: { BundleListener listener = (BundleListener) l; if (Debug.DEBUG_EVENTS) { String listenerName = listener.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(listener)); // $NON-NLS-1$ Debug.println( "dispatchBundleEvent[" + tmpBundle + "](" + listenerName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } BundleEvent event = (BundleEvent) object; switch (event.getType()) { case Framework.BATCHEVENT_BEGIN: { if (listener instanceof BatchBundleListener) ((BatchBundleListener) listener).batchBegin(); break; } case Framework.BATCHEVENT_END: { if (listener instanceof BatchBundleListener) ((BatchBundleListener) listener).batchEnd(); break; } default: { listener.bundleChanged((BundleEvent) object); } } break; } case ServiceRegistry.SERVICEEVENT: { ServiceEvent event = (ServiceEvent) object; ServiceListener listener = (ServiceListener) l; if (Debug.DEBUG_EVENTS) { String listenerName = listener.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(listener)); // $NON-NLS-1$ Debug.println( "dispatchServiceEvent[" + tmpBundle + "](" + listenerName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } listener.serviceChanged(event); break; } case Framework.FRAMEWORKEVENT: { FrameworkListener listener = (FrameworkListener) l; if (Debug.DEBUG_EVENTS) { String listenerName = listener.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(listener)); // $NON-NLS-1$ Debug.println( "dispatchFrameworkEvent[" + tmpBundle + "](" + listenerName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } listener.frameworkEvent((FrameworkEvent) object); break; } default: { throw new InternalError(); } } } } catch (Throwable t) { if (Debug.DEBUG_GENERAL) { Debug.println( "Exception in bottom level event dispatcher: " + t.getMessage()); // $NON-NLS-1$ Debug.printStackTrace(t); } // allow the adaptor to handle this unexpected error framework.adaptor.handleRuntimeError(t); publisherror: { if (action == Framework.FRAMEWORKEVENT) { FrameworkEvent event = (FrameworkEvent) object; if (event.getType() == FrameworkEvent.ERROR) { break publisherror; // avoid infinite loop } } framework.publishFrameworkEvent(FrameworkEvent.ERROR, tmpBundle, t); } } finally { if (previousTCCL != Boolean.FALSE) Thread.currentThread().setContextClassLoader((ClassLoader) previousTCCL); } }