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

Commit 45238a9d authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge changes I525cf2f0,I00bafdf5,I98a6ebbd,Iadef10dd into main

* changes:
  Trunk Stable/OppReceiver: do not skip test
  Trunk Stable/MediaControl: do not skip test
  Trunk Stable/HeadsetStateMachine: do not skip test
  Trunk Stable/GattServiceTest: do not skip test
parents 35eedb89 b2151fd3
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -45,10 +45,8 @@ import android.location.LocationManager;
import android.os.Binder;
import android.os.RemoteException;
import android.os.WorkSource;
import android.platform.test.flag.junit.SetFlagsRule;

import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
import androidx.test.rule.ServiceTestRule;
@@ -67,7 +65,6 @@ import com.android.bluetooth.flags.Flags;

import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -110,9 +107,7 @@ public class GattServiceTest {
    @Mock private AdvertiseManagerNativeInterface mAdvertiseManagerNativeInterface;

    @Rule public final ServiceTestRule mServiceRule = new ServiceTestRule();

    @Rule
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();

    private BluetoothDevice mDevice;
    private BluetoothAdapter mAdapter;
@@ -502,10 +497,9 @@ public class GattServiceTest {
        verify(mScanManager).flushBatchScanResults(new ScanClient(scannerId));
    }

    @RequiresFlagsEnabled(Flags.FLAG_LE_SCAN_FIX_REMOTE_EXCEPTION)
    @Test
    public void onScanResult_remoteException_clientDied() throws Exception {
        Assume.assumeTrue(Flags.leScanFixRemoteException());
        mSetFlagsRule.enableFlags(Flags.FLAG_LE_SCAN_FIX_REMOTE_EXCEPTION);
        int scannerId = 1;

        int eventType = 0;
@@ -893,9 +887,9 @@ public class GattServiceTest {
                        BluetoothProfile.STATE_CONNECTED);
    }

    @RequiresFlagsEnabled(Flags.FLAG_GATT_CLEANUP_RESTRICTED_HANDLES)
    @Test
    public void restrictedHandles() throws Exception {
        mSetFlagsRule.enableFlags(Flags.FLAG_GATT_CLEANUP_RESTRICTED_HANDLES);
        int clientIf = 1;
        int connId = 1;
        ArrayList<GattDbElement> db = new ArrayList<>();
+7 −3
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ import android.os.CancellationSignal;
import android.os.HandlerThread;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.SetFlagsRule;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.telephony.PhoneNumberUtils;
@@ -65,6 +65,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -85,6 +86,9 @@ public class HeadsetStateMachineTest {
    private static final int ASYNC_CALL_TIMEOUT_MILLIS = 250;
    private static final String TEST_PHONE_NUMBER = "1234567890";
    private static final int MAX_RETRY_DISCONNECT_AUDIO = 3;

    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();

    private Context mTargetContext;
    private BluetoothAdapter mAdapter;
    private HandlerThread mHandlerThread;
@@ -1017,8 +1021,8 @@ public class HeadsetStateMachineTest {

    /** A test to verify that we correctly send CIND response when a call is in progress */
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_PRETEND_NETWORK_SERVICE)
    public void testCindEventWhenCallIsInProgress() {
        mSetFlagsRule.enableFlags(Flags.FLAG_PRETEND_NETWORK_SERVICE);
        when(mPhoneState.getCindService())
                .thenReturn(HeadsetHalConstants.NETWORK_STATE_NOT_AVAILABLE);
        when(mHeadsetService.isVirtualCallStarted()).thenReturn(false);
@@ -1657,8 +1661,8 @@ public class HeadsetStateMachineTest {

    /** Test setting audio parameters according to received SWB event. SWB AptX is enabled. */
    @Test
    @RequiresFlagsEnabled(Flags.FLAG_HFP_CODEC_APTX_VOICE)
    public void testSetAudioParameters_SwbAptxEnabled() {
        mSetFlagsRule.enableFlags(Flags.FLAG_HFP_CODEC_APTX_VOICE);
        assumeTrue(SystemProperties.getBoolean("bluetooth.hfp.codec_aptx_voice.enabled", false));
        setUpConnectedState();
        mHeadsetStateMachine.sendMessage(
+5 −2
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothLeBroadcastMetadata;
import android.content.Context;
import android.os.Looper;
import android.platform.test.annotations.RequiresFlagsEnabled;

import androidx.test.InstrumentationRegistry;
import androidx.test.filters.MediumTest;
@@ -38,10 +37,12 @@ import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.le_audio.LeAudioService;
import android.platform.test.flag.junit.SetFlagsRule;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -68,6 +69,8 @@ public class MediaControlGattServiceTest {
    private static final UUID UUID_CCCD = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb");
    public static final int TEST_CCID = 1;

    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();

    private MediaControlGattService mMcpService;

    @Mock private AdapterService mAdapterService;
@@ -942,8 +945,8 @@ public class MediaControlGattServiceTest {
    }

    @Test
    @RequiresFlagsEnabled(Flags.FLAG_LEAUDIO_BROADCAST_FEATURE_SUPPORT)
    public void testMediaControlPointeRequest_OpcodePlayCallLeAudioServiceSetActiveDevice() {
        mSetFlagsRule.enableFlags(Flags.FLAG_LEAUDIO_BROADCAST_FEATURE_SUPPORT);
        BluetoothGattService service = initAllFeaturesGattService();
        prepareConnectedDevice();
        mMcpService.updateSupportedOpcodesChar(Request.SupportedOpcodes.PLAY, true);
+8 −12
Original line number Diff line number Diff line
@@ -42,10 +42,7 @@ import android.content.ContextWrapper;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.platform.test.annotations.RequiresFlagsDisabled;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.platform.test.flag.junit.SetFlagsRule;

import androidx.test.core.app.ActivityScenario;
import androidx.test.espresso.intent.Intents;
@@ -73,8 +70,7 @@ import java.util.List;
@RunWith(AndroidJUnit4.class)
public class BluetoothOppReceiverTest {

    @Rule
    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();

    Context mContext;

@@ -129,8 +125,8 @@ public class BluetoothOppReceiverTest {
    }

    @Test
    @RequiresFlagsDisabled(Flags.FLAG_OPP_START_ACTIVITY_DIRECTLY_FROM_NOTIFICATION)
    public void onReceive_withActionIncomingFileConfirm_startsIncomingFileConfirmActivity() {
        mSetFlagsRule.disableFlags(Flags.FLAG_OPP_START_ACTIVITY_DIRECTLY_FROM_NOTIFICATION);
        Intent intent = new Intent();
        intent.setAction(Constants.ACTION_INCOMING_FILE_CONFIRM);
        intent.setData(Uri.parse("content:///not/important"));
@@ -163,8 +159,8 @@ public class BluetoothOppReceiverTest {
    }

    @Test
    @RequiresFlagsDisabled(Flags.FLAG_OPP_START_ACTIVITY_DIRECTLY_FROM_NOTIFICATION)
    public void onReceive_withActionOutboundTransfer_startsTransferHistoryActivity() {
        mSetFlagsRule.disableFlags(Flags.FLAG_OPP_START_ACTIVITY_DIRECTLY_FROM_NOTIFICATION);
        Intent intent = new Intent();
        intent.setAction(Constants.ACTION_OPEN_OUTBOUND_TRANSFER);
        intent.setData(Uri.parse("content:///not/important"));
@@ -177,8 +173,8 @@ public class BluetoothOppReceiverTest {
    }

    @Test
    @RequiresFlagsDisabled(Flags.FLAG_OPP_START_ACTIVITY_DIRECTLY_FROM_NOTIFICATION)
    public void onReceive_withActionInboundTransfer_startsTransferHistoryActivity() {
        mSetFlagsRule.disableFlags(Flags.FLAG_OPP_START_ACTIVITY_DIRECTLY_FROM_NOTIFICATION);
        Intent intent = new Intent();
        intent.setAction(Constants.ACTION_OPEN_INBOUND_TRANSFER);
        intent.setData(Uri.parse("content:///not/important"));
@@ -216,8 +212,8 @@ public class BluetoothOppReceiverTest {
    }

    @Test
    @RequiresFlagsDisabled(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES)
    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);
@@ -227,8 +223,8 @@ public class BluetoothOppReceiverTest {
    }

    @Test
    @RequiresFlagsEnabled(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES)
    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);
@@ -246,8 +242,8 @@ public class BluetoothOppReceiverTest {
    }

    @Test
    @RequiresFlagsEnabled(Flags.FLAG_OPP_FIX_MULTIPLE_NOTIFICATIONS_ISSUES)
    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);