chromium/chromeos/ash/components/report/proto/fresnel_service.proto

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

package ash.report;

import "private_membership_rlwe.proto";

option optimize_for = LITE_RUNTIME;

// This proto represents the data transmitted over network
// requests while reporting Device Actives to Fresnel server.

// The possible channels for ChromeOS installations.
// See details in //components/version_info/channel.h
enum Channel {
  CHANNEL_UNKNOWN = 0;
  CHANNEL_CANARY = 1;
  CHANNEL_DEV = 2;
  CHANNEL_BETA = 3;
  CHANNEL_STABLE = 4;
}

enum MarketSegment {
  // Default segment, should not be in this state.
  MARKET_SEGMENT_UNSPECIFIED = 0;
  // Device is not yet enrolled, owned or have market segment available.
  MARKET_SEGMENT_UNKNOWN = 1;
  // Device is locally owned as a consumer device.
  MARKET_SEGMENT_CONSUMER = 2;
  // Device is enterprise enrolled but does not have enterprise market segment.
  MARKET_SEGMENT_ENTERPRISE_ENROLLED_BUT_UNKNOWN = 3;
  // Device is enterprise enrolled and has enterprise market segment.
  // Does not count demo devices. Demo devices are only counted in
  // MARKET_SEGMENT_ENTERPRISE_DEMO.
  MARKET_SEGMENT_ENTERPRISE = 4;
  // Device is enterprise enrolled and has education market segment.
  MARKET_SEGMENT_EDUCATION = 5;
  // Device is enterprise enrolled as a demo device.
  MARKET_SEGMENT_ENTERPRISE_DEMO = 6;
};

// The Chrome OS device metadata which is sent in PSM import requests.
// Each new field to this message requires privacy approval.
// Next ID: 6
message DeviceMetadata {
  // Chrome OS Hardware IDs (HWIDs) are strings that uniquely identify the
  // hardware configuration of a Chrome OS device.
  // See: go/gvc-g3/logs/chromeos-metrics.md
  optional string hardware_id = 1;

  // Represent the Chrome major milestone of the ChromeOS device.
  // See chrome://version -> Google Chrome:
  // i.e. 96.0.4664.55 (Official Build) (x86_64) would set field as "96".
  optional string chrome_milestone = 2;

  // Country code is represented by a 2-letter string (aka ISO 3166-1).
  // i.e. US for United States of America, CA for Canada.
  optional string country_code = 3;

  // Device market segment is one of the northstar breakout dimensions for
  // active device counting.
  optional MarketSegment market_segment = 4;

  // ChromeOS channel is used to determine the breakdown of devices that are
  // coming from canary, dev, beta, stable, or unknown channels.
  // This can be used with the chrome milestone in order to determine
  // questions like, what percentage of devices are in the M100 stable channel.
  optional Channel chromeos_channel = 5;
}

// The metadata which is related to Churn Cohort request.
message ChurnCohortMetadata {
  // This 28 bits value represents the device monthly cohort active statuses for
  // the past 18 months. The left 10 bits represent the number of months since
  // Jan. 2000, and the right 18 bits represent the device's monthly cohort
  // active statuses for the past 18 months, with a value of 1 indicating that
  // the device was active and a value of 0 indicating that the device was not
  // active in that month.
  //
  // If the device is active when the time switches to a new month (e.g., from
  // 1/31 to 2/1), the number of months will increase by 1 and the first 10 bits
  // will be updated. Also, use the number of months modulo 18 to get the index
  // in the right 18 bits and set that index bit to 1.
  //
  // If the device was not active for a couple of months, after the device
  // becomes active again and reports the cohort request successfully, it needs
  // to set the bits of the inactive months to 0 before updating the number of
  // months for the left 10 bits and the current month bit.
  optional int32 active_status_value = 1;

  // Compare the first active weeks obtained from the VPD to determine if the
  // device is new during the cohort month.
  optional bool is_first_active_in_cohort = 2;

  // Device ActivateDate, read from VPD. In YYYY-WW ISO8601 format.
  // Value exists after first OOBE completion and device restart.
  // Statistics provider loads VPD file in the chrome browser preloop,
  // before ActivateDate may be first written.
  // Field is only set if ActivateDate is <= 5 weeks old.
  optional string first_active_week = 4;
}

