diff options
author | Joseph Johnson <simplex@google.com> | 2018-06-28 15:18:37 -0700 |
---|---|---|
committer | Joseph Johnson <simplex@google.com> | 2018-07-11 12:09:47 -0700 |
commit | 06d21d47fe9e3295ff6456e8934de7b1b0e9a86b (patch) | |
tree | bb84b0d68c908cbbf3bcff05bad81064ef154646 /apps/tv | |
parent | 834298826bd40d24fef748d7f5906f78e695f357 (diff) | |
download | sample-06d21d47fe9e3295ff6456e8934de7b1b0e9a86b.tar.gz |
TvSetupCustomization apps
Added 2 customization and validation apps. Partners can use these to
validate the TV Setup partner customization interface. These apps
are not included in the default system image builds.
Also removes the existing SetupCustomizer, which is out-of-date.
Bug: 78910364
Test: manual
Change-Id: Icfb8dea4752100b0cff8d00c36d2e6b5ca0e90cb
Diffstat (limited to 'apps/tv')
104 files changed, 1946 insertions, 0 deletions
diff --git a/apps/tv/LeanbackCustomizer/Android.mk b/apps/tv/LeanbackCustomizer/Android.mk new file mode 100644 index 0000000..fb4f41c --- /dev/null +++ b/apps/tv/LeanbackCustomizer/Android.mk @@ -0,0 +1,13 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/priv-app + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := LeanbackCustomizer + +LOCAL_SDK_VERSION := current + +include $(BUILD_PACKAGE) diff --git a/apps/tv/LeanbackCustomizer/AndroidManifest.xml b/apps/tv/LeanbackCustomizer/AndroidManifest.xml new file mode 100644 index 0000000..e931ca2 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/AndroidManifest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.google.android.leanbacklauncher.partnercustomizer"> + + <uses-sdk + android:minSdkVersion="21" + android:targetSdkVersion="21" /> + + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> + <uses-permission android:name="android.permission.INTERNET" /> + + <application android:label="@string/app_label"> + + <receiver android:name=".PartnerReceiver"> + <intent-filter> + <action android:name="com.google.android.leanbacklauncher.action.PARTNER_CUSTOMIZATION" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + + <intent-filter> + <action android:name="android.intent.action.PACKAGE_ADDED" /> + <action android:name="android.intent.action.PACKAGE_REMOVED" /> + <data android:scheme="package"/> + </intent-filter> + </receiver> + + </application> +</manifest> diff --git a/apps/tv/LeanbackCustomizer/proguard-project.txt b/apps/tv/LeanbackCustomizer/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/apps/tv/LeanbackCustomizer/res/drawable-hdpi/ic_bundled_tuner_banner.png b/apps/tv/LeanbackCustomizer/res/drawable-hdpi/ic_bundled_tuner_banner.png Binary files differnew file mode 100644 index 0000000..520c6e8 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-hdpi/ic_bundled_tuner_banner.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-hdpi/ic_launcher.png b/apps/tv/LeanbackCustomizer/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..eb9dfe2 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-hdpi/ic_launcher.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-mdpi/ic_bundled_tuner_banner.png b/apps/tv/LeanbackCustomizer/res/drawable-mdpi/ic_bundled_tuner_banner.png Binary files differnew file mode 100644 index 0000000..785e3fc --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-mdpi/ic_bundled_tuner_banner.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-mdpi/ic_launcher.png b/apps/tv/LeanbackCustomizer/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..d8e46f3 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-mdpi/ic_launcher.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/bg_custom.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/bg_custom.png Binary files differnew file mode 100644 index 0000000..a14fcc7 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/bg_custom.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_bundled_tuner_banner.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_bundled_tuner_banner.png Binary files differnew file mode 100644 index 0000000..d7deb0e --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_bundled_tuner_banner.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_launcher.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..e4e79c9 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_launcher.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_play_movies_banner.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_play_movies_banner.png Binary files differnew file mode 100644 index 0000000..0e25c62 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_play_movies_banner.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_ted_banner.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_ted_banner.png Binary files differnew file mode 100644 index 0000000..dd34536 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_ted_banner.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_apps.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_apps.png Binary files differnew file mode 100644 index 0000000..c0073e3 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_apps.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_custom.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_custom.png Binary files differnew file mode 100644 index 0000000..ec9ab2b --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_custom.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_games.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_games.png Binary files differnew file mode 100644 index 0000000..d473e4e --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_games.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_settings.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_settings.png Binary files differnew file mode 100644 index 0000000..ed43296 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_title_settings.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_try_play_movies_banner.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_try_play_movies_banner.png Binary files differnew file mode 100644 index 0000000..567d130 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_try_play_movies_banner.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_try_ted_banner.png b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_try_ted_banner.png Binary files differnew file mode 100644 index 0000000..6f96f25 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xhdpi/ic_try_ted_banner.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xxhdpi/ic_bundled_tuner_banner.png b/apps/tv/LeanbackCustomizer/res/drawable-xxhdpi/ic_bundled_tuner_banner.png Binary files differnew file mode 100644 index 0000000..93f1df6 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xxhdpi/ic_bundled_tuner_banner.png diff --git a/apps/tv/LeanbackCustomizer/res/drawable-xxhdpi/ic_launcher.png b/apps/tv/LeanbackCustomizer/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..53ced36 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/drawable-xxhdpi/ic_launcher.png diff --git a/apps/tv/LeanbackCustomizer/res/values/colors.xml b/apps/tv/LeanbackCustomizer/res/values/colors.xml new file mode 100644 index 0000000..810e40e --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/values/colors.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="partner_color">#FFFF00FF</color> +</resources> diff --git a/apps/tv/LeanbackCustomizer/res/values/config.xml b/apps/tv/LeanbackCustomizer/res/values/config.xml new file mode 100644 index 0000000..868bb1d --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/values/config.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <bool name="partner_show_live_tv_on_start_up">true</bool> + + <bool name="disable_disconnected_inputs">false</bool> + <bool name="show_physical_tuners_separately">true</bool> + <string name="bundled_tuner_title">All Channels</string> + <item type="drawable" name="bundled_tuner_banner">@drawable/ic_bundled_tuner_banner</item> + + <!-- DO NOT TRANSLATE --> + <string name="partner_app_sorting_mode" translatable="false">fixed</string> + <!-- DO NOT TRANSLATE --> + <string name="partner_wallpaper" translatable="false">bg_custom</string> + <!-- DO NOT TRANSLATE --> + <string name="partner_widget_provider_component_name" translatable="false"> + com.google.android.leanbacklauncher.partnerwidget/.ClockWidgetProvider + </string> + + <!-- DO NOT TRANSLATE --> + <string name="partner_search_icon" translatable="false">ic_launcher</string> + + <!-- + DO NOT TRANSLATE + List showing default out of box ordering for the launcher. + The higher in this list a package appears, the higher it will be in the launcher. + Since the apps row and games row are separate, we can safely put them in the same array. + This same list will be used to determine the initial ordering of recommendations. + The Google default out of box ordering will supercede this ordering if there is a conflict. + --> + <string-array name="partner_out_of_box_order" translatable="false"> + <!-- Highest priority packages up here --> + + <!-- Apps row --> + <item>com.ted.android.tv</item> <!-- TED --> + <item>com.clearchannel.iheartradio.tv</item> <!-- iHeartRadio --> + <item>com.plexapp.plex</item> <!-- Plex --> + + <!-- Games row --> + <item>com.ayopagames.robotsloveicecream</item> <!-- Robots Love Ice Cream --> + <item>com.frogmind.badland</item> <!-- Badland --> + <item>com.bezircle</item> <!-- Bezircle --> + + <!-- Lowest priority packages down here --> + </string-array> + + <!-- DO NOT TRANSLATE --> + <string-array name="home_screen_row_ordering" translatable="false"> + <item>partner_row</item> + <item>inputs_row</item> + <item>games_row</item> + <item>apps_row</item> + <item>settings_row</item> + </string-array> + + <item type="drawable" name="partner_row_icon">@drawable/ic_title_custom</item> + <item type="drawable" name="apps_row_icon">@drawable/ic_title_apps</item> + <item type="drawable" name="games_row_icon">@drawable/ic_title_games</item> + <item type="drawable" name="inputs_row_icon">@drawable/ic_title_custom</item> + <item type="drawable" name="settings_row_icon">@drawable/ic_title_settings</item> + + <!-- DO NOT TRANSLATE --> + <string name="partner_font" translatable="false">sans-serif-bold</string> + + <!-- DO NOT TRANSLATE --> + <string name="launcher_category" translatable="false">android.intent.category.LEANBACK_LAUNCHER</string> +</resources> diff --git a/apps/tv/LeanbackCustomizer/res/values/strings.xml b/apps/tv/LeanbackCustomizer/res/values/strings.xml new file mode 100644 index 0000000..c9e9889 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/res/values/strings.xml @@ -0,0 +1,20 @@ +<resources> + + <string name="app_label">LeanbackCustomizer</string> + + <string name="partner_row_title">Google\'s Top Picks</string> + <string name="apps_row_title">My Apps</string> + <string name="games_row_title">My Games</string> + <string name="inputs_row_title">My Inputs</string> + <string name="settings_row_title">My Settings</string> + + <!-- Content description for Netflix App --> + <string name="ted">Ted</string> + <!-- Content description for banner to encourage users to download the Netflix App --> + <string name="try_ted">Try Ted</string> + <!-- Content description for Google Play Movies App --> + <string name="play_movies">Play Movies</string> + <!-- Content description for banner to encourage users to download Google Play Movies App --> + <string name="try_play_movies">Try Play Movies</string> + +</resources> diff --git a/apps/tv/LeanbackCustomizer/src/com/google/android/leanbacklauncher/partnercustomizer/PartnerReceiver.java b/apps/tv/LeanbackCustomizer/src/com/google/android/leanbacklauncher/partnercustomizer/PartnerReceiver.java new file mode 100644 index 0000000..daef196 --- /dev/null +++ b/apps/tv/LeanbackCustomizer/src/com/google/android/leanbacklauncher/partnercustomizer/PartnerReceiver.java @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2014 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.google.android.leanbacklauncher.partnercustomizer; + +import android.app.Notification; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.graphics.BitmapFactory; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; + +/** + * This class posts notifications that are used to populate the Partner Row of the Leanback Launcher + * It also allows the system/launcher to find the correct partner customization + * package. + * + * Packages using this broadcast receiver must also be a system app to be used for + * partner customization. + */ +public class PartnerReceiver extends BroadcastReceiver { + private static final String ACTION_PARTNER_CUSTOMIZATION = + "com.google.android.leanbacklauncher.action.PARTNER_CUSTOMIZATION"; + + private static final String EXTRA_ROW_WRAPPING_CUTOFF = + "com.google.android.leanbacklauncher.extra.ROW_WRAPPING_CUTOFF"; + + private static final String PARTNER_GROUP = "partner_row_entry"; + private static final String BLACKLIST_PACKAGE = "com.google.android.leanbacklauncher.replacespackage"; + + private static final String TED_PKG_NAME = "com.ted.android.tv"; + private static final String PLAY_MOVIES_PKG_NAME = "com.google.android.videos"; + + private Context mContext; + private NotificationManager mNotifMan; + private PackageManager mPkgMan; + + // Cutoff value for when the Launcher displays the Partner row as a single + // row, or a two row grid. Can be used for correctly positioning the partner + // app entries. + private int mRowCutoff = 0; + + @Override + public void onReceive(Context context, Intent intent) { + if (mContext == null) { + mContext = context; + mNotifMan = (NotificationManager) + mContext.getSystemService(Context.NOTIFICATION_SERVICE); + mPkgMan = mContext.getPackageManager(); + } + + String action = intent.getAction(); + if (Intent.ACTION_PACKAGE_ADDED.equals(action)|| + Intent.ACTION_PACKAGE_REMOVED.equals(action)) { + postNotification(getPackageName(intent)); + } else if (ACTION_PARTNER_CUSTOMIZATION.equals(action)) { + mRowCutoff = intent.getIntExtra(EXTRA_ROW_WRAPPING_CUTOFF, 0); + postNotification(TED_PKG_NAME); + postNotification(PLAY_MOVIES_PKG_NAME); + } + } + + private void postNotification(String pkgName) { + int sort; + int resId; + int backupResId; + int titleId; + int backupTitleId; + + switch (pkgName) { + case TED_PKG_NAME: + sort = 1; + resId = R.drawable.ic_ted_banner; + backupResId = R.drawable.ic_try_ted_banner; + titleId = R.string.ted; + backupTitleId = R.string.try_ted; + break; + case PLAY_MOVIES_PKG_NAME: + sort = 2; + resId = R.drawable.ic_play_movies_banner; + backupResId = R.drawable.ic_try_play_movies_banner; + titleId = R.string.play_movies; + backupTitleId = R.string.try_play_movies; + break; + default: + return; + } + + postNotification(sort, resId, backupResId, titleId, backupTitleId, pkgName); + } + + private void postNotification(int sort, int resId, int backupResId, + int titleId, int backupTitleId, String pkgName) { + int id = resId; + Intent intent = mPkgMan.getLeanbackLaunchIntentForPackage(pkgName); + + if (intent == null) { + titleId = backupTitleId; + resId = backupResId; + intent = getBackupIntent(pkgName); + } + + Notification.Builder bob = new Notification.Builder(mContext); + Bundle extras = new Bundle(); + extras.putString(BLACKLIST_PACKAGE, pkgName); + + bob.setContentTitle(mContext.getString(titleId)) + .setSmallIcon(R.drawable.ic_launcher) + .setLargeIcon(BitmapFactory.decodeResource(mContext.getResources(), resId)) + .setContentIntent(PendingIntent.getActivity(mContext, 0, intent, 0)) + .setCategory(Notification.CATEGORY_RECOMMENDATION) + .setGroup(PARTNER_GROUP) + .setSortKey(sort+"") + .setColor(mContext.getResources().getColor(R.color.partner_color)) + .setExtras(extras); + + mNotifMan.notify(id, bob.build()); + } + + private Intent getBackupIntent(String pkgName) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("market://details?id=" + pkgName)); + + return intent; + } + + private String getPackageName(Intent intent) { + Uri uri = intent.getData(); + String pkg = uri != null ? uri.getSchemeSpecificPart() : null; + return pkg; + } + +} diff --git a/apps/tv/LeanbackCustomizer/src/com/google/android/leanbacklauncher/partnercustomizer/TestActivity.java b/apps/tv/LeanbackCustomizer/src/com/google/android/leanbacklauncher/partnercustomizer/TestActivity.java new file mode 100644 index 0000000..6ae07ef --- /dev/null +++ b/apps/tv/LeanbackCustomizer/src/com/google/android/leanbacklauncher/partnercustomizer/TestActivity.java @@ -0,0 +1,7 @@ +package com.google.android.leanbacklauncher.partnercustomizer; + +import android.app.Activity; + +public class TestActivity extends Activity { + +} diff --git a/apps/tv/LeanbackWidget/Android.mk b/apps/tv/LeanbackWidget/Android.mk new file mode 100644 index 0000000..7209b52 --- /dev/null +++ b/apps/tv/LeanbackWidget/Android.mk @@ -0,0 +1,13 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/app + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := LeanbackWidget + +LOCAL_SDK_VERSION := current + +include $(BUILD_PACKAGE) diff --git a/apps/tv/LeanbackWidget/AndroidManifest.xml b/apps/tv/LeanbackWidget/AndroidManifest.xml new file mode 100644 index 0000000..9474560 --- /dev/null +++ b/apps/tv/LeanbackWidget/AndroidManifest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.google.android.leanbacklauncher.partnerwidget"> + + <uses-sdk + android:minSdkVersion="19" + android:targetSdkVersion="19" /> + + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> + + <application android:label="@string/app_label"> + <receiver android:name=".ClockWidgetProvider" > + <intent-filter> + <action android:name="android.net.conn.INET_CONDITION_ACTION" /> + <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> + + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + </intent-filter> + + <meta-data + android:name="android.appwidget.provider" + android:resource="@xml/clock_widget_info" /> + </receiver> + + </application> +</manifest> diff --git a/apps/tv/LeanbackWidget/proguard-project.txt b/apps/tv/LeanbackWidget/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/apps/tv/LeanbackWidget/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_launcher.png b/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..eb9dfe2 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_launcher.png diff --git a/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_ethernet_not_connected.png b/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_ethernet_not_connected.png Binary files differnew file mode 100644 index 0000000..df02569 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_ethernet_not_connected.png diff --git a/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_wifi_no_internet.png b/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_wifi_no_internet.png Binary files differnew file mode 100644 index 0000000..1b891de --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_wifi_no_internet.png diff --git a/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_wifi_not_connected.png b/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_wifi_not_connected.png Binary files differnew file mode 100644 index 0000000..d6d4a30 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-hdpi/ic_widget_wifi_not_connected.png diff --git a/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_launcher.png b/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..d8e46f3 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_launcher.png diff --git a/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_ethernet_not_connected.png b/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_ethernet_not_connected.png Binary files differnew file mode 100644 index 0000000..ece1478 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_ethernet_not_connected.png diff --git a/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_wifi_no_internet.png b/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_wifi_no_internet.png Binary files differnew file mode 100644 index 0000000..5054b40 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_wifi_no_internet.png diff --git a/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_wifi_not_connected.png b/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_wifi_not_connected.png Binary files differnew file mode 100644 index 0000000..ad53107 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-mdpi/ic_widget_wifi_not_connected.png diff --git a/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_launcher.png b/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..e4e79c9 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_launcher.png diff --git a/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_ethernet_not_connected.png b/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_ethernet_not_connected.png Binary files differnew file mode 100644 index 0000000..5d0bfb9 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_ethernet_not_connected.png diff --git a/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_wifi_no_internet.png b/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_wifi_no_internet.png Binary files differnew file mode 100644 index 0000000..909d020 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_wifi_no_internet.png diff --git a/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_wifi_not_connected.png b/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_wifi_not_connected.png Binary files differnew file mode 100644 index 0000000..c892b26 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-xhdpi/ic_widget_wifi_not_connected.png diff --git a/apps/tv/LeanbackWidget/res/drawable-xxhdpi/ic_launcher.png b/apps/tv/LeanbackWidget/res/drawable-xxhdpi/ic_launcher.png Binary files differnew file mode 100644 index 0000000..53ced36 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-xxhdpi/ic_launcher.png diff --git a/apps/tv/LeanbackWidget/res/drawable-xxhdpi/ic_widget_ethernet_not_connected.png b/apps/tv/LeanbackWidget/res/drawable-xxhdpi/ic_widget_ethernet_not_connected.png Binary files differnew file mode 100644 index 0000000..edb5a69 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/drawable-xxhdpi/ic_widget_ethernet_not_connected.png diff --git a/apps/tv/LeanbackWidget/res/layout/clock_widget.xml b/apps/tv/LeanbackWidget/res/layout/clock_widget.xml new file mode 100644 index 0000000..3ceb63e --- /dev/null +++ b/apps/tv/LeanbackWidget/res/layout/clock_widget.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="@dimen/widget_top_margin" > + + <TextClock + android:id="@+id/clock" + android:layout_width="@dimen/clock_width" + android:layout_height="wrap_content" + android:layout_alignParentEnd="true" + android:gravity="center_vertical|end" + android:format12Hour="@string/widget_12_hours_format" + android:format24Hour="@string/widget_24_hours_format" + android:fontFamily="@string/light_font" + android:includeFontPadding="false" + android:textColor="@color/clock_text_color" + android:textSize="@dimen/clock_text_size" /> + + <ImageView + android:id="@+id/connectivity_indicator" + android:layout_width="@dimen/connectivity_status_size" + android:layout_height="@dimen/connectivity_status_size" + android:layout_toStartOf="@+id/clock" + android:layout_centerVertical="true" + android:src="@null" /> + +</RelativeLayout> diff --git a/apps/tv/LeanbackWidget/res/values/colors.xml b/apps/tv/LeanbackWidget/res/values/colors.xml new file mode 100644 index 0000000..bcc3a80 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/values/colors.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="clock_text_color">#FFEEEEEE</color> +</resources> diff --git a/apps/tv/LeanbackWidget/res/values/config.xml b/apps/tv/LeanbackWidget/res/values/config.xml new file mode 100644 index 0000000..9e4f1ba --- /dev/null +++ b/apps/tv/LeanbackWidget/res/values/config.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <!-- DO NOT TRANSLATE --> + <string name="font" translatable="false">sans-serif-condensed</string> + <!-- DO NOT TRANSLATE --> + <string name="light_font" translatable="false">sans-serif-light</string> + <!-- DO NOT TRANSLATE --> + <string name="regular_font" translatable="false">sans-serif</string> + + <string name="widget_12_hours_format" translatable="false">h:mm</string> + <string name="widget_24_hours_format" translatable="false">kk:mm</string> + +</resources> diff --git a/apps/tv/LeanbackWidget/res/values/dimens.xml b/apps/tv/LeanbackWidget/res/values/dimens.xml new file mode 100644 index 0000000..fe1728f --- /dev/null +++ b/apps/tv/LeanbackWidget/res/values/dimens.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="clock_text_size">36sp</dimen> + <dimen name="clock_width">106dp</dimen> + <dimen name="connectivity_status_size">32dp</dimen> + <dimen name="widget_top_margin">1dp</dimen> +</resources> diff --git a/apps/tv/LeanbackWidget/res/values/strings.xml b/apps/tv/LeanbackWidget/res/values/strings.xml new file mode 100644 index 0000000..4f733a4 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/values/strings.xml @@ -0,0 +1,5 @@ +<resources> + + <string name="app_label">LeanbackWidget</string> + +</resources> diff --git a/apps/tv/LeanbackWidget/res/xml/clock_widget_info.xml b/apps/tv/LeanbackWidget/res/xml/clock_widget_info.xml new file mode 100644 index 0000000..a877df8 --- /dev/null +++ b/apps/tv/LeanbackWidget/res/xml/clock_widget_info.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" + android:updatePeriodMillis="1800000" + android:initialLayout="@layout/clock_widget" + android:widgetCategory="home_screen" + android:resizeMode="none" /> diff --git a/apps/tv/LeanbackWidget/src/com/google/android/leanbacklauncher/partnerwidget/ClockWidgetProvider.java b/apps/tv/LeanbackWidget/src/com/google/android/leanbacklauncher/partnerwidget/ClockWidgetProvider.java new file mode 100644 index 0000000..77a2851 --- /dev/null +++ b/apps/tv/LeanbackWidget/src/com/google/android/leanbacklauncher/partnerwidget/ClockWidgetProvider.java @@ -0,0 +1,95 @@ +package com.google.android.leanbacklauncher.partnerwidget; + +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.Bundle; +import android.widget.RemoteViews; + +public class ClockWidgetProvider extends AppWidgetProvider { + + private static final String SHARED_PREFS = "widget-prefs"; + private static final int INET_CONDITION_THRESHOLD = 50; + private static final String INET_CONDITION_ACTION = "android.net.conn.INET_CONDITION_ACTION"; + private static final String EXTRA_INET_CONDITION = "inetCondition"; + + @Override + public void onReceive(Context context, Intent intent) { + String intentAction = intent.getAction(); + + if (INET_CONDITION_ACTION.equals(intentAction) || + ConnectivityManager.CONNECTIVITY_ACTION.equals(intentAction)) { + + if (INET_CONDITION_ACTION.equals(intentAction)) { + // a broadcast with this intent action is only fired when we are actually connected + // (i.e connectionStatus = 100). So, clearing connectivity status when changing + // networks is required + int connectionStatus = intent.getIntExtra(EXTRA_INET_CONDITION, -551); + writeConnectivity(context, connectionStatus > INET_CONDITION_THRESHOLD); + } + + update(context); + } + + super.onReceive(context, intent); + } + + @Override + public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, + int appWidgetId, Bundle newOptions) { + update(context); + } + + public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { + update(context); + super.onUpdate(context, appWidgetManager, appWidgetIds); + } + + private void update(Context context) { + AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); + ComponentName thisWidget = new ComponentName(context, ClockWidgetProvider.class); + appWidgetManager.updateAppWidget(thisWidget, getRemoteViews(context)); + } + + private RemoteViews getRemoteViews(Context context) { + RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.clock_widget); + remoteViews.setImageViewResource(R.id.connectivity_indicator, getConnectedResId(context)); + + return remoteViews; + } + + private static int getConnectedResId(Context context) { + ConnectivityManager cm = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo info = cm.getActiveNetworkInfo(); + + int resId = 0; + if (info == null || !info.isAvailable() || !info.isConnected()) { + // can't have Internet access with no network + writeConnectivity(context, false); + resId = R.drawable.ic_widget_wifi_not_connected; + } else if (!readConnectivity(context)) { + resId = R.drawable.ic_widget_wifi_no_internet; + } else { + // internet is connected and working, show nothing + resId = android.R.color.transparent; + } + + return resId; + } + + private static void writeConnectivity(Context context, boolean inetConnected) { + context.getSharedPreferences(SHARED_PREFS, Context.MODE_PRIVATE).edit() + .putBoolean(EXTRA_INET_CONDITION, inetConnected).apply(); + } + + private static boolean readConnectivity(Context context) { + return context.getSharedPreferences(SHARED_PREFS, Context.MODE_PRIVATE).getBoolean( + EXTRA_INET_CONDITION, true); + } + +} diff --git a/apps/tv/SetupCustomizationSample/.gitignore b/apps/tv/SetupCustomizationSample/.gitignore new file mode 100644 index 0000000..09b993d --- /dev/null +++ b/apps/tv/SetupCustomizationSample/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/apps/tv/SetupCustomizationSample/app/.gitignore b/apps/tv/SetupCustomizationSample/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/apps/tv/SetupCustomizationSample/app/build.gradle b/apps/tv/SetupCustomizationSample/app/build.gradle new file mode 100644 index 0000000..f4df956 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + defaultConfig { + applicationId "com.google.android.tv.setup.customizationsample" + minSdkVersion 21 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + lintOptions { + abortOnError false + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:leanback-v17:26.1.0' + implementation 'com.android.support:appcompat-v7:26.1.0' +} diff --git a/apps/tv/SetupCustomizationSample/app/proguard-rules.pro b/apps/tv/SetupCustomizationSample/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/apps/tv/SetupCustomizationSample/app/src/main/AndroidManifest.xml b/apps/tv/SetupCustomizationSample/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..30f0c86 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/AndroidManifest.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.google.android.tv.setup.customizationsample"> + + <uses-feature + android:name="android.hardware.touchscreen" + android:required="false" /> + <uses-feature + android:name="android.software.leanback" + android:required="true" /> + + <uses-permission android:name="com.android.setupwizard.permission.SETUP" /> + <uses-permission android:name="android.permission.REBOOT" /> + + <application + android:label="TV Setup Customization Sample" + android:theme="@style/AppTheme"> + + + <!-- This Receiver marks this app as being eligible to provide resources which influence + the behavior and look of TV Setup. --> + <receiver android:name=".PartnerReceiver"> + <intent-filter> + <action android:name="com.google.android.tvsetup.action.PARTNER_CUSTOMIZATION" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </receiver> + + + <!-- HOOK Activity examples --> + + <activity + android:name=".HookBeginActivity" + android:label="Partner Hook: Begin (Priority 5)" + android:screenOrientation="landscape"> + <intent-filter android:priority="5"> + <action android:name="com.android.setupwizard.action.HOOK_BEGIN" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + + <activity + android:name=".HookBegin2Activity" + android:label="Partner Hook: Begin (Priority 4)" + android:screenOrientation="landscape"> + <intent-filter android:priority="4"> + <action android:name="com.android.setupwizard.action.HOOK_BEGIN" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + + <activity + android:name=".HookPostNetworkActivity" + android:screenOrientation="landscape" + android:label="Partner Hook: Post-Network" + > + <intent-filter> + <action android:name="com.android.setupwizard.action.HOOK_POST_NETWORK" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + + <activity + android:name=".HookPostNetworkFollowupActivity" + android:screenOrientation="landscape" + android:label="Partner Hook: Post-Network Follow-up" + android:exported="true" + > + </activity> + + + <activity + android:name=".HookEndActivity" + android:screenOrientation="landscape" + android:label="Partner Hook: End" + > + <intent-filter> + <action android:name="com.android.setupwizard.action.HOOK_END" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + </application> + +</manifest> diff --git a/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/BaseActivity.java b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/BaseActivity.java new file mode 100644 index 0000000..65b706e --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/BaseActivity.java @@ -0,0 +1,51 @@ +package com.google.android.tv.setup.customizationsample; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public abstract class BaseActivity extends Activity { + + protected ImageView iv0; + protected Button btn0; + protected TextView tv0; + protected TextView tv1; + protected TextView tv2; + protected TextView tv3; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_base_layout); + + iv0 = (ImageView)findViewById(R.id.image0); + btn0 = (Button)findViewById(R.id.btn0); + tv0 = (TextView)findViewById(R.id.tv0); + tv1 = (TextView)findViewById(R.id.tv1); + tv2 = (TextView)findViewById(R.id.tv2); + tv3 = (TextView)findViewById(R.id.tv3); + + tv0.setText(getTitle()); + + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + Date now = new Date(); + String strDate = sdf.format(now); + tv1.setText(strDate); + + boolean movingForward = getIntent().getBooleanExtra("movingForward", true); + tv2.setText("movingForward: " + movingForward); + + tv3.setText("upgraded_during_setup=" + getIntent().getBooleanExtra("upgraded_during_setup", false) + + ", post_provisioned_upgrade=" + getIntent().getBooleanExtra("post_provisioned_upgrade", false)); + } + + protected void log(String message) { + Log.d(getPackageName(), message); + } +} diff --git a/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookActivity.java b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookActivity.java new file mode 100644 index 0000000..05a387f --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookActivity.java @@ -0,0 +1,29 @@ +package com.google.android.tv.setup.customizationsample; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; + +public class HookActivity extends BaseActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + iv0.setVisibility(View.VISIBLE); + iv0.setImageResource(R.drawable.hook); + + btn0.setVisibility(View.VISIBLE); + btn0.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + onAboutToFinish(); + finish(); + } + }); + } + + protected void onAboutToFinish() { + setResult(Activity.RESULT_OK); + } +} diff --git a/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookBegin2Activity.java b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookBegin2Activity.java new file mode 100644 index 0000000..532e50a --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookBegin2Activity.java @@ -0,0 +1,39 @@ +package com.google.android.tv.setup.customizationsample; + +import android.content.Intent; + +/** + * A HOOK_BEGIN Activity. + */ +public class HookBegin2Activity extends HookActivity { + + private static final String EXTRA_PARTNER_HANDLED_NETWORK = "partner_handled_network"; + private static final String EXTRA_PARTNER_HANDLED_NETWORK_USER_SKIPPED = "partner_handled_network_user_skipped"; + + @Override + protected void onAboutToFinish() { + Intent intent = new Intent(); + + // Set this to true to inform TV Setup that the partner has handled the network setup. + // A present and true value means that TV Setup will not show the default Network step + // (because the partner has already handled it and it would be weird for the user to see + // the default Network step after already having gone through the partner's. + if (getIntent().getBooleanExtra(EXTRA_PARTNER_HANDLED_NETWORK, false)) { + // We read the extra from the incoming Intent only for testing purposes. Normally, this + // partner Activity would have its own reasons for returning this extra back to Setup. + intent.putExtra(EXTRA_PARTNER_HANDLED_NETWORK, true); + } + + // Set this to true to inform TV Setup that the partner has handled the network setup and + // that the user chose to skip setting up a network connection. + // A present and true value means that TV Setup will not show steps that require a network + // connection. + if (getIntent().getBooleanExtra(EXTRA_PARTNER_HANDLED_NETWORK_USER_SKIPPED, false)) { + // We read the extra from the incoming Intent only for testing purposes. Normally, this + // partner Activity would have its own reasons for returning this extra back to Setup. + intent.putExtra(EXTRA_PARTNER_HANDLED_NETWORK_USER_SKIPPED, true); + } + + setResult(RESULT_OK, intent); + } +} diff --git a/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookBeginActivity.java b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookBeginActivity.java new file mode 100644 index 0000000..5e6dce0 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookBeginActivity.java @@ -0,0 +1,7 @@ +package com.google.android.tv.setup.customizationsample; + +/** + * A HOOK_BEGIN Activity. + */ +public class HookBeginActivity extends HookActivity { +} diff --git a/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookEndActivity.java b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookEndActivity.java new file mode 100644 index 0000000..89b382d --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookEndActivity.java @@ -0,0 +1,7 @@ +package com.google.android.tv.setup.customizationsample; + +/** + * A HOOK_END Activity. + */ +public class HookEndActivity extends HookActivity { +} diff --git a/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookPostNetworkActivity.java b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookPostNetworkActivity.java new file mode 100644 index 0000000..b6394ac --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookPostNetworkActivity.java @@ -0,0 +1,51 @@ +package com.google.android.tv.setup.customizationsample; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; + +/** + * A HOOK_POST_NETWORK Activity, which simulates checking for a system upgrade. + */ +public class HookPostNetworkActivity extends BaseActivity { + + int mSecondsRemaining; + Runnable mRunnable; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Here we pretend that we are checking if an upgrade is available. + // We do not make visible any UI elements; instead we allow Android TV Setup's "Please wait" + // step to show under us while we figure out if an upgrade is available. That way there are + // fewer transitions which is especially useful in case we have nothing important to do. + mRunnable = new Runnable() { + @Override + public void run() { + mSecondsRemaining--; + if (mSecondsRemaining >= 0) { + tv3.setText(mSecondsRemaining + " seconds remaining"); + new Handler().postDelayed(mRunnable, 1000); + } else { + // This skip_stage_2 stuff is just for testing - so that we can exercise the + // case where no follow-up Activity is needed. + if (getIntent().getBooleanExtra("skip_follow_up", false)) { + log("hook post-network: return no follow-up Activity Intent"); + setResult(RESULT_OK); + finish(); + } else { + log("hook post-network: return follow-up Activity Intent"); + Intent intent = new Intent(getApplicationContext(), HookPostNetworkFollowupActivity.class); + setResult(RESULT_OK, intent); + finish(); + } + } + } + }; + mSecondsRemaining = 3; + mRunnable.run(); + } +} + + diff --git a/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookPostNetworkFollowupActivity.java b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookPostNetworkFollowupActivity.java new file mode 100644 index 0000000..e3d36e8 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/HookPostNetworkFollowupActivity.java @@ -0,0 +1,53 @@ +package com.google.android.tv.setup.customizationsample; + +import android.content.Context; +import android.os.Bundle; +import android.os.Handler; +import android.os.PowerManager; +import android.view.View; + +/** + * A HOOK_POST_NETWORK follow-up Activity, which simulates performing a system upgrade. + */ +public class HookPostNetworkFollowupActivity extends BaseActivity { + + int mSecondsRemaining; + Runnable mRunnable; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Here we pretend to perform a system upgrade. + iv0.setVisibility(View.VISIBLE); + iv0.setImageResource(R.drawable.download); + mRunnable = new Runnable() { + @Override + public void run() { + mSecondsRemaining--; + if (mSecondsRemaining >= 0) { + tv3.setText(mSecondsRemaining + " seconds remaining"); + new Handler().postDelayed(mRunnable, 1000); + } else { + conclude(); + } + } + }; + mSecondsRemaining = 3; + mRunnable.run(); + } + + protected void conclude() { + if (getIntent().getBooleanExtra("reboot", false)) { + log("simulate perform upgrade: simulate upgrade by invoking reboot now"); + PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); + pm.reboot(null); + } else { + log("simulate perform upgrade: simulate upgrade halted/failed; return to Setup"); + setResult(RESULT_OK); + finish(); + } + } +} + + diff --git a/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/PartnerReceiver.java b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/PartnerReceiver.java new file mode 100644 index 0000000..340d270 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/java/com/google/android/tv/setup/customizationsample/PartnerReceiver.java @@ -0,0 +1,17 @@ +package com.google.android.tv.setup.customizationsample; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +/** + * This no-op BroadcastReceiver marks this application as a provider of partner resources for + * Android TV Setup. See AndroidManifest.xml for more details. + */ +public class PartnerReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent intent) { + // Do nothing. + } +} diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/download.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/download.png Binary files differnew file mode 100644 index 0000000..ab2a1ea --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/download.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/hook.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/hook.png Binary files differnew file mode 100644 index 0000000..f7c7add --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/hook.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/hotword_graphic.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/hotword_graphic.png Binary files differnew file mode 100644 index 0000000..6e1513b --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/hotword_graphic.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/tutorial_image_0.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/tutorial_image_0.png Binary files differnew file mode 100644 index 0000000..a522985 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/tutorial_image_0.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/tutorial_image_1.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/tutorial_image_1.png Binary files differnew file mode 100644 index 0000000..19c0c75 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/tutorial_image_1.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/welcome_background.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/welcome_background.png Binary files differnew file mode 100644 index 0000000..7dd9c92 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-xhdpi/welcome_background.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/hotword_graphic.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/hotword_graphic.png Binary files differnew file mode 100644 index 0000000..a12e02b --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/hotword_graphic.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/tutorial_image_0.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/tutorial_image_0.png Binary files differnew file mode 100644 index 0000000..912c702 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/tutorial_image_0.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/tutorial_image_1.png b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/tutorial_image_1.png Binary files differnew file mode 100644 index 0000000..1a3685f --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/drawable-zh-xhdpi/tutorial_image_1.png diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/layout/activity_base_layout.xml b/apps/tv/SetupCustomizationSample/app/src/main/res/layout/activity_base_layout.xml new file mode 100644 index 0000000..da44ab4 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/layout/activity_base_layout.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + xmlns:tools="http://schemas.android.com/tools"> + + <ImageView + android:id="@+id/image0" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal|top" + android:layout_marginTop="60dp" + android:visibility="gone" + /> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + android:layout_gravity="left|bottom" + > + + <Button + android:id="@+id/btn0" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Next" + android:visibility="gone" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + /> + + <TextView + android:id="@+id/tv0" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + tools:text="foobar" + android:textColor="@android:color/white" + android:textSize="24sp" /> + + <TextView + android:id="@+id/tv1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + tools:text="foobar" + android:textColor="@android:color/white" + android:textSize="12sp" /> + + <TextView + android:id="@+id/tv2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + tools:text="foobar" + android:textColor="@android:color/white" + android:textSize="12sp" /> + + <TextView + android:id="@+id/tv3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left|bottom" + android:gravity="center" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + android:layout_marginBottom="20dp" + tools:text="foobar" + android:textColor="@android:color/white" + android:textSize="12sp" /> + + </LinearLayout> + +</FrameLayout> diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/values-zh/config.xml b/apps/tv/SetupCustomizationSample/app/src/main/res/values-zh/config.xml new file mode 100644 index 0000000..2441911 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/values-zh/config.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <!--<string name="welcome_message">你好</string>--> + + <!--<string name="hotword_description_appendage">Hotwording 很熱!</string>--> + + + <!--<string name="tutorial_title0">恐龍好可怕</string>--> + <!--<string name="tutorial_description0">要小心,否則你可能會被吃掉</string>--> + + <!--<string name="tutorial_title1">這部電影很棒</string>--> + <!--<string name="tutorial_description1">小孩子喜歡恐龍玩具</string>--> + +</resources> diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/values/config.xml b/apps/tv/SetupCustomizationSample/app/src/main/res/values/config.xml new file mode 100644 index 0000000..47841f7 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/values/config.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + + <!-- Whether to allow backing into the HOOK_BEGIN activities. --> + <!--<bool name="allow_hook_replay"></bool>--> + + + <!-- Whether to allow background music to play. --> + <!-- <bool name="play_background_music"></bool> --> + + + <!-- Whether to allow background movie to play. --> + <!-- <bool name="play_background_movie"></bool> --> + + + <!-- Whether to allow the welcome (locale picker) to be shown. --> + <!--<bool name="show_welcome"></bool>--> + + + <!-- Whether to show the your-device-has-been-upgraded step in the case of a post-provisioned-upgrade run. --> + <!--<bool name="show_welcome_post_provisioned_upgrade"></bool>--> + + + <!-- Provide a list of locales to show atop the default locale picker. + Relevant only if the default locale picker is shown. --> + <!--<string-array name="preferred_locales"><item></item></string-array>--> + + + <!-- Provide a welcome string to display on the default locale picker. + Relevant only if the default locale picker is shown. --> + <!--<string name="welcome_message"></string>--> + + + <!-- Provide the android:maxWidth attribute for the welcome string on the default locale picker. + Relevant only if the default locale picker is shown. --> + <!--<dimen name="welcome_message_max_width"></dimen>--> + + + <!-- Provide the y offset for the welcome string on the default locale picker. A negative value + means lift the View upward; a positive value means push it downward. + Relevant only if the default locale picker is shown. --> + <!--<dimen name="welcome_message_offset"></dimen>--> + + + <!-- Whether to present the device-to-device bootstrap (QuickSetup) flow. --> + <!--<bool name="show_quicksetup"></bool>--> + + + <!-- Whether to allow the user to skip the default Network step. --> + <!--<bool name="show_skip_network"></bool>--> + + + <!-- Whether to allow the user to skip the Google Account Sign-in step. --> + <!--<bool name="show_skip_signin"></bool>--> + + + <!-- Whether to show the set-device-name step. --> + <!--<bool name="show_set_device_name"></bool>--> + + + <!-- Whether to show the assistant hotword step during Setup. + This is only relevant if the device supports hotwording. --> + <!--<bool name="show_assistant_hotword"></bool>--> + + + <!-- Provide a partner-specific string for the hotword step. + This is only relevant if the hotwording step gets shown. --> + <!--<string name="hotword_description_appendage"></string>--> + + + <!-- Whether the tutorials step should be shown in the case of a post-provisioned-upgrade run. --> + <!--<bool name="show_tutorial_post_provisioned_upgrade"></bool>--> + + + <!-- Tutorial resources + <array name="tutorial_drawables"> + <item>@drawable/tutorial_image_0</item> + <item>@drawable/tutorial_image_1</item> + </array> + + <string-array name="tutorial_titles"> + <item>@string/tutorial_title0</item> + <item>@string/tutorial_title1</item> + </string-array> + + <string-array name="tutorial_descriptions"> + <item>@string/tutorial_description0</item> + <item>@string/tutorial_description1</item> + </string-array> + + <string name="tutorial_title0">Dinosaurs are scary</string> + <string name="tutorial_description0">Do not mess with them, or you might get eaten. Be aware!</string> + + <string name="tutorial_title1">This movie was great</string> + <string name="tutorial_description1">Be sure to purchase lots of merchandise</string> + --> + +</resources> diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/values/strings.xml b/apps/tv/SetupCustomizationSample/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..25fe7ea --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ +<resources> + + +</resources> diff --git a/apps/tv/SetupCustomizationSample/app/src/main/res/values/styles.xml b/apps/tv/SetupCustomizationSample/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..178c902 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/app/src/main/res/values/styles.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <style name="AppTheme" parent="@style/Theme.Leanback"> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:windowIsTranslucent">true</item> + <item name="android:windowShowWallpaper">false</item> + </style> + + <style name="AppThemeOpaque" parent="@style/Theme.Leanback"> + <item name="android:windowBackground">@android:color/holo_blue_light</item> + </style> + +</resources> diff --git a/apps/tv/SetupCustomizationSample/build.gradle b/apps/tv/SetupCustomizationSample/build.gradle new file mode 100644 index 0000000..e6b32bc --- /dev/null +++ b/apps/tv/SetupCustomizationSample/build.gradle @@ -0,0 +1,27 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/apps/tv/SetupCustomizationSample/gradle.properties b/apps/tv/SetupCustomizationSample/gradle.properties new file mode 100644 index 0000000..aac7c9b --- /dev/null +++ b/apps/tv/SetupCustomizationSample/gradle.properties @@ -0,0 +1,17 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/apps/tv/SetupCustomizationSample/gradle/wrapper/gradle-wrapper.jar b/apps/tv/SetupCustomizationSample/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 0000000..13372ae --- /dev/null +++ b/apps/tv/SetupCustomizationSample/gradle/wrapper/gradle-wrapper.jar diff --git a/apps/tv/SetupCustomizationSample/gradle/wrapper/gradle-wrapper.properties b/apps/tv/SetupCustomizationSample/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e03ba59 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed May 09 12:57:15 PDT 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/apps/tv/SetupCustomizationSample/gradlew b/apps/tv/SetupCustomizationSample/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/apps/tv/SetupCustomizationSample/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/apps/tv/SetupCustomizationSample/settings.gradle b/apps/tv/SetupCustomizationSample/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/apps/tv/SetupCustomizationSample/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/apps/tv/SetupValidation/.gitignore b/apps/tv/SetupValidation/.gitignore new file mode 100644 index 0000000..09b993d --- /dev/null +++ b/apps/tv/SetupValidation/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/apps/tv/SetupValidation/app/.gitignore b/apps/tv/SetupValidation/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/apps/tv/SetupValidation/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/apps/tv/SetupValidation/app/build.gradle b/apps/tv/SetupValidation/app/build.gradle new file mode 100644 index 0000000..05f841e --- /dev/null +++ b/apps/tv/SetupValidation/app/build.gradle @@ -0,0 +1,27 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 26 + defaultConfig { + applicationId "com.google.android.tv.setup.validation" + minSdkVersion 21 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + lintOptions { + abortOnError false + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:leanback-v17:26.1.0' + implementation 'com.android.support:appcompat-v7:26.1.0' +} diff --git a/apps/tv/SetupValidation/app/proguard-rules.pro b/apps/tv/SetupValidation/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/apps/tv/SetupValidation/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/apps/tv/SetupValidation/app/src/main/AndroidManifest.xml b/apps/tv/SetupValidation/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..83feeaa --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/AndroidManifest.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.google.android.tv.setup.validation"> + + <uses-feature + android:name="android.hardware.touchscreen" + android:required="false" /> + <uses-feature + android:name="android.software.leanback" + android:required="true" /> + + <application + android:label="TV Setup Validation" + android:theme="@style/AppTheme"> + + + <!-- A simple opaque Activity with a button that finishes it. --> + <activity + android:name=".OpaqueActivity" + android:screenOrientation="landscape" + android:label="Opaque Activity" + android:exported="true" + android:theme="@style/AppThemeOpaque" + > + </activity> + + <!-- A simple transparent Activity with a button that finishes it. --> + <activity + android:name=".TransparentActivity" + android:screenOrientation="landscape" + android:label="Transparent Activity" + android:exported="true" + > + </activity> + + + <!-- Implements a pre-Enrollment action (which is normally handled by Katniss). We say + 'pre-Enrollment' because the actual enrollment Activity is a device-specific Activity; the + design calls for the Katniss implementation of this action to redirect to that device- + specific Activity (which we do not attempt here with MockHotwordEnrollmentActivity)--> + <activity + android:name=".MockHotwordEnrollmentActivity" + android:screenOrientation="landscape" + android:label="Mock Hotword Enrollment" + > + <intent-filter> + <action android:name="com.google.android.katniss.action.ATV_SETUP_ENROLL_HOTWORD" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + + <!-- Implements a delegate-to-Katniss action. --> + <activity + android:name=".MockKatnissActivity" + android:screenOrientation="landscape" + android:label="Mock Katniss" + > + <intent-filter> + <action android:name="com.google.android.katniss.action.ATV_SETUP" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + </application> + +</manifest> diff --git a/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/BaseActivity.java b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/BaseActivity.java new file mode 100644 index 0000000..d369192 --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/BaseActivity.java @@ -0,0 +1,50 @@ +package com.google.android.tv.setup; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.TextView; + +import com.google.android.tv.setup.validation.R; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public abstract class BaseActivity extends Activity { + + protected ImageView iv0; + protected Button btn0; + protected TextView tv0; + protected TextView tv1; + protected TextView tv2; + protected TextView tv3; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_base_layout); + + iv0 = (ImageView)findViewById(R.id.image0); + btn0 = (Button)findViewById(R.id.btn0); + tv0 = (TextView)findViewById(R.id.tv0); + tv1 = (TextView)findViewById(R.id.tv1); + tv2 = (TextView)findViewById(R.id.tv2); + tv3 = (TextView)findViewById(R.id.tv3); + + tv0.setText(getTitle()); + + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + Date now = new Date(); + String strDate = sdf.format(now); + tv1.setText(strDate); + + boolean movingForward = getIntent().getBooleanExtra("movingForward", true); + tv2.setText("movingForward: " + movingForward); + } + + protected void log(String message) { + Log.d(getPackageName(), message); + } +} diff --git a/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/MockHotwordEnrollmentActivity.java b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/MockHotwordEnrollmentActivity.java new file mode 100644 index 0000000..c05624d --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/MockHotwordEnrollmentActivity.java @@ -0,0 +1,27 @@ +package com.google.android.tv.setup.validation; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; + +import com.google.android.tv.setup.BaseActivity; + +public class MockHotwordEnrollmentActivity extends BaseActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + iv0.setVisibility(View.VISIBLE); + iv0.setImageResource(R.drawable.hotword_enrollment); + + btn0.setVisibility(View.VISIBLE); + btn0.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + setResult(Activity.RESULT_OK); + finish(); + } + }); + } +} diff --git a/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/MockKatnissActivity.java b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/MockKatnissActivity.java new file mode 100644 index 0000000..9ff134d --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/MockKatnissActivity.java @@ -0,0 +1,31 @@ +package com.google.android.tv.setup.validation; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; + +import com.google.android.tv.setup.BaseActivity; + +public class MockKatnissActivity extends BaseActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + iv0.setVisibility(View.VISIBLE); + iv0.setImageResource(R.drawable.mock_katniss); + + btn0.setVisibility(View.VISIBLE); + btn0.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + onAboutToFinish(); + finish(); + } + }); + } + + protected void onAboutToFinish() { + setResult(Activity.RESULT_OK); + } +} diff --git a/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/OpaqueActivity.java b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/OpaqueActivity.java new file mode 100644 index 0000000..2ebf60d --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/OpaqueActivity.java @@ -0,0 +1,27 @@ +package com.google.android.tv.setup.validation; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; + +import com.google.android.tv.setup.BaseActivity; + +public class OpaqueActivity extends BaseActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + iv0.setVisibility(View.VISIBLE); + iv0.setImageResource(R.drawable.opaque_tile); + + btn0.setVisibility(View.VISIBLE); + btn0.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + setResult(Activity.RESULT_OK); + finish(); + } + }); + } +} diff --git a/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/TransparentActivity.java b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/TransparentActivity.java new file mode 100644 index 0000000..7b379ab --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/java/com/google/android/tv/setup/validation/TransparentActivity.java @@ -0,0 +1,27 @@ +package com.google.android.tv.setup.validation; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; + +import com.google.android.tv.setup.BaseActivity; + +public class TransparentActivity extends BaseActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + iv0.setVisibility(View.VISIBLE); + iv0.setImageResource(R.drawable.opaque_tile); + + btn0.setVisibility(View.VISIBLE); + btn0.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + setResult(Activity.RESULT_OK); + finish(); + } + }); + } +} diff --git a/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/hotword_enrollment.png b/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/hotword_enrollment.png Binary files differnew file mode 100644 index 0000000..c61f013 --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/hotword_enrollment.png diff --git a/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/mock_katniss.png b/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/mock_katniss.png Binary files differnew file mode 100644 index 0000000..b83bddf --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/mock_katniss.png diff --git a/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/opaque_tile.png b/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/opaque_tile.png Binary files differnew file mode 100644 index 0000000..ffe417c --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/res/drawable-xhdpi/opaque_tile.png diff --git a/apps/tv/SetupValidation/app/src/main/res/layout/activity_base_layout.xml b/apps/tv/SetupValidation/app/src/main/res/layout/activity_base_layout.xml new file mode 100644 index 0000000..da44ab4 --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/res/layout/activity_base_layout.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + xmlns:tools="http://schemas.android.com/tools"> + + <ImageView + android:id="@+id/image0" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal|top" + android:layout_marginTop="60dp" + android:visibility="gone" + /> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + android:layout_gravity="left|bottom" + > + + <Button + android:id="@+id/btn0" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Next" + android:visibility="gone" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + /> + + <TextView + android:id="@+id/tv0" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + tools:text="foobar" + android:textColor="@android:color/white" + android:textSize="24sp" /> + + <TextView + android:id="@+id/tv1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + tools:text="foobar" + android:textColor="@android:color/white" + android:textSize="12sp" /> + + <TextView + android:id="@+id/tv2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + tools:text="foobar" + android:textColor="@android:color/white" + android:textSize="12sp" /> + + <TextView + android:id="@+id/tv3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left|bottom" + android:gravity="center" + android:layout_marginTop="20dp" + android:layout_marginLeft="20dp" + android:layout_marginBottom="20dp" + tools:text="foobar" + android:textColor="@android:color/white" + android:textSize="12sp" /> + + </LinearLayout> + +</FrameLayout> diff --git a/apps/tv/SetupValidation/app/src/main/res/values/strings.xml b/apps/tv/SetupValidation/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..25fe7ea --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ +<resources> + + +</resources> diff --git a/apps/tv/SetupValidation/app/src/main/res/values/styles.xml b/apps/tv/SetupValidation/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..178c902 --- /dev/null +++ b/apps/tv/SetupValidation/app/src/main/res/values/styles.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <style name="AppTheme" parent="@style/Theme.Leanback"> + <item name="android:windowBackground">@android:color/transparent</item> + <item name="android:windowIsTranslucent">true</item> + <item name="android:windowShowWallpaper">false</item> + </style> + + <style name="AppThemeOpaque" parent="@style/Theme.Leanback"> + <item name="android:windowBackground">@android:color/holo_blue_light</item> + </style> + +</resources> diff --git a/apps/tv/SetupValidation/build.gradle b/apps/tv/SetupValidation/build.gradle new file mode 100644 index 0000000..e6b32bc --- /dev/null +++ b/apps/tv/SetupValidation/build.gradle @@ -0,0 +1,27 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/apps/tv/SetupValidation/gradle.properties b/apps/tv/SetupValidation/gradle.properties new file mode 100644 index 0000000..aac7c9b --- /dev/null +++ b/apps/tv/SetupValidation/gradle.properties @@ -0,0 +1,17 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/apps/tv/SetupValidation/gradle/wrapper/gradle-wrapper.jar b/apps/tv/SetupValidation/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 0000000..13372ae --- /dev/null +++ b/apps/tv/SetupValidation/gradle/wrapper/gradle-wrapper.jar diff --git a/apps/tv/SetupValidation/gradle/wrapper/gradle-wrapper.properties b/apps/tv/SetupValidation/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e03ba59 --- /dev/null +++ b/apps/tv/SetupValidation/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed May 09 12:57:15 PDT 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/apps/tv/SetupValidation/gradlew b/apps/tv/SetupValidation/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/apps/tv/SetupValidation/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/apps/tv/SetupValidation/settings.gradle b/apps/tv/SetupValidation/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/apps/tv/SetupValidation/settings.gradle @@ -0,0 +1 @@ +include ':app' |