1// Copyright 2014 The Chromium Authors 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5package org.chromium.net.impl; 6 7/** 8 * Build version information for Cronet impl code. 9 * 10 * <p>Note that this class will not necessarily return the same information as 11 * {@link org.chromium.net.ApiVersion}. Notably, in the case of Cronet being 12 * loaded via Google Play Services, the API and impl are shipped separately 13 * and the app can end up running API code that was not built from the same 14 * version as the impl code. 15 * 16 * <p>CAUTION: this class is used through reflection from the Cronet API code - 17 * be very careful when changing the API/ABI of this class, and keep in mind the 18 * caller code is not necessarily built from the same version as this code. 19 * 20 * @see org.chromium.net.ApiVersion 21 */ 22public class ImplVersion { 23 private static final String CRONET_VERSION = "@MAJOR@.@MINOR@.@BUILD@.@PATCH@"; 24 private static final int API_LEVEL = @API_LEVEL@; 25 private static final String LAST_CHANGE = "@LASTCHANGE@"; 26 27 /** 28 * Private constructor. All members of this class should be static. 29 */ 30 private ImplVersion() {} 31 32 public static String getCronetVersionWithLastChange() { 33 return CRONET_VERSION + "@" + LAST_CHANGE.substring(0, 8); 34 } 35 36 /** 37 * The level of API code that this impl was built against. 38 * 39 * <p>Note this is *NOT* necessarily the same as the level of the API code 40 * that this impl is currently *running* against. The runtime API level can 41 * be obtained using {@link 42 * org.chromium.net.ApiVersion#getMaximumAvailableApiLevel}. 43 */ 44 public static int getApiLevel() { 45 return API_LEVEL; 46 } 47 48 public static String getCronetVersion() { 49 return CRONET_VERSION; 50 } 51 52 public static String getLastChange() { 53 return LAST_CHANGE; 54 } 55} 56