Remove package name from the attribution tag.

GMSCore decided to prepend attribution tag with package name. Other
developers might go the same way in the future. To save on uploading,
we remove package name from attribution tag.

Bug: 143519689
Test: stats_testdrive 10075 && atest UidAtomTest#testAppOps
Change-Id: I2deb30fcb7615368c760655bf9dee24337a9135c
This commit is contained in:
Stanislav Zholnin
2020-06-03 17:53:53 +01:00
parent ebe62e4882
commit 044b1790c5

View File

@@ -3414,7 +3414,16 @@ public class StatsPullAtomService extends SystemService {
private void processHistoricalOp(AppOpsManager.HistoricalOp op,
List<AppOpEntry> opsList, int uid, int samplingRatio, String packageName,
@Nullable String attributionTag) {
AppOpEntry entry = new AppOpEntry(packageName, attributionTag, op, uid);
int firstChar = 0;
if (attributionTag != null && attributionTag.startsWith(packageName)) {
firstChar = packageName.length();
if (firstChar < attributionTag.length() && attributionTag.charAt(firstChar) == '.') {
firstChar++;
}
}
AppOpEntry entry = new AppOpEntry(packageName,
attributionTag == null ? null : attributionTag.substring(firstChar), op,
uid);
if (entry.mHash < samplingRatio) {
opsList.add(entry);
}