Fix how we build the statsd protos.

This lets us include frameworks protos, and use the constants
and messages from them.

Change-Id: I609d6e524f780e6a5beea543a68561bede47813e
Test: make
This commit is contained in:
Joe Onorato 2017-11-18 20:32:56 -08:00
parent 37e9278c77
commit 62c220b20b
20 changed files with 146 additions and 1246 deletions

View File

@ -677,35 +677,23 @@ cc_library {
"-Werror", "-Werror",
"-Wno-unused-parameter", "-Wno-unused-parameter",
], ],
srcs: [
"core/proto/**/*.proto",
"libs/incident/**/*.proto",
"tools/streaming_proto/stream.proto",
],
target: { target: {
host: { host: {
proto: { proto: {
type: "full", type: "full",
}, },
srcs: [
"core/proto/**/*.proto",
"libs/incident/**/*.proto",
"tools/streaming_proto/stream.proto",
],
}, },
android: { android: {
proto: { proto: {
type: "lite", type: "lite",
}, },
// We only build the protos that are optimized for the lite
// runtime, as well as the only protos that are actually
// needed by the device.
srcs: [
"core/proto/android/os/cpufreq.proto",
"core/proto/android/os/cpuinfo.proto",
"core/proto/android/os/kernelwake.proto",
"core/proto/android/os/pagetypeinfo.proto",
"core/proto/android/os/procrank.proto",
"core/proto/android/os/system_properties.proto",
"core/proto/android/service/graphicsstats.proto",
"libs/incident/proto/android/privacy.proto",
"tools/streaming_proto/stream.proto",
],
shared: { shared: {
enabled: false, enabled: false,
}, },

View File

@ -1008,7 +1008,7 @@ include $(BUILD_HOST_JAVA_LIBRARY)
# ==== java proto device library (for test only) ============================== # ==== java proto device library (for test only) ==============================
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := platformprotosnano LOCAL_MODULE := platformprotosnano
LOCAL_MODULE_TAGS := tests optional LOCAL_MODULE_TAGS := tests
LOCAL_PROTOC_OPTIMIZE_TYPE := nano LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTOC_FLAGS := \ LOCAL_PROTOC_FLAGS := \
-Iexternal/protobuf/src -Iexternal/protobuf/src
@ -1020,6 +1020,17 @@ LOCAL_SRC_FILES := \
include $(BUILD_STATIC_JAVA_LIBRARY) include $(BUILD_STATIC_JAVA_LIBRARY)
# ==== java proto device library (for test only) ==============================
include $(CLEAR_VARS)
LOCAL_MODULE := platformprotoslite
LOCAL_MODULE_TAGS := tests
LOCAL_PROTOC_OPTIMIZE_TYPE := lite
LOCAL_PROTOC_FLAGS := \
-Iexternal/protobuf/src
LOCAL_SRC_FILES := \
$(call all-proto-files-under, core/proto)
include $(BUILD_STATIC_JAVA_LIBRARY)
# Include subdirectory makefiles # Include subdirectory makefiles
# ============================================================ # ============================================================

View File

@ -50,12 +50,15 @@ cc_test {
"testdata/*", "testdata/*",
], ],
shared_libs: [
"libprotobuf-cpp-full",
],
static_libs: [ static_libs: [
"libgmock", "libgmock",
"libplatformprotos" "libplatformprotos"
], ],
shared_libs: [
"libprotobuf-cpp-full"
],
proto: {
type: "full",
},
} }

View File

@ -21,7 +21,7 @@
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/test_utils.h> #include <android-base/test_utils.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <google/protobuf/message.h> #include <google/protobuf/message_lite.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
@ -42,13 +42,6 @@ public:
ASSERT_TRUE(tf.fd != -1); ASSERT_TRUE(tf.fd != -1);
} }
string getSerializedString(::google::protobuf::Message& message) {
string expectedStr;
message.SerializeToFileDescriptor(tf.fd);
ReadFileToString(tf.path, &expectedStr);
return expectedStr;
}
protected: protected:
TemporaryFile tf; TemporaryFile tf;
@ -125,6 +118,6 @@ TEST_F(CpuFreqParserTest, Success) {
CaptureStdout(); CaptureStdout();
ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO)); ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected)); EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
close(fd); close(fd);
} }

