Loading services/core/java/com/android/server/pm/AppsFilter.java +66 −31 Original line number Diff line number Diff line Loading @@ -449,6 +449,7 @@ public class AppsFilter { } final PackageSetting callingPkgSetting; final ArraySet<PackageSetting> callingSharedPkgSettings; Trace.beginSection("callingSetting instanceof"); if (callingSetting instanceof PackageSetting) { callingPkgSetting = (PackageSetting) callingSetting; callingSharedPkgSettings = null; Loading @@ -456,6 +457,7 @@ public class AppsFilter { callingPkgSetting = null; callingSharedPkgSettings = ((SharedUserSetting) callingSetting).packages; } Trace.endSection(); if (callingPkgSetting != null) { if (!mFeatureConfig.packageIsEnabled(callingPkgSetting.pkg)) { Loading Loading @@ -485,6 +487,7 @@ public class AppsFilter { return true; } final String targetName = targetPkg.getPackageName(); Trace.beginSection("getAppId"); final int callingAppId; if (callingPkgSetting != null) { callingAppId = callingPkgSetting.appId; Loading @@ -492,6 +495,7 @@ public class AppsFilter { callingAppId = callingSharedPkgSettings.valueAt(0).appId; // all should be the same } final int targetAppId = targetPkgSetting.appId; Trace.endSection(); if (callingAppId == targetAppId) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "same app id"); Loading @@ -499,6 +503,8 @@ public class AppsFilter { return false; } try { Trace.beginSection("hasPermission"); if (callingSetting.getPermissionsState().hasPermission( Manifest.permission.QUERY_ALL_PACKAGES, UserHandle.getUserId(callingUid))) { if (DEBUG_LOGGING) { Loading @@ -506,25 +512,46 @@ public class AppsFilter { } return false; } } finally { Trace.endSection(); } try { Trace.beginSection("mForceQueryable"); if (mForceQueryable.contains(targetAppId)) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "force queryable"); } return false; } } finally { Trace.endSection(); } try { Trace.beginSection("mQueriesViaPackage"); if (mQueriesViaPackage.contains(callingAppId, targetAppId)) { // the calling package has explicitly declared the target package; allow if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "queries package"); } return false; } else if (mQueriesViaIntent.contains(callingAppId, targetAppId)) { } } finally { Trace.endSection(); } try { Trace.beginSection("mQueriesViaIntent"); if (mQueriesViaIntent.contains(callingAppId, targetAppId)) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "queries intent"); } return false; } } finally { Trace.endSection(); } try { Trace.beginSection("mImplicitlyQueryable"); final int targetUid = UserHandle.getUid(userId, targetAppId); if (mImplicitlyQueryable.contains(callingUid, targetUid)) { if (DEBUG_LOGGING) { Loading @@ -532,6 +559,9 @@ public class AppsFilter { } return false; } } finally { Trace.endSection(); } if (callingPkgSetting != null) { if (callingPkgInstruments(callingPkgSetting, targetPkgSetting, targetName)) { return false; Loading Loading @@ -576,6 +606,8 @@ public class AppsFilter { private static boolean callingPkgInstruments(PackageSetting callingPkgSetting, PackageSetting targetPkgSetting, String targetName) { try { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "callingPkgInstruments"); final List<ComponentParseUtils.ParsedInstrumentation> inst = callingPkgSetting.pkg.getInstrumentations(); for (int i = ArrayUtils.size(inst) - 1; i >= 0; i--) { Loading @@ -587,6 +619,9 @@ public class AppsFilter { } } return false; } finally { Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } } private static void log(SettingBase callingPkgSetting, PackageSetting targetPkgSetting, Loading Loading
services/core/java/com/android/server/pm/AppsFilter.java +66 −31 Original line number Diff line number Diff line Loading @@ -449,6 +449,7 @@ public class AppsFilter { } final PackageSetting callingPkgSetting; final ArraySet<PackageSetting> callingSharedPkgSettings; Trace.beginSection("callingSetting instanceof"); if (callingSetting instanceof PackageSetting) { callingPkgSetting = (PackageSetting) callingSetting; callingSharedPkgSettings = null; Loading @@ -456,6 +457,7 @@ public class AppsFilter { callingPkgSetting = null; callingSharedPkgSettings = ((SharedUserSetting) callingSetting).packages; } Trace.endSection(); if (callingPkgSetting != null) { if (!mFeatureConfig.packageIsEnabled(callingPkgSetting.pkg)) { Loading Loading @@ -485,6 +487,7 @@ public class AppsFilter { return true; } final String targetName = targetPkg.getPackageName(); Trace.beginSection("getAppId"); final int callingAppId; if (callingPkgSetting != null) { callingAppId = callingPkgSetting.appId; Loading @@ -492,6 +495,7 @@ public class AppsFilter { callingAppId = callingSharedPkgSettings.valueAt(0).appId; // all should be the same } final int targetAppId = targetPkgSetting.appId; Trace.endSection(); if (callingAppId == targetAppId) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "same app id"); Loading @@ -499,6 +503,8 @@ public class AppsFilter { return false; } try { Trace.beginSection("hasPermission"); if (callingSetting.getPermissionsState().hasPermission( Manifest.permission.QUERY_ALL_PACKAGES, UserHandle.getUserId(callingUid))) { if (DEBUG_LOGGING) { Loading @@ -506,25 +512,46 @@ public class AppsFilter { } return false; } } finally { Trace.endSection(); } try { Trace.beginSection("mForceQueryable"); if (mForceQueryable.contains(targetAppId)) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "force queryable"); } return false; } } finally { Trace.endSection(); } try { Trace.beginSection("mQueriesViaPackage"); if (mQueriesViaPackage.contains(callingAppId, targetAppId)) { // the calling package has explicitly declared the target package; allow if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "queries package"); } return false; } else if (mQueriesViaIntent.contains(callingAppId, targetAppId)) { } } finally { Trace.endSection(); } try { Trace.beginSection("mQueriesViaIntent"); if (mQueriesViaIntent.contains(callingAppId, targetAppId)) { if (DEBUG_LOGGING) { log(callingSetting, targetPkgSetting, "queries intent"); } return false; } } finally { Trace.endSection(); } try { Trace.beginSection("mImplicitlyQueryable"); final int targetUid = UserHandle.getUid(userId, targetAppId); if (mImplicitlyQueryable.contains(callingUid, targetUid)) { if (DEBUG_LOGGING) { Loading @@ -532,6 +559,9 @@ public class AppsFilter { } return false; } } finally { Trace.endSection(); } if (callingPkgSetting != null) { if (callingPkgInstruments(callingPkgSetting, targetPkgSetting, targetName)) { return false; Loading Loading @@ -576,6 +606,8 @@ public class AppsFilter { private static boolean callingPkgInstruments(PackageSetting callingPkgSetting, PackageSetting targetPkgSetting, String targetName) { try { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "callingPkgInstruments"); final List<ComponentParseUtils.ParsedInstrumentation> inst = callingPkgSetting.pkg.getInstrumentations(); for (int i = ArrayUtils.size(inst) - 1; i >= 0; i--) { Loading @@ -587,6 +619,9 @@ public class AppsFilter { } } return false; } finally { Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); } } private static void log(SettingBase callingPkgSetting, PackageSetting targetPkgSetting, Loading