DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (dc32c9061a0a)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
//#filter substitution
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.gecko;

import android.os.Build;
import android.support.v4.os.BuildCompat;

/**
 * A collection of constants that pertain to the build and runtime state of the
 * application. Typically these are sourced from build-time definitions (see
 * Makefile.in). This is a Java-side substitute for nsIXULAppInfo, amongst
 * other things.
 *
 * See also SysInfo.java, which includes some of the values available from
 * nsSystemInfo inside Gecko.
 */
// Normally, we'd annotate with @RobocopTarget.  Since AppConstants is compiled
// before RobocopTarget, we instead add o.m.g.AppConstants directly to the
// Proguard configuration.
public class AppConstants {
    public static final String ANDROID_PACKAGE_NAME = "@ANDROID_PACKAGE_NAME@";
    public static final String MANGLED_ANDROID_PACKAGE_NAME = "@MANGLED_ANDROID_PACKAGE_NAME@";

    public static final String MOZ_ANDROID_SHARED_FXACCOUNT_TYPE = "@ANDROID_PACKAGE_NAME@_fxaccount";
    public static final String MOZ_FILE_PROVIDER_AUTHORITY = "@ANDROID_PACKAGE_NAME@.fileprovider";

    /**
     * Encapsulates access to compile-time version definitions, allowing
     * for dead code removal for particular APKs.
     */
    public static final class Versions {
        public static final int MIN_SDK_VERSION = @MOZ_ANDROID_MIN_SDK_VERSION@;
        public static final int MAX_SDK_VERSION =
//#ifdef MOZ_ANDROID_MAX_SDK_VERSION
        @MOZ_ANDROID_MAX_SDK_VERSION@;
//#else
        999;
//#endif

        /*
         * The SDK_INT >= N check can only pass if our MAX_SDK_VERSION is
         * _greater than or equal_ to that number, because otherwise we
         * won't be installed on the device.
         *
         * If MIN_SDK_VERSION is greater than or equal to the number, there
         * is no need to do the runtime check.
         */
        public static final boolean feature16Plus = MIN_SDK_VERSION >= 16 || (MAX_SDK_VERSION >= 16 && Build.VERSION.SDK_INT >= 16);
        public static final boolean feature17Plus = MIN_SDK_VERSION >= 17 || (MAX_SDK_VERSION >= 17 && Build.VERSION.SDK_INT >= 17);
        public static final boolean feature19Plus = MIN_SDK_VERSION >= 19 || (MAX_SDK_VERSION >= 19 && Build.VERSION.SDK_INT >= 19);
        public static final boolean feature20Plus = MIN_SDK_VERSION >= 20 || (MAX_SDK_VERSION >= 20 && Build.VERSION.SDK_INT >= 20);
        public static final boolean feature21Plus = MIN_SDK_VERSION >= 21 || (MAX_SDK_VERSION >= 21 && Build.VERSION.SDK_INT >= 21);
        public static final boolean feature23Plus = MIN_SDK_VERSION >= 23 || (MAX_SDK_VERSION >= 23 && Build.VERSION.SDK_INT >= 23);
        public static final boolean feature24Plus = MIN_SDK_VERSION >= 24 || (MAX_SDK_VERSION >= 24 && Build.VERSION.SDK_INT >= 24);
        public static final boolean feature26Plus = MIN_SDK_VERSION >= 26 || (MAX_SDK_VERSION >= 26 && Build.VERSION.SDK_INT >= 26);
        public static final boolean feature29Plus = MIN_SDK_VERSION >= 29 || (MAX_SDK_VERSION >= 29 && Build.VERSION.SDK_INT >= 29);

        /*
         * If our MIN_SDK_VERSION is 14 or higher, we must be an ICS device.
         * If our MAX_SDK_VERSION is lower than ICS, we must not be an ICS device.
         * Otherwise, we need a range check.
         */
        public static final boolean preMarshmallow = MAX_SDK_VERSION < 23 || (MIN_SDK_VERSION < 23 && Build.VERSION.SDK_INT < 23);
        public static final boolean preLollipopMR1 = MAX_SDK_VERSION < 22 || (MIN_SDK_VERSION < 22 && Build.VERSION.SDK_INT < 22);
        public static final boolean preLollipop = MAX_SDK_VERSION < 21 || (MIN_SDK_VERSION < 21 && Build.VERSION.SDK_INT < 21);
        public static final boolean preJBMR2 = MAX_SDK_VERSION < 18 || (MIN_SDK_VERSION < 18 && Build.VERSION.SDK_INT < 18);
        public static final boolean preJBMR1 = MAX_SDK_VERSION < 17 || (MIN_SDK_VERSION < 17 && Build.VERSION.SDK_INT < 17);
        public static final boolean preJB = MAX_SDK_VERSION < 16 || (MIN_SDK_VERSION < 16 && Build.VERSION.SDK_INT < 16);
        public static final boolean preN = MAX_SDK_VERSION < 24 || (MIN_SDK_VERSION < 24 && Build.VERSION.SDK_INT < 24);
        public static final boolean N = Build.VERSION.SDK_INT == 24 || Build.VERSION.SDK_INT == 25;
        public static final boolean preO = MAX_SDK_VERSION < 26 || (MIN_SDK_VERSION < 26 && Build.VERSION.SDK_INT < 26);
        public static final boolean preQ = MAX_SDK_VERSION < 29 || (MIN_SDK_VERSION < 29 && Build.VERSION.SDK_INT < 29);
    }