View File

@ -21,7 +21,7 @@
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/test_utils.h> #include <android-base/test_utils.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <google/protobuf/message.h> #include <google/protobuf/message_lite.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
@ -42,13 +42,6 @@ public:
ASSERT_TRUE(tf.fd != -1); ASSERT_TRUE(tf.fd != -1);
} }
string getSerializedString(::google::protobuf::Message& message) {
string expectedStr;
message.SerializeToFileDescriptor(tf.fd);
ReadFileToString(tf.path, &expectedStr);
return expectedStr;
}
protected: protected:
TemporaryFile tf; TemporaryFile tf;
@ -153,6 +146,6 @@ TEST_F(CpuInfoParserTest, Success) {
CaptureStdout(); CaptureStdout();
ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO)); ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected)); EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
close(fd); close(fd);
} }

View File

@ -21,7 +21,7 @@
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/test_utils.h> #include <android-base/test_utils.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <google/protobuf/message.h> #include <google/protobuf/message_lite.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
@ -42,13 +42,6 @@ public:
ASSERT_TRUE(tf.fd != -1); ASSERT_TRUE(tf.fd != -1);
} }
string getSerializedString(::google::protobuf::Message& message) {
string expectedStr;
message.SerializeToFileDescriptor(tf.fd);
ReadFileToString(tf.path, &expectedStr);
return expectedStr;
}
protected: protected:
TemporaryFile tf; TemporaryFile tf;
@ -76,7 +69,7 @@ TEST_F(KernelWakesParserTest, Short) {
CaptureStdout(); CaptureStdout();
ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO)); ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected)); EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
close(fd); close(fd);
} }
@ -114,6 +107,6 @@ TEST_F(KernelWakesParserTest, Normal) {
CaptureStdout(); CaptureStdout();
ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO)); ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected)); EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
close(fd); close(fd);
} }

View File

@ -21,7 +21,7 @@
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/test_utils.h> #include <android-base/test_utils.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <google/protobuf/message.h> #include <google/protobuf/message_lite.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
@ -42,13 +42,6 @@ public:
ASSERT_TRUE(tf.fd != -1); ASSERT_TRUE(tf.fd != -1);
} }
string getSerializedString(::google::protobuf::Message& message) {
string expectedStr;
message.SerializeToFileDescriptor(tf.fd);
ReadFileToString(tf.path, &expectedStr);
return expectedStr;
}
protected: protected:
TemporaryFile tf; TemporaryFile tf;
@ -108,6 +101,6 @@ TEST_F(PageTypeInfoParserTest, Success) {
CaptureStdout(); CaptureStdout();
ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO)); ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected)); EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
close(fd); close(fd);
} }

View File

@ -21,7 +21,7 @@
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/test_utils.h> #include <android-base/test_utils.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <google/protobuf/message.h> #include <google/protobuf/message_lite.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
@ -42,13 +42,6 @@ public:
ASSERT_TRUE(tf.fd != -1); ASSERT_TRUE(tf.fd != -1);
} }
string getSerializedString(::google::protobuf::Message& message) {
string expectedStr;
message.SerializeToFileDescriptor(tf.fd);
ReadFileToString(tf.path, &expectedStr);
return expectedStr;
}
protected: protected:
TemporaryFile tf; TemporaryFile tf;
@ -104,7 +97,7 @@ TEST_F(ProcrankParserTest, HasSwapInfo) {
CaptureStdout(); CaptureStdout();
ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO)); ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected)); EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
close(fd); close(fd);
} }
@ -142,6 +135,6 @@ TEST_F(ProcrankParserTest, NoSwapInfo) {
CaptureStdout(); CaptureStdout();
ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO)); ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected)); EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
close(fd); close(fd);
} }

View File

