Loading services/core/java/com/android/server/appop/AppOpsService.java +5 −39 Original line number Diff line number Diff line Loading @@ -3397,21 +3397,11 @@ public class AppOpsService extends IAppOpsService.Stub { boolean shouldCollectMessage) { PackageVerificationResult pvr; try { boolean isLocOrActivity = code == AppOpsManager.OP_FINE_LOCATION || code == AppOpsManager.OP_FINE_LOCATION_SOURCE || code == AppOpsManager.OP_ACTIVITY_RECOGNITION || code == AppOpsManager.OP_ACTIVITY_RECOGNITION_SOURCE; pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName, isLocOrActivity); pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName); boolean wasNull = attributionTag == null; if (!pvr.isAttributionTagValid) { attributionTag = null; } if (attributionTag == null && isLocOrActivity && packageName.equals("com.google.android.gms")) { Slog.i("AppOpsDebug", "null tag on location or activity op " + code + " for " + packageName + ", was overridden: " + !wasNull, new Exception()); } } catch (SecurityException e) { Slog.e(TAG, "noteOperation", e); return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, Loading Loading @@ -3919,20 +3909,10 @@ public class AppOpsService extends IAppOpsService.Stub { int attributionChainId, boolean dryRun) { PackageVerificationResult pvr; try { boolean isLocOrActivity = code == AppOpsManager.OP_FINE_LOCATION || code == AppOpsManager.OP_FINE_LOCATION_SOURCE || code == AppOpsManager.OP_ACTIVITY_RECOGNITION || code == AppOpsManager.OP_ACTIVITY_RECOGNITION_SOURCE; pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName, isLocOrActivity); pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName); if (!pvr.isAttributionTagValid) { attributionTag = null; } if (attributionTag == null && isLocOrActivity && packageName.equals("com.google.android.gms")) { Slog.i("AppOpsDebug", "null tag on location or activity op " + code + " for " + packageName, new Exception()); } } catch (SecurityException e) { Slog.e(TAG, "startOperation", e); return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, Loading Loading @@ -4490,11 +4470,11 @@ public class AppOpsService extends IAppOpsService.Stub { } /** * @see #verifyAndGetBypass(int, String, String, String, boolean) * @see #verifyAndGetBypass(int, String, String, String) */ private @NonNull PackageVerificationResult verifyAndGetBypass(int uid, String packageName, @Nullable String attributionTag) { return verifyAndGetBypass(uid, packageName, attributionTag, null, false); return verifyAndGetBypass(uid, packageName, attributionTag, null); } /** Loading @@ -4511,7 +4491,7 @@ public class AppOpsService extends IAppOpsService.Stub { * attribution tag is valid */ private @NonNull PackageVerificationResult verifyAndGetBypass(int uid, String packageName, @Nullable String attributionTag, @Nullable String proxyPackageName, boolean extraLog) { @Nullable String attributionTag, @Nullable String proxyPackageName) { if (uid == Process.ROOT_UID) { // For backwards compatibility, don't check package name for root UID. return new PackageVerificationResult(null, Loading Loading @@ -4558,20 +4538,6 @@ public class AppOpsService extends IAppOpsService.Stub { AndroidPackage pkg = pmInt.getPackage(packageName); if (pkg != null) { isAttributionTagValid = isAttributionInPackage(pkg, attributionTag); if (packageName.equals("com.google.android.gms") && extraLog) { if (isAttributionTagValid && attributionTag != null) { Slog.i("AppOpsDebug", "tag " + attributionTag + " found in " + packageName); } else { ArrayList<String> tagList = new ArrayList<>(); for (int i = 0; i < pkg.getAttributions().size(); i++) { tagList.add(pkg.getAttributions().get(i).tag); } Slog.i("AppOpsDebug", "tag " + attributionTag + " missing from " + packageName + ", tags: " + tagList); } } pkgUid = UserHandle.getUid(userId, UserHandle.getAppId(pkg.getUid())); bypass = getBypassforPackage(pkg); } Loading services/core/java/com/android/server/policy/AppOpsPolicy.java +0 −23 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ import android.os.UserHandle; import android.service.voice.VoiceInteractionManagerInternal; import android.service.voice.VoiceInteractionManagerInternal.HotwordDetectionServiceIdentity; import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; import android.util.SparseArray; Loading Loading @@ -69,10 +68,6 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat "android:activity_recognition_allow_listed_tags"; private static final String ACTIVITY_RECOGNITION_TAGS_SEPARATOR = ";"; private static final ArraySet<String> sExpectedTags = new ArraySet<>(new String[] { "awareness_provider", "activity_recognition_provider", "network_location_provider", "network_location_calibration", "fused_location_provider", "geofencer_provider"}); @NonNull private final Object mLock = new Object(); Loading Loading @@ -269,32 +264,14 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat if (resolvedCode != code) { if (isDatasourceAttributionTag(uid, packageName, attributionTag, mLocationTags)) { if (packageName.equals("com.google.android.gms") && !sExpectedTags.contains(attributionTag)) { Log.i("AppOpsDebugRemapping", "remapping " + packageName + " location " + "for tag " + attributionTag); } return resolvedCode; } else if (packageName.equals("com.google.android.gms") && sExpectedTags.contains(attributionTag)) { Log.i("AppOpsDebugRemapping", "NOT remapping " + packageName + " code " + code + " for tag " + attributionTag); } } else { resolvedCode = resolveArOp(code); if (resolvedCode != code) { if (isDatasourceAttributionTag(uid, packageName, attributionTag, mActivityRecognitionTags)) { if (packageName.equals("com.google.android.gms") && !sExpectedTags.contains(attributionTag)) { Log.i("AppOpsDebugRemapping", "remapping " + packageName + " " + "activity recognition for tag " + attributionTag); } return resolvedCode; } else if (packageName.equals("com.google.android.gms") && sExpectedTags.contains(attributionTag)) { Log.i("AppOpsDebugRemapping", "NOT remapping " + packageName + " code " + code + " for tag " + attributionTag); } } } Loading Loading
services/core/java/com/android/server/appop/AppOpsService.java +5 −39 Original line number Diff line number Diff line Loading @@ -3397,21 +3397,11 @@ public class AppOpsService extends IAppOpsService.Stub { boolean shouldCollectMessage) { PackageVerificationResult pvr; try { boolean isLocOrActivity = code == AppOpsManager.OP_FINE_LOCATION || code == AppOpsManager.OP_FINE_LOCATION_SOURCE || code == AppOpsManager.OP_ACTIVITY_RECOGNITION || code == AppOpsManager.OP_ACTIVITY_RECOGNITION_SOURCE; pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName, isLocOrActivity); pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName); boolean wasNull = attributionTag == null; if (!pvr.isAttributionTagValid) { attributionTag = null; } if (attributionTag == null && isLocOrActivity && packageName.equals("com.google.android.gms")) { Slog.i("AppOpsDebug", "null tag on location or activity op " + code + " for " + packageName + ", was overridden: " + !wasNull, new Exception()); } } catch (SecurityException e) { Slog.e(TAG, "noteOperation", e); return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, Loading Loading @@ -3919,20 +3909,10 @@ public class AppOpsService extends IAppOpsService.Stub { int attributionChainId, boolean dryRun) { PackageVerificationResult pvr; try { boolean isLocOrActivity = code == AppOpsManager.OP_FINE_LOCATION || code == AppOpsManager.OP_FINE_LOCATION_SOURCE || code == AppOpsManager.OP_ACTIVITY_RECOGNITION || code == AppOpsManager.OP_ACTIVITY_RECOGNITION_SOURCE; pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName, isLocOrActivity); pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName); if (!pvr.isAttributionTagValid) { attributionTag = null; } if (attributionTag == null && isLocOrActivity && packageName.equals("com.google.android.gms")) { Slog.i("AppOpsDebug", "null tag on location or activity op " + code + " for " + packageName, new Exception()); } } catch (SecurityException e) { Slog.e(TAG, "startOperation", e); return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag, Loading Loading @@ -4490,11 +4470,11 @@ public class AppOpsService extends IAppOpsService.Stub { } /** * @see #verifyAndGetBypass(int, String, String, String, boolean) * @see #verifyAndGetBypass(int, String, String, String) */ private @NonNull PackageVerificationResult verifyAndGetBypass(int uid, String packageName, @Nullable String attributionTag) { return verifyAndGetBypass(uid, packageName, attributionTag, null, false); return verifyAndGetBypass(uid, packageName, attributionTag, null); } /** Loading @@ -4511,7 +4491,7 @@ public class AppOpsService extends IAppOpsService.Stub { * attribution tag is valid */ private @NonNull PackageVerificationResult verifyAndGetBypass(int uid, String packageName, @Nullable String attributionTag, @Nullable String proxyPackageName, boolean extraLog) { @Nullable String attributionTag, @Nullable String proxyPackageName) { if (uid == Process.ROOT_UID) { // For backwards compatibility, don't check package name for root UID. return new PackageVerificationResult(null, Loading Loading @@ -4558,20 +4538,6 @@ public class AppOpsService extends IAppOpsService.Stub { AndroidPackage pkg = pmInt.getPackage(packageName); if (pkg != null) { isAttributionTagValid = isAttributionInPackage(pkg, attributionTag); if (packageName.equals("com.google.android.gms") && extraLog) { if (isAttributionTagValid && attributionTag != null) { Slog.i("AppOpsDebug", "tag " + attributionTag + " found in " + packageName); } else { ArrayList<String> tagList = new ArrayList<>(); for (int i = 0; i < pkg.getAttributions().size(); i++) { tagList.add(pkg.getAttributions().get(i).tag); } Slog.i("AppOpsDebug", "tag " + attributionTag + " missing from " + packageName + ", tags: " + tagList); } } pkgUid = UserHandle.getUid(userId, UserHandle.getAppId(pkg.getUid())); bypass = getBypassforPackage(pkg); } Loading
services/core/java/com/android/server/policy/AppOpsPolicy.java +0 −23 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ import android.os.UserHandle; import android.service.voice.VoiceInteractionManagerInternal; import android.service.voice.VoiceInteractionManagerInternal.HotwordDetectionServiceIdentity; import android.text.TextUtils; import android.util.ArraySet; import android.util.Log; import android.util.SparseArray; Loading Loading @@ -69,10 +68,6 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat "android:activity_recognition_allow_listed_tags"; private static final String ACTIVITY_RECOGNITION_TAGS_SEPARATOR = ";"; private static final ArraySet<String> sExpectedTags = new ArraySet<>(new String[] { "awareness_provider", "activity_recognition_provider", "network_location_provider", "network_location_calibration", "fused_location_provider", "geofencer_provider"}); @NonNull private final Object mLock = new Object(); Loading Loading @@ -269,32 +264,14 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat if (resolvedCode != code) { if (isDatasourceAttributionTag(uid, packageName, attributionTag, mLocationTags)) { if (packageName.equals("com.google.android.gms") && !sExpectedTags.contains(attributionTag)) { Log.i("AppOpsDebugRemapping", "remapping " + packageName + " location " + "for tag " + attributionTag); } return resolvedCode; } else if (packageName.equals("com.google.android.gms") && sExpectedTags.contains(attributionTag)) { Log.i("AppOpsDebugRemapping", "NOT remapping " + packageName + " code " + code + " for tag " + attributionTag); } } else { resolvedCode = resolveArOp(code); if (resolvedCode != code) { if (isDatasourceAttributionTag(uid, packageName, attributionTag, mActivityRecognitionTags)) { if (packageName.equals("com.google.android.gms") && !sExpectedTags.contains(attributionTag)) { Log.i("AppOpsDebugRemapping", "remapping " + packageName + " " + "activity recognition for tag " + attributionTag); } return resolvedCode; } else if (packageName.equals("com.google.android.gms") && sExpectedTags.contains(attributionTag)) { Log.i("AppOpsDebugRemapping", "NOT remapping " + packageName + " code " + code + " for tag " + attributionTag); } } } Loading