Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7f05a7e authored by Hemant Gupta's avatar Hemant Gupta Committed by android-build-merger
Browse files

Merge "PBAP: Convert notifications to use NotificationChannel" into oc-dev

am: 9a4e9914

Change-Id: I682737aafb20701087aca05b09693a206e863abf
parents 99b52404 9a4e9914
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,4 +13,5 @@
    <string name="unknownName">Unknown name</string>
    <string name="localPhoneName">My name</string>
    <string name="defaultnumber">000000</string>
    <string name="pbap_notification_group">Bluetooth Contact share</string>
</resources>
+7 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
package com.android.bluetooth.pbap;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
@@ -145,6 +146,8 @@ public class BluetoothPbapService extends ProfileService {

    private static final int NOTIFICATION_ID_AUTH = -1000002;

    private static final String PBAP_NOTIFICATION_CHANNEL = "pbap_notification_channel";

    private PowerManager.WakeLock mWakeLock = null;

    private BluetoothAdapter mAdapter;
@@ -704,6 +707,9 @@ public class BluetoothPbapService extends ProfileService {

        NotificationManager nm = (NotificationManager)
            getSystemService(Context.NOTIFICATION_SERVICE);
        NotificationChannel notificationChannel = new NotificationChannel(PBAP_NOTIFICATION_CHANNEL,
                getString(R.string.pbap_notification_group), NotificationManager.IMPORTANCE_HIGH);
        nm.createNotificationChannel(notificationChannel);

        // Create an intent triggered by clicking on the status icon.
        Intent clickIntent = new Intent();
@@ -721,7 +727,7 @@ public class BluetoothPbapService extends ProfileService {

        if (action.equals(AUTH_CHALL_ACTION)) {
            Notification notification =
                    new Notification.Builder(this)
                    new Notification.Builder(this, PBAP_NOTIFICATION_CHANNEL)
                            .setWhen(System.currentTimeMillis())
                            .setContentTitle(getString(R.string.auth_notif_title))
                            .setContentText(getString(R.string.auth_notif_message, name))