@ -21,7 +21,7 @@
#include <android-base/file.h> #include <android-base/file.h>
#include <android-base/test_utils.h> #include <android-base/test_utils.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <google/protobuf/message.h> #include <google/protobuf/message_lite.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
@ -42,13 +42,6 @@ public:
ASSERT_TRUE(tf.fd != -1); ASSERT_TRUE(tf.fd != -1);
} }
string getSerializedString(::google::protobuf::Message& message) {
string expectedStr;
message.SerializeToFileDescriptor(tf.fd);
ReadFileToString(tf.path, &expectedStr);
return expectedStr;
}
protected: protected:
TemporaryFile tf; TemporaryFile tf;
@ -99,6 +92,6 @@ TEST_F(SystemPropertiesParserTest, HasSwapInfo) {
CaptureStdout(); CaptureStdout();
ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO)); ASSERT_EQ(NO_ERROR, parser.Parse(fd, STDOUT_FILENO));
EXPECT_EQ(GetCapturedStdout(), getSerializedString(expected)); EXPECT_EQ(GetCapturedStdout(), expected.SerializeAsString());
close(fd); close(fd);
} }

View File

@ -31,5 +31,11 @@ cc_library_host_shared {
type: "full", type: "full",
export_proto_headers: true, export_proto_headers: true,
}, },
export_shared_lib_headers: [
"libplatformprotos",
]
} }

View File

@ -19,7 +19,7 @@ statsd_common_src := \
../../core/java/android/os/IStatsManager.aidl \ ../../core/java/android/os/IStatsManager.aidl \
src/stats_log.proto \ src/stats_log.proto \
src/statsd_config.proto \ src/statsd_config.proto \
src/atoms_copy.proto \ src/atoms.proto \
src/anomaly/AnomalyMonitor.cpp \ src/anomaly/AnomalyMonitor.cpp \
src/anomaly/AnomalyTracker.cpp \ src/anomaly/AnomalyTracker.cpp \
src/condition/CombinationConditionTracker.cpp \ src/condition/CombinationConditionTracker.cpp \
@ -67,6 +67,9 @@ statsd_common_c_includes := \
statsd_common_aidl_includes := \ statsd_common_aidl_includes := \
$(LOCAL_PATH)/../../core/java $(LOCAL_PATH)/../../core/java
statsd_common_static_libraries := \
libplatformprotos
statsd_common_shared_libraries := \ statsd_common_shared_libraries := \
libbase \ libbase \
libbinder \ libbinder \
@ -121,6 +124,8 @@ LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes) LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
LOCAL_C_INCLUDES += $(statsd_common_c_includes) LOCAL_C_INCLUDES += $(statsd_common_c_includes)
LOCAL_STATIC_LIBRARIES := $(statsd_common_static_libraries)
LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \ LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) \
libgtest_prod libgtest_prod
@ -174,17 +179,22 @@ LOCAL_SRC_FILES := \
tests/guardrail/StatsdStats_test.cpp tests/guardrail/StatsdStats_test.cpp
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
$(statsd_common_static_libraries) \
libgmock libgmock
LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries) LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries)
LOCAL_PROTOC_OPTIMIZE_TYPE := lite LOCAL_PROTOC_OPTIMIZE_TYPE := lite
include $(BUILD_NATIVE_TEST)
statsd_common_src:= statsd_common_src:=
statsd_common_aidl_includes:= statsd_common_aidl_includes:=
statsd_common_c_includes:= statsd_common_c_includes:=
statsd_common_static_libraries:=
statsd_common_shared_libraries:=
include $(BUILD_NATIVE_TEST)
############################## ##############################

View File

