From bc0e91b3ffe107fb421d313ab38d8d6a02773fce Mon Sep 17 00:00:00 2001 From: Omer Nebil Yaveroglu Date: Wed, 15 Apr 2020 18:00:09 +0100 Subject: [PATCH] Extend the client logs when the calling package name is not identified in the logs. Test: None Bug: 153998363 Change-Id: I84c23f42fd01a5517ad7174ada8d38aa5e9662f5 --- .../integrity/AppIntegrityManagerServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java b/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java index 273fd48b0d962..35cd9309144e4 100644 --- a/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java +++ b/services/core/java/com/android/server/integrity/AppIntegrityManagerServiceImpl.java @@ -89,9 +89,9 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; -import java.util.function.Supplier; /** Implementation of {@link AppIntegrityManagerService}. */ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { @@ -656,8 +656,10 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { String callerPackageName = getCallerPackageName(); if (callerPackageName == null) { throw new SecurityException( - "Only system packages specified in config_integrityRuleProviderPackages are" - + " allowed to call this method."); + String.format( + "Only system packages specified in config_integrityRuleProviderPackages" + + " are allowed to call this method. These packages are %s.", + getAllowedRuleProviders().toString())); } return callerPackageName; } @@ -674,7 +676,9 @@ public class AppIntegrityManagerServiceImpl extends IAppIntegrityManager.Stub { if (isSystemApp(packageName)) { return packageName; } + Slog.i(TAG, "Rule provider package " + packageName + " is not a system app."); } + Slog.i(TAG, "Package " + packageName + " is not among calling package list."); } catch (PackageManager.NameNotFoundException e) { // Ignore the exception. We don't expect the app to be necessarily installed. Slog.i(TAG, "Rule provider package " + packageName + " not installed.");