summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Baumann <patb@google.com>2019-11-08 20:39:05 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-11-08 20:39:05 +0000
commit2e82e39c56aa9b0f24af74fe27933de9f95c44a0 (patch)
tree373baea6e609848475ea1c9988101bd9fefee71e
parent1008aa55e988ca702d10e11754fa6060a646dfee (diff)
parenta72e674e53266d4f500a2d3fe657956d8ed868f7 (diff)
Merge "Honor shared users in visibility calculations"
-rw-r--r--services/core/java/com/android/server/pm/AppsFilter.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/pm/AppsFilter.java b/services/core/java/com/android/server/pm/AppsFilter.java
index 31efed4a9491..bb5b04a08828 100644
--- a/services/core/java/com/android/server/pm/AppsFilter.java
+++ b/services/core/java/com/android/server/pm/AppsFilter.java
@@ -445,8 +445,31 @@ public class AppsFilter {
private boolean shouldFilterApplicationInternal(
PackageSetting callingPkgSetting, PackageSetting targetPkgSetting, int userId) {
+ return shouldFilterApplicationInternal(callingPkgSetting, targetPkgSetting, userId,
+ true /*expandSharedUser*/);
+ }
+
+ /**
+ * @param expandSharedUser true if all members of the shared user a target may belong to should
+ * be considered
+ */
+ private boolean shouldFilterApplicationInternal(
+ PackageSetting callingPkgSetting, PackageSetting targetPkgSetting, int userId,
+ boolean expandSharedUser) {
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "shouldFilterApplicationInternal");
try {
+ // special case shared user targets
+ if (expandSharedUser && targetPkgSetting.sharedUser != null) {
+ for (PackageSetting sharedMemberSetting : targetPkgSetting.sharedUser.packages) {
+ if (!shouldFilterApplicationInternal(
+ callingPkgSetting, sharedMemberSetting, userId,
+ false /*expandSharedUser*/)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
final String callingName = callingPkgSetting.pkg.packageName;
final PackageParser.Package targetPkg = targetPkgSetting.pkg;
@@ -471,6 +494,12 @@ public class AppsFilter {
}
return false;
}
+ if (callingPkgSetting.appId == targetPkgSetting.appId) {
+ if (DEBUG_LOGGING) {
+ log(callingPkgSetting, targetPkgSetting, "same app id");
+ }
+ return false;
+ }
if (isImplicitlyQueryableSystemApp(targetPkgSetting)) {
if (DEBUG_LOGGING) {
log(callingPkgSetting, targetPkgSetting, "implicitly queryable sys");