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

Commit f910abb3 authored by Charlie Boutier's avatar Charlie Boutier Committed by Gerrit Code Review
Browse files

Merge changes Ib3a5c706,Ib366eeea into main

* changes:
  Pandora: Change PendingIntent Flag
  Remove minSdkVersion on AndroidManifest
parents 9870abe7 a40091bd
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="android.bluetooth" >
    package="android.bluetooth" >


    <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.LOCAL_MAC_ADDRESS" />
    <uses-permission android:name="android.permission.LOCAL_MAC_ADDRESS" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />


    <application>
    <application>
        <uses-library android:name="android.test.runner" />
        <uses-library android:name="android.test.runner" />


        <receiver android:name="android.bluetooth.PendingIntentScanReceiver" >
        <receiver android:name="android.bluetooth.PendingIntentScanReceiver" android:exported="true">
            <intent-filter>
            <intent-filter>
                <action android:name="android.bluetooth.test.ACTION_SCAN_RESULT" />
                <action android:name="android.bluetooth.test.ACTION_SCAN_RESULT" />
            </intent-filter>
            </intent-filter>
+4 −2
Original line number Original line 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 scanIntent = Intent(ACTION_DYNAMIC_RECEIVER_SCAN_RESULT)
                val pendingIntent =
                val pendingIntent =
@@ -160,7 +160,9 @@ class DckTestRule(
                        context,
                        context,
                        0,
                        0,
                        scanIntent,
                        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)
                leScanner.startScan(listOf(scanFilter), scanSettings, pendingIntent)
+12 −6
Original line number Original line Diff line number Diff line
@@ -42,17 +42,18 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.flags.Flags;
import com.android.compatibility.common.util.AdoptShellPermissionsRule;
import com.android.compatibility.common.util.AdoptShellPermissionsRule;


import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;


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

import java.util.List;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeUnit;


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

/** Test cases for {@link BluetoothGattServer}. */
/** Test cases for {@link BluetoothGattServer}. */
@RunWith(AndroidJUnit4.class)
@RunWith(AndroidJUnit4.class)
public class GattServerConnectWithScanTest {
public class GattServerConnectWithScanTest {
@@ -61,11 +62,13 @@ public class GattServerConnectWithScanTest {
    private static final int TIMEOUT_SCANNING_MS = 2_000;
    private static final int TIMEOUT_SCANNING_MS = 2_000;
    private static final int TIMEOUT_GATT_CONNECTION_MS = 2_000;
    private static final int TIMEOUT_GATT_CONNECTION_MS = 2_000;


    @Rule public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule();
    @Rule(order = 2)
    public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule();


    @Rule public final PandoraDevice mBumble = new PandoraDevice();
    @Rule(order = 1)
    public final PandoraDevice mBumble = new PandoraDevice();


    @Rule
    @Rule(order = 0)
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();


    private final Context mContext = ApplicationProvider.getApplicationContext();
    private final Context mContext = ApplicationProvider.getApplicationContext();
@@ -75,6 +78,7 @@ public class GattServerConnectWithScanTest {
    private final BluetoothLeScanner mLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
    private final BluetoothLeScanner mLeScanner = mBluetoothAdapter.getBluetoothLeScanner();


    @Test
    @Test
    @Ignore("b/343525982: Remove hidden api's dependencies to enable the test.")
    public void serverConnectToRandomAddress_withTransportAuto() throws Exception {
    public void serverConnectToRandomAddress_withTransportAuto() throws Exception {
        advertiseWithBumble(OwnAddressType.RANDOM);
        advertiseWithBumble(OwnAddressType.RANDOM);
        assertThat(scanBumbleDevice(Utils.BUMBLE_RANDOM_ADDRESS)).isNotNull();
        assertThat(scanBumbleDevice(Utils.BUMBLE_RANDOM_ADDRESS)).isNotNull();
@@ -101,6 +105,7 @@ public class GattServerConnectWithScanTest {
    }
    }


    @Test
    @Test
    @Ignore("b/343525982: Remove hidden api's dependencies to enable the test.")
    public void serverConnectToRandomAddress_withTransportLE() throws Exception {
    public void serverConnectToRandomAddress_withTransportLE() throws Exception {
        advertiseWithBumble(OwnAddressType.RANDOM);
        advertiseWithBumble(OwnAddressType.RANDOM);
        assertThat(scanBumbleDevice(Utils.BUMBLE_RANDOM_ADDRESS)).isNotNull();
        assertThat(scanBumbleDevice(Utils.BUMBLE_RANDOM_ADDRESS)).isNotNull();
@@ -151,6 +156,7 @@ public class GattServerConnectWithScanTest {
    }
    }


    @Test
    @Test
    @Ignore("b/343525982: Remove hidden api's dependencies to enable the test.")
    public void serverConnectToPublicAddress_withTransportLE() throws Exception {
    public void serverConnectToPublicAddress_withTransportLE() throws Exception {
        String publicAddress = mBumble.getRemoteDevice().getAddress();
        String publicAddress = mBumble.getRemoteDevice().getAddress();
        advertiseWithBumble(OwnAddressType.PUBLIC);
        advertiseWithBumble(OwnAddressType.PUBLIC);
+1 −0
Original line number Original line Diff line number Diff line
@@ -137,6 +137,7 @@ public class GattServerConnectWithoutScanTest {
    }
    }


    @Test
    @Test
    @Ignore("b/343525982: Remove hidden api's dependencies to enable the test.")
    public void serverConnectToPublicAddress_withTransportLE() throws Exception {
    public void serverConnectToPublicAddress_withTransportLE() throws Exception {
        advertiseWithBumble(OwnAddressType.PUBLIC);
        advertiseWithBumble(OwnAddressType.PUBLIC);


+2 −0
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.compatibility.common.util.AdoptShellPermissionsRule;


import io.grpc.Deadline;
import io.grpc.Deadline;


import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;
@@ -56,6 +57,7 @@ public class LeAdvertisingTest {
    @Rule public final PandoraDevice mBumble = new PandoraDevice();
    @Rule public final PandoraDevice mBumble = new PandoraDevice();


    @Test
    @Test
    @Ignore("b/343525982: Remove hidden api's dependencies to enable the test.")
    public void advertisingSet() throws Exception {
    public void advertisingSet() throws Exception {
        Pair<String, Integer> addressPair = startAdvertising().join();
        Pair<String, Integer> addressPair = startAdvertising().join();
        ScanningResponse response = scanWithBumble(addressPair);
        ScanningResponse response = scanWithBumble(addressPair);
Loading