Merge "Add Bluetooth Pairing notifications to a channel" into oc-dev
am: 8b09195f80
Change-Id: Iced885cd7195ed48920667ef96c0cbbdec587466
This commit is contained in:
@@ -17,6 +17,8 @@
|
|||||||
package com.android.settings.bluetooth;
|
package com.android.settings.bluetooth;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.app.NotificationChannel;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
@@ -42,6 +44,9 @@ public final class BluetoothPairingService extends Service {
|
|||||||
private static final String ACTION_DISMISS_PAIRING =
|
private static final String ACTION_DISMISS_PAIRING =
|
||||||
"com.android.settings.bluetooth.ACTION_DISMISS_PAIRING";
|
"com.android.settings.bluetooth.ACTION_DISMISS_PAIRING";
|
||||||
|
|
||||||
|
private static final String BLUETOOTH_NOTIFICATION_CHANNEL =
|
||||||
|
"bluetooth_notification_channel";
|
||||||
|
|
||||||
private static final String TAG = "BluetoothPairingService";
|
private static final String TAG = "BluetoothPairingService";
|
||||||
|
|
||||||
private BluetoothDevice mDevice;
|
private BluetoothDevice mDevice;
|
||||||
@@ -94,6 +99,13 @@ public final class BluetoothPairingService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
|
NotificationManager mgr = (NotificationManager)this
|
||||||
|
.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
NotificationChannel notificationChannel = new NotificationChannel(
|
||||||
|
BLUETOOTH_NOTIFICATION_CHANNEL,
|
||||||
|
this.getString(R.string.bluetooth),
|
||||||
|
NotificationManager.IMPORTANCE_HIGH);
|
||||||
|
mgr.createNotificationChannel(notificationChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -105,7 +117,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,
|
||||||
|
BLUETOOTH_NOTIFICATION_CHANNEL)
|
||||||
.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));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user