Merge "Revert "TEMP add missing remap log, reduce log spam"" into sc-dev am: 4b61a18585
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15097056 Change-Id: Id86dc396fbd80df127652402676c3b695f706799
This commit is contained in:
@@ -3397,21 +3397,11 @@ public class AppOpsService extends IAppOpsService.Stub {
|
|||||||
boolean shouldCollectMessage) {
|
boolean shouldCollectMessage) {
|
||||||
PackageVerificationResult pvr;
|
PackageVerificationResult pvr;
|
||||||
try {
|
try {
|
||||||
boolean isLocOrActivity = code == AppOpsManager.OP_FINE_LOCATION
|
pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName);
|
||||||
|| code == AppOpsManager.OP_FINE_LOCATION_SOURCE
|
|
||||||
|| code == AppOpsManager.OP_ACTIVITY_RECOGNITION
|
|
||||||
|| code == AppOpsManager.OP_ACTIVITY_RECOGNITION_SOURCE;
|
|
||||||
pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName,
|
|
||||||
isLocOrActivity);
|
|
||||||
boolean wasNull = attributionTag == null;
|
boolean wasNull = attributionTag == null;
|
||||||
if (!pvr.isAttributionTagValid) {
|
if (!pvr.isAttributionTagValid) {
|
||||||
attributionTag = null;
|
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) {
|
} catch (SecurityException e) {
|
||||||
Slog.e(TAG, "noteOperation", e);
|
Slog.e(TAG, "noteOperation", e);
|
||||||
return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag,
|
return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag,
|
||||||
@@ -3919,20 +3909,10 @@ public class AppOpsService extends IAppOpsService.Stub {
|
|||||||
int attributionChainId, boolean dryRun) {
|
int attributionChainId, boolean dryRun) {
|
||||||
PackageVerificationResult pvr;
|
PackageVerificationResult pvr;
|
||||||
try {
|
try {
|
||||||
boolean isLocOrActivity = code == AppOpsManager.OP_FINE_LOCATION
|
pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName);
|
||||||
|| code == AppOpsManager.OP_FINE_LOCATION_SOURCE
|
|
||||||
|| code == AppOpsManager.OP_ACTIVITY_RECOGNITION
|
|
||||||
|| code == AppOpsManager.OP_ACTIVITY_RECOGNITION_SOURCE;
|
|
||||||
pvr = verifyAndGetBypass(uid, packageName, attributionTag, proxyPackageName,
|
|
||||||
isLocOrActivity);
|
|
||||||
if (!pvr.isAttributionTagValid) {
|
if (!pvr.isAttributionTagValid) {
|
||||||
attributionTag = null;
|
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) {
|
} catch (SecurityException e) {
|
||||||
Slog.e(TAG, "startOperation", e);
|
Slog.e(TAG, "startOperation", e);
|
||||||
return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag,
|
return new SyncNotedAppOp(AppOpsManager.MODE_ERRORED, code, attributionTag,
|
||||||
@@ -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,
|
private @NonNull PackageVerificationResult verifyAndGetBypass(int uid, String packageName,
|
||||||
@Nullable String attributionTag) {
|
@Nullable String attributionTag) {
|
||||||
return verifyAndGetBypass(uid, packageName, attributionTag, null, false);
|
return verifyAndGetBypass(uid, packageName, attributionTag, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4511,7 +4491,7 @@ public class AppOpsService extends IAppOpsService.Stub {
|
|||||||
* attribution tag is valid
|
* attribution tag is valid
|
||||||
*/
|
*/
|
||||||
private @NonNull PackageVerificationResult verifyAndGetBypass(int uid, String packageName,
|
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) {
|
if (uid == Process.ROOT_UID) {
|
||||||
// For backwards compatibility, don't check package name for root UID.
|
// For backwards compatibility, don't check package name for root UID.
|
||||||
return new PackageVerificationResult(null,
|
return new PackageVerificationResult(null,
|
||||||
@@ -4558,20 +4538,6 @@ public class AppOpsService extends IAppOpsService.Stub {
|
|||||||
AndroidPackage pkg = pmInt.getPackage(packageName);
|
AndroidPackage pkg = pmInt.getPackage(packageName);
|
||||||
if (pkg != null) {
|
if (pkg != null) {
|
||||||
isAttributionTagValid = isAttributionInPackage(pkg, attributionTag);
|
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()));
|
pkgUid = UserHandle.getUid(userId, UserHandle.getAppId(pkg.getUid()));
|
||||||
bypass = getBypassforPackage(pkg);
|
bypass = getBypassforPackage(pkg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import android.os.UserHandle;
|
|||||||
import android.service.voice.VoiceInteractionManagerInternal;
|
import android.service.voice.VoiceInteractionManagerInternal;
|
||||||
import android.service.voice.VoiceInteractionManagerInternal.HotwordDetectionServiceIdentity;
|
import android.service.voice.VoiceInteractionManagerInternal.HotwordDetectionServiceIdentity;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.ArraySet;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
|
||||||
@@ -69,10 +68,6 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat
|
|||||||
"android:activity_recognition_allow_listed_tags";
|
"android:activity_recognition_allow_listed_tags";
|
||||||
private static final String ACTIVITY_RECOGNITION_TAGS_SEPARATOR = ";";
|
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
|
@NonNull
|
||||||
private final Object mLock = new Object();
|
private final Object mLock = new Object();
|
||||||
|
|
||||||
@@ -269,32 +264,14 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat
|
|||||||
if (resolvedCode != code) {
|
if (resolvedCode != code) {
|
||||||
if (isDatasourceAttributionTag(uid, packageName, attributionTag,
|
if (isDatasourceAttributionTag(uid, packageName, attributionTag,
|
||||||
mLocationTags)) {
|
mLocationTags)) {
|
||||||
if (packageName.equals("com.google.android.gms")
|
|
||||||
&& !sExpectedTags.contains(attributionTag)) {
|
|
||||||
Log.i("AppOpsDebugRemapping", "remapping " + packageName + " location "
|
|
||||||
+ "for tag " + attributionTag);
|
|
||||||
}
|
|
||||||
return resolvedCode;
|
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 {
|
} else {
|
||||||
resolvedCode = resolveArOp(code);
|
resolvedCode = resolveArOp(code);
|
||||||
if (resolvedCode != code) {
|
if (resolvedCode != code) {
|
||||||
if (isDatasourceAttributionTag(uid, packageName, attributionTag,
|
if (isDatasourceAttributionTag(uid, packageName, attributionTag,
|
||||||
mActivityRecognitionTags)) {
|
mActivityRecognitionTags)) {
|
||||||
if (packageName.equals("com.google.android.gms")
|
|
||||||
&& !sExpectedTags.contains(attributionTag)) {
|
|
||||||
Log.i("AppOpsDebugRemapping", "remapping " + packageName + " "
|
|
||||||
+ "activity recognition for tag " + attributionTag);
|
|
||||||
}
|
|
||||||
return resolvedCode;
|
return resolvedCode;
|
||||||
} else if (packageName.equals("com.google.android.gms")
|
|
||||||
&& sExpectedTags.contains(attributionTag)) {
|
|
||||||
Log.i("AppOpsDebugRemapping", "NOT remapping " + packageName
|
|
||||||
+ " code " + code + " for tag " + attributionTag);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user