summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Kershaw <alexkershaw@google.com> 2020-05-15 18:12:11 +0100
committer Alex Kershaw <alexkershaw@google.com> 2020-05-16 15:47:31 +0100
commite9f930329cd71c8b9b1ae8e65399387ec84c8b8b (patch)
tree020a67e0f943d83804a189161b7c7eafd02ac057
parentca093e4abd49adc0cf06a94f7b38bf30b1f05b4c (diff)
Make DocsUI only log to device policy logger on R+
Make DocsUI's version of DevicePolicyEventLogger#write a no-op pre-R. Fixes: 150904641 Test: atest DocumentsUIGoogleTests:com.android.documentsui.dirlist.MessageTest Change-Id: If790247e54a070dcbd09908ecb4a6228d0bdfafe
-rw-r--r--src/com/android/documentsui/Metrics.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/documentsui/Metrics.java b/src/com/android/documentsui/Metrics.java
index 90f2b6ff7..9221ec93b 100644
--- a/src/com/android/documentsui/Metrics.java
+++ b/src/com/android/documentsui/Metrics.java
@@ -45,6 +45,7 @@ import com.android.documentsui.picker.PickResult;
import com.android.documentsui.roots.ProvidersAccess;
import com.android.documentsui.services.FileOperationService;
import com.android.documentsui.services.FileOperationService.OpType;
+import com.android.documentsui.util.VersionUtils;
import java.io.FileNotFoundException;
import java.util.List;
@@ -637,11 +638,15 @@ public final class Metrics {
}
/**
- * The implementation is copied from StatsLogInternal for the DEVICE_POLICY_EVENT.
+ * The implementation is copied from StatsLogInternal for the DEVICE_POLICY_EVENT. This is a
+ * no-op pre-R.
*/
private static class DevicePolicyEventLogger {
public static void write(@DevicePolicyMetricConsts.EventId int eventId,
boolean booleanValue) {
+ if (!VersionUtils.isAtLeastR()) {
+ return;
+ }
final StatsEvent.Builder builder = StatsEvent.newBuilder();
builder.setAtomId(DevicePolicyMetricConsts.ATOM_DEVICE_POLICY_EVENT);
builder.writeInt(eventId); // eventId