diff options
author | 2025-02-26 02:58:09 -0800 | |
---|---|---|
committer | 2025-02-26 02:58:09 -0800 | |
commit | 47ab31627dbf1bad5f911f298ead12297e241538 (patch) | |
tree | 348145dcf4092533072d8342b9fe9fe9561bd8cb /service/java | |
parent | b0514c4e229ef09328bc7aeaf09c4c2f3a3ace71 (diff) |
Revert "Query for contacts in the same user as the call when deciding trusted"
This reverts commit b0514c4e229ef09328bc7aeaf09c4c2f3a3ace71.
Reason for revert: <Droidmonitor created revert due to b/399250535. Will be verified through ABTD for standard investigation.>>
Change-Id: I8c343f180c05a8c770bfdb95430fcfca794f0c45
Diffstat (limited to 'service/java')
-rw-r--r-- | service/java/com/android/ecm/EnhancedConfirmationService.java | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/service/java/com/android/ecm/EnhancedConfirmationService.java b/service/java/com/android/ecm/EnhancedConfirmationService.java index 1e5ab2fed..fc0ed20d0 100644 --- a/service/java/com/android/ecm/EnhancedConfirmationService.java +++ b/service/java/com/android/ecm/EnhancedConfirmationService.java @@ -110,6 +110,7 @@ public class EnhancedConfirmationService extends SystemService { new EnhancedConfirmationManagerLocalImpl(this)); } + private ContentResolver mContentResolver; private TelephonyManager mTelephonyManager; @GuardedBy("mUserAccessibilityManagers") @@ -127,6 +128,7 @@ public class EnhancedConfirmationService extends SystemService { systemConfigManager.getEnhancedConfirmationTrustedInstallers()); publishBinderService(Context.ECM_ENHANCED_CONFIRMATION_SERVICE, new Stub()); + mContentResolver = getContext().getContentResolver(); mTelephonyManager = getContext().getSystemService(TelephonyManager.class); } @@ -175,12 +177,10 @@ public class EnhancedConfirmationService extends SystemService { // device, either because the device lacks telephony calling, or the telephony service // is unavailable. } - UserHandle user = call.getDetails().getAccountHandle().getUserHandle(); if (number != null) { - return hasContactWithPhoneNumber(number, user) - ? CALL_TYPE_TRUSTED : CALL_TYPE_UNTRUSTED; + return hasContactWithPhoneNumber(number) ? CALL_TYPE_TRUSTED : CALL_TYPE_UNTRUSTED; } else { - return hasContactWithDisplayName(call.getDetails().getCallerDisplayName(), user) + return hasContactWithDisplayName(call.getDetails().getCallerDisplayName()) ? CALL_TYPE_TRUSTED : CALL_TYPE_UNTRUSTED; } } @@ -196,7 +196,7 @@ public class EnhancedConfirmationService extends SystemService { return handle.getSchemeSpecificPart(); } - private boolean hasContactWithPhoneNumber(String phoneNumber, UserHandle user) { + private boolean hasContactWithPhoneNumber(String phoneNumber) { if (phoneNumber == null) { return false; } @@ -206,12 +206,12 @@ public class EnhancedConfirmationService extends SystemService { PhoneLookup.DISPLAY_NAME, ContactsContract.PhoneLookup._ID }; - try (Cursor res = getUserContentResolver(user).query(uri, projection, null, null)) { + try (Cursor res = mContentResolver.query(uri, projection, null, null)) { return res != null && res.getCount() > 0; } } - private boolean hasContactWithDisplayName(String displayName, UserHandle user) { + private boolean hasContactWithDisplayName(String displayName) { if (displayName == null) { return false; } @@ -219,16 +219,11 @@ public class EnhancedConfirmationService extends SystemService { String[] projection = new String[]{PhoneLookup._ID}; String selection = StructuredName.DISPLAY_NAME + " = ?"; String[] selectionArgs = new String[]{displayName}; - try (Cursor res = getUserContentResolver(user) - .query(uri, projection, selection, selectionArgs, null)) { + try (Cursor res = mContentResolver.query(uri, projection, selection, selectionArgs, null)) { return res != null && res.getCount() > 0; } } - private ContentResolver getUserContentResolver(UserHandle user) { - return getContext().createContextAsUser(user, 0).getContentResolver(); - } - private boolean hasCallOfType(@CallType int callType) { for (int ongoingCallType : mOngoingCalls.values()) { if (ongoingCallType == callType) { |