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

Commit a40091bd authored by Charlie Boutier's avatar Charlie Boutier
Browse files

Pandora: Change PendingIntent Flag

Bug: 335677534
Test: atest BumbleBluetoothTests:android.bluetooth.DckScanTest -- --abi x86_64
Flag: EXEMPT TEST_ONLY

Change-Id: Ib3a5c706d4b1df36b4781e7fac5c248e44f5e3bc
parent 4b31870d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ class DckTestRule(
                        }
                    }

                context.registerReceiver(broadcastReceiver, intentFilter)
                context.registerReceiver(broadcastReceiver, intentFilter, Context.RECEIVER_EXPORTED)

                val scanIntent = Intent(ACTION_DYNAMIC_RECEIVER_SCAN_RESULT)
                val pendingIntent =
@@ -160,7 +160,9 @@ class DckTestRule(
                        context,
                        0,
                        scanIntent,
                        PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
                        PendingIntent.FLAG_MUTABLE or
                            PendingIntent.FLAG_UPDATE_CURRENT or
                            PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT
                    )

                leScanner.startScan(listOf(scanFilter), scanSettings, pendingIntent)
+12 −7
Original line number Diff line number Diff line
@@ -52,17 +52,17 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;

import pandora.HostProto;
import pandora.HostProto.AdvertiseRequest;
import pandora.HostProto.AdvertiseResponse;
import pandora.HostProto.OwnAddressType;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;

import pandora.HostProto;
import pandora.HostProto.AdvertiseRequest;
import pandora.HostProto.AdvertiseResponse;
import pandora.HostProto.OwnAddressType;

@RunWith(AndroidJUnit4.class)
public class LeScanningTest {
    private static final String TAG = "LeScanningTest";
@@ -168,7 +168,7 @@ public class LeScanningTest {
    public void startBleScan_withPendingIntentAndDynamicReceiverAndCallbackTypeAllMatches() {
        BroadcastReceiver mockReceiver = mock(BroadcastReceiver.class);
        IntentFilter intentFilter = new IntentFilter(ACTION_DYNAMIC_RECEIVER_SCAN_RESULT);
        mContext.registerReceiver(mockReceiver, intentFilter);
        mContext.registerReceiver(mockReceiver, intentFilter, Context.RECEIVER_EXPORTED);

        advertiseWithBumble(TEST_UUID_STRING, OwnAddressType.PUBLIC);

@@ -187,7 +187,12 @@ public class LeScanningTest {
        Intent scanIntent = new Intent(ACTION_DYNAMIC_RECEIVER_SCAN_RESULT);
        PendingIntent pendingIntent =
                PendingIntent.getBroadcast(
                        mContext, 0, scanIntent, PendingIntent.FLAG_CANCEL_CURRENT);
                        mContext,
                        0,
                        scanIntent,
                        PendingIntent.FLAG_MUTABLE
                                | PendingIntent.FLAG_CANCEL_CURRENT
                                | PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT);

        mLeScanner.startScan(List.of(scanFilter), scanSettings, pendingIntent);

+4 −1
Original line number Diff line number Diff line
@@ -64,7 +64,10 @@ public class PendingIntentScanReceiver extends BroadcastReceiver {
     */
    public static PendingIntent newBroadcastPendingIntent(Context context, int requestCode) {
        return PendingIntent.getBroadcast(
                context, requestCode, newIntent(context), PendingIntent.FLAG_CANCEL_CURRENT);
                context,
                requestCode,
                newIntent(context),
                PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT);
    }

    /**