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

Commit a060aee4 authored by Alex Salo's avatar Alex Salo
Browse files

Add AttentionManagerService result logging into WW

Bug: 122960476
Test: tested locally on device using statsd_testdrive
Change-Id: I3f77e7c55cd6999d135896b5101fefb60560424a
parent 1655f989
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@ message Atom {
        SeStateChanged se_state_changed = 140;
        SeOmapiReported se_omapi_reported = 141;
        BroadcastDispatchLatencyReported broadcast_dispatch_latency_reported = 142;
        AttentionManagerServiceResultReported attention_manager_service_result_reported = 143;
    }

    // Pulled events will start at field 10000.
@@ -4469,11 +4470,30 @@ message SeOmapiReported {
}

/**
  * Logs the dispatch latencey of a broadcast during processing of BOOT_COMPLETED.
  * The dispatch latencey is the dispatchClockTime - enqueueClockTime.
  * Logs the dispatch latency of a broadcast during processing of BOOT_COMPLETED.
  * The dispatch latency is the dispatchClockTime - enqueueClockTime.
  * Logged from:
  *   frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
  */
message BroadcastDispatchLatencyReported {
    optional int64 dispatch_latency_millis = 1;
}

/**
   * Logs AttentionManagerService attention check result.
   *
   * Logged from:
   *   frameworks/base/services/core/java/com/android/server/attention/AttentionManagerService.java
   */
message AttentionManagerServiceResultReported {
    // See core/java/android/service/attention/AttentionService.java
    enum AttentionCheckResult {
        UNKNOWN = 20;
        ATTENTION_SUCCESS_ABSENT = 0;
        ATTENTION_SUCCESS_PRESENT = 1;
        ATTENTION_FAILURE_PREEMPTED = 2;
        ATTENTION_FAILURE_TIMED_OUT = 3;
        ATTENTION_FAILURE_UNKNOWN = 4;
    }
    optional AttentionCheckResult attention_check_result = 1 [default = UNKNOWN];
}
+6 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.service.attention.IAttentionService;
import android.text.TextUtils;
import android.util.Slog;
import android.util.SparseArray;
import android.util.StatsLog;

import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
@@ -176,11 +177,16 @@ public class AttentionManagerService extends SystemService {
                            userState.mAttentionCheckCache = new AttentionCheckCache(
                                    SystemClock.uptimeMillis(), result,
                                    timestamp);

                            StatsLog.write(StatsLog.ATTENTION_MANAGER_SERVICE_RESULT_REPORTED,
                                    result);
                        }

                        @Override
                        public void onFailure(int requestCode, int error) {
                            callback.onFailure(requestCode, error);
                            StatsLog.write(StatsLog.ATTENTION_MANAGER_SERVICE_RESULT_REPORTED,
                                    error);
                        }

                        @Override