aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorNick Chalko <nchalko@google.com>2015-08-03 15:39:56 -0700
committerNick Chalko <nchalko@google.com>2015-08-03 15:53:37 -0700
commit816a4be1a0f34f6a48877c8afd3dbbca19eac435 (patch)
tree4f18dda269764494942f5313acc93db4a35d47db /common
parent6edd2b09e5d16a29c703a5fcbd2e88c5cf5e55b7 (diff)
downloadTV-816a4be1a0f34f6a48877c8afd3dbbca19eac435.tar.gz
Migrate Live Channels App Src to AOSP branch
Bug: 21625152 Change-Id: I07e2830b27440556dc757e6340b4f77d1c0cbc66
Diffstat (limited to 'common')
-rw-r--r--common/Android.mk11
-rw-r--r--common/src/com/android/tv/common/TvCommonConstants.java58
2 files changed, 69 insertions, 0 deletions
diff --git a/common/Android.mk b/common/Android.mk
new file mode 100644
index 00000000..71d94781
--- /dev/null
+++ b/common/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# Include all test java files.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE := tv-common
+LOCAL_MODULE_TAGS := optional
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/common/src/com/android/tv/common/TvCommonConstants.java b/common/src/com/android/tv/common/TvCommonConstants.java
new file mode 100644
index 00000000..6dd67071
--- /dev/null
+++ b/common/src/com/android/tv/common/TvCommonConstants.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2015 The Android Open Source 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 com.android.tv.common;
+
+import android.os.Build;
+
+/**
+ * Constants for common use in TV app and tests.
+ */
+public final class TvCommonConstants {
+ /**
+ * A constant for the key of the extra data for the app linking intent.
+ */
+ public static final String EXTRA_APP_LINK_CHANNEL_URI = "app_link_channel_uri";
+
+ private static int sPreviewSdkInt;
+ static {
+ try {
+ sPreviewSdkInt = Build.VERSION.PREVIEW_SDK_INT;
+ } catch (java.lang.NoSuchFieldError e) {
+ sPreviewSdkInt = 0;
+ }
+ }
+
+ /**
+ * A flag whether this platform is MNC Preview or not.
+ */
+ public static final boolean IS_MNC_PREVIEW =
+ Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1 && sPreviewSdkInt > 0;
+
+ /**
+ * A flag whether this platform is after MNC Preview or not.
+ */
+ public static final boolean IS_MNC_OR_HIGHER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.MNC;
+
+ /**
+ * A flag whether this platform supports time shifting API or not.
+ * TODO: Stop supporting mnc preview if possible.
+ */
+ public static final boolean HAS_TIME_SHIFT_API = IS_MNC_PREVIEW || IS_MNC_OR_HIGHER;
+
+ private TvCommonConstants() {
+ }
+}