@ -21,6 +21,8 @@ package android.os.statsd;
option java_package = "com.android.os"; option java_package = "com.android.os";
option java_outer_classname = "AtomsProto"; option java_outer_classname = "AtomsProto";
import "frameworks/base/core/proto/android/app/activitymanager.proto";
/** /**
* The master atom class. This message defines all of the available * The master atom class. This message defines all of the available
* raw stats log events from the Android system, also known as "atoms." * raw stats log events from the Android system, also known as "atoms."
@ -168,7 +170,7 @@ message UidProcessStateChanged {
// The state. // The state.
// TODO: Use the real (mapped) process states. // TODO: Use the real (mapped) process states.
optional int32 state = 2; optional android.app.ProcessState state = 2;
} }
/** /**
@ -1072,4 +1074,4 @@ message ModemActivityInfoPulled {
optional uint64 controller_rx_time_ms = 9; optional uint64 controller_rx_time_ms = 9;
// product of current(mA), voltage(V) and time(ms) // product of current(mA), voltage(V) and time(ms)
optional uint64 energy_used = 10; optional uint64 energy_used = 10;
} }

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ package android.os.statsd;
option java_package = "com.android.os"; option java_package = "com.android.os";
option java_outer_classname = "StatsLog"; option java_outer_classname = "StatsLog";
import "frameworks/base/cmds/statsd/src/atoms_copy.proto"; import "frameworks/base/cmds/statsd/src/atoms.proto";
message KeyValuePair { message KeyValuePair {
optional int32 key = 1; optional int32 key = 1;

View File

@ -16,19 +16,19 @@
LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += ../../src/stats_log.proto \
../../src/atoms_copy.proto
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/../../src/
LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := StatsdDogfood LOCAL_PACKAGE_NAME := StatsdDogfood
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += ../../src/stats_log.proto \
../../src/atoms.proto
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/../../src/
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_STATIC_JAVA_LIBRARIES := platformprotoslite
LOCAL_PROTOC_OPTIMIZE_TYPE := lite
LOCAL_CERTIFICATE := platform LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true LOCAL_PRIVILEGED_MODULE := true
LOCAL_DEX_PREOPT := false LOCAL_DEX_PREOPT := false
include $(BUILD_PACKAGE) LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)

View File

@ -16,20 +16,20 @@
LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += ../../src/stats_log.proto \
../../src/atoms_copy.proto \
../../src/statsd_config.proto
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/../../src/
LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := StatsdLoadtest LOCAL_PACKAGE_NAME := StatsdLoadtest
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += ../../src/stats_log.proto \
../../src/atoms.proto \
../../src/statsd_config.proto
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/../../src/
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_STATIC_JAVA_LIBRARIES := platformprotoslite
LOCAL_PROTOC_OPTIMIZE_TYPE := lite
LOCAL_CERTIFICATE := platform LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true LOCAL_PRIVILEGED_MODULE := true
LOCAL_DEX_PREOPT := false LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE) include $(BUILD_PACKAGE)

View File

@ -533,10 +533,10 @@ public class ActivityManager {
// to frameworks/base/core/proto/android/app/activitymanager.proto and the following method must // to frameworks/base/core/proto/android/app/activitymanager.proto and the following method must
// be updated to correctly map between them. // be updated to correctly map between them.
/** /**
* Maps ActivityManager.PROCESS_STATE_ values to ActivityManagerProto.ProcessState enum. * Maps ActivityManager.PROCESS_STATE_ values to ProcessState enum.
* *
* @param amInt a process state of the form ActivityManager.PROCESS_STATE_ * @param amInt a process state of the form ActivityManager.PROCESS_STATE_
* @return the value of the corresponding android.app.ActivityManagerProto's ProcessState enum. * @return the value of the corresponding ActivityManager's ProcessState enum.
* @hide * @hide
*/ */
public static final int processStateAmToProto(int amInt) { public static final int processStateAmToProto(int amInt) {

View File

@ -20,61 +20,59 @@ package android.app;
option java_multiple_files = true; option java_multiple_files = true;
message ActivityManagerProto { // ActivityManager.java PROCESS_STATEs
enum ProcessState {
// Order matters for process states, so values have been spaced to provide
// room for future additions.
// ActivityManager.java PROCESS_STATEs // Not a real process state.
enum ProcessState { PROCESS_STATE_UNKNOWN = -100;
// Order matters for process states, so values have been spaced to provide // Process is a persistent system process.
// room for future additions. PROCESS_STATE_PERSISTENT = 0;
// Process is a persistent system process and is doing UI.
// Not a real process state. PROCESS_STATE_PERSISTENT_UI = 100;
PROCESS_STATE_UNKNOWN = -100; // Process is hosting the current top activities. Note that this covers
// Process is a persistent system process. // all activities that are visible to the user.
PROCESS_STATE_PERSISTENT = 0; PROCESS_STATE_TOP = 200;
// Process is a persistent system process and is doing UI. // Process is hosting a foreground service due to a system binding.
PROCESS_STATE_PERSISTENT_UI = 100; PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 300;
// Process is hosting the current top activities. Note that this covers // Process is hosting a foreground service.
// all activities that are visible to the user. PROCESS_STATE_FOREGROUND_SERVICE = 400;
PROCESS_STATE_TOP = 200; // Same as PROCESS_STATE_TOP but while device is sleeping.
// Process is hosting a foreground service due to a system binding. PROCESS_STATE_TOP_SLEEPING = 500;
PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 300; // Process is important to the user, and something they are aware of.
// Process is hosting a foreground service. PROCESS_STATE_IMPORTANT_FOREGROUND = 600;
PROCESS_STATE_FOREGROUND_SERVICE = 400; // Process is important to the user, but not something they are aware of.
// Same as PROCESS_STATE_TOP but while device is sleeping. PROCESS_STATE_IMPORTANT_BACKGROUND = 700;
PROCESS_STATE_TOP_SLEEPING = 500; // Process is in the background transient so we will try to keep running.
// Process is important to the user, and something they are aware of. PROCESS_STATE_TRANSIENT_BACKGROUND = 800;
PROCESS_STATE_IMPORTANT_FOREGROUND = 600; // Process is in the background running a backup/restore operation.
// Process is important to the user, but not something they are aware of. PROCESS_STATE_BACKUP = 900;
PROCESS_STATE_IMPORTANT_BACKGROUND = 700; // Process is in the background, but it can't restore its state so we want
// Process is in the background transient so we will try to keep running. // to try to avoid killing it.
PROCESS_STATE_TRANSIENT_BACKGROUND = 800; PROCESS_STATE_HEAVY_WEIGHT = 1000;
// Process is in the background running a backup/restore operation. // Process is in the background running a service. Unlike oom_adj, this
PROCESS_STATE_BACKUP = 900; // level is used for both the normal running in background state and the
// Process is in the background, but it can't restore its state so we want // executing operations state.
// to try to avoid killing it. PROCESS_STATE_SERVICE = 1100;
PROCESS_STATE_HEAVY_WEIGHT = 1000; // Process is in the background running a receiver. Note that from the
// Process is in the background running a service. Unlike oom_adj, this // perspective of oom_adj, receivers run at a higher foreground level, but
// level is used for both the normal running in background state and the // for our prioritization here that is not necessary and putting them
// executing operations state. // below services means many fewer changes in some process states as they
PROCESS_STATE_SERVICE = 1100; // receive broadcasts.
// Process is in the background running a receiver. Note that from the PROCESS_STATE_RECEIVER = 1200;
// perspective of oom_adj, receivers run at a higher foreground level, but // Process is in the background but hosts the home activity.
// for our prioritization here that is not necessary and putting them PROCESS_STATE_HOME = 1300;
// below services means many fewer changes in some process states as they // Process is in the background but hosts the last shown activity.
// receive broadcasts. PROCESS_STATE_LAST_ACTIVITY = 1400;
PROCESS_STATE_RECEIVER = 1200; // Process is being cached for later use and contains activities.
// Process is in the background but hosts the home activity. PROCESS_STATE_CACHED_ACTIVITY = 1500;
PROCESS_STATE_HOME = 1300; // Process is being cached for later use and is a client of another cached
// Process is in the background but hosts the last shown activity. // process that contains activities.
PROCESS_STATE_LAST_ACTIVITY = 1400; PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 1600;
// Process is being cached for later use and contains activities. // Process is being cached for later use and is empty.
PROCESS_STATE_CACHED_ACTIVITY = 1500; PROCESS_STATE_CACHED_EMPTY = 1700;
// Process is being cached for later use and is a client of another cached // Process does not exist.
// process that contains activities. PROCESS_STATE_NONEXISTENT = 1800;
PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 1600;
// Process is being cached for later use and is empty.
PROCESS_STATE_CACHED_EMPTY = 1700;
// Process does not exist.
PROCESS_STATE_NONEXISTENT = 1800;
}
} }

View File

@ -57,7 +57,7 @@ message PowerManagerServiceDumpProto {
optional bool is_active = 3; optional bool is_active = 3;
optional int32 num_wake_locks = 4; optional int32 num_wake_locks = 4;
optional bool is_process_state_unknown = 5; optional bool is_process_state_unknown = 5;
optional .android.app.ActivityManagerProto.ProcessState process_state = 6; optional .android.app.ProcessState process_state = 6;
} }
optional ConstantsProto constants = 1; optional ConstantsProto constants = 1;

View File

@ -36,6 +36,7 @@ LOCAL_SRC_FILES := \
src/IncidentReportArgs.cpp src/IncidentReportArgs.cpp
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_PROTO_OPTIMIZE_TYPE := lite
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)