Merge "Allow listening for noted Ops if app is sampled for Stack trace collection." into rvc-dev am: ae4605eee8 am: 0807ec1f69
Change-Id: I9f7b87856cd1bcfcc0ddeabfa9356ed259f8a4c7
This commit is contained in:
@@ -233,12 +233,9 @@ public class AppOpsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void reportStackTraceIfNeeded(@NonNull SyncNotedAppOp op) {
|
private void reportStackTraceIfNeeded(@NonNull SyncNotedAppOp op) {
|
||||||
if (sConfig.getSampledOpCode() == OP_NONE
|
if (!isCollectingStackTraces()) {
|
||||||
&& sConfig.getExpirationTimeSinceBootMillis()
|
|
||||||
>= SystemClock.elapsedRealtime()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageSamplingConfig config = sConfig;
|
MessageSamplingConfig config = sConfig;
|
||||||
if (leftCircularDistance(strOpToOp(op.getOp()), config.getSampledOpCode(),
|
if (leftCircularDistance(strOpToOp(op.getOp()), config.getSampledOpCode(),
|
||||||
_NUM_OP) <= config.getAcceptableLeftDistance()
|
_NUM_OP) <= config.getAcceptableLeftDistance()
|
||||||
@@ -8181,7 +8178,22 @@ public class AppOpsManager {
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static boolean isListeningForOpNoted() {
|
public static boolean isListeningForOpNoted() {
|
||||||
return sOnOpNotedCallback != null;
|
return sOnOpNotedCallback != null || isCollectingStackTraces();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {@code true} iff the process is currently sampled for stacktrace collection.
|
||||||
|
*
|
||||||
|
* @see #setOnOpNotedCallback
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
private static boolean isCollectingStackTraces() {
|
||||||
|
if (sConfig.getSampledOpCode() == OP_NONE &&
|
||||||
|
sConfig.getExpirationTimeSinceBootMillis() >= SystemClock.elapsedRealtime()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user