Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f9b6a6c authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Update UIEventLogger

To log an instanceId with the EventId without
needing to provide package and uid.

Test: manually log and check unbuffered log with
  adb shell cmd stats print-logs && adb logcat -s statsd:I
Bug: 213483562
Change-Id: Idddf899c94a79e828acb80fe6da21a03468dcae2
parent 458af9aa
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -57,6 +57,14 @@ public interface UiEventLogger {
     */
    void log(@NonNull UiEventEnum event);

    /**
     * Log a simple event with an instance id, without package information.
     * Does nothing if event.getId() <= 0.
     * @param event an enum implementing UiEventEnum interface.
     * @param instance An identifier obtained from an InstanceIdSequence. If null, reduces to log().
     */
    void log(@NonNull UiEventEnum event, @Nullable InstanceId instance);

    /**
     * Log an event with package information. Does nothing if event.getId() <= 0.
     * Give both uid and packageName if both are known, but one may be omitted if unknown.
+8 −3
Original line number Diff line number Diff line
@@ -41,6 +41,11 @@ public class UiEventLoggerImpl implements UiEventLogger {
        }
    }

    @Override
    public void log(UiEventEnum event, InstanceId instanceId) {
        logWithInstanceId(event, 0, null, instanceId);
    }

    @Override
    public void logWithInstanceId(UiEventEnum event, int uid, String packageName,
            InstanceId instance) {
@@ -51,7 +56,7 @@ public class UiEventLoggerImpl implements UiEventLogger {
                    /* uid = 2 */ uid,
                    /* package_name = 3 */ packageName,
                    /* instance_id = 4 */ instance.getId());
        } else {
        } else if (eventID > 0) {
            log(event, uid, packageName);
        }
    }
@@ -78,7 +83,7 @@ public class UiEventLoggerImpl implements UiEventLogger {
                    /* package_name = 2 */ packageName,
                    /* instance_id = 3 */ instance.getId(),
                    /* position_picked = 4 */ position);
        } else {
        } else if ((eventID > 0)) {
            logWithPosition(event, uid, packageName, position);
        }
    }
+5 −0
Original line number Diff line number Diff line
@@ -87,6 +87,11 @@ public class UiEventLoggerFake implements UiEventLogger {
        log(event, 0, null);
    }

    @Override
    public void log(UiEventEnum event, InstanceId instance) {
        logWithInstanceId(event, 0, null, instance);
    }

    @Override
    public void log(UiEventEnum event, int uid, String packageName) {
        final int eventId = event.getId();