summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/logging/EventLogArray.java
diff options
context:
space:
mode:
authorLuca Stefani <luca.stefani.ge1@gmail.com>2020-03-07 13:43:59 +0100
committerLuca Stefani <luca.stefani.ge1@gmail.com>2020-03-07 13:43:59 +0100
commit0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0 (patch)
tree2bc4acf2f54df560a34dcc7b7844d9d18cc58131 /src/com/android/launcher3/logging/EventLogArray.java
parent744d192669a148bde24d36bef02deb05c2f7a1fa (diff)
parent02826bbe04d9dc1e6111f5d6ffd8706ac1f8f908 (diff)
downloadandroid_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.gz
android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.bz2
android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.zip
Merge tag 'android-10.0.0_r31' into HEAD
Android 10.0.0 release 31 * tag 'android-10.0.0_r31': (218 commits) Increase drag distance threshold when drag starts from deep press Fix shortcut componentname in workspace layout logging Fix shortcut componentname in workspace layout logging perform accessbility focus when the recyclerview doesn't gain focus after fragment replacement in SettingsActivity Persist predicted items when dragged to workspace Import translations. DO NOT MERGE Import translations. DO NOT MERGE Align badging logic with platform IconDrawableFactory. Fix bug where icon remains invisible after returning home. Fix quick switch from home biased towards returning home Fix recents scale sometimes lagging behind window scale Fix folder open/close animation when grid size is small. fix custom shortcut test Improve quick switch from home by tracking both x and y motion Move shelf peeking anim code to ShelfPeekAnim class Fix folder available height calculation Tapl: AllApps: ensuring a minimal vertical size of an icon Enable a11y scrolling with item drag disable custom shortcut test in oop include predicted_rank in app launch logging ... Change-Id: Id824c350cd133c4c8fa91de0f8793faed9003393
Diffstat (limited to 'src/com/android/launcher3/logging/EventLogArray.java')
-rw-r--r--src/com/android/launcher3/logging/EventLogArray.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/com/android/launcher3/logging/EventLogArray.java b/src/com/android/launcher3/logging/EventLogArray.java
index f20f3659e..3ecfb23c2 100644
--- a/src/com/android/launcher3/logging/EventLogArray.java
+++ b/src/com/android/launcher3/logging/EventLogArray.java
@@ -16,11 +16,13 @@
package com.android.launcher3.logging;
+import android.util.Log;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
+import java.util.Random;
/**
* A utility class to record and log events. Events are stored in a fixed size array and old logs
@@ -37,6 +39,7 @@ public class EventLogArray {
private final String name;
private final EventEntry[] logs;
private int nextIndex;
+ private int mLogId;
public EventLogArray(String name, int size) {
this.name = name;
@@ -52,10 +55,6 @@ public class EventLogArray {
addLog(TYPE_INTEGER, event, extras);
}
- public void addLog(String event, float extras) {
- addLog(TYPE_FLOAT, event, extras);
- }
-
public void addLog(String event, boolean extras) {
addLog(extras ? TYPE_BOOL_TRUE : TYPE_BOOL_FALSE, event, 0);
}
@@ -65,7 +64,7 @@ public class EventLogArray {
int last = (nextIndex + logs.length - 1) % logs.length;
int secondLast = (nextIndex + logs.length - 2) % logs.length;
if (isEntrySame(logs[last], type, event) && isEntrySame(logs[secondLast], type, event)) {
- logs[last].update(type, event, extras);
+ logs[last].update(type, event, extras, mLogId);
logs[secondLast].duplicateCount++;
return;
}
@@ -73,7 +72,7 @@ public class EventLogArray {
if (logs[nextIndex] == null) {
logs[nextIndex] = new EventEntry();
}
- logs[nextIndex].update(type, event, extras);
+ logs[nextIndex].update(type, event, extras, mLogId);
nextIndex = (nextIndex + 1) % logs.length;
}
@@ -113,10 +112,18 @@ public class EventLogArray {
if (log.duplicateCount > 0) {
msg.append(" & ").append(log.duplicateCount).append(" similar events");
}
+ msg.append(" traceId: ").append(log.traceId);
writer.println(msg);
}
}
+ /** Returns a 3 digit random number between 100-999 */
+ public int generateAndSetLogId() {
+ Random r = new Random();
+ mLogId = r.nextInt(900) + 100;
+ return mLogId;
+ }
+
private boolean isEntrySame(EventEntry entry, int type, String event) {
return entry != null && entry.type == type && entry.event.equals(event);
}
@@ -129,11 +136,13 @@ public class EventLogArray {
private float extras;
private long time;
private int duplicateCount;
+ private int traceId;
- public void update(int type, String event, float extras) {
+ public void update(int type, String event, float extras, int traceId) {
this.type = type;
this.event = event;
this.extras = extras;
+ this.traceId = traceId;
time = System.currentTimeMillis();
duplicateCount = 0;
}