    /**
     * The name of the Java class that represents the android application.
     */
    public static final String MOZ_ANDROID_APPLICATION_CLASS = "@MOZ_ANDROID_APPLICATION_CLASS@";
    /**
     * The name of the Java class that launches the browser activity.
     */
    public static final String MOZ_ANDROID_BROWSER_INTENT_CLASS = "@MOZ_ANDROID_BROWSER_INTENT_CLASS@";

    public static final String GRE_MILESTONE = "@GRE_MILESTONE@";

    public static final String MOZ_APP_ABI = "@MOZ_APP_ABI@";
    public static final String MOZ_APP_BASENAME = "@MOZ_APP_BASENAME@";

    // For the benefit of future archaeologists:
    // GRE_BUILDID is exactly the same as MOZ_APP_BUILDID unless you're running
    // on XULRunner, which is never the case on Android.
    public static final String MOZ_APP_BUILDID = "@MOZ_BUILDID@";
    public static final String MOZ_APP_ID = "@MOZ_APP_ID@";
    public static final String MOZ_APP_NAME = "@MOZ_APP_NAME@";
    public static final String MOZ_APP_VENDOR = "@MOZ_APP_VENDOR@";
    public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
    public static final String MOZ_APP_VERSION_DISPLAY = "@MOZ_APP_VERSION_DISPLAY@";
    public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
    public static final String MOZ_APP_UA_NAME = "@MOZ_APP_UA_NAME@";

    // MOZILLA_VERSION is already quoted when it gets substituted in. If we
    // add additional quotes we end up with ""x.y"", which is a syntax error.
    public static final String MOZILLA_VERSION = @MOZILLA_VERSION@;

    public static final String MOZ_MOZILLA_API_KEY = "@MOZ_MOZILLA_API_KEY@";
    public static final boolean MOZ_STUMBLER_BUILD_TIME_ENABLED =
//#ifdef MOZ_ANDROID_MLS_STUMBLER
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_ANDROID_GCM =
//#ifdef MOZ_ANDROID_GCM
    true;
//#else
    false;
//#endif

    public static final String MOZ_ANDROID_GCM_SENDERIDS =
//#ifdef MOZ_MMA_GCM_SENDERID
    "@MOZ_ANDROID_GCM_SENDERID@,@MOZ_MMA_GCM_SENDERID@";
//#else
//#ifdef MOZ_ANDROID_GCM_SENDERID
    "@MOZ_ANDROID_GCM_SENDERID@";
//#else
    null;
//#endif
//#endif

    public static final boolean MOZ_ANDROID_MMA =
//#ifdef MOZ_ANDROID_MMA
    true;
//#else
    false;
//#endif

    public static final String MOZ_CHILD_PROCESS_NAME = "@MOZ_CHILD_PROCESS_NAME@";
    public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
    public static final String OMNIJAR_NAME = "@OMNIJAR_NAME@";
    public static final String OS_TARGET = "@OS_TARGET@";
    public static final String TARGET_XPCOM_ABI = "@TARGET_XPCOM_ABI@";

    public static final String USER_AGENT_BOT_LIKE = "Redirector/" + AppConstants.MOZ_APP_VERSION +
        " (Android; rv:" + AppConstants.MOZ_APP_VERSION + ")";

    public static final String USER_AGENT_FENNEC_MOBILE = "Mozilla/5.0 (Android " +
        Build.VERSION.RELEASE + "; Mobile; rv:" +
        AppConstants.MOZ_APP_VERSION + ") Gecko/" +
        AppConstants.MOZ_APP_VERSION + " Firefox/" +
        AppConstants.MOZ_APP_VERSION;

    public static final String USER_AGENT_FENNEC_TABLET = "Mozilla/5.0 (Android " +
        Build.VERSION.RELEASE + "; Tablet; rv:" +
        AppConstants.MOZ_APP_VERSION + ") Gecko/" +
        AppConstants.MOZ_APP_VERSION + " Firefox/" +
        AppConstants.MOZ_APP_VERSION;

