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

Commit 4338eab4 authored by Martin Brabham's avatar Martin Brabham Committed by Weichin Weng
Browse files

DO NOT MERGE: Make NIAP a Global Setting toggle.

Make the NIAP mode a Global toggle that can be modified by ADB for Enterprise provisioning.

Bug: 140483038
Test: atest net_test_bluetooth
Change-Id: Ia508fbd99cb39d45e2a66e071e69617575f34f02
Merged-In: Ia508fbd99cb39d45e2a66e071e69617575f34f02
(cherry picked from commit 1622cfb8)
parent 0f4d4806
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -684,7 +684,7 @@ static void classInitNative(JNIEnv* env, jclass clazz) {
}

static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest,
                       jboolean isSingleUserMode) {
                       jboolean isNiapMode) {
  ALOGV("%s", __func__);

  android_bluetooth_UidTraffic.clazz =
@@ -700,7 +700,7 @@ static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest,

  int ret = sBluetoothInterface->init(&sBluetoothCallbacks,
                                      isGuest == JNI_TRUE ? 1 : 0,
                                      isSingleUserMode == JNI_TRUE ? 1 : 0);
                                      isNiapMode == JNI_TRUE ? 1 : 0);
  if (ret != BT_STATUS_SUCCESS) {
    ALOGE("Error while setting the callbacks: %d\n", ret);
    sBluetoothInterface = NULL;
+4 −4
Original line number Diff line number Diff line
@@ -393,7 +393,7 @@ public class AdapterService extends Service {
        mAdapterProperties = new AdapterProperties(this);
        mAdapterStateMachine = AdapterState.make(this);
        mJniCallbacks = new JniCallbacks(this, mAdapterProperties);
        initNative(isGuest(), isSingleUserMode());
        initNative(isGuest(), isNiapMode());
        mNativeAvailable = true;
        mCallbacks = new RemoteCallbackList<IBluetoothCallback>();
        mAppOps = getSystemService(AppOpsManager.class);
@@ -2869,8 +2869,8 @@ public class AdapterService extends Service {
        return UserManager.get(this).isGuestUser();
    }

    private boolean isSingleUserMode() {
        return UserManager.get(this).hasUserRestriction(UserManager.DISALLOW_ADD_USER);
    private boolean isNiapMode() {
        return Settings.Global.getInt(getContentResolver(), "niap_mode", 0) == 1;
    }

    /**
@@ -2889,7 +2889,7 @@ public class AdapterService extends Service {

    static native void classInitNative();

    native boolean initNative(boolean startRestricted, boolean isSingleUserMode);
    native boolean initNative(boolean startRestricted, boolean isNiapMode);

    native void cleanupNative();

+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public class AdapterServiceTest {
        }
        Assert.assertNotNull(Looper.myLooper());
        AdapterService adapterService = new AdapterService();
        adapterService.initNative(false /* is_restricted */, false /* is_single_user_mode */);
        adapterService.initNative(false /* is_restricted */, false /* is_niap_mode */);
        adapterService.cleanupNative();
        HashMap<String, HashMap<String, String>> adapterConfig = TestUtils.readAdapterConfig();
        Assert.assertNotNull(adapterConfig);
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ public class ProfileServiceTest {

        mProfiles = Config.getSupportedProfiles();

        mMockAdapterService.initNative(false /* is_restricted */, false /* is_single_user_mode */);
        mMockAdapterService.initNative(false /* is_restricted */, false /* is_niap_mode */);

        TestUtils.setAdapterService(mMockAdapterService);