summaryrefslogtreecommitdiff
path: root/chromium/components/arc/common/process.mojom
blob: 20c982fbca7e31b19ccafba841e410bb714251d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Next MinVersion: 6

module arc.mojom;

// Describes the current process state, as defined by AOSP in
// android.app.ActivityManager.
enum ProcessState {
  // Process does not exist.
  NONEXISTENT = -1,

  // Process is a persistent system process.
  PERSISTENT = 0,

  // Process is a persistent system process and is doing UI.
  PERSISTENT_UI = 1,

  // Process is hosting the current top activities.  Note that this covers
  // all activities that are visible to the user.
  TOP = 2,

  // Process is hosting a foreground service due to a system binding.
  BOUND_FOREGROUND_SERVICE = 3,

  // Process is hosting a foreground service.
  FOREGROUND_SERVICE = 4,

  // Same as PROCESS_STATE_TOP but while device is sleeping.
  TOP_SLEEPING = 5,

  // Process is important to the user, and something they are aware of.
  IMPORTANT_FOREGROUND = 6,

  // Process is important to the user, but not something they are aware of.
  IMPORTANT_BACKGROUND = 7,

  // Process is in the background running a backup/restore operation.
  BACKUP = 8,

  // Process is in the background, but it can't restore its state so we want
  // to try to avoid killing it.
  HEAVY_WEIGHT = 9,

  // Process is in the background running a service.  Unlike oom_adj, this level
  // is used for both the normal running in background state and the executing
  // operations state.
  SERVICE = 10,

  // Process is in the background running a receiver.   Note that from the
  // perspective of oom_adj receivers run at a higher foreground level, but for
  // our prioritization here that is not necessary and putting them below
  // services means many fewer changes in some process states as they receive
  // broadcasts.
  RECEIVER = 11,

  // Process is in the background but hosts the home activity.
  HOME = 12,

  // Process is in the background but hosts the last shown activity.
  LAST_ACTIVITY = 13,

  // Process is being cached for later use and contains activities.
  CACHED_ACTIVITY = 14,

  // Process is being cached for later use and is a client of another cached
  // process that contains activities.
  CACHED_ACTIVITY_CLIENT = 15,

  // Process is being cached for later use and is empty.
  CACHED_EMPTY = 16,
};

// Describes a running ARC process.
// This struct is a subset of android.app.ActivityManager.RunningAppProcessInfo.
struct RunningAppProcessInfo {
  // Name of the process.
  string process_name;

  // PID (within ARC's PID namespace) of the process.
  uint32 pid;

  // Current process state.
  ProcessState process_state;

  // Package names running in the process.
  [MinVersion=4] array<string>? packages;

  // Whether this app is focused in ARC++ multi-window environment.
  [MinVersion=5] bool is_focused;

  // Last time the process was active. Milliseconds since boot.
  // The clock is monotonic (comes from Android System.uptimeMillis()).
  [MinVersion=5] int64 last_activity_time;
};

interface ProcessInstance {
  // Requests ARC instance to return the current process list.
  RequestProcessList@0() => (array<RunningAppProcessInfo> processes);

  // Requests ARC instance to kill a process.
  [MinVersion=1]
  KillProcess@1(uint32 pid, string reason);

  // Sets oom_score_adj of a process.
  [MinVersion=2]
  DeprecatedSetOomScoreAdj@2(uint32 pid, int32 score);

  // Disables Android built-in oom_adj adjustment.
  [MinVersion=2]
  DeprecatedDisableBuiltinOomAdjustment@3();

  // Disables Android lowmemorykiller.
  [MinVersion=3]
  DeprecatedDisableLowMemoryKiller@4();
};