From e08be735a431fe3f688418a04f8bb75603a6c5a9 Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Thu, 4 Jun 2015 17:55:50 -0700 Subject: [PATCH] CMSDK: Create versioning for platform SDK. Introduce Apricot, the first version for the platform sdk. Change-Id: I4963650cb861725508aa71276977ac6157f248fc --- src/java/cyanogenmod/os/Build.java | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/java/cyanogenmod/os/Build.java diff --git a/src/java/cyanogenmod/os/Build.java b/src/java/cyanogenmod/os/Build.java new file mode 100644 index 0000000..55b5cd0 --- /dev/null +++ b/src/java/cyanogenmod/os/Build.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2015 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package cyanogenmod.os; + +import android.os.SystemProperties; + +import java.util.HashMap; + +/** + * Information about the current CyanogenMod build, extracted from system properties. + */ +public class Build { + /** Value used for when a build property is unknown. */ + public static final String UNKNOWN = "unknown"; + + private static final HashMap sdkMap; + static + { + sdkMap = new HashMap(); + sdkMap.put(CM_VERSION_CODES.APRICOT, "Apricot"); + } + + /** Various version strings. */ + public static class CM_VERSION { + /** + * The user-visible SDK version of the framework; its possible + * values are defined in {@link Build.CM_VERSION_CODES}. + */ + public static final int SDK_INT = SystemProperties.getInt( + "ro.cm.build.version.plat.sdk", 0); + } + + /** + * Enumeration of the currently known SDK version codes. These are the + * values that can be found in {@link CM_VERSION#SDK_INT}. Version numbers + * increment monotonically with each official platform release. + */ + public static class CM_VERSION_CODES { + /** + * June 2015: The first version of the platform sdk for CyanogenMod + */ + public static final int APRICOT = 1; + } + + /** + * Retrieve the name for the SDK int + * @param sdkInt + * @return name of the SDK int + */ + public static String getNameForSDKInt(int sdkInt) { + return sdkMap.get(sdkInt); + } +}