diff options
author | Rahul Sabnis <rahulsabnis@google.com> | 2020-07-31 19:47:06 -0700 |
---|---|---|
committer | Anis Assi <anisassi@google.com> | 2020-09-10 13:50:41 -0700 |
commit | 47ace0e3a22c7a02430b8e7a6267bd5475529245 (patch) | |
tree | 00e8aa53aa3055a86546926aa0d4a3d2ecd57650 | |
parent | e0cae3d9f46ec3fc200154c694545dfbc1be011e (diff) | |
download | Bluetooth-47ace0e3a22c7a02430b8e7a6267bd5475529245.tar.gz |
Pass whether the local device is an atv device to the native layer toandroid-security-8.0.0_r54android-security-8.0.0_r53android-security-8.0.0_r52oreo-security-release
determine whether to include pairing dialogs for justworks and
encryption only LE pairing
Tag: #feature
Bug: 157038281
Test: Manual
Merged-In: Ib7575ff3d5f7e0c208743eff652440f7947dfed7
Change-Id: Ib7575ff3d5f7e0c208743eff652440f7947dfed7
(cherry picked from commit b9dee21f7558a14029c53bf3a0deed2c500cdfe0)
-rw-r--r-- | jni/com_android_bluetooth_btservice_AdapterService.cpp | 6 | ||||
-rw-r--r-- | src/com/android/bluetooth/btservice/AdapterService.java | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp index f743ec579..74729dbbe 100644 --- a/jni/com_android_bluetooth_btservice_AdapterService.cpp +++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp @@ -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}, diff --git a/src/com/android/bluetooth/btservice/AdapterService.java b/src/com/android/bluetooth/btservice/AdapterService.java index 030110730..b1d2ea29e 100644 --- a/src/com/android/bluetooth/btservice/AdapterService.java +++ b/src/com/android/bluetooth/btservice/AdapterService.java @@ -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; @@ -397,7 +398,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 @@ -2249,7 +2254,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(); |