// The metadata which is related to Churn Observation request.
message ChurnObservationMetadata {
  // The device's first active status in different cohort month.
  enum FirstActiveDuringCohort {
    // The device is either an existing device that was activated before the
    // cohort month, or it is a new device that has not yet been activated
    // during the cohort month.
    EXISTED_OR_NOT_ACTIVE_YET = 0;
    // The device was first activated during the corresponding monthly cohort
    // period.
    FIRST_ACTIVE_IN_MONTHLY_COHORT = 1;
    // The device was first activated during the corresponding yearly cohort
    // period.
    FIRST_ACTIVE_IN_YEARLY_COHORT = 2;
  }

  // Whether the device was `active` during monthly cohort period.
  optional bool monthly_active_status = 1;

  // Whether the device was `active` during yearly cohort period.
  optional bool yearly_active_status = 2;

  // Whether the device was `first active` during the corresponding cohort
  // period.
  optional FirstActiveDuringCohort first_active_during_cohort = 3;

  // Device ActivateDate, read from VPD. In YYYY-WW ISO8601 format.
  // Value exists after first OOBE completion and device restart.
  // Statistics provider loads VPD file in the chrome browser preloop,
  // before ActivateDate may be first written.
  // Field is only set if ActivateDate is <= 4 months old.
  optional string first_active_week = 4;

  // Device last powerwash week. Formatted YYYY-WW in ISO8601 format.
  // Field is only set if ActivateDate is <= 4 months old.
  optional string last_powerwash_week = 5;
}

// This message is part of the import request. For some use cases, such as
// N-Day use case, they may need to batch import the requests to Fresnel.
// We make a general import data message for all use cases.
message FresnelImportData {
  // The Device active window identifier, generated by client side.
  // For example, for Daily active pings, the active window identifier could be
  // '07012021'; for 28DA, it could be the start date when device was active.
  optional string window_identifier = 1;

  // The device derived id: hash(device_stable_identifier, use_case, date)
  optional string plaintext_id = 2;

  // The plaintext identifiers - value pair to be imported.
  // For example, this can be the cohort active status history byte for Churn
  // use case.
  optional bytes value = 3;

  // Boolean used to indicate whether client is sending UTC (false) or PT
  // (true) timezone for the window_identifier.
  optional bool is_pt_window_identifier = 4;

  // The metadata related to Churn Cohort check-in request.
  optional ChurnCohortMetadata churn_cohort_metadata = 5;

  // The metadata related to Churn Observation check-in request.
  optional ChurnObservationMetadata churn_observation_metadata = 6;
}

// This proto will represent the data sent to Fresnel used to generate a PSM
// import request on the server side.
// Next ID: 5
message FresnelImportDataRequest {
  // This field will be deprecated.
  optional string window_identifier = 1 [deprecated = true];

  // Device active metadata sent along with active pings for counting purposes.
  optional DeviceMetadata device_metadata = 2;

  // The name of the use case associated with the plaintext_id.
  optional private_membership.rlwe.RlweUseCase use_case = 3;

  // This field will be deprecated.
  optional string plaintext_identifier = 4 [deprecated = true];

  // This field will be deprecated.
  optional bytes value = 5 [deprecated = true];

  // The imported data which is related to use case.
  repeated FresnelImportData import_data = 6;
}

// The request of PsmRlweOprf sent by the client for checking PSM membership.
// Next ID: 2
message FresnelPsmRlweOprfRequest {
  optional private_membership.rlwe.PrivateMembershipRlweOprfRequest
      rlwe_oprf_request = 1;
}

// The response of PsmRlweOprf sent by the Fresnel Service for checking
// PSM membership.
// Next ID: 2
message FresnelPsmRlweOprfResponse {
  optional private_membership.rlwe.PrivateMembershipRlweOprfResponse
      rlwe_oprf_response = 1;
}

// The request of PsmRlweQuery sent by the client for checking PSM membership.
// Next ID: 2
message FresnelPsmRlweQueryRequest {
  optional private_membership.rlwe.PrivateMembershipRlweQueryRequest
      rlwe_query_request = 1;
}

// The response of PsmRlweQuery sent by the Fresnel Service for checking
// PSM membership.
// Next ID: 2
message FresnelPsmRlweQueryResponse {
  optional private_membership.rlwe.PrivateMembershipRlweQueryResponse
      rlwe_query_response = 1;
}