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

Commit 14f5e6c5 authored by Chenjie Yu's avatar Chenjie Yu Committed by Android (Google) Code Review
Browse files

Merge "allow use of atom definition outside of atoms.proto in pulled atoms"

parents a1d17b4d 159e4f8f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ cc_library_host_shared {
// ====  java proto device library (for test only)  ==============================
java_library {
    name: "statsdprotolite",
    no_framework_libs: true,
    proto: {
        type: "lite",
        include_dirs: ["external/protobuf/src"],
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import "frameworks/base/core/proto/android/telecomm/enums.proto";
import "frameworks/base/core/proto/android/telephony/enums.proto";
import "frameworks/base/core/proto/android/view/enums.proto";
import "frameworks/base/proto/src/stats_enums.proto";
import "frameworks/base/core/proto/android/service/procstats.proto";

/**
 * The master atom class. This message defines all of the available
@@ -165,6 +166,7 @@ message Atom {
        DirectoryUsage directory_usage = 10026;
        AppSize app_size = 10027;
        CategorySize category_size = 10028;
        android.service.procstats.ProcessStatsSectionProto proc_stats = 10029;
    }

    // DO NOT USE field numbers above 100,000 in AOSP. Field numbers above
+14 −5
Original line number Diff line number Diff line
@@ -195,9 +195,11 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
      print_error(field, "Unkown type for field: %s\n", field->name().c_str());
      errorCount++;
      continue;
    } else if (javaType == JAVA_TYPE_OBJECT) {
    } else if (javaType == JAVA_TYPE_OBJECT &&
               atomDecl->code < PULL_ATOM_START_ID) {
      // Allow attribution chain, but only at position 1.
      print_error(field, "Message type not allowed for field: %s\n",
      print_error(field,
                  "Message type not allowed for field in pushed atoms: %s\n",
                  field->name().c_str());
      errorCount++;
      continue;
@@ -233,6 +235,8 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
    java_type_t javaType = java_type(field);

    AtomField atField(field->name(), javaType);
    // Generate signature for pushed atoms
    if (atomDecl->code < PULL_ATOM_START_ID) {
      if (javaType == JAVA_TYPE_ENUM) {
        // All enums are treated as ints when it comes to function signatures.
        signature->push_back(JAVA_TYPE_INT);
@@ -240,6 +244,11 @@ int collate_atom(const Descriptor *atom, AtomDecl *atomDecl,
      } else {
        signature->push_back(javaType);
      }
    }
    if (javaType == JAVA_TYPE_ENUM) {
      // All enums are treated as ints when it comes to function signatures.
      collate_enums(*field->enum_type(), &atField);
    }
    atomDecl->fields.push_back(atField);

    if (field->options().GetExtension(os::statsd::stateFieldOption).option() ==
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ using std::vector;
using google::protobuf::Descriptor;
using google::protobuf::FieldDescriptor;

const int PULL_ATOM_START_ID = 10000;

/**
 * The types for atom parameters.
 */
+0 −2
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ using namespace std;
namespace android {
namespace stats_log_api_gen {

const int PULL_ATOM_START_ID = 1000;

int maxPushedAtomId = 2;

using android::os::statsd::Atom;