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

Commit 497aff40 authored by Marco Ballesio's avatar Marco Ballesio
Browse files

App freezer stat logs

Bug: 143308662
Test: westworld tests on local device (go/westworld-local-development)
Change-Id: I0f3f966b6057a3465a1e686f93caf28cd7247b2c
parent 4b41675b
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -391,6 +391,7 @@ message Atom {
        WifiHealthStatReported wifi_health_stat_reported = 251 [(module) = "wifi"];
        WifiFailureStatReported wifi_failure_stat_reported = 252 [(module) = "wifi"];
        WifiConnectionResultReported wifi_connection_result_reported = 253 [(module) = "wifi"];
        AppFreezeChanged app_freeze_changed = 254 [(module) = "framework"];
        SdkExtensionStatus sdk_extension_status = 354;
    }

@@ -8366,3 +8367,28 @@ message SdkExtensionStatus {
    // "Failed" here can mean a symbol that wasn't meant to be visible was, or the other way around.
    optional int32 failed_call_symbol = 3;
}

/**
 * Logs when an app is frozen or unfrozen.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/am/CachedAppOptimizer.java
 */
message AppFreezeChanged {
  // The type of event.
  enum Action {
    UNKNOWN = 0;
    FREEZE_APP = 1;
    UNFREEZE_APP = 2;
  }
  optional Action action = 1;

  // Pid of the process being frozen.
  optional int32 pid = 2;

  // Name of the process being frozen.
  optional string process_name = 3;

  // Time since last unfrozen.
  optional int64 time_unfrozen_millis = 4;
}
+19 −0
Original line number Diff line number Diff line
@@ -946,6 +946,15 @@ public final class CachedAppOptimizer {
                }

                EventLog.writeEvent(EventLogTags.AM_FREEZE, pid, name);

                // See above for why we're not taking mPhenotypeFlagLock here
                if (mRandom.nextFloat() < mFreezerStatsdSampleRate) {
                    FrameworkStatsLog.write(FrameworkStatsLog.APP_FREEZE_CHANGED,
                            FrameworkStatsLog.APP_FREEZE_CHANGED__ACTION__FREEZE_APP,
                            pid,
                            name,
                            unfrozenDuration);
                }
            }
        }

@@ -994,6 +1003,16 @@ public final class CachedAppOptimizer {
                }

                EventLog.writeEvent(EventLogTags.AM_UNFREEZE, pid, name);

                // See above for why we're not taking mPhenotypeFlagLock here
                if (mRandom.nextFloat() < mFreezerStatsdSampleRate) {
                    FrameworkStatsLog.write(
                            FrameworkStatsLog.APP_FREEZE_CHANGED,
                            FrameworkStatsLog.APP_FREEZE_CHANGED__ACTION__UNFREEZE_APP,
                            pid,
                            name,
                            frozenDuration);
                }
            }
        }
    }