Bluetooth: Make notifications local-only

This will prevent them from showing up on external devices where they
would be less than useful.

Test: connect to watch and pair a device
Bug: 34612389
Change-Id: I8b02c20200ce78a73967b8121cf7d5653b68f356
This commit is contained in:
Marie Janssen
2017-06-15 17:19:36 -07:00
parent 4e7846fbe4
commit 426903d155
2 changed files with 3 additions and 1 deletions

View File

@@ -107,7 +107,8 @@ public final class BluetoothPairingService extends Service {
Resources res = getResources(); Resources res = getResources();
Notification.Builder builder = new Notification.Builder(this) Notification.Builder builder = new Notification.Builder(this)
.setSmallIcon(android.R.drawable.stat_sys_data_bluetooth) .setSmallIcon(android.R.drawable.stat_sys_data_bluetooth)
.setTicker(res.getString(R.string.bluetooth_notif_ticker)); .setTicker(res.getString(R.string.bluetooth_notif_ticker))
.setLocalOnly(true);
PendingIntent pairIntent = PendingIntent.getActivity(this, 0, PendingIntent pairIntent = PendingIntent.getActivity(this, 0,
getPairingDialogIntent(this, intent), PendingIntent.FLAG_ONE_SHOT); getPairingDialogIntent(this, intent), PendingIntent.FLAG_ONE_SHOT);

View File

@@ -165,6 +165,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
.setDeleteIntent(PendingIntent.getBroadcast(context, 0, deleteIntent, 0)) .setDeleteIntent(PendingIntent.getBroadcast(context, 0, deleteIntent, 0))
.setColor(context.getColor( .setColor(context.getColor(
com.android.internal.R.color.system_notification_accent_color)) com.android.internal.R.color.system_notification_accent_color))
.setLocalOnly(true)
.build(); .build();
notification.flags |= Notification.FLAG_NO_CLEAR; // Cannot be set with the builder. notification.flags |= Notification.FLAG_NO_CLEAR; // Cannot be set with the builder.