context_fence.proto 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. syntax = "proto2";
  5. package personalization.context;
  6. // Represents the parameters for a time-based fence.
  7. message TimeFence {
  8. enum TriggerType {
  9. UNKNOWN_TIME_FENCE_TRIGGER_TYPE = 0;
  10. ABSOLUTE_INTERVAL = 1;
  11. DAILY_INTERVAL = 2;
  12. WEEKEND_INTERVAL = 3;
  13. WEEKDAY_INTERVAL = 4;
  14. SUNDAY_INTERVAL = 5;
  15. MONDAY_INTERVAL = 6;
  16. TUESDAY_INTERVAL = 7;
  17. WEDNESDAY_INTERVAL = 8;
  18. THURSDAY_INTERVAL = 9;
  19. FRIDAY_INTERVAL = 10;
  20. SATURDAY_INTERVAL = 11;
  21. // The enum type AFTER_LOCAL_TIME is not supported, and is here only for
  22. // backwards compatibility
  23. AFTER_LOCAL_TIME = 12;
  24. }
  25. optional TriggerType trigger_type = 1;
  26. // Unused for ABSOLUTE_INTERVAL. For all other types, this
  27. // represents the time zone to determine when the beginning of
  28. // day is.
  29. // If the flag use_local_time_zone is set to True, this is not set.
  30. optional string time_zone = 2;
  31. // For ABSOLUTE_INTERVAL, this is the time in millis since epoch
  32. // January 1, 1970. For other intervals, this is the time in
  33. // millis since the start of the day (where midnight is 0 and
  34. // 24*60*60*1000 millis is the end of the day).
  35. // This should not be set if triggerType is AFTER_LOCAL_TIME.
  36. optional int64 start_time_millis = 3;
  37. // For ABSOLUTE_INTERVAL, this is the time in millis since epoch
  38. // January 1, 1970. For other intervals, this is the time in
  39. // millis since the start of the day (where midnight is 0 and
  40. // 24*60*60*1000 millis is the end of the day).
  41. // This should not be set if triggerType is AFTER_LOCAL_TIME.
  42. optional int64 stop_time_millis = 4;
  43. // Used for representing the 'AFTER_LOCAL_TIME' trigger.
  44. // NOTE: DEPRECATED, AND UNSUPPORTED. DO NOT USE.
  45. optional DateTime date = 5 [deprecated = true];
  46. // Used to specify whether a local time zone at device location should
  47. // be used for the time fence.
  48. optional bool use_local_time_zone = 6;
  49. }
  50. // Represents the parameters for a location-based fence.
  51. message LocationFence {
  52. // The type of trigger for this location fence.
  53. enum TriggerType {
  54. UNKNOWN_LOCATION_FENCE_TRIGGER_TYPE = 0;
  55. // Represents a fence which is triggered when the user's location
  56. // is within this location fence.
  57. IN = 1;
  58. // Represents a fence which is triggered when the user enters
  59. // this location fence.
  60. ENTERING = 2;
  61. // Represents a fence which is triggered when the user exits
  62. // this location fence.
  63. EXITING = 3;
  64. }
  65. // The type indicating how this location fence's geometry is defined.
  66. enum GeometryType {
  67. UNKNOWN_LOCATION_FENCE_GEOMETRY_TYPE = 0;
  68. // Represents a location fence's boundary as a center and radius.
  69. CIRCLE = 1;
  70. }
  71. optional TriggerType trigger_type = 1;
  72. optional GeometryType geometry_type = 2;
  73. // Unused for trigger type IN.
  74. // For trigger types ENTERING and EXITING, this is window of time
  75. // in millis after detecting that the user has entered or exited the
  76. // location fence, during which this fence is considered triggered.
  77. // This parameter is needed to account for the async nature of context
  78. // data collection.
  79. optional int64 delta_time_millis = 3;
  80. // For GeometryType CIRCLE, this represents the center latitude
  81. // in E7 representation.
  82. optional int32 center_latitude_e7 = 4;
  83. // For GeometryType CIRCLE, this represents the center longitude
  84. // in E7 representation.
  85. optional int32 center_longitude_e7 = 5;
  86. // For GeometryType CIRCLE, this represents the outer radius in meters of
  87. // the circular region. A user's location transitions from inside to
  88. // outside only when the user's location is found to be farther than
  89. // outer_radius_meters away from the center.
  90. // Note that the outer_radius_meters must be greater than or equal to
  91. // inner_radius_meters, and effectively, implements hysteresis to deal
  92. // with noisy location data.
  93. optional double outer_radius_meters = 6;
  94. // For GeometryType CIRCLE, this represents the inner radius of the circular
  95. // region. A user's location transitions from outside to inside only when
  96. // the user's location is found to be closer than inner_radius_meters away
  97. // from the center.
  98. // Note that the inner_radius_meters must be less than or equal to
  99. // outer_radius_meters, and effectively, implement hysteresis to deal with
  100. // noisy location data.
  101. optional double inner_radius_meters = 7;
  102. // Used for trigger type IN.
  103. // For trigger type IN, it indicates the minimum dwell time at a location
  104. // before triggering the location fence.
  105. optional int64 dwell_time_millis = 8;
  106. }
  107. // Represents the parameters for a place-based fence.
  108. message PlaceFence {
  109. // The type of trigger for this place fence.
  110. enum TriggerType {
  111. UNKNOWN_PLACE_FENCE_TRIGGER_TYPE = 0;
  112. // Represents a fence which is triggered when the user's place
  113. // is one of the specified places (either matches one of the
  114. // place types or matches one of the place ids).
  115. IN = 1;
  116. // Represents a fence which is triggered when the user enters
  117. // one of the specified places from some other place.
  118. ENTERING = 2;
  119. // Represents a fence which is triggered when the user is
  120. // currently in one of the specified places and exits to some
  121. // other place.
  122. EXITING = 3;
  123. // Represents a fence which is triggered when the place changes
  124. // in successive screen on events.
  125. SCREEN_ON_CHANGE = 4;
  126. // Represents a fence which is triggered when CURRENT_PLACE context changes.
  127. AT_A_PLACE_CHANGE = 5;
  128. }
  129. optional TriggerType trigger_type = 1;
  130. // Unused for trigger type IN.
  131. // For trigger types ENTERING and EXITING, this is window of time
  132. // in millis after detecting that the user has entered or exited the
  133. // place fence, during which this fence is considered triggered.
  134. // This parameter is needed to account for the async nature of context
  135. // data collection.
  136. optional int64 delta_time_millis = 2;
  137. // List of place types as provided by the PlacesApi. This field will not be
  138. // filled in for
  139. // the SCREEN_ON_CHANGE trigger type. See
  140. // https://cs.corp.google.com/piper///depot/google3/java/com/google/android/gmscore/dev/client/placefencing/src/com/google/android/gms/location/places/Place.java
  141. // Only one place_type, or one place_id, or one place_alias, or one
  142. // place_chain_name can be set.
  143. repeated int32 place_type = 3;
  144. // List of place ids. This field will not be filled in for the
  145. // SCREEN_ON_CHANGE trigger type.
  146. // See Places.getId()
  147. // https://cs.corp.google.com/piper///depot/google3/java/com/google/android/gmscore/dev/client/placefencing/src/com/google/android/gms/location/places/Place.java
  148. // Only one place_type, or one place_id, or one place_alias, or one
  149. // place_chain_name can be set.
  150. repeated string place_id = 4;
  151. // Used for trigger type IN.
  152. // For trigger type IN, it indicates the minimum dwell time in a place
  153. // before triggering the Place fence.
  154. optional int64 dwell_time_millis = 5;
  155. // List of place aliases. This field will not be filled in for the
  156. // SCREEN_ON_CHANGE trigger type.
  157. // See PlaceAlias.getAlias()
  158. // https://cs.corp.google.com/piper///depot/google3/java/com/google/android/gmscore/dev/client/places/src/com/google/android/gms/location/places/personalized/PlaceAlias.java
  159. // Only one place_type, or one place_id, or one place_alias, or one
  160. // place_chain_name can be set.
  161. repeated string place_alias = 6;
  162. // Name of the place chain like Walmart, AMC etc,.
  163. // Only one place_type, or one place_id, or one place_alias, or one
  164. // place_chain_name can be set.
  165. optional string place_chain_name = 7;
  166. // Optional field to set the timestamp for this fence.
  167. // This is ignored by contextmanager, but can be used to force (AGSA) client
  168. // into treating this fence as logically different, even if other fields are
  169. // identical.
  170. optional int64 creation_timestamp = 8;
  171. }
  172. // This message encapsulates the context specific data.
  173. message ContextExtension {
  174. // Context specific data is attached as an extension.
  175. extensions 1000 to max;
  176. }
  177. message DetectedActivity {
  178. extend ContextExtension { optional DetectedActivity data = 77815057; }
  179. message ActivityRecord {
  180. // NextId: 22
  181. // Note: This enum must be kept in sync (including tag numbers) with
  182. // google3/java/com/google/geo/sidekick/proto/detected_activity.proto
  183. // google3/location/unified/proto/location_descriptor.proto
  184. enum Type {
  185. // LINT.IfChange
  186. IN_VEHICLE = 0;
  187. ON_BICYCLE = 1;
  188. ON_FOOT = 2;
  189. STILL = 3;
  190. UNKNOWN = 4;
  191. TILTING = 5;
  192. EXITING_VEHICLE = 6;
  193. WALKING = 7;
  194. RUNNING = 8;
  195. OFF_BODY = 9;
  196. TRUSTED_GAIT = 10;
  197. FLOOR_CHANGE = 11;
  198. ON_STAIRS = 12;
  199. ON_ESCALATOR = 13;
  200. IN_ELEVATOR = 14;
  201. SLEEPING = 15;
  202. IN_ROAD_VEHICLE = 16;
  203. IN_RAIL_VEHICLE = 17;
  204. IN_TWO_WHEELER_VEHICLE = 18;
  205. IN_FOUR_WHEELER_VEHICLE = 19;
  206. IN_CAR = 20;
  207. IN_BUS = 21;
  208. // This is to support EXPERIMENTAL_EXTRA_PERSONAL_VEHICLE until
  209. // Activity Recognition team figures out their API.
  210. EXPERIMENTAL_EXTRA_PERSONAL_VEHICLE = -1000;
  211. // LINT.ThenChange(
  212. // //depot/google3/java/com/google/geo/sidekick/proto/detected_activity.proto,
  213. // //depot/google3/location/unified/proto/location_descriptor.proto
  214. // )
  215. }
  216. // The type of activity.
  217. optional Type type = 1;
  218. // The confidence of the detection. Range is [0, 100].
  219. optional int32 confidence = 2;
  220. }
  221. repeated ActivityRecord activity_record = 2;
  222. }
  223. // Represents the parameters for an activity-based fence.
  224. message ActivityFence {
  225. enum TriggerType {
  226. UKNOWN_ACTIVITY_FENCE_TRIGGER_TYPE = 0;
  227. // Represents a fence which is triggered when the user's activity
  228. // is one of the specified activity types.
  229. DURING = 1;
  230. // Represents a fence which is triggered when the user starts
  231. // one of the specified activity types from some other activity type.
  232. STARTING = 2;
  233. // Represents a fence which is triggered when the user is
  234. // currently in one of the specified activity types but transitions
  235. // to some other activity type.
  236. STOPPING = 3;
  237. }
  238. optional TriggerType trigger_type = 1;
  239. // Unused for trigger type DURING.
  240. // For trigger types STARTING and STOPPING, this is window of time
  241. // in millis after detecting that the user has started or stopped the
  242. // activity types, during which this fence is considered triggered.
  243. // This parameter is needed to account for the async nature of context
  244. // data collection.
  245. optional int64 delta_time_millis = 2;
  246. // List of activity types that are considered part of this fence.
  247. repeated DetectedActivity.ActivityRecord.Type activity_type = 3;
  248. }
  249. // This represents the state of the device screen.
  250. message Screen {
  251. extend ContextExtension { optional Screen data = 79284926; }
  252. enum State {
  253. // Unknown screen state. All discrete states
  254. // like this should have an UNKNOWN enum set to 0.
  255. UNKNOWN = 0;
  256. // Screen is off.
  257. OFF = 1;
  258. // Screen is on.
  259. ON = 2;
  260. }
  261. // Screen state
  262. optional State state = 1;
  263. }
  264. // Represents the parameters for a fence based on screen on/off state
  265. message ScreenFence {
  266. enum TriggerType {
  267. UNKNOWN_SCREEN_FENCE_TRIGGER_TYPE = 0;
  268. // Represents a fence which is triggered when the screen is either
  269. // on or off
  270. DURING = 1;
  271. // Represents a fence which is triggered when the screen is turning
  272. // on.
  273. TURNING_ON = 2;
  274. // Represents a fence which is triggered when the screen it turning
  275. // off.
  276. TURNING_OFF = 3;
  277. }
  278. optional TriggerType trigger_type = 1;
  279. // Unused for trigger type DURING.
  280. // For trigger types TURNING_ON and TURNING_OFF, this is the window of
  281. // time in millis after detecting that the device's screen has turned
  282. // on or off. This parameter is needed to account for the async nature
  283. // of context data collection.
  284. optional int64 delta_time_millis = 2;
  285. // Used only for trigger type DURING. This indicates whether the screen is
  286. // on or off.
  287. optional Screen.State screen_state = 3;
  288. }
  289. // This represents the state of the headphones.
  290. message AudioState {
  291. extend ContextExtension { optional AudioState data = 91925232; }
  292. enum HeadPhoneState {
  293. UNKNOWN_HEADPHONE_STATE = 0;
  294. // Headphone is plugged.
  295. PLUGGED = 1;
  296. // Headphone is unplugged.
  297. UNPLUGGED = 2;
  298. }
  299. // Deprecated. Results may not be valid
  300. enum BluetoothA2DPState {
  301. UNKNOWN_BLUETOOTH_A2DP_STATE = 0;
  302. // State when A2DP audio routing to the Bluetooth headset is
  303. // on.
  304. BLUETOOTH_A2DP_ON = 1;
  305. // State when A2DP audio routing to the Bluetooth headset is
  306. // off.
  307. BLUETOOTH_A2DP_OFF = 2;
  308. }
  309. enum BluetoothSCOState {
  310. UNKNOWN_BLUETOOTH_SCO_STATE = 0;
  311. // State when SCO audio routing to the Bluetooth headset is
  312. // on.
  313. BLUETOOTH_SCO_ON = 1;
  314. // State when SCO audio routing to the Bluetooth headset is
  315. // off.
  316. BLUETOOTH_SCO_OFF = 2;
  317. }
  318. enum MicrophoneState {
  319. UNKNOWN_MICROPHONE_STATE = 0;
  320. // State indicating if the microphone mute is on.
  321. MICROPHONE_MUTE_ON = 1;
  322. // State indicating if the microphone mute is off.
  323. MICROPHONE_MUTE_OFF = 2;
  324. }
  325. enum MusicState {
  326. UNKNOWN_MUSIC_STATE = 0;
  327. // State indicating when some music is playing.
  328. MUSIC_ACTIVE = 1;
  329. // State indicating when music is not active.
  330. MUSIC_INACTIVE = 2;
  331. }
  332. enum SpeakerPhoneState {
  333. UNKNOWN_SPEAKERPHONE_STATE = 0;
  334. // State indicating if the speakerphone is on.
  335. SPEAKER_PHONE_ON = 1;
  336. // State indicating if the speakerphone is off.
  337. SPEAKER_PHONE_OFF = 2;
  338. }
  339. optional HeadPhoneState headphone_state = 1;
  340. optional BluetoothA2DPState bluetooth_a2dp_state = 2 [deprecated = true];
  341. optional BluetoothSCOState bluetooth_sco_state = 3 [deprecated = true];
  342. optional MicrophoneState microphone_state = 4;
  343. optional MusicState music_state = 5;
  344. optional SpeakerPhoneState speakerphone_state = 6;
  345. }
  346. // Represents the parameters for a fence based on audio state.
  347. // This audio state is derived from Android's AudioManager
  348. // For More details about AudioManager API refer here -
  349. // http://developer.android.com/reference/android/media/AudioManager.html
  350. message AudioStateFence {
  351. enum TriggerType {
  352. UNKNOWN_AUDIO_STATE_FENCE_TRIGGER_TYPE = 0;
  353. HEADPHONE_DURING = 1;
  354. HEADPHONE_PLUGGING = 2;
  355. HEADPHONE_UNPLUGGING = 3;
  356. BLUETOOTH_A2DP_DURING = 4 [deprecated = true];
  357. BLUETOOTH_A2DP_TURNING_ON = 5 [deprecated = true];
  358. BLUETOOTH_A2DP_TURNING_OFF = 6 [deprecated = true];
  359. BLUETOOTH_SCO_DURING = 7 [deprecated = true];
  360. BLUETOOTH_SCO_TURNING_ON = 8 [deprecated = true];
  361. BLUETOOTH_SCO_TURNING_OFF = 9 [deprecated = true];
  362. MICROPHONE_DURING = 10;
  363. MICROPHONE_MUTING = 11;
  364. MICROPHONE_UNMUTING = 12;
  365. MUSIC_DURING = 13;
  366. MUSIC_ACTIVATING = 14;
  367. MUSIC_DEACTIVATING = 15;
  368. SPEAKER_PHONE_DURING = 16;
  369. SPEAKER_PHONE_TURNING_ON = 17;
  370. SPEAKER_PHONE_TURNING_OFF = 18;
  371. }
  372. optional TriggerType trigger_type = 1;
  373. // Unused for trigger types *_DURING. Required for all others.
  374. // This is the window of time in millis after detecting that the audio state
  375. // has changed during which the context fence will still trigger. This
  376. // parameter is needed to account for the async nature of context data
  377. // collection. A non-zero value must be specified, otherwise the fence will
  378. // never trigger.
  379. optional int64 delta_time_millis = 2;
  380. // Used only for trigger types during.
  381. // Any give time at most one of these states will be set depending upon the
  382. // During trigger type.
  383. optional AudioState.HeadPhoneState headphone_state = 3;
  384. optional AudioState.BluetoothA2DPState bluetooth_a2dp_state = 4
  385. [deprecated = true];
  386. optional AudioState.BluetoothSCOState bluetooth_sco_state = 5
  387. [deprecated = true];
  388. optional AudioState.MicrophoneState microphone_state = 6;
  389. optional AudioState.MusicState music_state = 7;
  390. optional AudioState.SpeakerPhoneState speakerphone_state = 8;
  391. }
  392. // This represents the state of the phone if it is locked or not.
  393. message PhoneLock {
  394. extend ContextExtension { optional PhoneLock data = 91835270; }
  395. enum State {
  396. // Unknown state. All discrete states
  397. // like this should have an UNKNOWN enum set to 0.
  398. UNKNOWN = 0;
  399. // Phone is unlocked.
  400. UNLOCKED = 1;
  401. // Phone is locked.
  402. LOCKED = 2;
  403. }
  404. optional State state = 1;
  405. }
  406. // Represents the parameters for a fence based on phone lock/unlock state
  407. message PhoneLockFence {
  408. enum TriggerType {
  409. UNKNOWN_PHONE_LOCK_FENCE_TRIGGER_TYPE = 0;
  410. // Represents a fence which is triggered when the screen is either
  411. // on or off
  412. DURING = 1;
  413. // Represents a fence which is triggered when the phone is unlocked.
  414. UNLOCKING = 2;
  415. // Represents a fence which is triggered when the phone is locked.
  416. LOCKING = 3;
  417. }
  418. optional TriggerType trigger_type = 1;
  419. // Unused for trigger type DURING. Required for UNLOCKING and LOCKING.
  420. // This is the window of time in millis after detecting that the device has
  421. // been locked or unlocked during which the context fence will still trigger.
  422. // This parameter is needed to account for the async nature of context data
  423. // collection. A non-zero value must be specified, otherwise the fence will
  424. // never trigger.
  425. optional int64 delta_time_millis = 2;
  426. // Used only for trigger type DURING. This indicates whether the phone is
  427. // locked or unlocked.
  428. optional PhoneLock.State phone_lock_state = 3;
  429. }
  430. // This represents whether the device is connected to power.
  431. message PowerConnection {
  432. extend ContextExtension { optional PowerConnection data = 87654321; }
  433. enum State {
  434. // Unknown power connection state. All discrete states
  435. // like this should have an UNKNOWN enum set to 0.
  436. UNKNOWN = 0;
  437. // Device is not connected to a power source.
  438. DISCONNECTED = 1;
  439. // Device is connected to USB power.
  440. CONNECTED_USB = 2;
  441. // Device is connected to AC power.
  442. CONNECTED_AC = 3;
  443. // Device is connected to wireless power.
  444. CONNECTED_WIRELESS = 4;
  445. }
  446. // Power connection state
  447. optional State state = 1;
  448. // The battery level of the device (0.0-1.0).
  449. optional double battery_level = 2;
  450. }
  451. // Represents the parameters for a fence based on battery level or
  452. // plugged in state.
  453. message PowerConnectionFence {
  454. enum TriggerType {
  455. UNKNOWN_POWER_CONNECTION_FENCE_TRIGGER_TYPE = 0;
  456. // Represents a fence for which the battery level is within an
  457. // interval. For example, battery level between 30% and 80% is
  458. // represented by battery_level_lower_bound=.3 and
  459. // battery_level_upper_bound=.8. Because the battery level
  460. // can only range from 0.0 to 1.0, you can represent battery level
  461. // greater than a threshold, say 70%, by setting
  462. // battery_level_lower_bound=.7 and
  463. // battery_level_upper_bound=1.0. To represent battery level less
  464. // than a threshold, say 20%, you can set
  465. // battery_level_lower_bound=0.0 and battery_level_upper_bound=0.2.
  466. BATTERY_LEVEL_IN = 1;
  467. // Represents a fence when the battery level enters the interval.
  468. BATTERY_LEVEL_ENTERING = 2;
  469. // Represents a fence when the battery level exits the interval.
  470. BATTERY_LEVEL_EXITING = 3;
  471. // Represents a fence when the plugged in state is one of the
  472. // specified states.
  473. PLUGGED_IN_STATE_DURING = 4;
  474. // Represents a fence when the plugged in state transitions to one
  475. // of the specified states.
  476. PLUGGED_IN_STATE_STARTING = 5;
  477. // Represents a fence when the plugged in state transitions out
  478. // of one of the specified states.
  479. PLUGGED_IN_STATE_STOPPING = 6;
  480. }
  481. optional TriggerType trigger_type = 1;
  482. // Used for BATTERY_LEVEL_IN, BATTERY_LEVEL_ENTERING, and
  483. // BATTERY_LEVEL_EXITING. This is the lower bound of the
  484. // battery level interval. This ranges in value from 0.0 to 1.0.
  485. optional double battery_level_lower_bound = 2;
  486. // Used for BATTERY_LEVEL_IN, BATTERY_LEVEL_ENTERING, and
  487. // BATTERY_LEVEL_EXITING. This is the upper bound of the
  488. // battery level interval. This ranges in value from 0.0 to 1.0.
  489. // This value must be greater than or equal to
  490. // battery_level_lower_bound.
  491. optional double battery_level_upper_bound = 3;
  492. // Required for trigger types BATTERY_LEVEL_ENTERING, BATTERY_LEVEL_EXITING,
  493. // PLUGGED_IN_STATE_STARTING, and PLUGGED_IN_STATE_STOPPING.
  494. // This is the window of time in millis after detecting that the device's
  495. // state has changed during which the context fence will still trigger. This
  496. // parameter is needed to account for the async nature of context data
  497. // collection. A non-zero value must be specified, otherwise the fence will
  498. // never trigger.
  499. optional int64 delta_time_millis = 4;
  500. // Used for DURING_PLUGGED_IN_STATE, STARTING_PLUGGED_IN_STATE, and
  501. // STOPPING_PLUGGED_IN_STATE.
  502. repeated PowerConnection.State plugged_in_state = 5;
  503. }
  504. // Represents a fence that is triggered when detecting a beacon
  505. // that contains a beacon attachment of the given types.
  506. message BeaconFence {
  507. enum TriggerType {
  508. UNKNOWN_BEACON_FENCE_TRIGGER_TYPE = 0;
  509. // Represents a fence that is triggered when a beacon is
  510. // detected. The fence is triggered every time a unique
  511. // beacon is found that matches the set of beacon_type_filters.
  512. // Uniqueness for a beacon means that the (namespace,type,content)
  513. // triple is unique.
  514. FOUND = 1;
  515. // Represents a fence that is triggered when a beacon is
  516. // no longer detectable. The fence is triggered every time
  517. // a unique beacon is lost that matches the set of
  518. // beacon_type_filters. Uniqueness for a beacon means that the
  519. // (namespace,type,content) triple is unique.
  520. LOST = 2;
  521. // Represents a fence that is triggered when a beacon has been
  522. // found and is not lost.
  523. NEAR = 3;
  524. }
  525. optional TriggerType trigger_type = 1;
  526. // Represents the set of beacon types (i.e., namespace/type pairs)
  527. // that encompass this beacon fence. If none is set, then this
  528. // beacon fence will never trigger.
  529. // DEPRECATED, fill in beacon_type_filter instead.
  530. // repeated detected_beacon.DetectedBeacon.Type beacon_type = 2;
  531. // NOTE: do not reuse field number 2
  532. // Used for FOUND and LOST. This is the window of time in millis
  533. // after detecting that a beacon was either found or lost that
  534. // the transition is considered true. This is needed to account
  535. // for the async nature of context data collection.
  536. optional int64 delta_time_millis = 3;
  537. message BeaconTypeFilter {
  538. // REQUIRED
  539. // Namespace of the beacon attachment to match against.
  540. // e.g., "com.google.location.beaconservice"
  541. optional string namespace = 1;
  542. // REQUIRED
  543. // Type of the beacon attachment to match against.
  544. // e.g., "geo-message-dogfood"
  545. optional string type = 2;
  546. // OPTIONAL
  547. // Indicates the content to match against in terms of
  548. // a byte array equals. Do not set this if you do not
  549. // want to match against specific content.
  550. optional bytes content = 3;
  551. }
  552. repeated BeaconTypeFilter beacon_type_filter = 4;
  553. // Deprecated fields
  554. reserved 2;
  555. }
  556. // This represents the state of the phone's network connection,
  557. // i.e. whether the phone is connected to a network and if connected,
  558. // whether it is on WiFi or Cellular.
  559. message NetworkState {
  560. extend ContextExtension { optional NetworkState data = 95555291; }
  561. enum ConnectionState {
  562. // Unknown state. All discrete states
  563. // like this should have an UNKNOWN enum set to 0.
  564. UNKNOWN_STATE = 0;
  565. // Phone is not connected to network.
  566. DISCONNECTED = 1;
  567. // Phone is connected to network via WiFi
  568. ON_WIFI = 2;
  569. // Phone is connected to network via Cellular
  570. ON_CELLULAR = 3;
  571. }
  572. // connection_state is a REQUIRED field
  573. optional ConnectionState connection_state = 1;
  574. enum MeterState {
  575. // Unknown meter state
  576. UNKNOWN_METER_TYPE = 0;
  577. // Metered network connection
  578. METERED = 1;
  579. // Unmetered network connection
  580. UNMETERED = 2;
  581. }
  582. // meter_state field is omitted when connection_state is UNKNOWN_STATE
  583. // or DISCONNECTED; it is required when state is ON_CELLULAR or ON_WIFI
  584. optional MeterState meter_state = 2;
  585. message WifiInfo {
  586. // bssid of the currently connected Wifi connection
  587. optional string bssid = 1;
  588. // ssid of the currently connected Wifi connection
  589. optional string ssid = 2;
  590. }
  591. // connected_wifi_info is only populated when connection_state is connected
  592. optional WifiInfo connected_wifi_info = 3;
  593. }
  594. // Represents the parameters for a fence pertaining to network state
  595. // (disconnected, connected to network via WiFi, or Cellular.
  596. message NetworkStateFence {
  597. enum TriggerType {
  598. UNKNOWN_NETWORK_STATE_FENCE_TRIGGER_TYPE = 0;
  599. // Represents a fence which is triggered when the connection state of the
  600. // device
  601. // is one of the specified states in the connection_state field below.
  602. CONNECTION_DURING = 1;
  603. // Represents a fence which is triggered when the device gets into
  604. // one of the specified connection states from some other connection state.
  605. CONNECTION_STARTING = 2;
  606. // Represents a fence which is triggered when the device is
  607. // currently in one of the specified connection states but transitions
  608. // to some other connection state.
  609. CONNECTION_STOPPING = 3;
  610. // Represents a fence which is triggered when the meter state of the device
  611. // is one of the specified states in the connection_state field below.
  612. METER_DURING = 4;
  613. // Represents a fence which is triggered when the device gets into
  614. // one of the specified meter states from some other meter state.
  615. METER_STARTING = 5;
  616. // Represents a fence which is triggered when the device is
  617. // currently in one of the specified meter states but transitions
  618. // to some other meter state.
  619. METER_STOPPING = 6;
  620. }
  621. optional TriggerType trigger_type = 1;
  622. // Unused for trigger types DURING. Required for STARTING and STOPPING.
  623. // This is the window of time in millis after detecting that the network state
  624. // has changed during which the context fence will still trigger. This
  625. // parameter is needed to account for the async nature of context data
  626. // collection. A non-zero value must be specified, otherwise the fence will
  627. // never trigger.
  628. optional int64 delta_time_millis = 2;
  629. // A valid NetworkStateFence proto should have only one of the following two
  630. // fields set. i.e. the fence can be over a subset of either connection
  631. // states or meter states but not both.
  632. // connection_state indicates the list of connection states that are
  633. // considered part of this fence.
  634. // connection_state is set in the proto only if the trigger_type is set to
  635. // CONNECTION_DURING, CONNECTION_STARTING, or CONNECTION_STOPPING.
  636. repeated NetworkState.ConnectionState connection_state = 3;
  637. // meter_state indicates the list of meter states that are considered part of
  638. // this fence.
  639. // meter_state is set in the proto only if the trigger_type is set to
  640. // METER_DURING, METER_STARTING, or METER_STOPPING.
  641. repeated NetworkState.MeterState meter_state = 4;
  642. }
  643. // The fence defines a device to be 'IN wandering' state if it has moved more
  644. // than 'wander_distance_meters' in past interval 'wander_time_interval_hours'.
  645. message WanderStateFence {
  646. enum TriggerType {
  647. UNKNOWN_WANDER_STATE_FENCE_TRIGGER_TYPE = 0;
  648. // Represents a fence which is triggered when the device is in a state
  649. // where it is moving by at least 'wander_distance_meters' in a time
  650. // interval of 'wander_time_millis'
  651. IS_WANDERING = 1;
  652. // Represents a fence which is triggered when the device is entering a
  653. // wander state specified by the device moving by at least
  654. // 'wander_distance_meters' in a time interval of 'wander_time_millis'
  655. STARTING_WANDER = 2;
  656. // Represents a fence which is triggered when the device is leaving a
  657. // wander state specified by the device moving by at least
  658. // 'wander_distance_meters' in a time interval of 'wander_time_millis'
  659. STOPPING_WANDER = 3;
  660. }
  661. optional TriggerType trigger_type = 1;
  662. // Unused for trigger type IS_WANDERING.
  663. // For trigger types STARTING and STOPPING, this is window of time
  664. // in millis after detecting that the wander state has changed,
  665. // during which this fence is considered triggered.
  666. // This parameter is needed to account for the async nature of context
  667. // data collection.
  668. optional int64 delta_time_millis = 2;
  669. // the minimum distance that the phone needs to move for it to be evaluated
  670. // to be in wander state for this fence
  671. optional float wander_distance_meters = 3;
  672. // the time interval in hours during which the device should have covered
  673. // 'wander_distance_meters' for it to be evaluated to be in wander state
  674. // for this fence. This must be an integer number of hours between 1 and 20.
  675. // There is a 20 hour limit because the maximum period of location history
  676. // available on the phone is only 20 hours.
  677. optional int32 wander_time_interval_hours = 4;
  678. }
  679. // Represents the attributes of the day corresponding to the
  680. // current time and locale.
  681. // As examples, some attributes are: MORNING, AFTERNOON, EVENING,
  682. // WEEKDAY, WEEKEND, HOLIDAY.
  683. message DayAttributes {
  684. extend ContextExtension { optional DayAttributes data = 121436786; }
  685. enum DayAttributeType {
  686. // Unknown attribute type. All discrete types
  687. // like this should have an UNKNOWN enum set to 0.
  688. UNKNOWN = 0;
  689. // Denotes a weekday for the device locale at the current time
  690. WEEKDAY = 1;
  691. // Denotes a weekend for the device locale at the current time
  692. WEEKEND = 2;
  693. // Denotes a government-sanctioned holiday for the device locale
  694. // at the current time
  695. HOLIDAY = 3;
  696. // Denotes the period of a day that is classified as morning
  697. MORNING = 4;
  698. // Denotes the period of a day that is classified as afternoon
  699. AFTERNOON = 5;
  700. // Denotes the period of a day that is classified as evening
  701. EVENING = 6;
  702. // Denotes the period of a day that is classified as night
  703. NIGHT = 7;
  704. }
  705. repeated DayAttributeType day_attribute_types = 1;
  706. }
  707. // Represents the parameters for a time-based fence.
  708. message TimeIntervalFence {
  709. enum TriggerType {
  710. UNKNOWN_TIME_INTERVAL_FENCE_TRIGGER_TYPE = 0;
  711. // Represents a fence which is triggered when one of the attributes for
  712. // the local time for the device is the attribute specified for the fence
  713. // in 'day_attribute' parameter
  714. IN = 1;
  715. // Represents a fence which is triggered when one of the attributes for
  716. // the local time for the device transitions into being equal to the
  717. // attribute specified for the fence in 'day_attribute' parameter,
  718. // and the previous attribute before the transition was not equal
  719. // to the 'day_attribute' parameter
  720. STARTING = 2;
  721. // Represents a fence which is triggered when one of the attributes for
  722. // the local time for the device transitions to being not equal to the
  723. // attribute specified for the fence in 'day_attribute' parameter,
  724. // and the previous attribute before the transition was equal
  725. // to the 'day_attribute' parameter
  726. STOPPING = 3;
  727. }
  728. optional TriggerType trigger_type = 1;
  729. // Used to specify one of the DAY_ATTRIBUTE related triggers
  730. optional DayAttributes.DayAttributeType time_interval_type = 2;
  731. }
  732. // Represents the installed apps fence
  733. message InstalledAppsFence {
  734. enum TriggerType {
  735. UNKNOWN_INSTALLED_APPS_TRIGGER_TYPE = 0;
  736. // Used for the fence which is triggered when the app is installed.
  737. INSTALLED = 1;
  738. // Used for the fence which is triggered when the app is not installed.
  739. NOT_INSTALLED = 2;
  740. }
  741. optional TriggerType trigger_type = 1;
  742. // The package to check for the installed status
  743. optional string package_name = 2;
  744. }
  745. // Represents the phone call fence
  746. message PhoneCallFence {
  747. enum TriggerType {
  748. UNKNOWN_PHONE_CALL_TRIGGER_TYPE = 0;
  749. // Used for the fence which is triggered when the user is in a phone call.
  750. IN_CALL = 1;
  751. // Used for the fence which is triggered when the user is not in a phone
  752. // call.
  753. NOT_IN_CALL = 2;
  754. }
  755. optional TriggerType trigger_type = 1;
  756. }
  757. // Represents the proximity distance fence
  758. message ProximityDistanceFence {
  759. enum TriggerType {
  760. UNKNOWN_PROXIMITY_DISTANCE_TRIGGER_TYPE = 0;
  761. // Used for the fence which is triggered when the proximity sensor is far
  762. // from an object.
  763. FAR_AWAY = 1;
  764. // Used for the fence which is triggered when the proximity sensor is near
  765. // to an object.
  766. NEAR = 2;
  767. }
  768. optional TriggerType trigger_type = 1;
  769. }
  770. // Represents a time fence expressed in terms of moments of the day
  771. message SunStateFence {
  772. enum TriggerType {
  773. UNKNOWN_MOMENT_FENCE_TRIGGER_TYPE = 0;
  774. // Time triggers specified based on sunrise times
  775. AROUND_SUNRISE = 1;
  776. // Time triggers specified based on sunset times
  777. AROUND_SUNSET = 2;
  778. }
  779. optional TriggerType trigger_type = 1;
  780. // Absolute value of begin_relative_to_sun_state_millis
  781. // cannot exceed total millis in a day.
  782. // begin_relative_to_sun_state_millis cannot be later than
  783. // end_relative_to_sun_state_millis.
  784. optional int64 begin_relative_to_sun_state_millis = 3;
  785. // Absolute value of end_relative_to_sun_state_millis
  786. // cannot exceed total millis in a day.
  787. // end_relative_to_sun_state_millis cannot be earlier
  788. // than begin_relative_to_sun_state_millis.
  789. optional int64 end_relative_to_sun_state_millis = 4;
  790. }
  791. // Represents a weather fence that triggers when specified criteria
  792. // on weather connditions, temperatures or humidity is met
  793. message WeatherFence {
  794. enum TriggerType {
  795. UNKNOWN_WEATHER_FENCE_TRIGGER_TYPE = 0;
  796. // Fence that triggers when the temperature in the device's location
  797. // is in a specified range.
  798. IN_TEMPERATURE_RANGE = 1;
  799. // Fence that triggers when the feels-like temperature in the device's
  800. // location is in a specified range.
  801. IN_FEELS_LIKE_TEMPERATURE_RANGE = 2;
  802. // Fence that triggers when the dew point in the device's location
  803. // is in a specified range.
  804. IN_DEW_POINT_RANGE = 3;
  805. // Fence that triggers when the humidity in the device's location
  806. // is in a specified range.
  807. IN_HUMIDITY_RANGE = 4;
  808. // Fence that triggers when the weather condition in the device's location
  809. // is the specified condition
  810. IN_CONDITION = 5;
  811. }
  812. optional TriggerType trigger_type = 1;
  813. // Low value of the temperature range of the weather fence.
  814. // Used only for trigger types IN_TEMPERATURE_RANGE,
  815. // IN_FEELS_LIKE_TEMPERATURE_RANGE, IN_DEW_POINT_RANGE.
  816. // Note: low_temp_f < high_temp_f for a valid fence.
  817. optional float low_temp_f = 2;
  818. // High value of the temperature range of the weather fence.
  819. // Used only for trigger types IN_TEMPERATURE_RANGE,
  820. // IN_FEELS_LIKE_TEMPERATURE_RANGE, IN_DEW_POINT_RANGE.
  821. // Note: low_temp_f < high_temp_f for a valid fence.
  822. optional float high_temp_f = 3;
  823. // Low value of the humidity range of the weather fence.
  824. // Used only for trigger type IN_HUMIDITY_RANGE.
  825. // Note: low_humidity < high_temp_f for a valid fence.
  826. optional int32 low_humidity = 4;
  827. // High value of the temperature range of the weather fence.
  828. // Used only for trigger type IN_HUMIDITY_RANGE.
  829. // Note: low_humidity < high_humidity for a valid fence.
  830. optional int32 high_humidity = 5;
  831. // Desired type of weather condition for the fence.
  832. // Used only for trigger types IN_CONDITION
  833. // This should be set to one of the values in:
  834. // Weather.WeatherCondition.Type or
  835. // com.google.android.gms.awareness.state.Weather.WeatherCondition
  836. optional int32 condition_type = 6;
  837. }
  838. // Represents the parameters for a shush state fence
  839. message ShushStateFence {}
  840. // Represents the parameters for a wifi state fence
  841. message WifiStateFence {
  842. enum TriggerType {
  843. UNKNOWN_WIFI_FENCE_TRIGGER_TYPE = 0;
  844. // Fence triggers when a matching access point is connected
  845. CONNECTED = 1;
  846. // Fence triggers when a matching access point is detectable
  847. FOUND = 2;
  848. }
  849. optional TriggerType trigger_type = 1;
  850. // If provided, matches when an access point has given bssid
  851. optional string bssid = 2;
  852. // If provided, matches when an access point has given ssid
  853. optional string ssid = 3;
  854. }
  855. // Names of the different contexts. The enum here is meant to grow as more
  856. // contexts are defined. Names are loosely organized (and corresponding proto
  857. // tag numbers) by family. See ContextFamily for description of what families
  858. // entail. It is understood that some context names may fall under multiple
  859. // families but should be tagged with whatever is deemed the more prominent
  860. // family grouping.
  861. //
  862. // The ContextName directly maps to a proto (if one exists) that is put in
  863. // the extension of a Context object. These protos are stored
  864. // in subdirectories under //personalization/context/proto according to the
  865. // name. (E.g., for SCREEN and POWER_CONNECTION, the corresponding protos
  866. // are stored in //personalization/context/proto/screen/screen.proto and
  867. // //personalization/context/proto/power_connection/power_connection.proto.
  868. //
  869. // A ContextName can also be mapped to a model that may be used to generate
  870. // a context for a particular type. Each model name should strictly be suffixed
  871. // with '_MODEL' to indicate that it is a Model. It is also fine if multiple
  872. // contexts share the same model.
  873. //
  874. // Namespaces of 1 - 10000 is reserved for Contexts.
  875. // For any clarification, always contact context-team@
  876. enum ContextName {
  877. // The context name is unknown.
  878. UNKNOWN_CONTEXT_NAME = 0;
  879. // The user's current location.
  880. USER_LOCATION = 1;
  881. // How familiar the user is with their current location (tourist vs. local).
  882. USER_LOCATION_FAMILIARITY = 2 [deprecated = true];
  883. // Predicted future locations that the user will be at.
  884. USER_LOCATION_FORECAST = 3 [deprecated = true];
  885. // The Maps viewport that the user is currently looking at.
  886. MAPS_VIEWPORT = 4;
  887. // How familiar the user is with the Maps viewport they are currently looking
  888. // at (tourist vs. local).
  889. MAPS_VIEWPORT_FAMILIARITY = 5;
  890. // Detected activity of the user.
  891. DETECTED_ACTIVITY = 6;
  892. // Device screen state: on/off
  893. SCREEN = 7;
  894. // Device power connection state: connected/disconnected
  895. POWER_CONNECTION = 8;
  896. // Signal related to current trust state of the device (ex. Connection state
  897. // of devices, signals from facial recognition, user activity or location
  898. // affinity.
  899. TRUST_SIGNAL = 9;
  900. // A decision evaluated by a decision engine about how much the device is
  901. // currently secure.
  902. TRUST_DECISION = 10;
  903. // Use these context names if experimenting with the Context Manager for the
  904. // first time. In order to query for experimental context types, be sure
  905. // to include keys in the Key field when inserting Context objects into
  906. // Context Manager. For more information see go/experimental-context-name
  907. // EXPERIMENTAL1_UPLOAD_RESTRICTED is an upload restricted context name,
  908. // meaning it will not be uploaded to the backend context manager server.
  909. // Use this for experimental contexts that are prohibited from syncing.
  910. EXPERIMENTAL1_UPLOAD_RESTRICTED = 11;
  911. // The 2 and 3 are not upload restricted. These will be synced to the
  912. // backend.
  913. EXPERIMENTAL2_UPLOAD_OK = 12;
  914. EXPERIMENTAL3_UPLOAD_OK = 13;
  915. // Snapped-to-road locations as provided by GMM in navigation mode.
  916. SNAPPED_TO_ROAD_LOCATION = 14;
  917. // High-level semantic time, location and activity state of the user.
  918. SEMANTIC_STATE = 15;
  919. // User's travel context, e.g., trips, locations, travel modes, etc.
  920. TRAVEL = 16;
  921. // User's device wifi scan results.
  922. WIFI_SCAN = 17;
  923. // Places context. See android places api.
  924. PLACES = 18;
  925. // Calendar events for the user.
  926. CALENDAR_EVENT = 19;
  927. // APPS that are running at a given time interval. This is obtained via the
  928. // UsageStatsManager for Lollipop+ platform versions, and via ActivityManager
  929. // for pre Lollipop.
  930. // Deprecated. consider using UsageStatsManager API directly.
  931. RUNNING_APPS = 20 [deprecated = true];
  932. // The topics about which the user will be interested in consuming content.
  933. CONTENT_INTERESTS = 21;
  934. // Cast events.
  935. CAST_EVENT = 22;
  936. // Places that are of interest to the user.
  937. PLACE_INTERESTS = 23 [deprecated = true];
  938. // Audio state for the device provided by Android's audio manager.
  939. AUDIO_STATE = 24;
  940. // State of the User's phone, whether it is locked or unlocked.
  941. PHONE_LOCK = 25;
  942. // Detected beacon attachments from scanned BLE beacons.
  943. DETECTED_BEACON = 26;
  944. // State of the network connection, if connected whether it is on WiFi or
  945. // Cellular
  946. NETWORK_STATE = 27;
  947. // Locations the user recently visited.
  948. RECENT_VISITS = 28;
  949. // Snapped place location of the user. Obtained from Hulk STP backend
  950. // based on user's lat/lng location, detected activity, nearby Wifi signals,
  951. // BLE beacons, etc.
  952. SNAPPED_PLACES = 29;
  953. // Snapped city location of the user. Obtained by reverse geocoding
  954. // the user's lat/lng location.
  955. SNAPPED_CITY = 30 [deprecated = true];
  956. // Context for the weather information.
  957. WEATHER = 31;
  958. // User's wandering state context, i.e. distance spanned by a device in
  959. // a given time interval
  960. WANDER_STATE = 32;
  961. // User's affinities with service providers.
  962. PROVIDER_AFFINITIES = 34;
  963. // User's detected routines
  964. ROUTINES = 35 [deprecated = true];
  965. // Attributes of the day corresponding to the current time and locale
  966. // As examples, some attributes are: MORNING, EVENING, WEEKDAY,
  967. // WEEKEND, HOLIDAY.
  968. DAY_ATTRIBUTES = 36;
  969. // Phone call state
  970. PHONE_CALL = 37 [deprecated = true];
  971. // Proximity distance reported by the proximity sensor
  972. PROXIMITY_DISTANCE = 38;
  973. // Installed applications on the device
  974. INSTALLED_APPS = 39;
  975. // Shopping related contexts (e.g. Shopping product profiles from
  976. // web and Chrome)
  977. SHOPPING = 40;
  978. // Users Personas. go/persona
  979. PERSONAS = 41 [deprecated = true];
  980. // Users language preferences. go/now-u-languages-design
  981. LANGUAGES = 42;
  982. // Sunrise and sunset times of the day at the device's location
  983. SUN_STATE = 43;
  984. // User demographics (e.g. age, gender, income bracket)
  985. DEMOGRAPHICS = 44;
  986. // Properties of time (such as time zone at device's locale). This is similar
  987. // to LOCALE_BASED_TIME_MODEL but does not need a network call. The guiding
  988. // principle has been to have flat organization for contexts despite possible
  989. // overlap. The alternative of having the same context being produced from
  990. // client or server introduces code complexity that gets unmaintainable.
  991. // This context is part of the same SEMANTIC_TIME family.
  992. TIME_PROPERTY = 45;
  993. // Predicted future locations the user will go to.
  994. // This context will eventually replace USER_LOCATION_FORECAST
  995. DESTINATION_PREDICTION = 46;
  996. // Where the user has a vehicle parked and related information such as how
  997. // long they can park there, how to find the parking spot, etc.
  998. PARKING_LOCATIONS = 47;
  999. // User's current direction and speed
  1000. USER_VELOCITY = 48;
  1001. // Context from user's Gmail, e.g. movie tickets, flight information,
  1002. // restaurant reservation, etc.
  1003. PERSONAL_INTELLIGENCE = 49;
  1004. // The contextual pivot for a search query, e.g. a KG mid, a location, etc.
  1005. // This is provided as part of search requests to describe the thing that a
  1006. // query is pivoted around.
  1007. QUERY_PIVOT = 50;
  1008. // Intents predicted by the intent system (go/pips).
  1009. // Deprecated. This context is currently not supported. Please email to
  1010. // user-model-clients@google.com before use it.
  1011. PROACTIVE_INTENTS = 51 [deprecated = true];
  1012. // XGeo header
  1013. XGEO_HEADER = 52 [deprecated = true];
  1014. // User's location history and location habits. See go/distill
  1015. DISTILL_LOCATION_PROFILE = 53 [deprecated = true];
  1016. // Trained user embeddings.
  1017. USER_EMBEDDING = 54;
  1018. // Weather context for internal (first-party) clients
  1019. WEATHER_INTERNAL = 55;
  1020. // Trained entity embeddings for user interests.
  1021. INTEREST_ENTITY_EMBEDDINGS = 56;
  1022. // Prediction for whether the device is indoors or outdoors
  1023. // automatic read/write permissions
  1024. INDOOR_OUTDOOR = 57;
  1025. // User's inferred task and task related suggestions.
  1026. VASCO_TASK_SUGGESTIONS = 58;
  1027. // Probability of user in DND mode
  1028. DND_MODE = 59;
  1029. // Filtered CurrentPlaces context, based on filtered PlaceUpdates.
  1030. CURRENT_PLACES = 60;
  1031. // Aware profile (go/search-aware).
  1032. AWARE_PROFILE = 61;
  1033. // The language (ISO 639-1) and country (ISO 3166-1) codes, such as "en_US",
  1034. // of the device that made the request. It belongs to the DEVICE_STATE family.
  1035. DEVICE_LOCALE = 62;
  1036. // All activity in a timeline (go/unified-activity-overview).
  1037. ACTIVITY_TIMELINE = 63;
  1038. // Current Maps turn-by-turn navigation state. See
  1039. // go/gmm-guided-navigation-state-export.
  1040. MAPS_NAVIGATION_STATE = 67;
  1041. // The user's device information as gathered in Search. Uses
  1042. // superroot/impls/web/proto/device.proto as representation.
  1043. SEARCH_DEVICE = 68;
  1044. // Scores related to sending geo notifications computed from internal ML
  1045. // models. (go/ml-for-ugc-notifications).
  1046. GEO_NOTIFICATION_SCORES = 70;
  1047. // Interest similarity. A list of related entity interests with support for
  1048. // different types and verticals.
  1049. INTEREST_ENTITY_SIMILARITY = 71;
  1050. // Entities consumed by a user and related metadata. (It covers use cases
  1051. // like metadata about watching a movie / tv show or buying a book etc).
  1052. CONTENT_CONSUMPTION = 73;
  1053. // User's semantic location state for at-home, at-work, and traveling.
  1054. SEMANTIC_LOCATION = 74 [deprecated = true];
  1055. // Set of locations (IP location, device location, historic location, etc)
  1056. LOCATION_CONTEXT = 75;
  1057. // The input method of the query, e.g. typed or voice.
  1058. SEARCH_INPUT_METHOD = 76;
  1059. // Knowledge-specific params.
  1060. KE_PARAMS = 77;
  1061. // State of the user w.r.t Product. This is intended to serve
  1062. // lightweight product specific information about a user e.g opt-in age,
  1063. // activity levels, etc.
  1064. PRODUCT_USER_STATE = 78;
  1065. // `ACTIVITY_TRANSPOSE` is deprecated.
  1066. ACTIVITY_TRANSPOSE = 79 [deprecated = true];
  1067. // Search ugc interests, contains entity-level and user-level aggregated
  1068. // signals about user's activities with Search UGC features.
  1069. SEARCH_UGC_INTERESTS = 80;
  1070. // Context indicating user is currently on commute.
  1071. ON_COMMUTE = 81;
  1072. // Relations (Caretaker, Owner, Employee) users have to places
  1073. // go/user-relation-to-place-anima.
  1074. USER_RELATION_TO_PLACES = 82;
  1075. // State capturing user interactions in Discover sliced by card category,
  1076. // content topic etc. which will be used by interest exploration efforts
  1077. // (go/exploration-state-design).
  1078. DISCOVER_ACTIONS_PROFILE = 84;
  1079. // Returns user's related activities given a set of input activities.
  1080. // (go/related-activity-api-proto-proposal).
  1081. RELATED_ACTIVITY = 85;
  1082. // Stateful Task APIs: go/stateful-task-apis
  1083. STATEFUL_ACTIVITY_RECOMMENDED = 86;
  1084. STATEFUL_ACTIVITY_RELATED = 87;
  1085. STATEFUL_ACTIVITY_RENDERABLE = 88;
  1086. STATEFUL_TASK_ACTIVE = 89;
  1087. STATEFUL_TASK_RELATED = 90;
  1088. // Stateful API v2 (go/stateful-api-v2)
  1089. STATEFUL_TASK = 128;
  1090. STATEFUL_TASK_ACTIVITY_CARD = 130;
  1091. STATEFUL_TASK_DISCOVER = 131;
  1092. STATEFUL_TASK_TASK_HUB = 137;
  1093. STATEFUL_TASK_NOTIFICATIONS = 142;
  1094. // State of the currently connected wifi connection
  1095. WIFI_CONNECTION_STATE = 91;
  1096. // User contribution data for geo UGC. go/ugc-motivation.
  1097. GEO_UGC_MOTIVATION = 92;
  1098. // User's search suggestion state, such as previous query and suggested
  1099. // queries from recent queries (go/suggest-context).
  1100. SEARCH_SUGGEST_STATE = 93;
  1101. // User's predicted Geo Merchant Identification state (go/mid-anima).
  1102. GEO_MERCHANT_IDENTIFICATION_STATE = 94;
  1103. // Affinity signals from Sherlock.
  1104. SHERLOCK_AFFINITY = 95;
  1105. // User Activity Counts (go/user-activity-counts).
  1106. USER_ACTIVITY_COUNTS = 96;
  1107. // Shopping preferences model
  1108. SHOPPING_PREFERENCE_PROFILE = 97;
  1109. // Users contribution data for Get-on-Google (go/gog). Includes stats about
  1110. // previous contributions, contribution views, topic interests, and topic
  1111. // tasks.
  1112. GOG_CONTRIBUTOR_PROFILE = 98;
  1113. // Crosspath representative items.
  1114. CROSSPATH_REPRESENTATIVE_ITEMS = 99;
  1115. // Entity History Model which holds entities the user might want to re-engage
  1116. // with in evergreen verticals like Books and Video Games. go/ehm
  1117. ENTITY_HISTORY = 100;
  1118. // Discover User Actions Profile which holds personalized aggregate counts of
  1119. // actions sliced by custom dimensions over longer term time windows.
  1120. // go/discover-uap-redesign
  1121. DISCOVER_USER_ACTIONS_PROFILE = 101;
  1122. // LOCAL_ADS_ENTITY_PREFERENCES represents the serving analog for the local
  1123. // ads entity preference model (go/anima-local-ads-entity-model). The model
  1124. // represents KG entities which the user has shown a preference for based on
  1125. // the Ads-approved activities across Google products.
  1126. LOCAL_ADS_ENTITY_PREFERENCES = 102;
  1127. // Aggregated clicks on merchant websites. See go/scaling-merchant-reviews.
  1128. MERCHANT_CLICK_COUNTS = 103;
  1129. // Model containing aggregated views of Get on Google Cameos across platforms
  1130. // (assistant, SRP, Discover, Topic Feed)
  1131. GOG_CAMEO_VIEWS = 104;
  1132. // Single-day aggregate counts of distinct Semantic User Needs (SUNs) in
  1133. // the user's activity timeline. (See: go/nash-pre-suns)
  1134. DAILY_SUN_COUNTS = 105;
  1135. // Representation Assistant Recipe Embeddings.
  1136. ASSISTANT_RECIPE_USER_EMBEDDINGS = 106;
  1137. // Representation of Assistant Recipe Embeddings inferred during request-time.
  1138. ASSISTANT_RECIPE_ONLINE_USER_EMBEDDINGS = 145;
  1139. // Representation of Core Interest Embeddings.
  1140. CORE_INTEREST_EMBEDDINGS = 107;
  1141. // Representation of Event User Embedding.
  1142. EVENT_USER_EMBEDDINGS = 108;
  1143. // Representation of Podcast User Embedding.
  1144. PODCAST_USER_EMBEDDINGS = 109;
  1145. // Representation of Long term interest embeddings.
  1146. LONG_TERM_INTEREST_EMBEDDINGS = 110;
  1147. // Representation of Horizontal User Embeddings.
  1148. HORIZONTAL_USER_EMBEDDINGS = 135;
  1149. // Monet online embeddings.
  1150. MONET_ONLINE_EMBEDDINGS = 138;
  1151. // Representation of Tvn Timeline Signals.
  1152. TVM_TIMELINE_SIGNALS_FEATURES = 111;
  1153. // Representation of qualia profile for Discover feed.
  1154. DISCOVER_QUALIA_PROFILE = 112;
  1155. // Representation of qualia profile for GNews.
  1156. NEWS_QUALIA_PROFILE = 127;
  1157. // Representation of monet embeddings model input features.
  1158. DISCOVER_MONET_EMBEDDINGS_FEATURES = 113;
  1159. // Representation of monet pilot embeddings model input features.
  1160. DISCOVER_MONET_PILOT_EMBEDDINGS_FEATURES = 144;
  1161. // Representation of monet holdback embeddings model input features.
  1162. DISCOVER_MONET_HOLDBACK_EMBEDDINGS_FEATURES = 148;
  1163. // TVM items click counts, within what-to-watch. Includes item clicks (W2W)
  1164. // and clicks on 'watch now' button (W2W and Amati).
  1165. W2W_CLICKS = 114;
  1166. // Aggregated TVM items clicks, impressions and other relevant signals in W2W,
  1167. // Amati and other surfaces. go/recomedia-freshness
  1168. W2W_STATEFULNESS = 132;
  1169. // Representation of user embeddings for recomedia TVM vertical.
  1170. RECOMEDIA_TVM_USER_EMBEDDINGS = 115;
  1171. // Representation of user embeddings for books vertical.
  1172. RECOMEDIA_BOOKS_USER_EMBEDDINGS = 136;
  1173. // User's implicit watch state across products, i.e. Search, Amati, and
  1174. // Primetime. go/ump-implicit-watch
  1175. UMP_IMPLICIT_WATCH = 116;
  1176. // Representation of Hobbes DeepTrends IDLE user embeddings.
  1177. HOBBES_DEEP_TRENDS_IDLE_USER_EMBEDDINGS = 117;
  1178. // Representation of Hobbes DeepTrends FaBLE user embeddings.
  1179. HOBBES_DEEP_TRENDS_FABLE_USER_EMBEDDINGS = 118;
  1180. // Representation of signals needed to determine churn probability of a user.
  1181. // go/aga-churn-notif-design
  1182. AGA_CHURN_PREVENTION_MODEL = 119;
  1183. // User Activity Store on Evergreen Content (a.k.a., RoutinesMemory Redesign).
  1184. // go/user-activity-store-on-evergreen-content
  1185. USER_ACTIVITY_STORE_ON_EVERGREEN_CONTENT = 120;
  1186. // Url view demotion PSM, containing counts of docids from Chrome, Search,
  1187. // and Discover per time ranges.
  1188. // go/psm-view-demotion-aggregates
  1189. VIEW_DEMOTION_AGGREGATES = 125;
  1190. // Representation of user embeddings model for Shopping Property user
  1191. // timeline.
  1192. SHOPPING_PROPERTY_USER_TIMELINE = 121;
  1193. // Representation of the signals needed to determine churn probability in
  1194. // opa for a user.
  1195. GROWTH_FACTORS_OPA_CHURN_MODEL = 122;
  1196. // LOCAL_ADS_CHAIN_ENTITY_PREFERENCES represents the serving analog for the
  1197. // local ads chain entity preference model. The model scores KG entities
  1198. // pertaining to business chains which the user has shown a preference for
  1199. // based on the Ads-approved activities across Google products.
  1200. LOCAL_ADS_CHAIN_ENTITY_PREFERENCES = 123;
  1201. // Representation of the user profile generated by Qualia model during serving
  1202. // time based on features extracted from both LTAT and STAT.
  1203. QUALIA_ONLINE_PROFILE = 126;
  1204. // Representation of Books Timeline Signals.
  1205. BOOKS_TIMELINE_SIGNALS_FEATURES = 129;
  1206. // Representation of Handbag Personalized entities.
  1207. HANDBAG_PERSONALIZED_ENTITIES = 133;
  1208. // Represents the backfill analog for the local
  1209. // ads entity preference model (go/anima-local-ads-entity-model). The model
  1210. // represents KG entities which the user has shown a preference for based on
  1211. // the Ads-approved activities across Google products.
  1212. LOCAL_ADS_HISTORICAL_ENTITY_PREFERENCES = 134;
  1213. // Representation of Deep Now `ContextFeatures` signals. Note that this is a
  1214. // temporary solution and should not be used for other external use cases.
  1215. // TODO(b/187311600): Clean up DEEP_NOW_CONTEXT_FEATURES
  1216. DEEP_NOW_CONTEXT_FEATURES = 139;
  1217. // Represents the Hobbes user embeddings model for Hotels Ranking.
  1218. HOTEL_HOBBES_USER_EMBEDDINGS = 140;
  1219. // Representation of the petacat profile generated by Petacat model during
  1220. // serving time.
  1221. PETACAT_ONLINE_PROFILE = 143;
  1222. // Represents user's recent actions on documents.
  1223. RECENT_URL_ACTIONS = 146;
  1224. // Represents user's recent activity signals that is local related.
  1225. LOCAL_RELATED_RECENT_ACTIVITY_SIGNALS = 147;
  1226. // Profile of documents by domain visited by the user across google e.g.
  1227. // Search and Chrome (go/wind-rose-data).
  1228. WIND_ROSE_PROFILE = 149;
  1229. // Represents the user's U-SERP profile, i.e. how much they like/dislike
  1230. // certain OneNamespace types (go/u-serp).
  1231. USERP = 150;
  1232. // Next Context Id: 151
  1233. //---------------------------------------------------------------------------
  1234. // Context Manager Internal Contexts. These are usually contexts such as
  1235. // models that are used by the first party apps for synchronization from
  1236. // cloud, or used by context manager for creating other higher level
  1237. // contexts.
  1238. // A range of [10000 - 19999] is reserved.
  1239. // Next Id: 10010
  1240. //---------------------------------------------------------------------------
  1241. // Model for the USER_LOCATION_FAMILIARITY context.
  1242. USER_LOCATION_FAMILIARITY_MODEL = 10000;
  1243. // Model that is trained for a user based upon the hotword detection.
  1244. // Hotword detection is also known as Keyword Spotting and is the task
  1245. // of detecting a pre-defined Hotword like “Ok Google” in a continuous
  1246. // audio stream.
  1247. // These already trained models can be pushed from cloud to device where
  1248. // they can be used as preconfigured for voice search on a new or resetted
  1249. // device.
  1250. HOTWORD_SPEAKER_MODEL = 10001;
  1251. // Model representing the UDC settings.
  1252. UDC_FOOTPRINTS_SETTINGS_MODEL = 10002;
  1253. // Model that is used for predicting safe locations for a user.
  1254. // These locations can be marked as trusted locations on the device,
  1255. // used for creating an overall trust/confidence score etc.
  1256. SAFE_LOCATION_MODEL = 10003;
  1257. // A set of places for which we have personal data for ELSA to use for place
  1258. // inference. This includes the user's home and work, and places for which
  1259. // they have interactions in the GeoJournalSummary. See
  1260. // http://go/elsa-geojournal.
  1261. PERSONALIZED_PLACES = 10004;
  1262. // A set of places which user has set aliases, such as HOME/WORK
  1263. ALIASED_PLACES = 10005;
  1264. // A special type of Context Manager's internal context that represents the
  1265. // encoded bytes of a differential context.
  1266. CONTEXT_DELTA = 10006;
  1267. // Model that represents information about time that is expressed
  1268. // semantically and dependent on locale. For example, notions of weekday,
  1269. // weekend, holiday refer to time but are dependent on country.
  1270. // In addition this includes personalized day parts such as start of day,
  1271. // morning, evening which is user dependent.
  1272. LOCALE_BASED_TIME_MODEL = 10007;
  1273. // Representation for the feedback to be collected about the fence states
  1274. FENCE_FEEDBACK = 10008;
  1275. // Information about the fence state. This includes the fence key, the event
  1276. // related to the fence and the condition of the fence
  1277. FENCE_STATE = 10009;
  1278. // Representation of domain interests
  1279. DOMAIN_INTERESTS = 10011;
  1280. reserved 33, 64, 65, 66, 69, 72, 83, 124, 141, 10010;
  1281. // Next Model Id: 10012
  1282. //---------------------------------------------------------------------------
  1283. // The following block is reserved by Context Manager for generic local
  1284. // contexts, that are produced by a local app or process.
  1285. // UNSPECIFIED_LOCAL_CONTEXTx tags are left in as placeholders so proto
  1286. // parsing does not eliminate them. Each tag should be renamed appropriately
  1287. // once claimed.
  1288. //---------------------------------------------------------------------------
  1289. // Marker for start of the block; default length is 100, expandable to 1000
  1290. LOCALLY_PRODUCED_BLOCK_START_MARKER = 10999;
  1291. // Next locally-produce Context Id: 11000 (claim the name below)
  1292. UNSPECIFIED_LOCAL_CONTEXT0 = 11000;
  1293. UNSPECIFIED_LOCAL_CONTEXT1 = 11001;
  1294. UNSPECIFIED_LOCAL_CONTEXT2 = 11002;
  1295. UNSPECIFIED_LOCAL_CONTEXT3 = 11003;
  1296. UNSPECIFIED_LOCAL_CONTEXT4 = 11004;
  1297. UNSPECIFIED_LOCAL_CONTEXT5 = 11005;
  1298. UNSPECIFIED_LOCAL_CONTEXT6 = 11006;
  1299. UNSPECIFIED_LOCAL_CONTEXT7 = 11007;
  1300. UNSPECIFIED_LOCAL_CONTEXT8 = 11008;
  1301. UNSPECIFIED_LOCAL_CONTEXT9 = 11009;
  1302. //---------------------------------------------------------------------------
  1303. // This block is reserved by Context Manager for generic remote
  1304. // contexts, that are produced on-demand via CMFE. The
  1305. // UNSPECIFIED_BACKEND_CONTEXTx tags are left in as placeholders so proto
  1306. // parsing does not eliminate them. Each tag should be renamed appropriately
  1307. // once claimed.
  1308. //---------------------------------------------------------------------------
  1309. // Marker for start of the block; default length is 100, expandable to 1000
  1310. BACKEND_PRODUCED_BLOCK_START_MARKER = 11999;
  1311. // Next Backend-produce Context Id: 12000 (claim the name below)
  1312. UNSPECIFIED_BACKEND_CONTEXT0 = 12000;
  1313. UNSPECIFIED_BACKEND_CONTEXT1 = 12001;
  1314. UNSPECIFIED_BACKEND_CONTEXT2 = 12002;
  1315. UNSPECIFIED_BACKEND_CONTEXT3 = 12003;
  1316. UNSPECIFIED_BACKEND_CONTEXT4 = 12004;
  1317. UNSPECIFIED_BACKEND_CONTEXT5 = 12005;
  1318. UNSPECIFIED_BACKEND_CONTEXT6 = 12006;
  1319. UNSPECIFIED_BACKEND_CONTEXT7 = 12007;
  1320. UNSPECIFIED_BACKEND_CONTEXT8 = 12008;
  1321. UNSPECIFIED_BACKEND_CONTEXT9 = 12009;
  1322. //---------------------------------------------------------------------------
  1323. // Context names > 100_000 are reserved for experimentation by various teams,
  1324. // These contexts will have automatic read/write permission for everyone, but
  1325. // should NOT be submitted!
  1326. // Next Id: 100001
  1327. //---------------------------------------------------------------------------
  1328. // Dummy context, used to mark beginning of range
  1329. DUMMY_EXPERIMENTAL_AUTO_RW_MARKER = 99999;
  1330. DUMMY_EXPERIMENTAL_AUTO_RW_1 = 100000;
  1331. }
  1332. // Represents a context fence, which can either be an AND,
  1333. // OR, or NOT of other context fences. Or, one of the fences for
  1334. // a particular context name.
  1335. message ContextFence {
  1336. // WARNING! This protocol buffer has a unique equals() method in its nano
  1337. // implementation. See cl/209825626 and b/112847166. The default nano
  1338. // equals method somehow causes pathological performance in dex2oat in
  1339. // Lollipop devices, so bad that GMS Core can never start. This is dependent
  1340. // also on which member messages are in different dex files dependent on
  1341. // which bytecode ProGuard generates. Instead, the equals() method generated
  1342. // for this just delegates to MessageNano.messageNanoEquals which is slower.
  1343. enum Type {
  1344. UNKNOWN_CONTEXT_FENCE_TYPE = 0;
  1345. AND = 1; // AND expression
  1346. OR = 2; // OR expression
  1347. NOT = 3; // NOT expression
  1348. TIME_FENCE = 4; // Time-based fence
  1349. LOCATION_FENCE = 5; // Location-based fence
  1350. PLACE_FENCE = 6; // Place-based fence
  1351. ACTIVITY_FENCE = 7; // Activity-based fence
  1352. SCREEN_FENCE = 8; // Screen-based fence
  1353. POWER_CONNECTION_FENCE = 9; // Power connection-based fence
  1354. PHONE_LOCK_FENCE = 10; // Phone lock fence
  1355. AUDIO_STATE_FENCE = 11; // Audio state fence
  1356. BEACON_FENCE = 12; // Beacon fence
  1357. NETWORK_STATE_FENCE = 13; // Network state fence
  1358. WANDER_STATE_FENCE = 14; // Wander state fence
  1359. TIME_INTERVAL_FENCE = 15; // Time fence specified using day attributes
  1360. INSTALLED_APPS_FENCE = 16; // Installed apps fence
  1361. PHONE_CALL_FENCE = 17; // Phone call based fence
  1362. PROXIMITY_DISTANCE_FENCE = 18; // Proximity distance based fence
  1363. SUN_STATE_FENCE = 19; // Sun-state based fence
  1364. LOCAL_TIME_FENCE = 20; // Local-time-based fence
  1365. WEATHER_FENCE = 21; // Weather-based fence
  1366. PREDICTIVE = 22; // Predictive fence
  1367. SHUSH_STATE_FENCE = 23; // Shush state fence
  1368. WIFI_STATE_FENCE = 24; // Wifi state fence
  1369. }
  1370. optional Type type = 1;
  1371. // For AND and OR types, this is the list of ContextFence messages
  1372. // that should be ANDed or ORed together. For NOT type, this
  1373. // should contain a single element.
  1374. repeated ContextFence fence_list = 2;
  1375. // Should be set only when type is TIME_FENCE.
  1376. optional TimeFence time_fence = 3;
  1377. // Should be set only when type is LOCATION_FENCE.
  1378. optional LocationFence location_fence = 4;
  1379. // Should be set only when type is PLACE_FENCE.
  1380. optional PlaceFence place_fence = 5;
  1381. // Should be set only when type is ACTIVITY_FENCE.
  1382. optional ActivityFence activity_fence = 6;
  1383. // Should be set only when type is SCREEN_FENCE.
  1384. optional ScreenFence screen_fence = 7;
  1385. // Should be set only when type is POWER_CONNECTION_FENCE.
  1386. optional PowerConnectionFence power_connection_fence = 8;
  1387. // Should be set only when the type is PHONE_LOCK_FENCE.
  1388. optional PhoneLockFence phone_lock_fence = 9;
  1389. // Should be set only when the type if AUDIO_STATE_FENCE.
  1390. optional AudioStateFence audio_state_fence = 10;
  1391. // Should be set only when the type is BEACON_FENCE.
  1392. optional BeaconFence beacon_fence = 11;
  1393. // Should be set only when the type is NETWORK_STATE_FENCE.
  1394. optional NetworkStateFence network_state_fence = 12;
  1395. // Encapsulates the source that evaluates this fence.
  1396. optional Source source = 13;
  1397. // Should be set only when the type is WANDER_STATE_FENCE.
  1398. optional WanderStateFence wander_state_fence = 14;
  1399. // Should be set only when the type is TIME_INTERVAL_FENCE.
  1400. optional TimeIntervalFence time_interval_fence = 15;
  1401. // Should be set only when the type is INSTALLED_APPS_FENCE.
  1402. optional InstalledAppsFence installed_apps_fence = 16;
  1403. // Should be set only when the type is PHONE_CALL_FENCE.
  1404. optional PhoneCallFence phone_call_fence = 17;
  1405. // Should be set only when the type is PROXIMITY_DISTANCE_FENCE.
  1406. optional ProximityDistanceFence proximity_distance_fence = 18;
  1407. // Should be set only when the type is SUN_STATE_FENCE.
  1408. optional SunStateFence sun_state_fence = 19;
  1409. // Should be set only when type is LOCAL_TIME_FENCE.
  1410. optional TimeFence local_time_fence = 20;
  1411. // Should be set only when type is WEATHER_FENCE.
  1412. optional WeatherFence weather_fence = 21;
  1413. // Contexts to be snapshot when fence triggers.
  1414. repeated ContextName requested_snapshot = 22;
  1415. // Contain parameters for predictive fences,
  1416. // null if the fence is not predictive
  1417. optional PredictiveParameters predictive_parameters = 23;
  1418. // Should be set only when type is SHUSH_STATE_FENCE.
  1419. optional ShushStateFence shush_state_fence = 24;
  1420. // Should be set only when type is WIFI_STATE_FENCE.
  1421. optional WifiStateFence wifi_state_fence = 25;
  1422. // Next Tag: 26
  1423. }
  1424. // Encapsulates the source metadata associated with a context fence.
  1425. // This is useful for the distributed fences, when a particular context fence
  1426. // can be remotely evaluated on a different device.
  1427. message Source {
  1428. // TODO(b112847166): Re-migrate to lite after we understand how to avoid this
  1429. // from getting pulled into the main dex and causing catastrophic failures.
  1430. // [REQUIRED]
  1431. optional string account_name = 1;
  1432. }
  1433. // Represents an expression for representing the date time.
  1434. message DateTime {
  1435. // TODO(b112847166): Re-migrate to lite after we understand how to avoid this
  1436. // from getting pulled into the main dex and causing catastrophic failures.
  1437. // Represents the year for the date time.
  1438. // For example: 2015
  1439. optional int32 year = 1;
  1440. // Represents the month for the date time with values ranging
  1441. // from 0 to 11. Example, January is represented as 0 and December
  1442. // as 11.
  1443. optional int32 month = 2;
  1444. // Represents the day of the month
  1445. // The first day of the month has a value of 1.
  1446. // Example January 1 will have day as 1, January 2 will
  1447. // have day as 2 respectively.
  1448. optional int32 day = 3;
  1449. // Represents the hour of the day as a 24 hour clock.
  1450. // Range of valid values is 0 - 23, example for 10:04:15 PM
  1451. // the HOUR_OF_DAY is 22
  1452. optional int32 hour = 4;
  1453. // Represents the minute with in the hour.
  1454. // Range of valid values is 0 - 59, example at 10:04:15 PM
  1455. // the MINUTE is 4
  1456. optional int32 minutes = 5;
  1457. // Represents the seconds with in the minute.
  1458. // Range of valid values is 0 - 59, example at 10:04:15 PM
  1459. // the SECOND is 15
  1460. optional int32 seconds = 6;
  1461. }
  1462. message PredictiveParameters {
  1463. // Minimum confidence level for a predictive fence to be triggered.
  1464. optional int32 prediction_confidence_level = 1;
  1465. // Time duration within which prediction will be considered.
  1466. optional int64 prediction_time_millis = 2;
  1467. // Next Tag: 25
  1468. }