// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Logging information for Android "checkin" events (automatic, periodic
// requests made by Android devices to the server).

syntax = "proto2";

option optimize_for = LITE_RUNTIME;
package checkin_proto;

// Build characteristics unique to the Chrome browser, and Chrome OS
message ChromeBuildProto {
  enum Platform {
    PLATFORM_WIN = 1;
    PLATFORM_MAC = 2;
    PLATFORM_LINUX = 3;
    PLATFORM_CROS = 4;
    PLATFORM_IOS = 5;
    // Just a placeholder. Likely don't need it due to the presence of the
    // Android GCM on phone/tablet devices.
    PLATFORM_ANDROID = 6;
  }

  enum Channel {
    CHANNEL_STABLE = 1;
    CHANNEL_BETA = 2;
    CHANNEL_DEV = 3;
    CHANNEL_CANARY = 4;
    CHANNEL_UNKNOWN = 5;  // for tip of tree or custom builds
  }

  // The platform of the device.
  optional Platform platform = 1;

  // The Chrome instance's version.
  optional string chrome_version = 2;

  // The Channel (build type) of Chrome.
  optional Channel channel = 3;
}

// Information sent by the device in a "checkin" request.
message AndroidCheckinProto {
  // Miliseconds since the Unix epoch of the device's last successful checkin.
  optional int64 last_checkin_msec = 2;

  // The current MCC+MNC of the mobile device's current cell.
  optional string cell_operator = 6;

  // The MCC+MNC of the SIM card (different from operator if the
  // device is roaming, for instance).
  optional string sim_operator = 7;

  // The device's current roaming state (reported starting in eclair builds).
  // Currently one of "{,not}mobile-{,not}roaming", if it is present at all.
  optional string roaming = 8;

  // For devices supporting multiple user profiles (which may be
  // supported starting in jellybean), the ordinal number of the
  // profile that is checking in.  This is 0 for the primary profile
  // (which can't be changed without wiping the device), and 1,2,3,...
  // for additional profiles (which can be added and deleted freely).
  optional int32 user_number = 9;

  // Class of device.  Indicates the type of build proto
  // (IosBuildProto/ChromeBuildProto/AndroidBuildProto)
  // That is included in this proto
  optional DeviceType type = 12 [default = DEVICE_ANDROID_OS];

  // For devices running MCS on Chrome, build-specific characteristics
  // of the browser.  There are no hardware aspects (except for ChromeOS).
  // This will only be populated for Chrome builds/ChromeOS devices
  optional checkin_proto.ChromeBuildProto chrome_build = 13;

  // Note: Some of the Android specific optional fields were skipped to limit
  // the protobuf definition.
  // Next 14
}

// enum values correspond to the type of device.
// Used in the AndroidCheckinProto and Device proto.
enum DeviceType {
  // Android Device
  DEVICE_ANDROID_OS = 1;

  // Apple IOS device
  DEVICE_IOS_OS = 2;

  // Chrome browser - Not Chrome OS.  No hardware records.
  DEVICE_CHROME_BROWSER = 3;

  // Chrome OS
  DEVICE_CHROME_OS = 4;
}
