From 00168e0b8ab2a20f6b17688de8cce4899b320f17 Mon Sep 17 00:00:00 2001 From: Patrick Baumann Date: Mon, 4 May 2020 10:07:04 -0700 Subject: [PATCH] Migrate from beginSection to beginTrace This change migrates from the public facing beginSection trace api to the beginTrace internal API to avoid noise from package visibility showing up in traces. Bug: 136675067 Test: atest AppEnumerationTests Change-Id: I3683ea145b6cb925a99f11a3ba8133f0b3b1c610 --- .../com/android/server/pm/AppsFilter.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/services/core/java/com/android/server/pm/AppsFilter.java b/services/core/java/com/android/server/pm/AppsFilter.java index 118fdcbcb7369..70d1adecc6f37 100644 --- a/services/core/java/com/android/server/pm/AppsFilter.java +++ b/services/core/java/com/android/server/pm/AppsFilter.java @@ -725,7 +725,7 @@ public class AppsFilter { } final PackageSetting callingPkgSetting; final ArraySet callingSharedPkgSettings; - Trace.beginSection("callingSetting instanceof"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "callingSetting instanceof"); if (callingSetting instanceof PackageSetting) { callingPkgSetting = (PackageSetting) callingSetting; callingSharedPkgSettings = null; @@ -733,7 +733,7 @@ public class AppsFilter { callingPkgSetting = null; callingSharedPkgSettings = ((SharedUserSetting) callingSetting).packages; } - Trace.endSection(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); if (callingPkgSetting != null) { if (callingPkgSetting.pkg != null @@ -769,7 +769,7 @@ public class AppsFilter { return false; } final String targetName = targetPkg.getPackageName(); - Trace.beginSection("getAppId"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "getAppId"); final int callingAppId; if (callingPkgSetting != null) { callingAppId = callingPkgSetting.appId; @@ -777,7 +777,7 @@ public class AppsFilter { callingAppId = callingSharedPkgSettings.valueAt(0).appId; // all should be the same } final int targetAppId = targetPkgSetting.appId; - Trace.endSection(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); if (callingAppId == targetAppId) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "same app id"); @@ -786,7 +786,7 @@ public class AppsFilter { } try { - Trace.beginSection("hasPermission"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "hasPermission"); if (callingSetting.getPermissionsState().hasPermission( Manifest.permission.QUERY_ALL_PACKAGES, UserHandle.getUserId(callingUid))) { if (DEBUG_LOGGING) { @@ -795,10 +795,10 @@ public class AppsFilter { return false; } } finally { - Trace.endSection(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } try { - Trace.beginSection("mForceQueryable"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mForceQueryable"); if (mForceQueryable.contains(targetAppId)) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "force queryable"); @@ -806,10 +806,10 @@ public class AppsFilter { return false; } } finally { - Trace.endSection(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } try { - Trace.beginSection("mQueriesViaPackage"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mQueriesViaPackage"); if (mQueriesViaPackage.contains(callingAppId, targetAppId)) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "queries package"); @@ -817,10 +817,10 @@ public class AppsFilter { return false; } } finally { - Trace.endSection(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } try { - Trace.beginSection("mQueriesViaComponent"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mQueriesViaComponent"); if (mQueriesViaComponent.contains(callingAppId, targetAppId)) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "queries component"); @@ -828,11 +828,11 @@ public class AppsFilter { return false; } } finally { - Trace.endSection(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } try { - Trace.beginSection("mImplicitlyQueryable"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mImplicitlyQueryable"); final int targetUid = UserHandle.getUid(userId, targetAppId); if (mImplicitlyQueryable.contains(callingUid, targetUid)) { if (DEBUG_LOGGING) { @@ -841,11 +841,11 @@ public class AppsFilter { return false; } } finally { - Trace.endSection(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } try { - Trace.beginSection("mOverlayReferenceMapper"); + Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "mOverlayReferenceMapper"); if (callingSharedPkgSettings != null) { int size = callingSharedPkgSettings.size(); for (int index = 0; index < size; index++) { @@ -868,7 +868,7 @@ public class AppsFilter { } } } finally { - Trace.endSection(); + Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); }