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

Commit e58d0584 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 pi-dev
parents 872f029c de362995
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -685,7 +685,7 @@ static void classInitNative(JNIEnv* env, jclass clazz) {
  }
}

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

  android_bluetooth_UidTraffic.clazz =
@@ -699,7 +699,7 @@ static bool initNative(JNIEnv* env, jobject obj) {
    return JNI_FALSE;
  }

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

        // 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(isAtvDevice);
        mNativeAvailable = true;
        mCallbacks = new RemoteCallbackList<IBluetoothCallback>();
        //Load the name and address
@@ -2541,7 +2545,7 @@ public class AdapterService extends Service {

    static native void classInitNative();

    native boolean initNative();
    native boolean initNative(boolean isAtvDevice);

    native void cleanupNative();

+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ public class ProfileServiceTest {

        mProfiles = Config.getSupportedProfiles();

        mMockAdapterService.initNative();
        mMockAdapterService.initNative(false);

        TestUtils.setAdapterService(mMockAdapterService);