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

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     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/. */
     5 package org.mozilla.gecko.background.healthreport;
     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;
    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.
    30   public Environment() {
    31     this(Environment.HashAppender.class);
    32   }
    34   public Environment(Class<? extends EnvironmentAppender> appenderClass) {
    35     super(appenderClass);
    36     version = CURRENT_VERSION;
    37   }
    39   @Override
    40   protected void appendHash(EnvironmentAppender appender) {
    41     super.appendHash(appender);
    43     // v2.
    44     appender.append(osLocale);
    45     appender.append(appLocale);
    46     appender.append(acceptLangSet);
    47     appender.append(distribution);
    48   }
    49 }

mercurial