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

Commit ed5eb9f4 authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Automerger Merge Worker
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 oc-dev am: 2221073a

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

Change-Id: I3d1e899f5b4b55e25f3ef1c14d2e1bb293b349da
parents 16fc18aa 2221073a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -646,7 +646,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 =
@@ -660,7 +660,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;
@@ -1213,7 +1213,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},
+7 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.BatteryStats;
import android.os.Binder;
@@ -394,7 +395,11 @@ public class AdapterService extends Service {
        mAdapterProperties = new AdapterProperties(this);
        mAdapterStateMachine =  AdapterState.make(this, mAdapterProperties);
        mJniCallbacks =  new JniCallbacks(mAdapterStateMachine, 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
@@ -2265,7 +2270,7 @@ public class AdapterService extends Service {
    };

    private native static void classInitNative();
    private native boolean initNative();
    private native boolean initNative(boolean isAtvDevice);
    private native void cleanupNative();
    /*package*/ native boolean enableNative(boolean startRestricted);
    /*package*/ native boolean disableNative();