    public static final boolean MOZ_ANDROID_ANR_REPORTER =
//#ifdef MOZ_ANDROID_ANR_REPORTER
    true;
//#else
    false;
//#endif

    public static final String MOZ_PKG_SPECIAL =
//#ifdef MOZ_PKG_SPECIAL
    "@MOZ_PKG_SPECIAL@";
//#else
    null;
//#endif

    public static final boolean MOZ_EXCLUDE_HYPHENATION_DICTIONARIES =
//#ifdef MOZ_EXCLUDE_HYPHENATION_DICTIONARIES
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_SERVICES_HEALTHREPORT =
//#ifdef MOZ_SERVICES_HEALTHREPORT
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_TELEMETRY_ON_BY_DEFAULT =
//#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
    true;
//#else
    false;
//#endif

    public static final String TELEMETRY_PREF_NAME =
          "toolkit.telemetry.enabled";

    public static final boolean MOZ_TELEMETRY_REPORTING =
//#ifdef MOZ_TELEMETRY_REPORTING
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_CRASHREPORTER =
//#ifdef MOZ_CRASHREPORTER
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_DATA_REPORTING =
//#ifdef MOZ_DATA_REPORTING
      true;
//#else
    false;
//#endif

    public static final boolean MOZ_UPDATER =
//#ifdef MOZ_UPDATER
    true;
//#else
    false;
//#endif

    // Android Beam is only supported on API14+, so we don't even bother building
    // it if this APK doesn't include API14 support.
    public static final boolean MOZ_ANDROID_BEAM =
//#ifdef MOZ_ANDROID_BEAM
    true;
//#else
    false;
//#endif

    // See this wiki page for more details about channel specific build defines:
    // https://wiki.mozilla.org/Platform/Channel-specific_build_defines
    public static final boolean RELEASE_OR_BETA =
//#ifdef RELEASE_OR_BETA
    true;
//#else
    false;
//#endif

    public static final boolean NIGHTLY_BUILD =
//#ifdef NIGHTLY_BUILD
    true;
//#else
    false;
//#endif

    public static final boolean FENNEC_NIGHTLY =
//#ifdef FENNEC_NIGHTLY
    true;
//#else
    false;
//#endif

    public static final boolean DEBUG_BUILD =
//#ifdef MOZ_DEBUG
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_MEDIA_PLAYER =
//#ifdef MOZ_NATIVE_DEVICES
    true;
//#else
    false;
//#endif

    // Official corresponds, roughly, to whether this build is performed on
    // Mozilla's continuous integration infrastructure. You should disable
    // developer-only functionality when this flag is set.
    public static final boolean MOZILLA_OFFICIAL =
//#ifdef MOZILLA_OFFICIAL
    true;
//#else
    false;
//#endif

    public static final boolean ANDROID_DOWNLOADS_INTEGRATION =
//#ifdef MOZ_ANDROID_DOWNLOADS_INTEGRATION
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_DRAGGABLE_URLBAR = false;

    public static final boolean MOZ_INSTALL_TRACKING =
//#ifdef MOZ_INSTALL_TRACKING
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_SWITCHBOARD =
//#ifdef MOZ_SWITCHBOARD
    true;
//#else
    false;
//#endif

    /**
     * Target CPU architecture: "armeabi-v7a", "arm64-v8a", "x86", "mips", ..
     */
    public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@";

    public static final boolean MOZ_ANDROID_EXCLUDE_FONTS =
//#ifdef MOZ_ANDROID_EXCLUDE_FONTS
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE =
//#ifdef MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE
    true;
//#else
    false;
//#endif

    public static final boolean MOZ_ANDROID_PWA =
//#ifdef MOZ_ANDROID_PWA
    true;
//#else
    false;
//#endif

    // (bug 1266820) Temporarily disabled since no one is working on it.
    public static final boolean SCREENSHOTS_IN_BOOKMARKS_ENABLED = false;

    public static final boolean MOZ_ANDROID_ACTIVITY_STREAM =
//#ifdef MOZ_ANDROID_ACTIVITY_STREAM
        true;
//#else
        false;
//#endif
    /**
     * This flag is for enabling custom code used only in the
     * MozillaOnline (Mozilla China) version of Fennec.
     */
    public static final boolean MOZ_ANDROID_MOZILLA_ONLINE =
//#ifdef MOZ_ANDROID_MOZILLA_ONLINE
        true;
//#else
        false;
//#endif

    public static final String MOZ_POCKET_API_KEY =
//#ifdef MOZ_ANDROID_POCKET
        "@MOZ_POCKET_API_KEY@";
//#else
        null;
//#endif
}