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

Commit 91c535c7 authored by Hongbo Zeng's avatar Hongbo Zeng Committed by Gerrit Code Review
Browse files

Revert "Open activity directly from notification (incoming file ..."

Revert submission 2907830

Reason for revert: reverted due to BluetoothOppTransferHistoryTest failed and these patches are the only intermediate CLs per b/320600377

Reverted changes: /q/submissionid:2907830

Change-Id: Ifd5b21084bd92d04ebaec87fbc8a81054bc702e2
parent 95daa14e
Loading
Loading
Loading
Loading
+8 −21
Original line number Diff line number Diff line
@@ -582,31 +582,15 @@ class BluetoothOppNotification {
                    PendingIntent.getBroadcast(mContext, 0,
                            new Intent(baseIntent).setAction(Constants.ACTION_ACCEPT),
                            PendingIntent.FLAG_IMMUTABLE)).build();

            PendingIntent contentIntent;
            if (Flags.oppStartActivityDirectlyFromNotification()) {
                Intent intent = new Intent(mContext, BluetoothOppIncomingFileConfirmActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.setDataAndNormalize(contentUri);
                contentIntent =
                        PendingIntent.getActivity(
                                mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE);
            } else {
                contentIntent =
                        PendingIntent.getBroadcast(
                                mContext,
                                0,
                                new Intent(baseIntent)
                                        .setAction(Constants.ACTION_INCOMING_FILE_CONFIRM),
                                PendingIntent.FLAG_IMMUTABLE);
            }

            Notification public_n =
                    new Notification.Builder(mContext, OPP_NOTIFICATION_CHANNEL).setOnlyAlertOnce(
                            true)
                            .setOngoing(true)
                            .setWhen(info.mTimeStamp)
                            .setContentIntent(contentIntent)
                            .setContentIntent(PendingIntent.getBroadcast(mContext, 0,
                                    new Intent(baseIntent).setAction(
                                            Constants.ACTION_INCOMING_FILE_CONFIRM),
                                    PendingIntent.FLAG_IMMUTABLE))
                            .setDeleteIntent(PendingIntent.getBroadcast(mContext, 0,
                                    new Intent(baseIntent).setAction(Constants.ACTION_HIDE),
                                    PendingIntent.FLAG_IMMUTABLE))
@@ -630,7 +614,10 @@ class BluetoothOppNotification {
                            true)
                            .setOngoing(true)
                            .setWhen(info.mTimeStamp)
                            .setContentIntent(contentIntent)
                            .setContentIntent(PendingIntent.getBroadcast(mContext, 0,
                                    new Intent(baseIntent).setAction(
                                            Constants.ACTION_INCOMING_FILE_CONFIRM),
                                    PendingIntent.FLAG_IMMUTABLE))
                            .setDeleteIntent(PendingIntent.getBroadcast(mContext, 0,
                                    new Intent(baseIntent).setAction(Constants.ACTION_HIDE),
                                    PendingIntent.FLAG_IMMUTABLE))
+9 −10
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
            }
            Toast.makeText(context, toastMsg, Toast.LENGTH_SHORT).show();
        } else if (action.equals(Constants.ACTION_INCOMING_FILE_CONFIRM)) {
            if (!Flags.oppStartActivityDirectlyFromNotification()) {
            if (V) {
                Log.v(TAG, "Receiver ACTION_INCOMING_FILE_CONFIRM");
            }
@@ -86,7 +85,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
            in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            in.setDataAndNormalize(uri);
            context.startActivity(in);
            }

        } else if (action.equals(Constants.ACTION_DECLINE)) {
            if (V) {
                Log.v(TAG, "Receiver ACTION_DECLINE");
+0 −5
Original line number Diff line number Diff line
@@ -121,12 +121,7 @@ public class BluetoothOppReceiverTest {
    }

    @Test
    @RequiresFlagsDisabled(Flags.FLAG_OPP_START_ACTIVITY_DIRECTLY_FROM_NOTIFICATION)
    public void onReceive_withActionIncomingFileConfirm_startsIncomingFileConfirmActivity() {
        if (Flags.oppStartActivityDirectlyFromNotification()) {
            return;
        }

        Intent intent = new Intent();
        intent.setAction(Constants.ACTION_INCOMING_FILE_CONFIRM);
        intent.setData(Uri.parse("content:///not/important"));