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