AdbMemoryInfo.fromJsonInKB constructor

AdbMemoryInfo.fromJsonInKB(
  1. Map<String, dynamic> json
)

Use when converting data received from the service extension, directly from ADB. All data received from ADB dumpsys meminfo is in kilobytes must adjust to total bytes for AdbMemoryInfo data.

Implementation

factory AdbMemoryInfo.fromJsonInKB(
  Map<String, dynamic> json,
) {
  final int realTime = json[realTimeKey];
  int javaHeap = json[javaHeapKey];
  int nativeHeap = json[nativeHeapKey];
  int code = json[codeKey];
  int stack = json[stackKey];
  int graphics = json[graphicsKey];
  int other = json[otherKey];
  int system = json[systemKey];
  int total = json[totalKey];

  // Convert to total bytes.
  javaHeap *= 1024;
  nativeHeap *= 1024;
  code *= 1024;
  stack *= 1024;
  graphics *= 1024;
  other *= 1024;
  system *= 1024;
  total *= 1024;

  return AdbMemoryInfo(
    realTime,
    javaHeap,
    nativeHeap,
    code,
    stack,
    graphics,
    other,
    system,
    total,
  );
}