From f17894f341a4a29d791901d37e396db6a02dabb2 Mon Sep 17 00:00:00 2001 From: Michael Groover Date: Wed, 25 Mar 2020 20:29:27 -0700 Subject: [PATCH] Clean up device identifier access logging This commit removes the log message from DevicePolicyManagerService when a caller fails the access requirements as it can be confusing if the caller subsequently passes a carrier privilege check and can access identifiers, or in the case where the caller does not have access a similar entry is logged by TelephonyPermissions. The subId for which the carrier privilege check is performed is also logged to facilitate debugging. Bug: 152117976 Test: atest SubscriptionControllerTest Change-Id: I6d88d739a0d9053e8eff32d74d90009699abe8fc --- .../server/devicepolicy/DevicePolicyManagerService.java | 2 -- .../com/android/internal/telephony/TelephonyPermissions.java | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 09fab3e29fe01..31c08df72fb73 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -9182,8 +9182,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return true; } - Log.w(LOG_TAG, String.format("Package %s (uid=%d, pid=%d) cannot access Device IDs", - packageName, uid, pid)); return false; } diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java index 0b331744d922b..3bf3444d41976 100644 --- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java +++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java @@ -361,7 +361,8 @@ public final class TelephonyPermissions { TelephonyCommonStatsLog.write(TelephonyCommonStatsLog.DEVICE_IDENTIFIER_ACCESS_DENIED, callingPackage, message, /* isPreinstalled= */ false, false); } - Log.w(LOG_TAG, "reportAccessDeniedToReadIdentifiers:" + callingPackage + ":" + message); + Log.w(LOG_TAG, "reportAccessDeniedToReadIdentifiers:" + callingPackage + ":" + message + ":" + + subId); // if the target SDK is pre-Q then check if the calling package would have previously // had access to device identifiers. if (callingPackageInfo != null && (