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

Commit add6ebb7 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-qpr1-dev
parents 062d5e96 4cb01948
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line 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,
static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest,
                       jboolean isNiapMode) {
                       jboolean isNiapMode, jboolean isAtvDevice) {
  ALOGV("%s", __func__);
  ALOGV("%s", __func__);


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


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

        // 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(), isNiapMode(), isAtvDevice);
        mNativeAvailable = true;
        mNativeAvailable = true;
        mCallbacks = new RemoteCallbackList<IBluetoothCallback>();
        mCallbacks = new RemoteCallbackList<IBluetoothCallback>();
        mAppOps = getSystemService(AppOpsManager.class);
        mAppOps = getSystemService(AppOpsManager.class);
@@ -2890,7 +2894,7 @@ public class AdapterService extends Service {


    static native void classInitNative();
    static native void classInitNative();


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


    native void cleanupNative();
    native void cleanupNative();


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


        mProfiles = Config.getSupportedProfiles();
        mProfiles = Config.getSupportedProfiles();


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


        TestUtils.setAdapterService(mMockAdapterService);
        TestUtils.setAdapterService(mMockAdapterService);