Merge "Prevent developer provided strings from being uploaded through statsd." into rvc-dev am: 7a65a7a37c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11930479

Change-Id: Iccfaf0a632131722b130b932796a0386fa5bd559
This commit is contained in:
Stanislav Zholnin
2020-06-22 08:25:11 +00:00
committed by Automerger Merge Worker
8 changed files with 86 additions and 68 deletions

View File

@@ -7370,15 +7370,17 @@ public class AppOpsManager {
try {
collectNoteOpCallsForValidation(op);
int collectionMode = getNotedOpCollectionMode(uid, packageName, op);
boolean shouldCollectMessage = Process.myUid() == Process.SYSTEM_UID ? true : false;
if (collectionMode == COLLECT_ASYNC) {
if (message == null) {
// Set stack trace as default message
message = getFormattedStackTrace();
shouldCollectMessage = true;
}
}
int mode = mService.noteOperation(op, uid, packageName, attributionTag,
collectionMode == COLLECT_ASYNC, message);
collectionMode == COLLECT_ASYNC, message, shouldCollectMessage);
if (mode == MODE_ALLOWED) {
if (collectionMode == COLLECT_SELF) {
@@ -7531,16 +7533,19 @@ public class AppOpsManager {
try {
collectNoteOpCallsForValidation(op);
int collectionMode = getNotedOpCollectionMode(proxiedUid, proxiedPackageName, op);
boolean shouldCollectMessage = myUid == Process.SYSTEM_UID ? true : false;
if (collectionMode == COLLECT_ASYNC) {
if (message == null) {
// Set stack trace as default message
message = getFormattedStackTrace();
shouldCollectMessage = true;
}
}
int mode = mService.noteProxyOperation(op, proxiedUid, proxiedPackageName,
proxiedAttributionTag, myUid, mContext.getOpPackageName(),
mContext.getAttributionTag(), collectionMode == COLLECT_ASYNC, message);
mContext.getAttributionTag(), collectionMode == COLLECT_ASYNC, message,
shouldCollectMessage);
if (mode == MODE_ALLOWED) {
if (collectionMode == COLLECT_SELF) {
@@ -7855,15 +7860,18 @@ public class AppOpsManager {
try {
collectNoteOpCallsForValidation(op);
int collectionMode = getNotedOpCollectionMode(uid, packageName, op);
boolean shouldCollectMessage = Process.myUid() == Process.SYSTEM_UID ? true : false;
if (collectionMode == COLLECT_ASYNC) {
if (message == null) {
// Set stack trace as default message
message = getFormattedStackTrace();
shouldCollectMessage = true;
}
}
int mode = mService.startOperation(getClientId(), op, uid, packageName,
attributionTag, startIfModeDefault, collectionMode == COLLECT_ASYNC, message);
attributionTag, startIfModeDefault, collectionMode == COLLECT_ASYNC, message,
shouldCollectMessage);
if (mode == MODE_ALLOWED) {
if (collectionMode == COLLECT_SELF) {

View File

@@ -22,7 +22,7 @@ import android.util.SparseArray;
import android.util.SparseIntArray;
import com.android.internal.app.IAppOpsCallback;
import com.android.internal.util.function.HexFunction;
import com.android.internal.util.function.HeptFunction;
import com.android.internal.util.function.QuadFunction;
/**
@@ -73,9 +73,9 @@ public abstract class AppOpsManagerInternal {
*/
int noteOperation(int code, int uid, @Nullable String packageName,
@Nullable String featureId, boolean shouldCollectAsyncNotedOp,
@Nullable String message,
@NonNull HexFunction<Integer, Integer, String, String, Boolean, String, Integer>
superImpl);
@Nullable String message, boolean shouldCollectMessage,
@NonNull HeptFunction<Integer, Integer, String, String, Boolean, String, Boolean,
Integer> superImpl);
}
/**