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

Commit f2297eeb authored by Bertrand SIMONNET's avatar Bertrand SIMONNET
Browse files

metrics: Remove user action logic.

User actions are no longer reported anywhere, we can remove the logic.

Bug: 25818567
Change-Id: Ie8fee841bda6503a3f5781d73b0f879babe99b03
parent c5e921fe
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -66,14 +66,6 @@ extern "C" int CMetricsLibrarySendSparseToUMA(CMetricsLibrary handle,
  return lib->SendSparseToUMA(std::string(name), sample);
}

extern "C" int CMetricsLibrarySendUserActionToUMA(CMetricsLibrary handle,
                                                  const char* action) {
  MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle);
  if (lib == NULL)
    return 0;
  return lib->SendUserActionToUMA(std::string(action));
}

extern "C" int CMetricsLibrarySendCrashToUMA(CMetricsLibrary handle,
                                            const char* crash_kind) {
  MetricsLibrary* lib = reinterpret_cast<MetricsLibrary*>(handle);
+0 −4
Original line number Diff line number Diff line
@@ -44,10 +44,6 @@ int CMetricsLibrarySendEnumToUMA(CMetricsLibrary handle,
int CMetricsLibrarySendSparseToUMA(CMetricsLibrary handle,
                                   const char* name, int sample);

// C wrapper for MetricsLibrary::SendUserActionToUMA.
int CMetricsLibrarySendUserActionToUMA(CMetricsLibrary handle,
                                       const char* action);

// C wrapper for MetricsLibrary::SendCrashToUMA.
int CMetricsLibrarySendCrashToUMA(CMetricsLibrary handle,
                                  const char* crash_kind);
+0 −13
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ class MetricsLibraryInterface {
  virtual bool SendEnumToUMA(const std::string& name, int sample, int max) = 0;
  virtual bool SendBoolToUMA(const std::string& name, bool sample) = 0;
  virtual bool SendSparseToUMA(const std::string& name, int sample) = 0;
  virtual bool SendUserActionToUMA(const std::string& action) = 0;
  virtual ~MetricsLibraryInterface() {}
};

@@ -114,18 +113,6 @@ class MetricsLibrary : public MetricsLibraryInterface {
  // |sample| is the 32-bit integer value to be recorded.
  bool SendSparseToUMA(const std::string& name, int sample) override;

  // Sends a user action to Chrome for transport to UMA and returns true on
  // success. This method results in the equivalent of an asynchronous
  // non-blocking RPC to UserMetrics::RecordAction.  The new metric must be
  // added to chrome/tools/extract_actions.py in the Chromium repository, which
  // should then be run to generate a hash for the new action.
  //
  // Until http://crosbug.com/11125 is fixed, the metric must also be added to
  // chrome/browser/chromeos/external_metrics.cc.
  //
  // |action| is the user-generated event (e.g., "MuteKeyPressed").
  bool SendUserActionToUMA(const std::string& action) override;

  // Sends a signal to UMA that a crash of the given |crash_kind|
  // has occurred.  Used by UMA to generate stability statistics.
  bool SendCrashToUMA(const char *crash_kind);
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ class MetricsLibraryMock : public MetricsLibraryInterface {
                                   int max));
  MOCK_METHOD2(SendBoolToUMA, bool(const std::string& name, bool sample));
  MOCK_METHOD2(SendSparseToUMA, bool(const std::string& name, int sample));
  MOCK_METHOD1(SendUserActionToUMA, bool(const std::string& action));

  bool AreMetricsEnabled() override {return metrics_enabled_;};
};
+1 −19
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ enum Mode {
    kModeSendSample,
    kModeSendEnumSample,
    kModeSendSparseSample,
    kModeSendUserAction,
    kModeSendCrosEvent,
    kModeHasConsent,
    kModeIsGuestMode,
@@ -38,7 +37,6 @@ void ShowUsage() {
          "        metrics_client -e   name sample max\n"
          "        metrics_client -s   name sample\n"
          "        metrics_client -v   event\n"
          "        metrics_client -u action\n"
          "        metrics_client [-cdg]\n"
          "\n"
          "  default: send metric with integer values \n"
@@ -49,7 +47,6 @@ void ShowUsage() {
          "  -g: return exit status 0 if machine in guest mode, 1 otherwise\n"
          "  -s: send a sparse histogram sample\n"
          "  -t: convert sample from double seconds to int milliseconds\n"
          "  -u: send a user action to Chrome\n"
          "  -v: send a Platform.CrOSEvent enum histogram sample\n");
  exit(1);
}
@@ -102,14 +99,6 @@ static int SendStats(char* argv[],
  return 0;
}

static int SendUserAction(char* argv[], int action_index) {
  const char* action = argv[action_index];
  MetricsLibrary metrics_lib;
  metrics_lib.Init();
  metrics_lib.SendUserActionToUMA(action);
  return 0;
}

static int SendCrosEvent(char* argv[], int action_index) {
  const char* event = argv[action_index];
  bool result;
@@ -141,7 +130,7 @@ int main(int argc, char** argv) {

  // Parse arguments
  int flag;
  while ((flag = getopt(argc, argv, "abcegstuv")) != -1) {
  while ((flag = getopt(argc, argv, "abcegstv")) != -1) {
    switch (flag) {
      case 'c':
        mode = kModeHasConsent;
@@ -158,9 +147,6 @@ int main(int argc, char** argv) {
      case 't':
        secs_to_msecs = true;
        break;
      case 'u':
        mode = kModeSendUserAction;
        break;
      case 'v':
        mode = kModeSendCrosEvent;
        break;
@@ -178,8 +164,6 @@ int main(int argc, char** argv) {
    expected_args = 3;
  else if (mode == kModeSendSparseSample)
    expected_args = 2;
  else if (mode == kModeSendUserAction)
    expected_args = 1;
  else if (mode == kModeSendCrosEvent)
    expected_args = 1;

@@ -198,8 +182,6 @@ int main(int argc, char** argv) {
                       arg_index,
                       mode,
                       secs_to_msecs);
    case kModeSendUserAction:
      return SendUserAction(argv, arg_index);
    case kModeSendCrosEvent:
      return SendCrosEvent(argv, arg_index);
    case kModeHasConsent:
Loading