mobile/android/base/background/healthreport/Environment.java

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:a6043edd9c7b
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 package org.mozilla.gecko.background.healthreport;
6
7 /**
8 * This captures all of the details that define an 'environment' for FHR's purposes.
9 * Whenever this format changes, it'll be changing with a build ID, so no migration
10 * of values is needed.
11 *
12 * Unless you remove the build descriptors from the set, of course.
13 *
14 * Or store these in a database.
15 *
16 * Instances of this class should be considered "effectively immutable": control their
17 * scope such that clear creation/sharing boundaries exist. Once you've populated and
18 * registered an <code>Environment</code>, don't do so again; start from scratch.
19 *
20 */
21 public abstract class Environment extends EnvironmentV1 {
22 // Version 2 adds osLocale, appLocale, acceptLangSet, and distribution.
23 public static final int CURRENT_VERSION = 2;
24
25 public String osLocale; // The Android OS "Locale" value.
26 public String appLocale;
27 public int acceptLangSet;
28 public String distribution; // ID + version. Typically empty.
29
30 public Environment() {
31 this(Environment.HashAppender.class);
32 }
33
34 public Environment(Class<? extends EnvironmentAppender> appenderClass) {
35 super(appenderClass);
36 version = CURRENT_VERSION;
37 }
38
39 @Override
40 protected void appendHash(EnvironmentAppender appender) {
41 super.appendHash(appender);
42
43 // v2.
44 appender.append(osLocale);
45 appender.append(appLocale);
46 appender.append(acceptLangSet);
47 appender.append(distribution);
48 }
49 }

mercurial