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

Commit a20743b9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make state atom field annotation name consistent between google3 and android."

parents 24222202 b6b77c6f
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@ enum StateField {
// exclusive state field, and any number of primary key fields.
// For example,
// message UidProcessStateChanged {
//    optional int32 uid = 1 [(stateFieldOption).option = PRIMARY];
//    optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
//    optional int32 uid = 1 [(state_field_option).option = PRIMARY];
//    optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
//  }
// Each of this UidProcessStateChanged atom represents a state change for a specific uid.
// A new state automatically overrides the previous state.
@@ -46,16 +46,16 @@ enum StateField {
// the primary key.
// For example:
// message ThreadStateChanged {
//    optional int32 pid = 1  [(stateFieldOption).option = PRIMARY];
//    optional int32 tid = 2  [(stateFieldOption).option = PRIMARY];
//    optional int32 state = 3 [(stateFieldOption).option = EXCLUSIVE];
//    optional int32 pid = 1  [(state_field_option).option = PRIMARY];
//    optional int32 tid = 2  [(state_field_option).option = PRIMARY];
//    optional int32 state = 3 [(state_field_option).option = EXCLUSIVE];
// }
//
// Sometimes, there is no primary key field, when the state is GLOBAL.
// For example,
//
// message ScreenStateChanged {
//    optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
//    optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
// }
//
// Only fields of primary types can be annotated. AttributionNode cannot be primary keys (and they
@@ -66,7 +66,7 @@ message StateAtomFieldOption {

extend google.protobuf.FieldOptions {
    // Flags to decorate an atom that presents a state change.
    optional StateAtomFieldOption stateFieldOption = 50000;
    optional StateAtomFieldOption state_field_option = 50000;

    // Flags to decorate the uid fields in an atom.
    optional bool is_uid = 50001 [default = false];
+6 −6
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ message ThermalThrottlingStateChanged {
 */
message ScreenStateChanged {
    // New screen state, from frameworks/base/core/proto/android/view/enums.proto.
    optional android.view.DisplayStateEnum state = 1 [(stateFieldOption).option = EXCLUSIVE];
    optional android.view.DisplayStateEnum state = 1 [(state_field_option).option = EXCLUSIVE];
}

/**
@@ -285,10 +285,10 @@ message ScreenStateChanged {
 *   frameworks/base/services/core/java/com/android/server/am/BatteryStatsService.java
 */
message UidProcessStateChanged {
    optional int32 uid = 1 [(stateFieldOption).option = PRIMARY, (is_uid) = true];
    optional int32 uid = 1 [(state_field_option).option = PRIMARY, (is_uid) = true];

    // The state, from frameworks/base/core/proto/android/app/enums.proto.
    optional android.app.ProcessStateEnum state = 2 [(stateFieldOption).option = EXCLUSIVE];
    optional android.app.ProcessStateEnum state = 2 [(state_field_option).option = EXCLUSIVE];
}

/**
@@ -320,7 +320,7 @@ message ActivityManagerSleepStateChanged {
        ASLEEP = 1;
        AWAKE = 2;
    }
    optional State state = 1 [(stateFieldOption).option = EXCLUSIVE];
    optional State state = 1 [(state_field_option).option = EXCLUSIVE];
}

/**
@@ -339,7 +339,7 @@ message MemoryFactorStateChanged {
        CRITICAL = 4;   // critical memory.

    }
    optional State factor = 1 [(stateFieldOption).option = EXCLUSIVE];
    optional State factor = 1 [(state_field_option).option = EXCLUSIVE];
}

/**
@@ -1940,7 +1940,7 @@ message LmkKillOccurred {
 */
message AppDied {
    // timestamp(elapsedRealtime) of record creation
    optional uint64 timestamp_millis = 1 [(stateFieldOption).option = EXCLUSIVE];
    optional uint64 timestamp_millis = 1 [(state_field_option).option = EXCLUSIVE];
}

/**
+2 −2
Original line number Diff line number Diff line
@@ -251,7 +251,7 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
    }
    atomDecl->fields.push_back(atField);

    if (field->options().GetExtension(os::statsd::stateFieldOption).option() ==
    if (field->options().GetExtension(os::statsd::state_field_option).option() ==
        os::statsd::StateField::PRIMARY) {
        if (javaType == JAVA_TYPE_UNKNOWN ||
            javaType == JAVA_TYPE_ATTRIBUTION_CHAIN ||
@@ -261,7 +261,7 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
        atomDecl->primaryFields.push_back(it->first);
    }

    if (field->options().GetExtension(os::statsd::stateFieldOption).option() ==
    if (field->options().GetExtension(os::statsd::state_field_option).option() ==
        os::statsd::StateField::EXCLUSIVE) {
        if (javaType == JAVA_TYPE_UNKNOWN ||
            javaType == JAVA_TYPE_ATTRIBUTION_CHAIN ||
+12 −12
Original line number Diff line number Diff line
@@ -127,33 +127,33 @@ message GoodStateAtoms {
// The atom has only primary field but no exclusive state field.
message BadStateAtom1 {
    optional int32 uid = 1
            [(android.os.statsd.stateFieldOption).option = PRIMARY];
            [(android.os.statsd.state_field_option).option = PRIMARY];
}

// Only primative types can be annotated.
message BadStateAtom2 {
    repeated android.os.statsd.AttributionNode attribution = 1
            [(android.os.statsd.stateFieldOption).option = PRIMARY];
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 state = 2
            [(android.os.statsd.stateFieldOption).option = EXCLUSIVE];
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

// Having 2 exclusive state field in the atom means the atom is badly designed.
// E.g., putting bluetooth state and wifi state in the same atom.
message BadStateAtom3 {
    optional int32 uid = 1
            [(android.os.statsd.stateFieldOption).option = PRIMARY];
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 state = 2
            [(android.os.statsd.stateFieldOption).option = EXCLUSIVE];
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
    optional int32 state2 = 3
            [(android.os.statsd.stateFieldOption).option = EXCLUSIVE];
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

message GoodStateAtom1 {
    optional int32 uid = 1
            [(android.os.statsd.stateFieldOption).option = PRIMARY];
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 state = 2
            [(android.os.statsd.stateFieldOption).option = EXCLUSIVE];
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

// Atoms can have exclusive state field, but no primary field. That means
@@ -161,16 +161,16 @@ message GoodStateAtom1 {
message GoodStateAtom2 {
    optional int32 uid = 1;
    optional int32 state = 2
            [(android.os.statsd.stateFieldOption).option = EXCLUSIVE];
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}

// We can have more than one primary fields. That means their combination is a
// primary key.
message GoodStateAtom3 {
    optional int32 uid = 1
            [(android.os.statsd.stateFieldOption).option = PRIMARY];
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 tid = 2
            [(android.os.statsd.stateFieldOption).option = PRIMARY];
            [(android.os.statsd.state_field_option).option = PRIMARY];
    optional int32 state = 3
            [(android.os.statsd.stateFieldOption).option = EXCLUSIVE];
            [(android.os.statsd.state_field_option).option = EXCLUSIVE];
}
 No newline at end of file