1. seandroid
  2. Untitled project
  3. packages/apps/Settings

Commits

Stephen Smalley  committed 1b79132 Merge

Merge branch 'master' into seandroid

  • Participants
  • Parent commits 9a5151f, 0223f9c

Comments (0)

Files changed (2)

File AndroidManifest.xml

View file
  • Ignore whitespace
             <intent-filter>
                 <action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
                 <action android:name="android.bluetooth.device.action.PAIRING_CANCEL" />
+                <action android:name="android.bluetooth.device.action.BOND_STATE_CHANGED" />
             </intent-filter>
         </receiver>
 

File src/com/android/settings/bluetooth/BluetoothPairingRequest.java

View file
  • Ignore whitespace
             NotificationManager manager = (NotificationManager) context
                     .getSystemService(Context.NOTIFICATION_SERVICE);
             manager.cancel(NOTIFICATION_ID);
+
+        } else if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) {
+            int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,
+                    BluetoothDevice.ERROR);
+            int oldState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
+                    BluetoothDevice.ERROR);
+            if((oldState == BluetoothDevice.BOND_BONDING) &&
+                    (bondState == BluetoothDevice.BOND_NONE)) {
+                // Remove the notification
+                NotificationManager manager = (NotificationManager) context
+                    .getSystemService(Context.NOTIFICATION_SERVICE);
+                manager.cancel(NOTIFICATION_ID);
+            }
         }
     }
 }