From 90dc6fcdcba6c0c2b0f9bdaad28457a81c9af4ba Mon Sep 17 00:00:00 2001 From: Brian Delwiche Date: Tue, 8 Nov 2022 23:32:46 +0000 Subject: Fix OPP comparison isBluetoothShareUri_correctlyCheckUri (under com.android.bluetooth.opp.BluetoothOppUtilityTest) is failing on null input due to an incorrect comparison in isBluetoothShareUri. Change the comparison to one which can cope with null input. Bug: 257190999 Test: atest: BluetoothOppUtilityTest Tag: #security Ignore-AOSP-First: Security Change-Id: Ia6a08e7092c2084e1816b782317c13254e78719b --- src/com/android/bluetooth/opp/BluetoothOppUtility.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/android/bluetooth/opp/BluetoothOppUtility.java b/src/com/android/bluetooth/opp/BluetoothOppUtility.java index 7fdbe1302..b0878e83c 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppUtility.java +++ b/src/com/android/bluetooth/opp/BluetoothOppUtility.java @@ -60,6 +60,7 @@ import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; /** @@ -77,10 +78,10 @@ public class BluetoothOppUtility { public static boolean isBluetoothShareUri(Uri uri) { if (uri.toString().startsWith(BluetoothShare.CONTENT_URI.toString()) - && !uri.getAuthority().equals(BluetoothShare.CONTENT_URI.getAuthority())) { + && !Objects.equals(uri.getAuthority(), BluetoothShare.CONTENT_URI.getAuthority())) { EventLog.writeEvent(0x534e4554, "225880741", -1, ""); } - return uri.getAuthority().equals(BluetoothShare.CONTENT_URI.getAuthority()); + return Objects.equals(uri.getAuthority(), BluetoothShare.CONTENT_URI.getAuthority()); } public static BluetoothOppTransferInfo queryRecord(Context context, Uri uri) { -- cgit v1.2.3