summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Onea <andreionea@google.com>2019-02-18 12:17:00 +0000
committerAndrei-Valentin Onea <andreionea@google.com>2019-02-20 12:58:54 +0000
commit5913e8333d4fb618285853bb5a82927faaa2e4eb (patch)
treef21c396d09e988fa21d18c8f64d38f9df28ef30b
parent2df2ca9a34b8fb064ea7493093d337171456bb1b (diff)
Pass sampled value to hidden api logger
The logger will use the sampled value to select the logging method to be used. Test: m Bug: 119217680 (cherry picked from commit c46991d2b3b13889bef3b0e91662c8cbd7d0ce4f) Change-Id: If58442275b6936a56b5ae25f1e80654a567dc953 Merged-In: If9fce9a254eb0d2952e9b68ead658c2f096dbab9
-rw-r--r--libart/src/main/java/dalvik/system/VMRuntime.java14
-rw-r--r--mmodules/core_platform_api/api/platform/current-api.txt2
2 files changed, 9 insertions, 7 deletions
diff --git a/libart/src/main/java/dalvik/system/VMRuntime.java b/libart/src/main/java/dalvik/system/VMRuntime.java
index 04dac34329..7721574359 100644
--- a/libart/src/main/java/dalvik/system/VMRuntime.java
+++ b/libart/src/main/java/dalvik/system/VMRuntime.java
@@ -88,6 +88,8 @@ public final class VMRuntime {
/**
* Logs hidden API access
*
+ * @param sampledValue value that was sampled, to be compared against the
+ * sampling rate
* @param appPackageName package name of the app attempting the access
* @param signature signature of the method being called, i.e
* class_name->member_name:type_signature (e.g.
@@ -97,8 +99,8 @@ public final class VMRuntime {
* @param accessType how the accessed was done
* @param accessDenied whether the access was allowed or not
*/
- public void hiddenApiUsed(String appPackageName, String signature,
- int accessType, boolean accessDenied);
+ public void hiddenApiUsed(int sampledValue, String appPackageName,
+ String signature, int accessType, boolean accessDenied);
}
static HiddenApiUsageLogger hiddenApiUsageLogger;
@@ -115,14 +117,14 @@ public final class VMRuntime {
/**
* Records an attempted hidden API access to
- * {@link HiddenApiUsageLogger#hiddenApiUsed(String, String, int, boolean}
+ * {@link HiddenApiUsageLogger#hiddenApiUsed(int, String, String, int, boolean}
* if a logger is registered via {@link #setHiddenApiUsageLogger}.
*/
- private static void hiddenApiUsed(String appPackageName, String signature,
+ private static void hiddenApiUsed(int sampledValue, String appPackageName, String signature,
int accessType, boolean accessDenied) {
if (VMRuntime.hiddenApiUsageLogger != null) {
- VMRuntime.hiddenApiUsageLogger.hiddenApiUsed(appPackageName, signature,
- accessType, accessDenied);
+ VMRuntime.hiddenApiUsageLogger.hiddenApiUsed(sampledValue, appPackageName,
+ signature, accessType, accessDenied);
}
}
diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt
index 598708a0a6..6b92dd93cb 100644
--- a/mmodules/core_platform_api/api/platform/current-api.txt
+++ b/mmodules/core_platform_api/api/platform/current-api.txt
@@ -785,7 +785,7 @@ package dalvik.system {
}
public static interface VMRuntime.HiddenApiUsageLogger {
- method public void hiddenApiUsed(String, String, int, boolean);
+ method public void hiddenApiUsed(int, String, String, int, boolean);
field public static final int ACCESS_METHOD_JNI = 2; // 0x2
field public static final int ACCESS_METHOD_LINKING = 3; // 0x3
field public static final int ACCESS_METHOD_NONE = 0; // 0x0