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

Commit 9ed661f4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Pass whether the local device is an atv device to the native layer to...

Merge "Pass whether the local device is an atv device to the native layer to determine whether to include pairing dialogs for justworks and encryption only LE pairing" into qt-dev
parents 00e67fec 9cfb9204
Loading
Loading
Loading
Loading
+4 −3
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 isSingleUserMode, jboolean isAtvDevice) {
  ALOGV("%s", __func__);

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

  int ret = sBluetoothInterface->init(&sBluetoothCallbacks,
                                      isGuest == JNI_TRUE ? 1 : 0,
                                      isSingleUserMode == JNI_TRUE ? 1 : 0);
                                      isSingleUserMode == JNI_TRUE ? 1 : 0,
                                      isAtvDevice == JNI_TRUE ? 1 : 0);
  if (ret != BT_STATUS_SUCCESS) {
    ALOGE("Error while setting the callbacks: %d\n", ret);
    sBluetoothInterface = NULL;
@@ -1240,7 +1241,7 @@ static jbyteArray obfuscateAddressNative(JNIEnv* env, jobject obj,
static JNINativeMethod sMethods[] = {
    /* name, signature, funcPtr */
    {"classInitNative", "()V", (void*)classInitNative},
    {"initNative", "(ZZ)Z", (void*)initNative},
    {"initNative", "(ZZZ)Z", (void*)initNative},
    {"cleanupNative", "()V", (void*)cleanupNative},
    {"enableNative", "()Z", (void*)enableNative},
    {"disableNative", "()Z", (void*)disableNative},
+7 −2
Original line number Diff line number Diff line
@@ -393,7 +393,11 @@ public class AdapterService extends Service {
        mAdapterProperties = new AdapterProperties(this);
        mAdapterStateMachine = AdapterState.make(this);
        mJniCallbacks = new JniCallbacks(this, mAdapterProperties);
        initNative(isGuest(), isSingleUserMode());

        // Android TV doesn't show consent dialogs for just works and encryption only le pairing
        boolean isAtvDevice = getApplicationContext().getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_LEANBACK_ONLY);
        initNative(isGuest(), isSingleUserMode(), isAtvDevice);
        mNativeAvailable = true;
        mCallbacks = new RemoteCallbackList<IBluetoothCallback>();
        mAppOps = getSystemService(AppOpsManager.class);
@@ -2891,7 +2895,8 @@ public class AdapterService extends Service {

    static native void classInitNative();

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

    native void cleanupNative();

+2 −1
Original line number Diff line number Diff line
@@ -101,7 +101,8 @@ 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_single_user_mode */,
                false);
        adapterService.cleanupNative();
        HashMap<String, HashMap<String, String>> adapterConfig = TestUtils.readAdapterConfig();
        Assert.assertNotNull(adapterConfig);
+2 −1
Original line number Diff line number Diff line
@@ -96,7 +96,8 @@ public class ProfileServiceTest {

        mProfiles = Config.getSupportedProfiles();

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

        TestUtils.setAdapterService(mMockAdapterService);