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

Commit e16c2eec authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
Browse files

Merge changes from topic "re-enable-bt-instrumentation-tests" into tm-dev am:...

Merge changes from topic "re-enable-bt-instrumentation-tests" into tm-dev am: 27c96eb1 am: c8728abd

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/17582656



Change-Id: Ic960e6ca67d8fc247ccb1935ec5e110bf86afc07
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 92b4eb4f c8728abd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -322,6 +322,11 @@ public final class Utils {
    }

    static int sForegroundUserId = USER_HANDLE_NULL.getIdentifier();

    public static int getForegroundUserId() {
        return Utils.sForegroundUserId;
    }

    public static void setForegroundUserId(int userId) {
        Utils.sForegroundUserId = userId;
    }
+1 −3
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ import android.bluetooth.UidTraffic;
import android.companion.CompanionDeviceManager;
import android.content.AttributionSource;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -3715,8 +3714,7 @@ public class AdapterService extends Service {
        @Override
        public void setForegroundUserId(int userId, AttributionSource attributionSource) {
            AdapterService service = getService();
            if (service == null || !callerIsSystemOrActiveUser(TAG, "setForegroundUserId")
                    || !Utils.checkConnectPermissionForDataDelivery(
            if (service == null || !Utils.checkConnectPermissionForDataDelivery(
                    service, Utils.getCallingAttributionSource(mService),
                    "AdapterService setForegroundUserId")) {
                return;
+5 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ public class AdapterServiceTest {
    private PackageManager mMockPackageManager;
    private MockContentResolver mMockContentResolver;
    private HashMap<String, HashMap<String, String>> mAdapterConfig;
    private int mForegroundUserId;

    private void configureEnabledProfiles() {
        Log.e("AdapterServiceTest", "configureEnabledProfiles");
@@ -319,6 +320,10 @@ public class AdapterServiceTest {
    @After
    public void tearDown() {
        Log.e("AdapterServiceTest", "tearDown()");

        // Restores the foregroundUserId to the ID prior to the test setup
        Utils.setForegroundUserId(mForegroundUserId);

        mServiceBinder.unregisterCallback(mIBluetoothCallback, mAttributionSource);
        mAdapterService.cleanup();
    }