Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac6a92ff authored by Nate Myren's avatar Nate Myren Committed by Android (Google) Code Review
Browse files

Merge "TEMP add missing remap log, reduce log spam" into sc-dev

parents cf3e019b b05444be
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -4502,8 +4502,12 @@ public class AppOpsService extends IAppOpsService.Stub {
                        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);
                                + packageName + ", tags: " + tagList);
                    }
                }

+23 −6
Original line number Diff line number Diff line
@@ -64,6 +64,11 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat
            "android:activity_recognition_allow_listed_tags";
    private static final String ACTIVITY_RECOGNITION_TAGS_SEPARATOR = ";";

    private static 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();

@@ -222,8 +227,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")) {
            } else if (packageName.equals("com.google.android.gms")
                    && sExpectedTags.contains(attributionTag)) {
                Log.i("AppOpsDebugRemapping", "NOT remapping " + packageName + " code "
                        + code + " for tag " + attributionTag);
            }
@@ -232,10 +243,14 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat
            if (resolvedCode != code) {
                if (isDatasourceAttributionTag(uid, packageName, attributionTag,
                        mActivityRecognitionTags)) {
                    Log.i("AppOpsDebugRemapping", "remapping " + packageName + " code "
                            + code + " to " + resolvedCode + " for tag " + attributionTag);
                    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")) {
                } else if (packageName.equals("com.google.android.gms")
                        && sExpectedTags.contains(attributionTag)) {
                    Log.i("AppOpsDebugRemapping", "NOT remapping " + packageName
                            + " code " + code + " for tag " + attributionTag);
                }
@@ -351,13 +366,15 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat
        if (appIdTags != null) {
            final ArraySet<String> packageTags = appIdTags.get(packageName);
            if (packageTags != null && packageTags.contains(attributionTag)) {
                if (packageName.equals("com.google.android.gms")) {
                if (packageName.equals("com.google.android.gms")
                        && !sExpectedTags.contains(attributionTag)) {
                    Log.i("AppOpsDebugRemapping", packageName + " tag "
                            + attributionTag + " in " + packageTags);
                }
                return true;
            }
            if (packageName.equals("com.google.android.gms")) {
            if (packageName.equals("com.google.android.gms")
                    && sExpectedTags.contains(attributionTag)) {
                Log.i("AppOpsDebugRemapping", packageName + " tag " + attributionTag
                        + " NOT in " + packageTags);
            }