diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2020-11-03 21:10:00 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-11-03 21:10:00 +0000 |
commit | 8e6546897d87fbcce3141870f84ef55f76774a65 (patch) | |
tree | 29992b1442dc7f72cf6457af5666ea5b77ad9969 | |
parent | 876b111a198895a997f99c4b016db5b98b2b159a (diff) | |
parent | f495683d75a2be42d52f0475d53fa0af11cb1e68 (diff) | |
download | Bluetooth-8e6546897d87fbcce3141870f84ef55f76774a65.tar.gz |
Merge "Snap for 6949450 from 45a2fb5c6f454b6ee54e9869c85034b8d07cb48e to android11-tests-release" into android11-tests-releaseandroid-vts-11.0_r9android-vts-11.0_r8android-vts-11.0_r7android-vts-11.0_r6android-vts-11.0_r5android-vts-11.0_r4android-vts-11.0_r3android-vts-11.0_r2android-vts-11.0_r16android-vts-11.0_r15android-vts-11.0_r14android-vts-11.0_r13android-vts-11.0_r12android-vts-11.0_r11android-vts-11.0_r10android-cts-11.0_r9android-cts-11.0_r8android-cts-11.0_r7android-cts-11.0_r6android-cts-11.0_r5android-cts-11.0_r4android-cts-11.0_r3android-cts-11.0_r16android-cts-11.0_r15android-cts-11.0_r14android-cts-11.0_r13android-cts-11.0_r12android-cts-11.0_r11android-cts-11.0_r10android11-tests-release
4 files changed, 13 insertions, 7 deletions
diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp index 462f1959b..3e4d27289 100644 --- a/jni/com_android_bluetooth_btservice_AdapterService.cpp +++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp @@ -680,7 +680,8 @@ static void classInitNative(JNIEnv* env, jclass clazz) { } static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest, - jboolean isNiapMode, int configCompareResult) { + jboolean isNiapMode, int configCompareResult, + jboolean isAtvDevice) { ALOGV("%s", __func__); android_bluetooth_UidTraffic.clazz = @@ -696,7 +697,8 @@ static bool initNative(JNIEnv* env, jobject obj, jboolean isGuest, int ret = sBluetoothInterface->init( &sBluetoothCallbacks, isGuest == JNI_TRUE ? 1 : 0, - isNiapMode == JNI_TRUE ? 1 : 0, configCompareResult); + isNiapMode == JNI_TRUE ? 1 : 0, configCompareResult, + isAtvDevice == JNI_TRUE ? 1 : 0); if (ret != BT_STATUS_SUCCESS) { ALOGE("Error while setting the callbacks: %d\n", ret); sBluetoothInterface = NULL; @@ -1309,7 +1311,7 @@ static int getMetricIdNative(JNIEnv* env, jobject obj, jbyteArray address) { static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"classInitNative", "()V", (void*)classInitNative}, - {"initNative", "(ZZI)Z", (void*)initNative}, + {"initNative", "(ZZIZ)Z", (void*)initNative}, {"cleanupNative", "()V", (void*)cleanupNative}, {"enableNative", "()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 a5bf8e0b0..6c5a7e6f3 100644 --- a/src/com/android/bluetooth/btservice/AdapterService.java +++ b/src/com/android/bluetooth/btservice/AdapterService.java @@ -441,7 +441,11 @@ public class AdapterService extends Service { mBluetoothKeystoreService = new BluetoothKeystoreService(isNiapMode()); mBluetoothKeystoreService.start(); int configCompareResult = mBluetoothKeystoreService.getCompareResult(); - initNative(isGuest(), isNiapMode(), configCompareResult); + + // 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(), configCompareResult, isAtvDevice); mNativeAvailable = true; mCallbacks = new RemoteCallbackList<IBluetoothCallback>(); mAppOps = getSystemService(AppOpsManager.class); @@ -3080,7 +3084,7 @@ public class AdapterService extends Service { static native void classInitNative(); native boolean initNative(boolean startRestricted, boolean isNiapMode, - int configCompareResult); + int configCompareResult, boolean isAtvDevice); native void cleanupNative(); diff --git a/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java b/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java index a7282f5b6..b82e5546d 100644 --- a/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +++ b/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java @@ -108,7 +108,7 @@ public class AdapterServiceTest { Assert.assertNotNull(Looper.myLooper()); AdapterService adapterService = new AdapterService(); adapterService.initNative(false /* is_restricted */, false /* is_niap_mode */, - 0 /* config_compare_result */); + 0 /* config_compare_result */, false); adapterService.cleanupNative(); HashMap<String, HashMap<String, String>> adapterConfig = TestUtils.readAdapterConfig(); Assert.assertNotNull(adapterConfig); diff --git a/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java b/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java index 05a910080..4648e1f9d 100644 --- a/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java +++ b/tests/unit/src/com/android/bluetooth/btservice/ProfileServiceTest.java @@ -97,7 +97,7 @@ public class ProfileServiceTest { mProfiles = Config.getSupportedProfiles(); mMockAdapterService.initNative(false /* is_restricted */, false /* is_niap_mode */, - 0 /* config_compare_result */); + 0 /* config_compare_result */, false); TestUtils.setAdapterService(mMockAdapterService); |