Loading core/java/com/android/internal/pm/pkg/component/ParsedAttributionImpl.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -38,7 +38,7 @@ import java.util.List; public class ParsedAttributionImpl implements ParsedAttribution, Parcelable { public class ParsedAttributionImpl implements ParsedAttribution, Parcelable { /** Maximum amount of attributions per package */ /** Maximum amount of attributions per package */ static final int MAX_NUM_ATTRIBUTIONS = 10000; static final int MAX_NUM_ATTRIBUTIONS = 400; /** Tag of the attribution */ /** Tag of the attribution */ private @NonNull String tag; private @NonNull String tag; Loading services/core/java/com/android/server/appop/AppOpsService.java +38 −0 Original line number Original line Diff line number Diff line Loading @@ -2882,6 +2882,10 @@ public class AppOpsService extends IAppOpsService.Stub { return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, packageName); packageName); } } if (proxyAttributionTag != null && !isAttributionTagDefined(packageName, proxyPackageName, proxyAttributionTag)) { proxyAttributionTag = null; } synchronized (this) { synchronized (this) { final Ops ops = getOpsLocked(uid, packageName, attributionTag, final Ops ops = getOpsLocked(uid, packageName, attributionTag, Loading Loading @@ -3476,6 +3480,10 @@ public class AppOpsService extends IAppOpsService.Stub { return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, packageName); packageName); } } if (proxyAttributionTag != null && !isAttributionTagDefined(packageName, proxyPackageName, proxyAttributionTag)) { proxyAttributionTag = null; } boolean isRestricted = false; boolean isRestricted = false; int startType = START_TYPE_FAILED; int startType = START_TYPE_FAILED; Loading Loading @@ -4329,6 +4337,36 @@ public class AppOpsService extends IAppOpsService.Stub { return false; return false; } } /** * Checks to see if the attribution tag is defined in either package or proxyPackage. * This method is intended for ProxyAttributionTag validation and returns false * if it does not exist in either one of them. * * @param packageName Name of the package * @param proxyPackageName Name of the proxy package * @param attributionTag attribution tag to be checked * * @return boolean specifying if attribution tag is valid or not */ private boolean isAttributionTagDefined(@Nullable String packageName, @Nullable String proxyPackageName, @Nullable String attributionTag) { if (packageName == null) { return false; } else if (attributionTag == null) { return true; } PackageManagerInternal pmInt = LocalServices.getService(PackageManagerInternal.class); if (proxyPackageName != null) { AndroidPackage proxyPkg = pmInt.getPackage(proxyPackageName); if (proxyPkg != null && isAttributionInPackage(proxyPkg, attributionTag)) { return true; } } AndroidPackage pkg = pmInt.getPackage(packageName); return isAttributionInPackage(pkg, attributionTag); } private void logVerifyAndGetBypassFailure(int uid, @NonNull SecurityException e, private void logVerifyAndGetBypassFailure(int uid, @NonNull SecurityException e, @NonNull String methodName) { @NonNull String methodName) { if (Process.isIsolated(uid)) { if (Process.isIsolated(uid)) { Loading Loading
core/java/com/android/internal/pm/pkg/component/ParsedAttributionImpl.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -38,7 +38,7 @@ import java.util.List; public class ParsedAttributionImpl implements ParsedAttribution, Parcelable { public class ParsedAttributionImpl implements ParsedAttribution, Parcelable { /** Maximum amount of attributions per package */ /** Maximum amount of attributions per package */ static final int MAX_NUM_ATTRIBUTIONS = 10000; static final int MAX_NUM_ATTRIBUTIONS = 400; /** Tag of the attribution */ /** Tag of the attribution */ private @NonNull String tag; private @NonNull String tag; Loading
services/core/java/com/android/server/appop/AppOpsService.java +38 −0 Original line number Original line Diff line number Diff line Loading @@ -2882,6 +2882,10 @@ public class AppOpsService extends IAppOpsService.Stub { return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, packageName); packageName); } } if (proxyAttributionTag != null && !isAttributionTagDefined(packageName, proxyPackageName, proxyAttributionTag)) { proxyAttributionTag = null; } synchronized (this) { synchronized (this) { final Ops ops = getOpsLocked(uid, packageName, attributionTag, final Ops ops = getOpsLocked(uid, packageName, attributionTag, Loading Loading @@ -3476,6 +3480,10 @@ public class AppOpsService extends IAppOpsService.Stub { return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, packageName); packageName); } } if (proxyAttributionTag != null && !isAttributionTagDefined(packageName, proxyPackageName, proxyAttributionTag)) { proxyAttributionTag = null; } boolean isRestricted = false; boolean isRestricted = false; int startType = START_TYPE_FAILED; int startType = START_TYPE_FAILED; Loading Loading @@ -4329,6 +4337,36 @@ public class AppOpsService extends IAppOpsService.Stub { return false; return false; } } /** * Checks to see if the attribution tag is defined in either package or proxyPackage. * This method is intended for ProxyAttributionTag validation and returns false * if it does not exist in either one of them. * * @param packageName Name of the package * @param proxyPackageName Name of the proxy package * @param attributionTag attribution tag to be checked * * @return boolean specifying if attribution tag is valid or not */ private boolean isAttributionTagDefined(@Nullable String packageName, @Nullable String proxyPackageName, @Nullable String attributionTag) { if (packageName == null) { return false; } else if (attributionTag == null) { return true; } PackageManagerInternal pmInt = LocalServices.getService(PackageManagerInternal.class); if (proxyPackageName != null) { AndroidPackage proxyPkg = pmInt.getPackage(proxyPackageName); if (proxyPkg != null && isAttributionInPackage(proxyPkg, attributionTag)) { return true; } } AndroidPackage pkg = pmInt.getPackage(packageName); return isAttributionInPackage(pkg, attributionTag); } private void logVerifyAndGetBypassFailure(int uid, @NonNull SecurityException e, private void logVerifyAndGetBypassFailure(int uid, @NonNull SecurityException e, @NonNull String methodName) { @NonNull String methodName) { if (Process.isIsolated(uid)) { if (Process.isIsolated(uid)) { Loading