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

Commit 832bfce4 authored by Hyundo Moon's avatar Hyundo Moon Committed by Automerger Merge Worker
Browse files

Merge "OPP: Fix uploading animation is not stopped" into main am: 818145af am: c64977e6

parents 71f0d9f1 c64977e6
Loading
Loading
Loading
Loading
+34 −15
Original line number Original line Diff line number Diff line
@@ -105,6 +105,13 @@ class BluetoothOppNotification {
    @VisibleForTesting
    @VisibleForTesting
    static final int NOTIFICATION_ID_INBOUND_COMPLETE = -1000006;
    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 boolean mUpdateCompleteNotification = true;


    private ContentResolver mContentResolver = null;
    private ContentResolver mContentResolver = null;
@@ -382,6 +389,9 @@ class BluetoothOppNotification {
            intent.setDataAndNormalize(Uri.parse(BluetoothShare.CONTENT_URI + "/" + item.id));
            intent.setDataAndNormalize(Uri.parse(BluetoothShare.CONTENT_URI + "/" + item.id));
            b.setContentIntent(PendingIntent.getBroadcast(mContext, 0, intent,
            b.setContentIntent(PendingIntent.getBroadcast(mContext, 0, intent,
                        PendingIntent.FLAG_IMMUTABLE));
                        PendingIntent.FLAG_IMMUTABLE));
            if (Flags.oppFixMultipleNotificationsIssues()) {
                b.setGroup(NOTIFICATION_GROUP_KEY_PROGRESS);
            }
            mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, b.build());
            mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, b.build());
        }
        }
    }
    }
@@ -446,7 +456,7 @@ class BluetoothOppNotification {


            Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName(
            Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName(
                    mContext, BluetoothOppReceiver.class.getName());
                    mContext, BluetoothOppReceiver.class.getName());
            Notification outNoti =
            Notification.Builder b =
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                            true)
                            true)
                            .setContentTitle(mContext.getString(R.string.outbound_noti_title))
                            .setContentTitle(mContext.getString(R.string.outbound_noti_title))
@@ -462,9 +472,11 @@ class BluetoothOppNotification {
                                    PendingIntent.getBroadcast(mContext, 0, deleteIntent,
                                    PendingIntent.getBroadcast(mContext, 0, deleteIntent,
                                        PendingIntent.FLAG_IMMUTABLE))
                                        PendingIntent.FLAG_IMMUTABLE))
                            .setWhen(timeStamp)
                            .setWhen(timeStamp)
                            .setLocalOnly(true)
                            .setLocalOnly(true);
                            .build();
            if (Flags.oppFixMultipleNotificationsIssues()) {
            mNotificationMgr.notify(NOTIFICATION_ID_OUTBOUND_COMPLETE, outNoti);
                b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE);
            }
            mNotificationMgr.notify(NOTIFICATION_ID_OUTBOUND_COMPLETE, b.build());
        } else {
        } else {
            if (mNotificationMgr != null) {
            if (mNotificationMgr != null) {
                mNotificationMgr.cancel(NOTIFICATION_ID_OUTBOUND_COMPLETE);
                mNotificationMgr.cancel(NOTIFICATION_ID_OUTBOUND_COMPLETE);
@@ -521,7 +533,7 @@ class BluetoothOppNotification {


            Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName(
            Intent deleteIntent = new Intent(Constants.ACTION_COMPLETE_HIDE).setClassName(
                    mContext, BluetoothOppReceiver.class.getName());
                    mContext, BluetoothOppReceiver.class.getName());
            Notification inNoti =
            Notification.Builder b =
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                            true)
                            true)
                            .setContentTitle(mContext.getString(R.string.inbound_noti_title))
                            .setContentTitle(mContext.getString(R.string.inbound_noti_title))
@@ -538,9 +550,11 @@ class BluetoothOppNotification {
                                    PendingIntent.getBroadcast(mContext, 0, deleteIntent,
                                    PendingIntent.getBroadcast(mContext, 0, deleteIntent,
                                        PendingIntent.FLAG_IMMUTABLE))
                                        PendingIntent.FLAG_IMMUTABLE))
                            .setWhen(timeStamp)
                            .setWhen(timeStamp)
                            .setLocalOnly(true)
                            .setLocalOnly(true);
                            .build();
            if (Flags.oppFixMultipleNotificationsIssues()) {
            mNotificationMgr.notify(NOTIFICATION_ID_INBOUND_COMPLETE, inNoti);
                b.setGroup(NOTIFICATION_GROUP_KEY_TRANSFER_COMPLETE);
            }
            mNotificationMgr.notify(NOTIFICATION_ID_INBOUND_COMPLETE, b.build());
        } else {
        } else {
            if (mNotificationMgr != null) {
            if (mNotificationMgr != null) {
                mNotificationMgr.cancel(NOTIFICATION_ID_INBOUND_COMPLETE);
                mNotificationMgr.cancel(NOTIFICATION_ID_INBOUND_COMPLETE);
@@ -601,7 +615,7 @@ class BluetoothOppNotification {
                                PendingIntent.FLAG_IMMUTABLE);
                                PendingIntent.FLAG_IMMUTABLE);
            }
            }


            Notification public_n =
            Notification.Builder publicNotificationBuilder =
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                            true)
                            true)
                            .setOngoing(true)
                            .setOngoing(true)
@@ -623,9 +637,12 @@ class BluetoothOppNotification {
                                    info.mDeviceName, fileNameSafe)))
                                    info.mDeviceName, fileNameSafe)))
                            .setSubText(Formatter.formatFileSize(mContext, info.mTotalBytes))
                            .setSubText(Formatter.formatFileSize(mContext, info.mTotalBytes))
                            .setSmallIcon(R.drawable.bt_incomming_file_notification)
                            .setSmallIcon(R.drawable.bt_incomming_file_notification)
                            .setLocalOnly(true)
                            .setLocalOnly(true);
                            .build();
            if (Flags.oppFixMultipleNotificationsIssues()) {
            Notification n =
                publicNotificationBuilder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM);
            }

            Notification.Builder builder =
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                            true)
                            true)
                            .setOngoing(true)
                            .setOngoing(true)
@@ -651,9 +668,11 @@ class BluetoothOppNotification {
                            .setVisibility(Notification.VISIBILITY_PRIVATE)
                            .setVisibility(Notification.VISIBILITY_PRIVATE)
                            .addAction(actionDecline)
                            .addAction(actionDecline)
                            .addAction(actionAccept)
                            .addAction(actionAccept)
                            .setPublicVersion(public_n)
                            .setPublicVersion(publicNotificationBuilder.build());
                            .build();
            if (Flags.oppFixMultipleNotificationsIssues()) {
            mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, n);
                builder.setGroup(NOTIFICATION_GROUP_KEY_INCOMING_FILE_CONFIRM);
            }
            mNotificationMgr.notify(NOTIFICATION_ID_PROGRESS, builder.build());
        }
        }
        cursor.close();
        cursor.close();
    }
    }