public void noteBluetoothOn() {
   enforceCallingPermission();
   BluetoothHeadset headset = new BluetoothHeadset(mContext, null);
   synchronized (mStats) {
     mStats.noteBluetoothOnLocked();
     mStats.setBtHeadset(headset);
   }
 }
 public void onServiceConnected(int profile, BluetoothProfile proxy) {
   mBluetoothHeadset = (BluetoothHeadset) proxy;
   synchronized (mStats) {
     if (mBluetoothPendingStats) {
       mStats.noteBluetoothOnLocked();
       mStats.setBtHeadset(mBluetoothHeadset);
       mBluetoothPendingStats = false;
     }
   }
 }
 public void noteBluetoothOn() {
   enforceCallingPermission();
   mAdapter = BluetoothAdapter.getDefaultAdapter();
   if (mAdapter != null) {
     mAdapter.getProfileProxy(
         mContext, mBluetoothProfileServiceListener, BluetoothProfile.HEADSET);
   }
   synchronized (mStats) {
     if (mBluetoothHeadset != null) {
       mStats.noteBluetoothOnLocked();
       mStats.setBtHeadset(mBluetoothHeadset);
     } else {
       mBluetoothPendingStats = true;
     }
   }
 }