Loading android/app/src/com/android/bluetooth/opp/BluetoothOppNotification.java +34 −15 Original line number Diff line number Diff line Loading @@ -105,6 +105,13 @@ class BluetoothOppNotification { @VisibleForTesting static final int NOTIFICATION_ID_INBOUND_COMPLETE = -1000006; private static final String NOTIFICATION_GROUP_KEY_PROGRESS = "PROGRESS"; private static final String NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE = "TRANSFER_COMPLETE"; private static final String NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM = "INCOMING_FILE_CONFIRM"; private boolean mUpdateCompleteNotification = true; private ContentResolver mContentResolver = null; Loading Loading @@ -382,6 +389,9 @@ class BluetoothOppNotification { intent.setDataAndNormalize(Uri.parse(BluetoothShare.CONTENT_URI + "/" + item.id)); b.setContentIntent(PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE)); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_PROGRESS); } mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, b.build()); } } Loading Loading @@ -446,7 +456,7 @@ class BluetoothOppNotification { Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( mContext, BluetoothOppReceiver.class.getName()); Notification outNoti = Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce( true) .setContentTitle(mContext.getString(R.string.outbound_noti_title)) Loading @@ -462,9 +472,11 @@ class BluetoothOppNotification { PendingIntent.getBroadcast(mContext, 0, deleteIntent, PendingIntent.FLAG_IMMUTABLE)) .setWhen(timeStamp) .setLocalOnly(true) .build(); mNotificationMgr.notify(NOTIFICATION_ID_OUTBOUND_COMPLETE, outNoti); .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); } mNotificationMgr.notify(NOTIFICATION_ID_OUTBOUND_COMPLETE, b.build()); } else { if (mNotificationMgr != null) { mNotificationMgr.cancel(NOTIFICATION_ID_OUTBOUND_COMPLETE); Loading Loading @@ -521,7 +533,7 @@ class BluetoothOppNotification { Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( mContext, BluetoothOppReceiver.class.getName()); Notification inNoti = Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce( true) .setContentTitle(mContext.getString(R.string.inbound_noti_title)) Loading @@ -538,9 +550,11 @@ class BluetoothOppNotification { PendingIntent.getBroadcast(mContext, 0, deleteIntent, PendingIntent.FLAG_IMMUTABLE)) .setWhen(timeStamp) .setLocalOnly(true) .build(); mNotificationMgr.notify(NOTIFICATION_ID_INBOUND_COMPLETE, inNoti); .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); } mNotificationMgr.notify(NOTIFICATION_ID_INBOUND_COMPLETE, b.build()); } else { if (mNotificationMgr != null) { mNotificationMgr.cancel(NOTIFICATION_ID_INBOUND_COMPLETE); Loading Loading @@ -601,7 +615,7 @@ class BluetoothOppNotification { PendingIntent.FLAG_IMMUTABLE); } Notification public_n = Notification.Builder publicNotificationBuilder = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce( true) .setOngoing(true) Loading @@ -623,9 +637,12 @@ class BluetoothOppNotification { info.mDeviceName, fileNameSafe))) .setSubText(Formatter.formatFileSize(mContext, info.mTotalBytes)) .setSmallIcon(R.drawable.bt_incomming_file_notification) .setLocalOnly(true) .build(); Notification n = .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { publicNotificationBuilder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); } Notification.Builder builder = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce( true) .setOngoing(true) Loading @@ -651,9 +668,11 @@ class BluetoothOppNotification { .setVisibility(Notification.VISIBILITY_PRIVATE) .addAction(actionDecline) .addAction(actionAccept) .setPublicVersion(public_n) .build(); mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, n); .setPublicVersion(publicNotificationBuilder.build()); if (Flags.oppFixMultipleNotificationsIssues()) { builder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); } mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, builder.build()); } cursor.close(); } Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppNotification.java +34 −15 Original line number Diff line number Diff line Loading @@ -105,6 +105,13 @@ class BluetoothOppNotification { @VisibleForTesting static final int NOTIFICATION_ID_INBOUND_COMPLETE = -1000006; private static final String NOTIFICATION_GROUP_KEY_PROGRESS = "PROGRESS"; private static final String NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE = "TRANSFER_COMPLETE"; private static final String NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM = "INCOMING_FILE_CONFIRM"; private boolean mUpdateCompleteNotification = true; private ContentResolver mContentResolver = null; Loading Loading @@ -382,6 +389,9 @@ class BluetoothOppNotification { intent.setDataAndNormalize(Uri.parse(BluetoothShare.CONTENT_URI + "/" + item.id)); b.setContentIntent(PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE)); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_PROGRESS); } mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, b.build()); } } Loading Loading @@ -446,7 +456,7 @@ class BluetoothOppNotification { Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( mContext, BluetoothOppReceiver.class.getName()); Notification outNoti = Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce( true) .setContentTitle(mContext.getString(R.string.outbound_noti_title)) Loading @@ -462,9 +472,11 @@ class BluetoothOppNotification { PendingIntent.getBroadcast(mContext, 0, deleteIntent, PendingIntent.FLAG_IMMUTABLE)) .setWhen(timeStamp) .setLocalOnly(true) .build(); mNotificationMgr.notify(NOTIFICATION_ID_OUTBOUND_COMPLETE, outNoti); .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); } mNotificationMgr.notify(NOTIFICATION_ID_OUTBOUND_COMPLETE, b.build()); } else { if (mNotificationMgr != null) { mNotificationMgr.cancel(NOTIFICATION_ID_OUTBOUND_COMPLETE); Loading Loading @@ -521,7 +533,7 @@ class BluetoothOppNotification { Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName( mContext, BluetoothOppReceiver.class.getName()); Notification inNoti = Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce( true) .setContentTitle(mContext.getString(R.string.inbound_noti_title)) Loading @@ -538,9 +550,11 @@ class BluetoothOppNotification { PendingIntent.getBroadcast(mContext, 0, deleteIntent, PendingIntent.FLAG_IMMUTABLE)) .setWhen(timeStamp) .setLocalOnly(true) .build(); mNotificationMgr.notify(NOTIFICATION_ID_INBOUND_COMPLETE, inNoti); .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); } mNotificationMgr.notify(NOTIFICATION_ID_INBOUND_COMPLETE, b.build()); } else { if (mNotificationMgr != null) { mNotificationMgr.cancel(NOTIFICATION_ID_INBOUND_COMPLETE); Loading Loading @@ -601,7 +615,7 @@ class BluetoothOppNotification { PendingIntent.FLAG_IMMUTABLE); } Notification public_n = Notification.Builder publicNotificationBuilder = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce( true) .setOngoing(true) Loading @@ -623,9 +637,12 @@ class BluetoothOppNotification { info.mDeviceName, fileNameSafe))) .setSubText(Formatter.formatFileSize(mContext, info.mTotalBytes)) .setSmallIcon(R.drawable.bt_incomming_file_notification) .setLocalOnly(true) .build(); Notification n = .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { publicNotificationBuilder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); } Notification.Builder builder = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce( true) .setOngoing(true) Loading @@ -651,9 +668,11 @@ class BluetoothOppNotification { .setVisibility(Notification.VISIBILITY_PRIVATE) .addAction(actionDecline) .addAction(actionAccept) .setPublicVersion(public_n) .build(); mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, n); .setPublicVersion(publicNotificationBuilder.build()); if (Flags.oppFixMultipleNotificationsIssues()) { builder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); } mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, builder.build()); } cursor.close(); } Loading