Loading android/app/src/com/android/bluetooth/opp/BluetoothOppNotification.java +12 −30 Original line number Diff line number Diff line Loading @@ -445,9 +445,7 @@ 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 @@ -516,11 +514,7 @@ class BluetoothOppNotification { } Intent deleteIntent = new Intent(mContext, BluetoothOppReceiver.class); if (Flags.oppFixMultipleNotificationsIssues()) { deleteIntent.setAction(Constants.ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER); } else { deleteIntent.setAction(Constants.ACTION_COMPLETE_HIDE); } Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL) Loading @@ -542,10 +536,8 @@ class BluetoothOppNotification { deleteIntent, PendingIntent.FLAG_IMMUTABLE)) .setWhen(timeStamp) .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); } .setLocalOnly(true) .setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); mNotificationMgr.notify(NOTIFICATION_ID_OUTBOUND_COMPLETE, b.build()); } else { if (mNotificationMgr != null) { Loading Loading @@ -605,11 +597,7 @@ class BluetoothOppNotification { } Intent deleteIntent = new Intent(mContext, BluetoothOppReceiver.class); if (Flags.oppFixMultipleNotificationsIssues()) { deleteIntent.setAction(Constants.ACTION_HIDE_COMPLETED_INBOUND_TRANSFER); } else { deleteIntent.setAction(Constants.ACTION_COMPLETE_HIDE); } Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL) Loading @@ -631,10 +619,8 @@ class BluetoothOppNotification { deleteIntent, PendingIntent.FLAG_IMMUTABLE)) .setWhen(timeStamp) .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); } .setLocalOnly(true) .setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); mNotificationMgr.notify(NOTIFICATION_ID_INBOUND_COMPLETE, b.build()); } else { if (mNotificationMgr != null) { Loading @@ -643,7 +629,7 @@ class BluetoothOppNotification { } } if (Flags.oppFixMultipleNotificationsIssues() && inboundNum > 0 && outboundNum > 0) { if (inboundNum > 0 && outboundNum > 0) { Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL) .setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE) Loading Loading @@ -760,10 +746,8 @@ class BluetoothOppNotification { fileNameSafe))) .setSubText(Formatter.formatFileSize(mContext, info.mTotalBytes)) .setSmallIcon(R.drawable.ic_bluetooth_file_transfer_notification) .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { publicNotificationBuilder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); } .setLocalOnly(true) .setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); Notification.Builder builder = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL) Loading Loading @@ -801,10 +785,8 @@ class BluetoothOppNotification { .setVisibility(Notification.VISIBILITY_PRIVATE) .addAction(actionDecline) .addAction(actionAccept) .setPublicVersion(publicNotificationBuilder.build()); if (Flags.oppFixMultipleNotificationsIssues()) { builder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); } .setPublicVersion(publicNotificationBuilder.build()) .setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, builder.build()); } cursor.close(); Loading android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java +2 −16 Original line number Diff line number Diff line Loading @@ -214,20 +214,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver { } cursor.close(); } } else if (action.equals(Constants.ACTION_COMPLETE_HIDE) && !Flags.oppFixMultipleNotificationsIssues()) { Log.v(TAG, "Receiver ACTION_COMPLETE_HIDE"); ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_HIDDEN); BluetoothMethodProxy.getInstance() .contentResolverUpdate( context.getContentResolver(), BluetoothShare.CONTENT_URI, updateValues, BluetoothOppNotification.WHERE_COMPLETED, null); } else if (action.equals(Constants.ACTION_HIDE_COMPLETED_INBOUND_TRANSFER) && Flags.oppFixMultipleNotificationsIssues()) { } else if (action.equals(Constants.ACTION_HIDE_COMPLETED_INBOUND_TRANSFER)) { Log.v(TAG, "Received ACTION_HIDE_COMPLETED_INBOUND_TRANSFER"); ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_HIDDEN); Loading @@ -238,8 +225,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver { updateValues, BluetoothOppNotification.WHERE_COMPLETED_INBOUND, null); } else if (action.equals(Constants.ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER) && Flags.oppFixMultipleNotificationsIssues()) { } else if (action.equals(Constants.ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER)) { Log.v(TAG, "Received ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER"); ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_HIDDEN); Loading android/app/src/com/android/bluetooth/opp/Constants.java +0 −8 Original line number Diff line number Diff line Loading @@ -166,14 +166,6 @@ public class Constants { /** the intent that gets sent when declining the incoming file confirmation notification */ static final String ACTION_DECLINE = "android.btopp.intent.action.DECLINE"; /** * The intent that gets sent when deleting the notifications of outbound and inbound completed * transfer. */ // TODO(b/323096132): Remove this variable when the flag // opp_fix_multiple_notifications_issues is ramped up. static final String ACTION_COMPLETE_HIDE = "android.btopp.intent.action.HIDE_COMPLETE"; /** The intent that gets sent when deleting the notifications of completed inbound transfer. */ static final String ACTION_HIDE_COMPLETED_INBOUND_TRANSFER = "android.btopp.intent.action.HIDE_COMPLETED_INBOUND_TRANSFER"; Loading android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiverTest.java +0 −21 Original line number Diff line number Diff line Loading @@ -272,28 +272,8 @@ public class BluetoothOppReceiverTest { any()); } @Test public void onReceive_withActionCompleteHide_makeAllVisibilityHidden() { mSetFlagsRule.disableFlags(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES); Intent intent = new Intent(); intent.setAction(Constants.ACTION_COMPLETE_HIDE); mReceiver.onReceive(mContext, intent); verify(mBluetoothMethodProxy) .contentResolverUpdate( any(), eq(BluetoothShare.CONTENT_URI), argThat( arg -> Objects.equal( BluetoothShare.VISIBILITY_HIDDEN, arg.get(BluetoothShare.VISIBILITY))), any(), any()); } @Test public void onReceive_withActionHideCompletedInboundTransfer_makesInboundVisibilityHidden() { mSetFlagsRule.enableFlags(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES); Intent intent = new Intent(); intent.setAction(Constants.ACTION_HIDE_COMPLETED_INBOUND_TRANSFER); mReceiver.onReceive(mContext, intent); Loading @@ -312,7 +292,6 @@ public class BluetoothOppReceiverTest { @Test public void onReceive_withActionHideCompletedOutboundTransfer_makesOutboundVisibilityHidden() { mSetFlagsRule.enableFlags(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES); Intent intent = new Intent(); intent.setAction(Constants.ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER); mReceiver.onReceive(mContext, intent); Loading flags/opp.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -8,16 +8,6 @@ flag { bug: "319050411" } flag { name: "opp_fix_multiple_notifications_issues" namespace: "bluetooth" description: "Fix UI issues related to multiple OPP notifications" bug: "323096132" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "opp_ignore_content_observer_after_service_stop" namespace: "bluetooth" Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppNotification.java +12 −30 Original line number Diff line number Diff line Loading @@ -445,9 +445,7 @@ 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 @@ -516,11 +514,7 @@ class BluetoothOppNotification { } Intent deleteIntent = new Intent(mContext, BluetoothOppReceiver.class); if (Flags.oppFixMultipleNotificationsIssues()) { deleteIntent.setAction(Constants.ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER); } else { deleteIntent.setAction(Constants.ACTION_COMPLETE_HIDE); } Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL) Loading @@ -542,10 +536,8 @@ class BluetoothOppNotification { deleteIntent, PendingIntent.FLAG_IMMUTABLE)) .setWhen(timeStamp) .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); } .setLocalOnly(true) .setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); mNotificationMgr.notify(NOTIFICATION_ID_OUTBOUND_COMPLETE, b.build()); } else { if (mNotificationMgr != null) { Loading Loading @@ -605,11 +597,7 @@ class BluetoothOppNotification { } Intent deleteIntent = new Intent(mContext, BluetoothOppReceiver.class); if (Flags.oppFixMultipleNotificationsIssues()) { deleteIntent.setAction(Constants.ACTION_HIDE_COMPLETED_INBOUND_TRANSFER); } else { deleteIntent.setAction(Constants.ACTION_COMPLETE_HIDE); } Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL) Loading @@ -631,10 +619,8 @@ class BluetoothOppNotification { deleteIntent, PendingIntent.FLAG_IMMUTABLE)) .setWhen(timeStamp) .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); } .setLocalOnly(true) .setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE); mNotificationMgr.notify(NOTIFICATION_ID_INBOUND_COMPLETE, b.build()); } else { if (mNotificationMgr != null) { Loading @@ -643,7 +629,7 @@ class BluetoothOppNotification { } } if (Flags.oppFixMultipleNotificationsIssues() && inboundNum > 0 && outboundNum > 0) { if (inboundNum > 0 && outboundNum > 0) { Notification.Builder b = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL) .setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE) Loading Loading @@ -760,10 +746,8 @@ class BluetoothOppNotification { fileNameSafe))) .setSubText(Formatter.formatFileSize(mContext, info.mTotalBytes)) .setSmallIcon(R.drawable.ic_bluetooth_file_transfer_notification) .setLocalOnly(true); if (Flags.oppFixMultipleNotificationsIssues()) { publicNotificationBuilder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); } .setLocalOnly(true) .setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); Notification.Builder builder = new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL) Loading Loading @@ -801,10 +785,8 @@ class BluetoothOppNotification { .setVisibility(Notification.VISIBILITY_PRIVATE) .addAction(actionDecline) .addAction(actionAccept) .setPublicVersion(publicNotificationBuilder.build()); if (Flags.oppFixMultipleNotificationsIssues()) { builder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); } .setPublicVersion(publicNotificationBuilder.build()) .setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM); mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, builder.build()); } cursor.close(); Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java +2 −16 Original line number Diff line number Diff line Loading @@ -214,20 +214,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver { } cursor.close(); } } else if (action.equals(Constants.ACTION_COMPLETE_HIDE) && !Flags.oppFixMultipleNotificationsIssues()) { Log.v(TAG, "Receiver ACTION_COMPLETE_HIDE"); ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_HIDDEN); BluetoothMethodProxy.getInstance() .contentResolverUpdate( context.getContentResolver(), BluetoothShare.CONTENT_URI, updateValues, BluetoothOppNotification.WHERE_COMPLETED, null); } else if (action.equals(Constants.ACTION_HIDE_COMPLETED_INBOUND_TRANSFER) && Flags.oppFixMultipleNotificationsIssues()) { } else if (action.equals(Constants.ACTION_HIDE_COMPLETED_INBOUND_TRANSFER)) { Log.v(TAG, "Received ACTION_HIDE_COMPLETED_INBOUND_TRANSFER"); ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_HIDDEN); Loading @@ -238,8 +225,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver { updateValues, BluetoothOppNotification.WHERE_COMPLETED_INBOUND, null); } else if (action.equals(Constants.ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER) && Flags.oppFixMultipleNotificationsIssues()) { } else if (action.equals(Constants.ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER)) { Log.v(TAG, "Received ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER"); ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_HIDDEN); Loading
android/app/src/com/android/bluetooth/opp/Constants.java +0 −8 Original line number Diff line number Diff line Loading @@ -166,14 +166,6 @@ public class Constants { /** the intent that gets sent when declining the incoming file confirmation notification */ static final String ACTION_DECLINE = "android.btopp.intent.action.DECLINE"; /** * The intent that gets sent when deleting the notifications of outbound and inbound completed * transfer. */ // TODO(b/323096132): Remove this variable when the flag // opp_fix_multiple_notifications_issues is ramped up. static final String ACTION_COMPLETE_HIDE = "android.btopp.intent.action.HIDE_COMPLETE"; /** The intent that gets sent when deleting the notifications of completed inbound transfer. */ static final String ACTION_HIDE_COMPLETED_INBOUND_TRANSFER = "android.btopp.intent.action.HIDE_COMPLETED_INBOUND_TRANSFER"; Loading
android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppReceiverTest.java +0 −21 Original line number Diff line number Diff line Loading @@ -272,28 +272,8 @@ public class BluetoothOppReceiverTest { any()); } @Test public void onReceive_withActionCompleteHide_makeAllVisibilityHidden() { mSetFlagsRule.disableFlags(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES); Intent intent = new Intent(); intent.setAction(Constants.ACTION_COMPLETE_HIDE); mReceiver.onReceive(mContext, intent); verify(mBluetoothMethodProxy) .contentResolverUpdate( any(), eq(BluetoothShare.CONTENT_URI), argThat( arg -> Objects.equal( BluetoothShare.VISIBILITY_HIDDEN, arg.get(BluetoothShare.VISIBILITY))), any(), any()); } @Test public void onReceive_withActionHideCompletedInboundTransfer_makesInboundVisibilityHidden() { mSetFlagsRule.enableFlags(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES); Intent intent = new Intent(); intent.setAction(Constants.ACTION_HIDE_COMPLETED_INBOUND_TRANSFER); mReceiver.onReceive(mContext, intent); Loading @@ -312,7 +292,6 @@ public class BluetoothOppReceiverTest { @Test public void onReceive_withActionHideCompletedOutboundTransfer_makesOutboundVisibilityHidden() { mSetFlagsRule.enableFlags(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES); Intent intent = new Intent(); intent.setAction(Constants.ACTION_HIDE_COMPLETED_OUTBOUND_TRANSFER); mReceiver.onReceive(mContext, intent); Loading
flags/opp.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -8,16 +8,6 @@ flag { bug: "319050411" } flag { name: "opp_fix_multiple_notifications_issues" namespace: "bluetooth" description: "Fix UI issues related to multiple OPP notifications" bug: "323096132" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "opp_ignore_content_observer_after_service_stop" namespace: "bluetooth" Loading