refCount = refCount+1;
}
sReferenceCount.put(mName, refCount);
- log("REFCOUNT: CREATED. INSTANCE_COUNT=" +refCount);
+ if (DBG) log("REFCOUNT: CREATED. INSTANCE_COUNT=" +refCount);
}
}
}
@Override
public void onCreate() {
- log("onCreate");
+ if (DBG) log("onCreate");
super.onCreate();
mAdapter = BluetoothAdapter.getDefaultAdapter();
mBinder = initBinder();
}
public int onStartCommand(Intent intent, int flags, int startId) {
- log("onStartCommand()");
+ if (DBG) log("onStartCommand()");
if (mStartError || mAdapter == null) {
Log.w(mName, "Stopping profile service: device does not have BT");
doStop(intent);
}
public IBinder onBind(Intent intent) {
- log("onBind");
+ if (DBG) log("onBind");
return mBinder;
}
public boolean onUnbind(Intent intent) {
- log("onUnbind");
+ if (DBG) log("onUnbind");
return super.onUnbind(intent);
}
@Override
public void onDestroy() {
- log("Destroying service.");
+ if (DBG) log("Destroying service.");
if (mCleaningUp) {
- log("Cleanup already started... Skipping cleanup()...");
+ if (DBG) log("Cleanup already started... Skipping cleanup()...");
} else {
- log("cleanup()");
+ if (DBG) log("cleanup()");
mCleaningUp = true;
cleanup();
if (mBinder != null) {
if (mAdapter == null) {
Log.e(mName, "Error starting profile. BluetoothAdapter is null");
} else {
- log("start()");
+ if (DBG) log("start()");
mStartError = !start();
if (!mStartError) {
notifyProfileServiceStateChanged(BluetoothAdapter.STATE_ON);
private void doStop(Intent intent) {
if (stop()) {
- log("stop()");
+ if (DBG) log("stop()");
notifyProfileServiceStateChanged(BluetoothAdapter.STATE_OFF);
stopSelf();
} else {
if(halState == CONN_STATE_CONNECTED &&
prevState == BluetoothInputDevice.STATE_DISCONNECTED &&
(!okToConnect(device))) {
- Log.d(TAG,"Incoming HID connection rejected");
+ if (DBG) Log.d(TAG,"Incoming HID connection rejected");
disconnectHidNative(Utils.getByteAddress(device));
} else {
broadcastConnectionState(device, convertHalState(halState));
info.mUri = Uri.parse(stringFromCursor(info.mUri.toString(), cursor,
BluetoothShare.URI));
} else {
- Log.d(TAG, "updateShare() called for ID " + info.mId + " with null URI");
+ Log.w(TAG, "updateShare() called for ID " + info.mId + " with null URI");
}
info.mHint = stringFromCursor(info.mHint, cursor, BluetoothShare.FILENAME_HINT);
info.mFilename = stringFromCursor(info.mFilename, cursor, BluetoothShare._DATA);