Revert "TEMP add missing remap log, reduce log spam"

Revert "TEMP add app ops debug logs"

This reverts commit b05444be8c.
This reverts commit 39c56f4be2.

Reason for revert: no longer needed
Test: build
Fixes: 192279096

Change-Id: I2749a8c2c8fe1f9885d23d21f71474aac4b4b5d2
This commit is contained in:
Nate Myren
2021-06-24 19:15:49 +00:00
parent ec801cc398
commit 3431494880
2 changed files with 5 additions and 62 deletions

View File

@@ -3372,21 +3372,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,
@@ -3893,20 +3883,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,
@@ -4458,11 +4438,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);
}
/**
@@ -4479,7 +4459,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,
@@ -4526,20 +4506,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);
}

View File

@@ -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;
@@ -68,10 +67,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();
@@ -260,32 +255,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);
}
}
}