מסגרת קלט טלוויזיה

סמל HAL של Android TV

מסגרת הקלט של Android TV (TIF) מפשטת את האספקה ​​של תוכן חי ל-Android TV. ה-Android TIF מספק API סטנדרטי ליצרנים ליצירת מודולי קלט לשליטה ב-Android TV, ומאפשר חיפוש טלוויזיה והמלצות בשידור חי באמצעות מטא נתונים שפורסמו על ידי קלט הטלוויזיה.

המסגרת אינה שואפת ליישם תקני טלוויזיה או דרישות אזוריות, אך כן מקלה על יצרני מכשירים לעמוד בתקני שידור טלוויזיה דיגיטלית אזורית ללא יישום מחדש. התיעוד בסעיף זה עשוי להיות שימושי גם למפתחי אפליקציות של צד שלישי שרוצים ליצור כניסות טלוויזיה מותאמות אישית.

רכיבים

יישום Android TV Input Framework כולל מנהל קלט טלוויזיה. ה-TIF עובד עם אפליקציית הטלוויזיה, אפליקציית מערכת שלא ניתנת להחלפה באפליקציית צד שלישי, כדי לגשת לערוצי טיונר מובנים ו-IP. אפליקציית הטלוויזיה מתקשרת עם מודולי קלט טלוויזיה שסופקו על ידי יצרן המכשיר או גורמים אחרים דרך מנהל קלט הטלוויזיה.

מסגרת קלט הטלוויזיה מורכבת מ:

  • ספק טלוויזיה ( com.android.providers.tv.TvProvider ): מסד נתונים של ערוצים, תוכניות והרשאות קשורות
  • אפליקציית טלוויזיה ( com.android.tv.TvActivity ): האפליקציה שמטפלת באינטראקציה של משתמשים
  • מנהל קלט טלוויזיה ( android.media.tv.TvInputManager ): מאפשר לכניסות הטלוויזיה לתקשר עם אפליקציית הטלוויזיה
  • קלט טלוויזיה: אפליקציה המייצגת מקלטים פיזיים או וירטואליים ויציאות קלט
  • TV Input HAL (מודול tv_input ): הגדרת חומרה המאפשרת לכניסות טלוויזיה של המערכת לגשת לחומרה ספציפית לטלוויזיה כאשר היא מיושמת
  • בקרת הורים: הטכנולוגיה המאפשרת חסימת ערוצים ותוכניות
  • HDMI-CEC: הטכנולוגיה המאפשרת שליטה מרחוק במכשירים שונים באמצעות HDMI
  • Tuner Framework: מסגרת לכניסת טלוויזיה מובנית
  • MediaCas: מסגרת לגישה מותנית
  • Tuner Resource Manager: שירות לניהול משאב החומרה עבור קלט טלוויזיה, MediaCas וקלט מובנה

רכיבים אלה מכוסים בפירוט להלן. עיין בתרשים הבא לתצוגה מפורטת של ארכיטקטורת מסגרת הקלט של Android TV.

סקירה כללית של ארכיטקטורת TIF של אנדרואיד
איור 1. ארכיטקטורת Android TV Input Framework (TIF).

זְרִימָה

כך מופעלת הארכיטקטורה:

  1. המשתמש רואה ומקיים אינטראקציה עם אפליקציית הטלוויזיה, אפליקציית מערכת שלא ניתנת להחלפה באפליקציית צד שלישי.
  2. אפליקציית הטלוויזיה מציגה את תוכן ה-AV מכניסת הטלוויזיה.
  3. אפליקציית הטלוויזיה אינה יכולה לדבר ישירות עם כניסות הטלוויזיה. מנהל קלט הטלוויזיה מזהה את מצב כניסות הטלוויזיה עבור אפליקציית הטלוויזיה. עיין במנהל קלט הטלוויזיה למטה לקבלת פרטים נוספים על מגבלות אלו.

הרשאות

  • רק signatureOrSystem TV Inputs ואפליקציית TV הם בעלי גישה מלאה למסד הנתונים של ספק הטלוויזיה והם מסוגלים לקבל KeyEvents.
  • רק כניסות הטלוויזיה של המערכת יכולות לגשת ל-TV Input HAL דרך שירות TV Input Manager. ניתן לגשת לכניסות טלוויזיה אחד לאחד באמצעות הפעלות של מנהל קלט טלוויזיה.
  • לכניסות טלוויזיה של צד שלישי יש גישה נעולה בחבילה למסד הנתונים של ספק הטלוויזיה ויכולות לקרוא/לכתוב רק לשורות חבילות תואמות.
  • כניסות טלוויזיה של צד שלישי יכולות להציג תוכן משלהן או תוכן מכניסות טלוויזיה עוברות של יצרן מכשיר, כמו HDMI1. הם לא יכולים להציג תוכן מכניסות טלוויזיה שאינן עוברות, כמו מקלט מובנה או מקלט IPTV.
  • הרשאת TV_INPUT_HARDWARE לאפליקציית קלט טלוויזיה בחומרה, מסמנת לשירות מנהל קלט הטלוויזיה להודיע ​​לשירות קלט הטלוויזיה בעת האתחול להתקשר לשירות מנהל קלט הטלוויזיה ולהוסיף את כניסות הטלוויזיה שלו. הרשאה זו מאפשרת לאפליקציית חומרת קלט טלוויזיה לתמוך במספר כניסות טלוויזיה לכל שירות קלט טלוויזיה, כמו גם אפשרות להוסיף ולהסיר באופן דינמי את כניסות הטלוויזיה הנתמכות שלה.

ספק טלוויזיה

מסד הנתונים של ספק הטלוויזיה מאחסן את הערוצים והתוכניות מכניסות טלוויזיה. ספק הטלוויזיה גם מפרסם ומנהל את ההרשאות הקשורות כך שכניסות טלוויזיה יוכלו לראות רק את הרשומות שלהם. לדוגמה, קלט טלוויזיה ספציפי יכול לראות רק את הערוצים והתוכניות שהוא סיפק ואסור לו לגשת לערוצים ולתוכניות של כניסות טלוויזיה אחרות.

ספק הטלוויזיה ממפה "ז'אנר שידור" ל"ז'אנר קנוני" באופן פנימי. כניסות טלוויזיה אחראיות לאכלוס "ז'אנר שידור" בערך בתקן השידור הבסיסי, והשדה "ז'אנר קנוני" יאוכלס אוטומטית בז'אנר המשויך הנכון מ- android.provider.TvContract.Genres . לדוגמה, עם תקן שידור ATSC A/65 ותוכנית עם ז'אנר 0x25 (כלומר "ספורט"), קלט הטלוויזיה יאכלס את "ז'אנר השידור" במחרוזת "ספורט" וספק הטלוויזיה יאכלס את השדה "ז'אנר קנוני" עם הערך המופה android.provider.TvContract.Genres.SPORTS .

עיין בתרשים שלהלן לתצוגה מפורטת של ספק הטלוויזיה.

ספק אנדרואיד TV
איור 2. ספק Android TV

רק אפליקציות במחיצת המערכת הפריבילגית יכולות לקרוא את כל מסד הנתונים של ספק הטלוויזיה.

כניסות מעבר לטלוויזיה אינן מאחסנות ערוצים ותוכניות.

בנוסף לשדות הסטנדרטיים עבור ערוצים ותוכניות, מסד הנתונים של ספקי הטלוויזיה מציע גם שדה מסוג BLOB, COLUMN_INTERNAL_PROVIDER_DATA , בכל טבלה שבה כניסות טלוויזיה עשויות להשתמש כדי לאחסן נתונים שרירותיים. נתוני BLOB אלה יכולים לכלול מידע מותאם אישית, כגון תדירות הטיונר המשויך, ועשויים להיות מסופקים במאגר פרוטוקול או בצורה אחרת. שדה ניתן לחיפוש זמין כדי להפוך ערוצים מסוימים ללא זמינים בחיפוש (כגון לעמוד בדרישות ספציפיות למדינה להגנה על תוכן).

דוגמאות לשדות מסד נתונים

ספק הטלוויזיה תומך בנתונים מובנים בטבלאות ערוצים ( android.provider.TvContract.Channels ) ותוכניות ( android.provider.TvContract.Programs ). טבלאות אלה מאוכלסות וניגשים אליהן על ידי כניסות טלוויזיה ואפליקציות מערכת כמו אפליקציית הטלוויזיה. לטבלאות אלה יש ארבעה סוגי שדות:

  • תצוגה: שדות תצוגה מכילים מידע שיישומים עשויים לרצות להפוך לגלויים למשתמש, כמו שם ערוץ ( COLUMN_DISPLAY_NAME ) או מספר ( COLUMN_DISPLAY_NUMBER ), או כותרת התוכנית הנצפה.
  • מטא נתונים: ישנם שלושה שדות לזיהוי תוכן, בהתאם לסטנדרטים הרלוונטיים, כמו מזהה זרם התחבורה של הערוץ ( COLUMN_TRANSPORT_STREAM_ID ), מזהה הרשת המקורי ( COLUMN_ORIGINAL_NETWORK_ID ) ומזהה השירות ( COLUMN_SERVICE_ID ).
  • נתונים פנימיים : שדות המיועדים לשימוש מותאם אישית של כניסות טלוויזיה.
    שדות מסוימים, כמו COLUMN_INTERNAL_PROVIDER_DATA , הם שדות BLOB הניתנים להתאמה אישית שבהם קלט טלוויזיה יכול לאחסן מטא נתונים שרירותיים לגבי הערוץ או התוכנית שלהם.
  • דגל: שדות דגל מייצגים אם יש להגביל ערוץ מחיפוש, עיון או צפייה. ניתן להגדיר זאת רק ברמת הערוץ. כל התוכניות דוחות להגדרה בערוץ.
    • COLUMN_SEARCHABLE : הגבלת חיפוש מערוצים מסוימים עשויה להיות דרישה באזורים מסוימים. COLUMN_SEARCHABLE = 0 פירושו שהערוץ לא אמור להיחשף בתוצאות החיפוש.
    • COLUMN_BROWSABLE : גלוי ליישומי מערכת בלבד. הגבלת אפליקציות לגלישה בערוץ. COLUMN_BROWSABLE = 0 פירושו שהערוץ לא אמור להיכלל ברשימת הערוצים.
    • COLUMN_LOCKED : גלוי ליישומי מערכת בלבד. הגבלת הצפייה בערוץ על ידי חשבונות לא חוקיים מבלי להזין קוד PIN. COLUMN_LOCKED = 1 אומר שהערוץ צריך להיות מוגן על ידי בקרת הורים.

לרשימה ממצה יותר של השדות, ראה android/frameworks/base/media/java/android/media/tv/TvContract.java

הרשאות ובקרת גישה

כל השדות גלויים לכל מי שיש לו גישה לשורה המתאימה. אין שדות נגישים ישירות למשתמשים; הם רואים רק את מה שעל פני השטח של אפליקציית הטלוויזיה, אפליקציות המערכת או כניסות הטלוויזיה.

  • לכל שורה יש PACKAGE_NAME , החבילה (אפליקציה) שבבעלותה שורה זו, מסומנת ב-Query, Insert, Update באמצעות TvProvider.java. קלט טלוויזיה רשאי לגשת רק למידע שכתב והוא מגודר מהמידע המסופק על ידי כניסות טלוויזיה אחרות.
  • קרא, כתוב הרשאות באמצעות AndroidManifest.xml (דורש הסכמת משתמש) כדי לקבוע ערוצים זמינים.
  • רק אפליקציות signatureOrSystem יכולות לקבל הרשאת ACCESS_ALL_EPG_DATA לגשת למסד הנתונים כולו.

מנהל קלט טלוויזיה

מנהל קלט הטלוויזיה מספק ממשק API מערכת מרכזי למסגרת הקלט הכוללת של Android TV. זה בורר אינטראקציה בין אפליקציות וכניסות טלוויזיה ומספק פונקציונליות של בקרת הורים. יש ליצור הפעלות של מנהל קלט טלוויזיה אחד על אחד עם כניסות טלוויזיה. מנהל קלט הטלוויזיה מאפשר גישה לכניסות טלוויזיה מותקנות כך שאפליקציות עשויות:

  • רשום את כניסות הטלוויזיה ובדוק את מצבן
  • צור הפעלות ונהל את המאזינים

עבור הפעלות, קלט טלוויזיה עשוי להיות מכוון על ידי אפליקציית הטלוויזיה רק ​​ל-URI שהיא הוסיפה למסד הנתונים של ספק הטלוויזיה, למעט כניסות טלוויזיה מעבר שניתן לכוונן באמצעות TvContract.buildChannelUriForPassthroughInput() . ייתכן שגם עוצמת הקול של כניסת טלוויזיה מוגדרת. כניסות טלוויזיה שסופקו ונחתמו על ידי יצרן המכשיר (אפליקציות חתימה) או אפליקציות אחרות המותקנות במחיצת המערכת יקבלו גישה לכל מסד הנתונים של ספק הטלוויזיה. ניתן להשתמש בגישה זו לבניית אפליקציות לגלישה ולחיפוש בכל ערוצי הטלוויזיה והתוכניות הזמינים.

אפליקציה עשויה ליצור ולרשום TvInputCallback עם android.media.tv.TvInputManager כדי להיקרא בחזרה בשינוי המצב של קלט טלוויזיה או בהוספה או הסרה של קלט טלוויזיה. לדוגמה, אפליקציית טלוויזיה יכולה להגיב כאשר קלט טלוויזיה מנותק על ידי הצגתו כמנותק ומניעת בחירתו.

מנהל קלט הטלוויזיה מפשט תקשורת בין אפליקציית הטלוויזיה לכניסות הטלוויזיה. הממשק הסטנדרטי של TV Input Manager ו-TV Input מאפשר ליצרני מכשירים מרובים ליצור אפליקציות טלוויזיה משלהם תוך סיוע לכל כניסות הטלוויזיה של צד שלישי לעבוד בכל אפליקציות הטלוויזיה.

כניסות טלוויזיה

כניסות טלוויזיה הן אפליקציות אנדרואיד במובן זה שיש להן AndroidManifest.xml והן מותקנות (באמצעות Play, מותקנות מראש או נטענות בצד). Android TV תומך באפליקציות מערכת מותקנות מראש, אפליקציות חתומות על ידי יצרן המכשיר וכניסות טלוויזיה של צד שלישי.

כניסות מסוימות, כמו כניסת HDMI או כניסת טיונר מובנית, יכולות להיות מסופקות רק על ידי היצרן מכיוון שהן מדברות ישירות עם החומרה הבסיסית. אחרים, כגון IPTV, העברת מקום ו-STB חיצוני, יכולים להיות מסופקים על ידי צדדים שלישיים כ-APKs בחנות Google Play. לאחר ההורדה וההתקנה, ניתן לבחור את הקלט החדש באפליקציית הטלוויזיה.

דוגמה לקלט מעבר

קלט מערכת Android TV
איור 3. קלט מערכת Android TV

בדוגמה זו, קלט הטלוויזיה שסופק על ידי יצרן המכשיר הוא מהימן ויש לו גישה מלאה לספק הטלוויזיה. ככניסת טלוויזיה עוברת, הוא אינו רושם אף ערוצים או תוכניות אצל ספק הטלוויזיה. כדי להשיג את ה-URI המשמש להפניה לקלט המעבר, השתמש בשיטת השירות android.media.tv.TvContract buildChannelUriForPassthroughInput(String inputId) . אפליקציית הטלוויזיה מתקשרת עם מנהל קלט הטלוויזיה כדי להגיע לכניסת הטלוויזיה HDMI.

דוגמה של טיונר מובנה

קלט טיונר מובנה של Android TV
איור 4. קלט טיונר מובנה של Android TV

בדוגמה זו, כניסת הטלוויזיה המובנית של הטיונר המסופק על ידי יצרן המכשיר הוא מהימן ויש לו גישה מלאה לספק הטלוויזיה.

דוגמה לקלט של צד שלישי

קלט של צד שלישי ל-Android TV
איור 5. קלט צד שלישי של Android TV

בדוגמה זו, כניסת הטלוויזיה STB החיצונית מסופקת על ידי צד שלישי. מכיוון שכניסת הטלוויזיה הזו לא יכולה לגשת ישירות להזנת הווידאו של ה-HDMI שנכנסת, היא חייבת לעבור דרך מנהל קלט הטלוויזיה ולהשתמש בכניסת הטלוויזיה HDMI שסופקה על ידי יצרן המכשיר.

דרך מנהל קלט הטלוויזיה, כניסת הטלוויזיה STB החיצונית יכולה לדבר עם כניסת הטלוויזיה HDMI ולבקש ממנה להציג את הסרטון ב-HDMI1. כך שכניסת הטלוויזיה STB יכולה לשלוט בטלוויזיה בזמן שכניסת הטלוויזיה HDMI שסופקה על ידי היצרן מעבדת את הווידאו.

תמונה בתמונה (PIP) לדוגמה

Android TV KeyEvents
איור 6. Android TV KeyEvents

התרשים שלמעלה מראה כיצד לחצנים בשלט רחוק מועברים לכניסת טלוויזיה ספציפית לתצוגת תמונה בתמונה (PIP). לחיצות כפתור אלו מתפרשות על ידי מנהל ההתקן של החומרה שסופק על ידי יצרן המכשיר, הממיר קודי חומרה לקודי מפתחות של אנדרואיד ומעביר אותם לצינור הקלט הסטנדרטי של אנדרואיד InputReader ו- InputDispatcher מתפקדים כ- KeyEvents . אלה בתורם מפעילים אירועים באפליקציית הטלוויזיה אם היא בפוקוס.

רק כניסות טלוויזיה של המערכת זכאיות לקבל InputEvents , ורק אם יש להם הרשאת מערכת RECEIVE_INPUT_EVENT . קלט הטלוויזיה אחראי לקבוע אילו אירועי קלט לצרוך ואמור לאפשר לאפליקציית הטלוויזיה לטפל במפתחות שהיא לא צריכה לצרוך.

אפליקציית הטלוויזיה אחראית לדעת איזו מערכת קלט הטלוויזיה פעילה, כלומר נבחרה על ידי המשתמש, ועל מנת לבלבל את KeyEvents הנכנסים ולנתב אותם להפעלה הנכונה של מנהל קלט הטלוויזיה, תוך קריאה ל- dispatchInputEvent() כדי להעביר את האירוע לקלט הטלוויזיה המשויך. .

דוגמה לקלט MHEG-5

הדיאגרמה הבאה מציגה תצוגה מפורטת יותר של אופן הניתוב של KeyEvents דרך ה-Android TIF.

דוגמה לחצן אדום של Android TV
איור 7. דוגמה לחצן אדום של Android TV

הוא מתאר את הזרימה של אפליקציית כפתור אדום, הנפוצה באירופה המאפשרת למשתמשים לגשת לאפליקציות אינטראקטיביות בטלוויזיות שלהם. ניתן להעביר אפליקציה דרך זרם התחבורה הזה. כאשר הלחצן נלחץ, הוא מאפשר למשתמשים לקיים אינטראקציה עם אפליקציות השידור הללו. לדוגמה, תוכל להשתמש באפליקציות השידור הללו כדי לגשת לדפי אינטרנט קשורים או לתוצאות ספורט.

עיין בסעיף אפליקציית שידור כדי ללמוד כיצד יישומי שידור מקיימים אינטראקציה עם אפליקציית הטלוויזיה.

בדוגמה זו:

  1. אפליקציית הטלוויזיה נמצאת בפוקוס ומקבלת את כל המפתחות.
  2. KeyEvents (למשל הכפתור האדום) מועברים לכניסת הטלוויזיה הפעילה בתור InputEvents.
  3. כניסת הטלוויזיה של המערכת משתלבת עם ערימת MHEG-5 ויש לה הרשאת מערכת RECEIVE_INPUT_EVENT .
  4. עם קבלת קוד מפתח הפעלה (למשל כפתור אדום), כניסת הטלוויזיה מפעילה את אפליקציית השידור.
  5. קלט הטלוויזיה צורך KeyEvents כ- InputEvents ואפליקציית השידור היא המוקד ומטפלת InputEvents עד להדחה.

הערה : כניסות טלוויזיה של צד שלישי לעולם אינן מקבלות מפתחות.

כניסת טלוויזיה HAL

ה-TV Input HAL מסייע בפיתוח כניסות טלוויזיה לגישה לחומרה ספציפית לטלוויזיה. כמו עם HALs אחרים של אנדרואיד, ה-TV Input HAL ( tv_input ) זמין בעץ המקור של AOSP והספק מפתח את היישום שלו.

אפליקציית טלוויזיה

אפליקציית מערכת הטלוויזיה מציגה למשתמש תוכן טלוויזיה חי. אפליקציית עזר לטלוויזיה (Live TV) מסופקת לצד פלטפורמת אנדרואיד, שניתן להשתמש בה כפי שהיא, מותאמת אישית, מורחבת או מוחלפת על ידי יצרני המכשירים. קוד המקור זמין ב-Android Open Source Project, ותוכלו להתחיל איתו במאמר אפליקציית Reference TV .

יצרני מכשירים עשויים להרחיב את יישומי הטלוויזיה שלהם כדי ליישם תכונות ספציפיות ליצרן מכשיר או למדינה, אולם זה אינו בהיקף של TIF או אפליקציית הטלוויזיה הייחוס.

לכל הפחות, אפליקציית הטלוויזיה של המערכת צריכה להתמודד עם המשימות הבאות:

הגדרה ותצורה

  • זיהוי אוטומטי של כניסות טלוויזיה
  • אפשר לכניסות טלוויזיה להתחיל את הגדרת הערוצים
  • שליטה בהגדרות ההורים
  • ערוך ערוצים

צפייה

  • גישה וניווט בכל ערוצי הטלוויזיה
  • גישה לסרגל המידע של תוכניות טלוויזיה
  • הצגת נתוני מדריך תכנות אלקטרוני (EPG).
  • תמיכה במספר רצועות שמע וכתוביות
  • ספק אתגר PIN של בקרת הורים
  • אפשר שכבת-על של ממשק משתמש לכניסת טלוויזיה עבור תקן טלוויזיה (HbbTV וכו')
  • אכלס תוצאות חיפוש עבור ערוצי טלוויזיה ותוכניות
  • הצג כרטיסי קישור לאפליקציה
  • תמיכה בממשקי API לשינוי זמן
  • לטפל בפונקציונליות DVR ולתמוך בממשקי API להקלטת טלוויזיה

מערך תכונות זה יגדל בהתאם לגרסאות אנדרואיד חדשות שבהן הפלטפורמה TIF APIs מורחבת. CTS Verifier מספק את כיסוי בדיקת התאימות.

תמיכה בכניסות טלוויזיה של צד שלישי

Android TV מספקת ממשקי API למפתחים עבור כניסות טלוויזיה של צד שלישי, ומאפשרת לאפליקציות מותקנות להעביר ערוצי תוכנה לחוויית הטלוויזיה החיה. כדי להבטיח הטמעה תואמת של מכשיר אנדרואיד, לאפליקציית מערכת הטלוויזיה ישנה אחריות מסוימת בנוגע להצגת כניסות וערוצים של צד שלישי למשתמש. אפליקציית ה-Reference Live TV מספקת יישום תואם; אם מחליפים את אפליקציית הטלוויזיה של המערכת, יצרני המכשירים חייבים להבטיח שהאפליקציות שלהם מספקות תאימות דומה, כדי לעמוד בציפיות המפתחים בכל מכשירי Android TV.

אפליקציית הטלוויזיה של המערכת חייבת להציג כניסות של צד שלישי לצד שירות ברירת המחדל של הטלוויזיה בשידור חי של המכשיר. ההבטחה של ממשקי ה-API למפתחים היא שמשתמשים יוכלו למצוא ערוצים (לאחר ההתקנה) בחוויית הטלוויזיה הסטנדרטית שלהם.

מותר הבדל חזותי בין ערוצים מובנים לערוצים של צד שלישי, כפי שמוגדר בסעיף אפליקציית הטלוויזיה של ה-CDD של Android.

הסעיפים הבאים מראים כיצד יישום Live TV ממלא את דרישות ה-CDD.

הגדרת ערוץ חדשה

הוספת כניסות/ערוצים חדשים של צד שלישי מתחילה בכך שהמשתמש מוצא ומתקין קלט טלוויזיה מחנות אפליקציות, כגון Google Play.

חלק מכניסות הטלוויזיה של צד שלישי מוסיפות אוטומטית ערוצים למסד הנתונים של TvProvider. עם זאת, רובם יספקו פעילות הגדרה כדי לאפשר למשתמש להגדיר את הערוצים שלו, לספק פרטי התחברות ופעולות אחרות. אפליקציית הטלוויזיה של המערכת צריכה להבטיח שהמשתמש יכול להפעיל את פעילות ההגדרה הזו, וזו הסיבה שה-CDD דורש כניסות של צד שלישי להיות מינימליות של פעולות ניווט הרחק מאפליקציית הטלוויזיה הראשית.

אפליקציית ה-Reference Live TV מספקת את תפריט מקורות הערוצים לגישה לכניסות.

לך להגדרות
איור 8. עבור אל הגדרות .

עבור אל מקור ערוץ בהגדרות
איור 9. עבור אל מקורות ערוץ בהגדרות.

בחר את המקור שלך מהרשימה.
איור 10. בחר את המקור שלך מהרשימה.

הוסף ערוצים מהמקור שלך
איור 11. הוסף ערוצים מהמקור שלך.

בנוסף, כרטיס התראה מוצג בחלק העליון של תפריט אפליקציית הטלוויזיה לאחר התקנת TvInput חדש, כדי להעביר את המשתמש ישירות להגדרות:

התראה שמראה שמקורות ערוץ חדשים זמינים.
איור 12. הודעה שמראה שמקורות ערוצים חדשים זמינים.

אם המשתמש נוקט פעולה באמצעות ההתראה, הוא יכול לבחור להגדיר את המקורות שלו כפי שניתן לראות באיור 10.

ראה הגדרת שירות קלט הטלוויזיה שלך לציפיות המפתחים בתחום זה.

התאם אישית את רשימת הערוצים

יצרני מכשירים עשויים לספק ממשק משתמש כדי להסתיר ערוצים מסוימים ולאפשר למשתמשים לנהל את ה-EPG שלהם. טלוויזיה בשידור חי כולל מתקן זה.

פתח את רשימת הערוצים בהגדרות.
איור 13. פתח את רשימת הערוצים בהגדרות .

התאם אישית את רשימת הערוצים שלך.
איור 14. התאם אישית את רשימת הערוצים שלך.

EPG

מפתחי קלט של צד שלישי צריכים להיות בטוחים שמשתמשים יכולים לנווט בקלות לערוצים שלהם במהלך שימוש כללי, בכל מכשירי Android TV התואמים.

ערוצים מכניסות של צד שלישי חייבים להיות מוצגים כחלק מה-EPG הסטנדרטי של חוויית טלוויזיה חיה של המכשיר. ניתן להשתמש בהפרדה חזותית או בקטגוריות נפרדות עבור ערוצים של צד שלישי (ראה סעיף אפליקציית הטלוויזיה ב-CDD של Android) — מה שחשוב הוא שהמשתמשים יוכלו למצוא את הערוצים שהם התקינו.

היצרנים חייבים ליישם את אפליקציית הטלוויזיה כדי לכלול תוצאות חיפוש עבור בקשות חיפוש גלובליות על מנת להבטיח את חוויית המשתמש הטובה ביותר. טלוויזיה בשידור חי מספקת יישום (ראה מה מספק תוצאות מתשומות של צד שלישי (נדרש עבור תאימות פלטפורמה) כמו גם תשומות מובנות.

שינוי זמן

עבור מכשירים עם אנדרואיד 6.0 ומעלה, אפליקציית הטלוויזיה חייבת לתמוך בממשקי API לשינוי זמן של מסגרת Android . בנוסף, היצרנים חייבים ליישם בקרות השמעה באפליקציית הטלוויזיה, המאפשרים למשתמשים להשהות, להמשיך, להריץ אחורה ולהריץ קדימה את ההשמעה.

עבור כניסות טלוויזיה התומכות בהזזת זמן, אפליקציית הטלוויזיה צריכה להציג בקרות השמעה.

בקרות השמעה
איור 15. בקרות השמעה

DVR

עבור מכשירים עם אנדרואיד 7.0 ומעלה, אפליקציית הטלוויזיה חייבת לתמוך בממשקי ה-API להקלטת טלוויזיה במסגרת Android, כדי לתמוך, לרשום ולהפעיל תוכניות מוקלטות.

זה מאפשר ליצרני מכשירים לחבר את תת-מערכות ה-DVR שלהם ל-TIF ולהפחית באופן דרמטי את מאמץ האינטגרציה שנדרש כדי להפעיל או לשלב פונקציונליות DVR במכשיר טלוויזיה. זה גם מאפשר לצדדים שלישיים לספק מערכות DVR לאחר השוק שניתן לחבר למכשיר Android TV.

בנוסף להקלטת תוכן חי, אפליקציית הטלוויזיה מטפלת גם בהתנגשות במשאבים. לדוגמה, אם למכשיר יש שני מקלטים, הוא יכול להקליט שתי תוכניות בו-זמנית. אם המשתמש מבקש להקליט שלוש, אפליקציית הטלוויזיה חייבת לטפל בהתנגשות ועליה להציג הודעה או לבקש שהמשתמש יקבע עדיפות לבקשות אלו.

אפליקציות טלוויזיה יכולות גם ליישם היגיון מתוחכם יותר כמו לשאול משתמש אם הוא רוצה להקליט את כל הפרקים העתידיים בסדרה כאשר הוא מבקש להקליט פרק אחד.

ראה את הדיאגרמה הבאה לתצוגה של יישום DVR אפשרי ב-Android TV.

הקלטת וידאו דיגיטלית באנדרואיד TV
איור 16. הקלטת וידאו דיגיטלית באנדרואיד TV

  1. שירות קלט הטלוויזיה אומר לאפליקציית הטלוויזיה כמה מקלטים זמינים כך שאפליקציית הטלוויזיה תוכל להתמודד עם התנגשות משאבים אפשרית.
  2. אפליקציית הטלוויזיה מקבלת בקשה ביוזמת המשתמש להקלטת תוכנית טלוויזיה.
  3. אפליקציית הטלוויזיה מאחסנת את לוח הזמנים של ההקלטות במסד הנתונים הפנימי שלה.
  4. כשמגיע הזמן להקליט, אפליקציית הטלוויזיה מעבירה בקשה לכוונון לערוץ המשויך להקלטה.
  5. שירות קלט הטלוויזיה מקבל בקשה זו, מגיב אם יש משאבים מתאימים או אין, ומכוון לערוץ.
  6. לאחר מכן, אפליקציית הטלוויזיה מעבירה בקשה להתחיל להקליט למנהל קלט הטלוויזיה.
  7. שירות קלט הטלוויזיה מקבל בקשה זו ומתחיל להקליט.
  8. שירות קלט הטלוויזיה מאחסן את נתוני הווידאו בפועל באחסון שלו, שיכולים להיות אחסון חיצוני או אחסון ענן.
  9. כשמגיע הזמן לסיים את ההקלטה, אפליקציית הטלוויזיה מעבירה את בקשת הפסקת ההקלטה למנהל קלט הטלוויזיה.
  10. ברגע ששירות קלט הטלוויזיה מקבל את הבקשה, הוא עוצר את ההקלטה ומוסיף את המטא-נתונים המשויכים שלו לספק הטלוויזיה, כך שאפליקציית הטלוויזיה תוכל להציג את ההקלטה למשתמשים כאשר תתבקש.

למידע נוסף על הטמעת תכונות ההקלטה בשירות קלט הטלוויזיה שלך, עיין במאמר הקלטת טלוויזיה זה.

משאבים שימושיים

  • ה- CDD של אנדרואיד וממשקי API למפתחים מתועדים הם ההפניות הסופיות.
  • CTS Verifier מפעיל את ממשקי ה-API כחלק מתוכנית בדיקת התאימות. הפעלת זה מול Live TV עשויה להיות דרך שימושית לראות את ה-EPG, החיפוש, בקרת הורים ודרישות אחרות בהקשר של קלט של צד שלישי.
  • ראה הגדרת שירות קלט הטלוויזיה שלך לציפיות המפתחים בתחום זה.

בקרת הורים

בקרת הורים מאפשרת למשתמש לחסום ערוצים ותוכניות לא רצויים, אך לעקוף את החסימה על ידי הזנת קוד PIN.

האחריות לפונקציונליות בקרת הורים מתחלקת בין אפליקציית הטלוויזיה, שירות מנהל קלט הטלוויזיה, ספק הטלוויזיה וכניסת הטלוויזיה.

בקרת הורים היא חובה, והיא מכוסה על ידי CTS Verifier.

מספר מדינות הגדירו מערכות דירוג שבהן כניסות טלוויזיה יכולות להשתמש באמצעות ה- API של TVContentRating . בנוסף, כניסות טלוויזיה יכולות לרשום מערכות דירוג מותאמות אישית משלהן כפי שהוכח על ידי מבחן CTS Verifier, שמציג דירוג 'מזויף'. עבור מדינות שבהן קיימת מערכת דירוג סטנדרטית, מומלץ ליצרני המכשירים לשלב את בקרת ההורים של מסגרת קלט הטלוויזיה עם כל מנגנון אחר שהם עשויים לכלול.

ספק טלוויזיה

לכל שורת ערוצים יש שדה COLUMN_LOCKED המשמש לנעילת ערוצים ספציפיים לצפייה מבלי להזין קוד PIN. שדה התוכנית COLUMN_CONTENT_RATING מיועד לתצוגה ואינו משמש לאכיפת בקרת הורים.

מנהל קלט טלוויזיה

מנהל קלט הטלוויזיה מאחסן כל TvContentRating חסום ומגיב ל- isRatingBlocked() כדי לייעץ אם יש לחסום תוכן עם הדירוג הנתון.

כניסת טלוויזיה

קלט הטלוויזיה בודק אם יש לחסום את התוכן הנוכחי על ידי קריאה ל- isRatingBlocked() במנהל קלט הטלוויזיה כאשר הדירוג של התוכן המוצג השתנה (בשינוי תוכנית או ערוץ), או הגדרות בקרת הורים השתנו (ב- ACTION_BLOCKED_RATINGS_CHANGED וב- ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED ) . אם יש לחסום את התוכן, קלט הטלוויזיה משבית את האודיו והווידאו ומודיע לאפליקציית הטלוויזיה שהתוכן הנוכחי נחסם על ידי קריאה ל- notifyContentBlocked(TvContentRating) . אם אין לחסום את התוכן, קלט הטלוויזיה מאפשר אודיו ווידאו ומודיע לאפליקציית הטלוויזיה שהתוכן הנוכחי מותר על ידי קריאה ל- notifyContentAllowed() .

אפליקציית טלוויזיה

כדי לכבד את ממשקי ה-API של בקרת הורים, ולפיכך ליצור פלטפורמה תואמת, אפליקציית הטלוויזיה של המערכת צריכה לספק דרך למשתמשים לנהל בקרת הורים, כולל עבור כל דירוגים מותאמים אישית שנרשמו על ידי אפליקציות ספציפיות.

אפליקציית הטלוויזיה מציגה ממשק משתמש של קוד PIN כאשר היא מקבלת הודעה על ידי קלט טלוויזיה שהתוכן הנוכחי חסום או כאשר המשתמש מנסה לצפות בערוץ חסום.

אפליקציית הטלוויזיה אינה מאחסנת ישירות את הגדרות בקרת ההורים. כאשר המשתמש משנה את הגדרות בקרת ההורים, כל TvContentRating חסום מאוחסן על ידי מנהל קלט הטלוויזיה, וערוצים חסומים מאוחסנים על ידי ספק הטלוויזיה.

אפליקציית הטלוויזיה צריכה להצהיר על ההרשאה android.permission.MODIFY_PARENTAL_CONTROLS כדי לשנות את הגדרות בקרת ההורים.

יצרני המכשירים מוזמנים:

  • הפעל את מבחן בקרת הורים של CTS Verifier מול אפליקציית ה-Reference Live TV לצורך הדגמה של דרישות התאימות.
  • השתמשו באפליקציית ה-Live TV כעזר לאפליקציית הטלוויזיה שלהם: בפרט ראו את המקור ContentRatingsManager ו- RatingSystemsFragment , וכיצד הם מטפלים בדירוגים מותאמים אישית.

HDMI-CEC

HDMI-CEC מאפשר למכשיר אחד לשלוט באחר, ובכך מאפשר לשלט בודד לשלוט במספר מכשירים בקולנוע ביתי. הוא משמש את Android TV כדי להאיץ את ההגדרה ולאפשר שליטה מרחוק על כניסות טלוויזיה שונות באמצעות אפליקציית הטלוויזיה המרכזית. לדוגמה, הוא עשוי להחליף כניסות, להפעיל או לכבות מכשירים ועוד.

ה-Android TIF מיישם את HDMI-CEC כשירות הבקרה של HDMI כך שיצרני מכשירים רק צריכים לפתח דרייברים ברמה נמוכה המתקשרים עם ה-Android TV HAL קל המשקל, ומדלגים על היגיון עסקי מורכב יותר. במתן יישום סטנדרטי, אנדרואיד שואפת לצמצם בעיות תאימות על ידי הפחתת יישומים מפוצלים ותמיכה בתכונות סלקטיביות. שירות בקרת HDMI משתמש בשירותי אנדרואיד הקיימים, כולל קלט ומתח.

המשמעות היא שיישומי HDMI-CEC קיימים יצטרכו להיות מעוצבים מחדש כדי לפעול יחד עם ה-Android TIF. אנו ממליצים שפלטפורמת החומרה תכיל מיקרו-מעבד כדי לקבל הפעלת CEC ופקודות אחרות.

שילוב CEC ב-Android TV
איור 17. שילוב CEC ב-Android TV

  1. האפיק CEC מקבל פקודה מהמקור הפעיל כעת לעבור למקור אחר.
  2. הנהג מעביר את הפקודה ל-HDMI-CEC HAL.
  3. ה-HAL מודיע לכל ActiveSourceChangeListeners .
  4. שירות בקרת HDMI מקבל הודעה על שינוי מקור באמצעות ActiveSourceChangeListener .
  5. שירות TV Input Manager מייצר כוונה עבור אפליקציית הטלוויזיה להחליף את המקור.
  6. לאחר מכן, אפליקציית הטלוויזיה יוצרת הפעלה של מנהל קלט טלוויזיה עבור כניסת הטלוויזיה שאליו עוברת וקוראת ל- setMain באותו הפעלה.
  7. הפעלת מנהל קלט הטלוויזיה מעבירה מידע זה לכניסת הטלוויזיה HDMI.
  8. כניסת טלוויזיה HDMI מבקשת להגדיר את משטח פס הצד.
  9. שירות ה-TV Input Manager יוצר פקודת בקרת ניתוב מתאימה בחזרה ל-HDMI Control Service כאשר המשטח מוגדר.

הנחיות לשילוב טלוויזיה

אפליקציית שידור

מכיוון שלכל מדינה יש דרישות ספציפיות לשידור (MHEG, טלטקסט, HbbTV ועוד), היצרנים צפויים לספק פתרונות משלהם עבור אפליקציית השידור, למשל:

  • MHEG: מחסנית מקורית
  • טלטקסט: מחסנית מקורית
  • HbbTV: פתרון HbbTV מבית Vewd Software

במהדורת Android L, Android TV מצפה מיצרני המכשירים להשתמש במשלבי מערכות או בפתרונות אנדרואיד עבור ערימות טלוויזיה אזוריות, להעביר את פני השטח לערימות תוכנת טלוויזיה או להעביר את קוד המפתח הדרוש כדי ליצור אינטראקציה עם ערימות מדור קודם.

הנה האופן שבו אפליקציית השידור ואפליקציית הטלוויזיה פועלות באינטראקציה:

  1. אפליקציית הטלוויזיה נמצאת בפוקוס, ומקבלת את כל המפתחות.
  2. אפליקציית הטלוויזיה מעבירה מפתחות (כגון כפתור אדום) להתקן קלט הטלוויזיה.
  3. התקן קלט הטלוויזיה משתלב באופן פנימי עם ערימת טלוויזיה מדור קודם.
  4. עם קבלת קוד מפתח הפעלה (כגון לחצן אדום), התקן קלט הטלוויזיה מפעיל אפליקציות שידור.
  5. אפליקציית שידור מתמקדת באפליקציית הטלוויזיה ומטפלת בפעולות המשתמש.

לחיפוש/המלצה קולית, אפליקציית השידור עשויה לתמוך בחיפוש בתוך האפליקציה לחיפוש קולי.

, סמל HAL של Android TV

מסגרת הקלט של Android TV (TIF) מפשטת את האספקה ​​של תוכן חי ל-Android TV. ה-Android TIF מספק API סטנדרטי ליצרנים ליצירת מודולי קלט לשליטה ב-Android TV, ומאפשר חיפוש טלוויזיה והמלצות בשידור חי באמצעות מטא נתונים שפורסמו על ידי קלט הטלוויזיה.

המסגרת אינה שואפת ליישם תקני טלוויזיה או דרישות אזוריות, אך כן מקלה על יצרני מכשירים לעמוד בתקני שידור טלוויזיה דיגיטלית אזורית ללא יישום מחדש. התיעוד בסעיף זה עשוי להיות שימושי גם למפתחי אפליקציות של צד שלישי שרוצים ליצור כניסות טלוויזיה מותאמות אישית.

רכיבים

יישום Android TV Input Framework כולל מנהל קלט טלוויזיה. ה-TIF עובד עם אפליקציית הטלוויזיה, אפליקציית מערכת שלא ניתנת להחלפה באפליקציית צד שלישי, כדי לגשת לערוצי טיונר מובנים ו-IP. אפליקציית הטלוויזיה מתקשרת עם מודולי קלט טלוויזיה שסופקו על ידי יצרן המכשיר או גורמים אחרים דרך מנהל קלט הטלוויזיה.

מסגרת קלט הטלוויזיה מורכבת מ:

  • ספק טלוויזיה ( com.android.providers.tv.TvProvider ): מסד נתונים של ערוצים, תוכניות והרשאות קשורות
  • אפליקציית טלוויזיה ( com.android.tv.TvActivity ): האפליקציה שמטפלת באינטראקציה של משתמשים
  • מנהל קלט טלוויזיה ( android.media.tv.TvInputManager ): מאפשר לכניסות הטלוויזיה לתקשר עם אפליקציית הטלוויזיה
  • קלט טלוויזיה: אפליקציה המייצגת מקלטים פיזיים או וירטואליים ויציאות קלט
  • TV Input HAL (מודול tv_input ): הגדרת חומרה המאפשרת לכניסות טלוויזיה של המערכת לגשת לחומרה ספציפית לטלוויזיה כאשר היא מיושמת
  • בקרת הורים: הטכנולוגיה המאפשרת חסימת ערוצים ותוכניות
  • HDMI-CEC: הטכנולוגיה המאפשרת שליטה מרחוק במכשירים שונים באמצעות HDMI
  • Tuner Framework: מסגרת לכניסת טלוויזיה מובנית
  • MediaCas: מסגרת לגישה מותנית
  • Tuner Resource Manager: שירות לניהול משאב החומרה עבור קלט טלוויזיה, MediaCas וקלט מובנה

רכיבים אלה מכוסים בפירוט להלן. עיין בתרשים הבא לתצוגה מפורטת של ארכיטקטורת מסגרת הקלט של Android TV.

סקירה כללית של ארכיטקטורת TIF של אנדרואיד
איור 1. ארכיטקטורת Android TV Input Framework (TIF).

זְרִימָה

כך מופעלת הארכיטקטורה:

  1. המשתמש רואה ומקיים אינטראקציה עם אפליקציית הטלוויזיה, אפליקציית מערכת שלא ניתנת להחלפה באפליקציית צד שלישי.
  2. אפליקציית הטלוויזיה מציגה את תוכן ה-AV מכניסת הטלוויזיה.
  3. אפליקציית הטלוויזיה אינה יכולה לדבר ישירות עם כניסות הטלוויזיה. מנהל קלט הטלוויזיה מזהה את מצב כניסות הטלוויזיה עבור אפליקציית הטלוויזיה. עיין במנהל קלט הטלוויזיה למטה לקבלת פרטים נוספים על מגבלות אלו.

הרשאות

  • רק signatureOrSystem TV Inputs ואפליקציית TV הם בעלי גישה מלאה למסד הנתונים של ספק הטלוויזיה והם מסוגלים לקבל KeyEvents.
  • רק כניסות הטלוויזיה של המערכת יכולות לגשת ל-TV Input HAL דרך שירות TV Input Manager. ניתן לגשת לכניסות טלוויזיה אחד לאחד באמצעות הפעלות של מנהל קלט טלוויזיה.
  • לכניסות טלוויזיה של צד שלישי יש גישה נעולה בחבילה למסד הנתונים של ספק הטלוויזיה ויכולות לקרוא/לכתוב רק לשורות חבילות תואמות.
  • כניסות טלוויזיה של צד שלישי יכולות להציג תוכן משלהן או תוכן מכניסות טלוויזיה עוברות של יצרן מכשיר, כמו HDMI1. הם לא יכולים להציג תוכן מכניסות טלוויזיה שאינן עוברות, כמו מקלט מובנה או מקלט IPTV.
  • הרשאת TV_INPUT_HARDWARE לאפליקציית קלט טלוויזיה בחומרה, מסמנת לשירות מנהל קלט הטלוויזיה להודיע ​​לשירות קלט הטלוויזיה בעת האתחול להתקשר לשירות מנהל קלט הטלוויזיה ולהוסיף את כניסות הטלוויזיה שלו. הרשאה זו מאפשרת לאפליקציית חומרת קלט טלוויזיה לתמוך במספר כניסות טלוויזיה לכל שירות קלט טלוויזיה, כמו גם אפשרות להוסיף ולהסיר באופן דינמי את כניסות הטלוויזיה הנתמכות שלה.

ספק טלוויזיה

The TV Provider database stores the channels and programs from TV Inputs. The TV Provider also publishes and manages the associated permissions so that TV Inputs can see only their own records. For instance, a specific TV Input can see only the channels and programs it has supplied and is prohibited from accessing any other TV Inputs' channels and programs.

The TV Provider maps "broadcast genre" to "canonical genre" internally. TV Inputs are responsible for populating "broadcast genre" with the value in the underlying broadcast standard, and the "canonical genre" field will automatically be populated with the correct associated genre from android.provider.TvContract.Genres . For example, with broadcast standard ATSC A/65 and program with genre 0x25 (meaning “Sports”), the TV Input will populate the “broadcast genre” with the String “Sports” and TV Provider will populate the “canonical genre” field with the mapped value android.provider.TvContract.Genres.SPORTS .

See the diagram below for a detailed view of the TV Provider.

Android TV Provider
Figure 2. Android TV Provider

Only apps in the privileged system partition can read the entire TV Provider database.

Passthrough TV inputs do not store channels and programs.

In addition to the standard fields for channels and programs, the TV Provider database also offers a BLOB type field, COLUMN_INTERNAL_PROVIDER_DATA , in each table that TV Inputs may use to store arbitrary data. That BLOB data can include custom information, such as frequency of the associated tuner, and may be provided in a protocol buffer or another form. A Searchable field is available to make certain channels unavailable in search (such as to meet country-specific requirements for content protection).

Database field examples

The TV Provider supports structured data in channel ( android.provider.TvContract.Channels ) and program ( android.provider.TvContract.Programs ) tables. These tables are populated and accessed by TV Inputs and system apps like the TV App. These tables have four types of fields:

  • Display: Display fields contain information that apps may want to make visible to the user, like a channel's name ( COLUMN_DISPLAY_NAME ) or number ( COLUMN_DISPLAY_NUMBER ), or the title of the program being viewed.
  • Metadata: There are three fields for identifying content, according to relevant standards, like a channel's transport stream ID ( COLUMN_TRANSPORT_STREAM_ID ), original network ID ( COLUMN_ORIGINAL_NETWORK_ID ) and service id ( COLUMN_SERVICE_ID ).
  • Internal data : Fields that are for the custom use of TV Inputs.
    Some fields, like COLUMN_INTERNAL_PROVIDER_DATA , are customizable BLOB fields where a TV Input can store arbitrary metadata about their channel or program.
  • Flag: Flag fields represent whether a channel should be restricted from search, browse, or viewing. This can be set only at the channel level. All programs defer to the setting on the channel.
    • COLUMN_SEARCHABLE : Restricting search from some channels may be a requirement in certain regions. COLUMN_SEARCHABLE = 0 means the channel should not be exposed in search results.
    • COLUMN_BROWSABLE : Visible to system applications only. Restricting channel from being browsed by applications. COLUMN_BROWSABLE = 0 means the channel should not be included in the channel list.
    • COLUMN_LOCKED : Visible to system applications only. Restricting channel from being viewed by invalid accounts without entering PIN code. COLUMN_LOCKED = 1 means the channel should be protected by parental control.

For a more exhaustive list of the fields, see android/frameworks/base/media/java/android/media/tv/TvContract.java

Permissions and access control

All fields are visible to anyone with access to the corresponding row. No fields are directly accessible to users; they see only what the TV App, System apps, or TV Inputs surface.

  • Each row has PACKAGE_NAME , the package (app) that owns that row, checked on Query, Insert, Update via TvProvider.java. A TV Input may access only the information it wrote and is cordoned off from the information provided by other TV Inputs.
  • READ, WRITE permissions via AndroidManifest.xml (requires user consent) to determine available channels.
  • Only signatureOrSystem apps can acquire ACCESS_ALL_EPG_DATA permission to access the entire database.

TV Input Manager

The TV Input Manager provides a central system API to the overall Android TV Input Framework. It arbitrates interaction between apps and TV Inputs and provides parental control functionality. TV Input Manager sessions must be created one-to-one with TV Inputs. The TV Input Manager allows access to installed TV Inputs so apps may:

  • List TV inputs and check their status
  • Create sessions and manage listeners

For sessions, a TV Input may be tuned by the TV App only to URIs it has added to the TV Provider database, except for passthrough TV Inputs which can be tuned to using TvContract.buildChannelUriForPassthroughInput() . A TV Input may also have its volume set. TV Inputs provided and signed by the device manufacturer (signature apps) or other apps installed in the system partition will have access to the entire TV Provider database. This access can be used to construct apps to browse and search across all available TV channels and programs.

An app may create and register a TvInputCallback with the android.media.tv.TvInputManager to be called back on a TV Input's state change or on the addition or removal of a TV Input. For example, a TV App can react when a TV Input is disconnected by displaying it as disconnected and preventing its selection.

The TV Input Manager abstracts communication between the TV App and TV Inputs. The standard interface of TV Input Manager and TV Input allows multiple device manufacturers to create their own TV Apps while helping all third-party TV Inputs work on all TV Apps.

TV Inputs

TV Inputs are Android apps in the sense they have an AndroidManifest.xml and are installed (via Play, pre-installed, or sideloaded). Android TV supports pre-installed system apps, apps signed by the device manufacturer and third-party TV Inputs.

Some inputs, like the HDMI input or built-in tuner input, can be provided only by the manufacturer as they speak directly with the underlying hardware. Others, such as IPTV, place-shifting, and external STB, can be supplied by third parties as APKs on Google Play Store. Once downloaded and installed, the new input can be selected within the TV App.

Passthrough input example

Android TV System Input
Figure 3. Android TV System Input

In this example, the TV Input provided by the device manufacturer is trusted and has full access to the TV Provider. As a passthrough TV Input, it does not register any channels or programs with the TV Provider. To obtain the URI used to reference the passthrough input, use the android.media.tv.TvContract utility method buildChannelUriForPassthroughInput(String inputId) . The TV App communicates with the TV Input Manager to reach the HDMI TV Input.

Built-in tuner example

Android TV Built-in Tuner Input
Figure 4. Android TV Built-in Tuner Input

In this example, the Built-in Tuner TV Input provided by the device manufacturer is trusted and has full access to the TV Provider.

Third-party input example

Android TV third-party input
Figure 5. Android TV third-party input

In this example, the external STB TV Input is provided by a third party. Since that TV Input can't directly access the HDMI video feed coming in, it must go through the TV Input Manager and use the HDMI TV Input provided by the device manufacture.

Through the TV Input Manager, the external STB TV Input can speak with the HDMI TV Input and ask it to show the video on HDMI1. So the STB TV Input can control the TV while the manufacturer-provided HDMI TV Input renders the video.

Picture in picture (PIP) example

Android TV KeyEvents
Figure 6. Android TV KeyEvents

The diagram above shows how buttons on a remote control are passed to a specific TV Input for picture in picture (PIP) display. Those button presses are interpreted by the hardware driver supplied by the device manufacturer, converting hardware scancodes to Android keycodes and passing them to the standard Android input pipeline InputReader and InputDispatcher functions as KeyEvents . These in turn trigger events on the TV App if it is in focus.

Only system TV Inputs are eligible to receive InputEvents , and only if they have the RECEIVE_INPUT_EVENT system permission. The TV Input is responsible to determine which InputEvents to consume and should allow the TV App to handle the keys it does not need to consume.

The TV App is responsible for knowing which system TV Input is active, meaning selected by the user, and to disambiguate incoming KeyEvents and route them to the correct TV Input Manager session, calling dispatchInputEvent() to pass on the event to the associated TV Input.

MHEG-5 input example

The following diagram shows a more detailed view of how KeyEvents are routed through the Android TIF.

Android TV Red button example
Figure 7. Android TV Red button example

It depicts the flow of a Red button app, common in Europe for letting users access interactive apps on their televisions. An app can be delivered over this transport stream. When the button is clicked, it lets users interact with these broadcast apps. For example, you might use these broadcast apps to access related web pages or sports scores.

See the Broadcast app section to learn how broadcast apps interact with the TV App.

In this example:

  1. The TV App is in focus and receives all keys.
  2. KeyEvents (eg the Red button) is passed to the active TV Input as InputEvents.
  3. The system TV Input integrates with MHEG-5 stack and has the RECEIVE_INPUT_EVENT system permission.
  4. On receiving activation keycode (eg Red button), the TV Input activates broadcast app.
  5. TV input consumes KeyEvents as InputEvents and the broadcast app is the focus and handles InputEvents until dismissed.

Note : Third-party TV inputs never receive keys.

TV Input HAL

The TV Input HAL aids development of TV Inputs to access TV-specific hardware. As with other Android HALs, the TV Input HAL ( tv_input ) is available in the AOSP source tree and the vendor develops its implementation.

TV App

The system TV App presents live TV content to the user. A reference TV App (Live TV) is provided alongside the Android platform, which can be used as-is, customized, extended, or replaced by device manufacturers. The source code is available in the Android Open Source Project, and you can get started with it in the Reference TV app article.

Device manufacturers may extend their TV Apps to implement device manufacturer or country-specific features, however this is not in the scope of TIF or the reference TV App.

At a minimum, the system TV App needs to handle the following tasks:

Setup and configuration

  • Auto-detect TV Inputs
  • Let TV Inputs initiate channel setup
  • Control parental settings
  • Edit channels

Viewing

  • Access and navigate all TV channels
  • Access TV program information bar
  • Display Electronic Programming Guide (EPG) data
  • Support multiple audio and subtitle tracks
  • Supply parental control PIN challenge
  • Allow TV Input UI overlay for TV standard (HbbTV, etc.)
  • Populate search results for TV channels and programs
  • Display app linking cards
  • Support timeshifting APIs
  • Handle DVR functionality and support TV recording APIs

This feature set will increase in line with new Android versions where the platform TIF APIs are extended. CTS Verifier provides the compatibility test coverage.

Support for third-party TV Inputs

Android TV provides developer APIs for third-party TV inputs, enabling installed apps to deliver software channels into the live TV experience. To ensure a compatible Android device implementation, the system TV App has some responsibilities regarding surfacing third-party TV inputs and channels to the user. The reference Live TV app provides a compatible implementation; if replacing the system TV App, device manufacturers must ensure their own apps provide similar compatibility, to meet developer expectations across all Android TV devices.

The system TV App must surface third-party inputs alongside the device's default live TV service. The promise of the developer APIs is that users will be able to find channels (once installed) within their standard TV experience.

Visual differentiation between built-in channels and third-party channels is allowed, as defined in the TV App section of the Android CDD.

The following sections show how the Live TV application fulfills the CDD requirements.

New channel setup

The addition of new third-party inputs/channels begins with the user finding and installing a TV Input from an application store, such as Google Play.

Some third-party TV inputs automatically add channels to the TvProvider database. However most will provide a Setup activity to enable the user to set up their channels, provide login details, and other actions. The system TV App needs to ensure the user can activate this Setup activity, which is why the CDD requires third-party inputs be minimal navigation actions away from the main TV App.

The reference Live TV app provides the Channel Sources menu for accessing inputs.

Go to Settings
Figure 8. Go to Settings .

Go to Channel source in Settings
Figure 9. Go to Channel sources in Settings.

Select your source from the list.
Figure 10. Select your source from the list.

Add channels from your source
Figure 11. Add channels from your source.

In addition a notification card is shown at the top of the TV App menu after a new TvInput is installed, to take the user directly to the Setup:

Notification that shows new channel sources are available.
Figure 12. Notification that shows new channel sources are available.

If the user takes action through the notification, they can select to set up their sources as seen in Figure 10.

See Define Your TV Input Service for developer expectations in this area.

Customize the channel list

Device manufacturers may provide a UI to hide certain channels and enable users to manage their own EPGs. Live TV includes this facility.

Open the channel list in Settings.
Figure 13. Open the channel list in Settings .

Customize your channel list.
Figure 14. Customize your channel list.

EPG

Third-party input developers need to have confidence that users can easily navigate to their channels during general usage, across all compatible Android TV devices.

Channels from third-party inputs must be presented as part of the device's standard live TV experience EPG. Visual separation or separate categories for third-party channels can be used (see the TV App section of the Android CDD) —what's key is that users are able to find the channels they have installed.

Manufacturers must implement the TV App to include search results for global search requests in order to ensure the best user experience. Live TV provides an implementation (see which provides results from third-party inputs (required for platform compatibility) as well as built-in inputs.

Time shifting

For devices on Android 6.0 and above, the TV App must support the Android framework time shifting APIs . Additionally, manufacturers must implement playback controls in the TV App, which allow users to pause, resume, rewind, and fast forward the playback.

For TV Inputs that support time shifting, the TV App needs to display playback controls.

Playback controls
Figure 15. Playback controls

DVR

For devices on Android 7.0 and above, the TV App must support the Android framework TV recording APIs , to support, list, and play recorded programs.

This allows device manufacturers to plug their DVR subsystems into TIF and dramatically reduce the integration effort it takes to enable or integrate DVR functionality on a TV device. It also enables third parties to provide aftermarket DVR systems that can be plugged into an Android TV device.

In addition to recording live content, the TV App also handles resource conflict. For example, if the device has two tuners, it can record two programs at the same time. If the user asks to record three, the TV App must handle the conflict and should either surface a notification or request that the user schedules a priority for these requests.

TV Apps can also implement more sophisticated logic like asking a user if they'd like to record all future episodes in a series when they request to record one episode.

See the following diagram for a view into a possible DVR implementation in Android TV.

Digital video recording in Android TV
Figure 16. Digital video recording in Android TV

  1. The TV Input Service tells the TV App how many tuners are available so that the TV App can handle possible resource conflict.
  2. The TV App receives a user-initiated request to record a TV program.
  3. The TV App stores the recording schedule in its internal database.
  4. When it's time to record, the TV App passes a request to tune to the channel associated with the recording.
  5. The TV Input Service receives this request, responds with whether or not there are appropriate resources, and tunes to the channel.
  6. Then the TV App passes a request to start recording to the TV Input Manager.
  7. The TV Input Service receives this request and starts recording.
  8. The TV Input Service stores the actual video data in its storage, which can be external storage or cloud storage.
  9. When it's time to finish the recording, the TV App passes the stop recording request to the TV Input Manager.
  10. Once the TV Input Service receives the request, it stops the recording and adds its associated metadata to the TV Provider so that the TV App can show the recording to users when requested.

For more information about implementing Recording features in your TV Input service, see this TV Recording article.

Useful resources

  • The Android CDD and documented developer APIs are the definitive references.
  • CTS Verifier exercises the APIs as part of the compatibility testing program. Running this against Live TV may be a useful way to see the EPG, Search, Parental Control, and other requirements in the context of third-party inputs.
  • See Define Your TV Input Service for developer expectations in this area.

Parental control

Parental control lets a user block undesired channels and programs, but bypass the block by entering a PIN code.

Responsibility for parental control functionality is shared amongst the TV App, TV Input Manager service, TV Provider, and TV Input.

Parental control is mandatory, and is covered by CTS Verifier.

A number of countries have defined rating systems that TV Inputs can use via the TVContentRating API . Additionally, TV Inputs can register their own custom rating systems as demonstrated by the CTS Verifier test, which introduces a 'fake' rating. For countries where a standard rating system exists, device manufacturers are encouraged to combine the TV Input Framework Parental Control with any other mechanisms they may include.

TV provider

Each channel row has a COLUMN_LOCKED field that is used to lock specific channels from viewing without entering a PIN code. The program field COLUMN_CONTENT_RATING is intended for display and is not used to enforce parental control.

TV Input Manager

The TV Input Manager stores every blocked TvContentRating and responds to isRatingBlocked() to advise if content with the given rating should be blocked.

TV Input

The TV Input checks if the current content should be blocked by calling isRatingBlocked() on the TV Input Manager when the rating of the displayed content has changed (on program or channel change), or parental control settings have changed (on ACTION_BLOCKED_RATINGS_CHANGED and ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED ). If the content should be blocked, the TV Input disables the audio and video and notifies the TV app that the current content is blocked by calling notifyContentBlocked(TvContentRating) . If the content should not be blocked, the TV Input enables audio and video and notifies the TV App the current content is allowed by calling notifyContentAllowed() .

TV App

To honor the parental control APIs, and therefore create a compatible platform, the system TV App needs to provide a way for users to manage parental control, including for any custom ratings registered by specific apps.

The TV App shows a PIN code UI when it is notified by a TV Input that the current content is blocked or when the user attempts to view a blocked channel.

The TV App does not directly store the parental control settings. When the user changes the parental control settings, every blocked TvContentRating is stored by the TV Input Manager, and blocked channels are stored by the TV Provider.

The TV App needs to declare the permission android.permission.MODIFY_PARENTAL_CONTROLS in order to change the parental control settings.

Device manufacturers are encouraged to:

  • Exercise the CTS Verifier parental controls test against the reference Live TV application for a demonstration of the compatibility requirements.
  • Use the Live TV app as reference for their own TV App: in particular see ContentRatingsManager and RatingSystemsFragment source, and how they handle custom ratings.

HDMI-CEC

HDMI-CEC allows one device to control another, thereby enabling a single remote to control multiple appliances in a home theater. It is used by Android TV to speed setup and allow distant control over various TV Inputs via the central TV App. For instance, it may switch inputs, power up or down devices, and more.

The Android TIF implements HDMI-CEC as the HDMI Control Service so that device manufacturers merely need to develop low-level drivers that interact with the lightweight Android TV HAL, skipping more complex business logic. In providing a standard implementation, Android seeks to mitigate compatibility issues by reducing fragmented implementations and selective feature support. The HDMI Control Service uses the existing Android services, including input and power.

This means existing HDMI-CEC implementations will need to be redesigned to interoperate with the Android TIF. We recommend the hardware platform contain a microprocessor to receive CEC power on and other commands.

CEC integration on Android TV
Figure 17. CEC integration on Android TV

  1. The CEC bus receives a command from the currently active source to switch to a different source.
  2. The driver passes the command to the HDMI-CEC HAL.
  3. The HAL notifies all ActiveSourceChangeListeners .
  4. THe HDMI Control Service is notified of source change via ActiveSourceChangeListener .
  5. The TV Input Manager service generates an intent for the TV App to switch the source.
  6. The TV App then creates a TV Input Manager Session for the TV Input being switched to and calls setMain on that session.
  7. The TV Input Manager Session passes this information on to the HDMI TV Input.
  8. The HDMI TV input requests to set sideband surface.
  9. The TV Input Manager Service generates a corresponding routing control command back to HDMI Control Service when the surface is set.

TV integration guidelines

Broadcast app

Because each country has broadcast-specific requirements (MHEG, Teletext, HbbTV, and more), manufacturers are expected to supply their own solutions for the broadcast app, for example:

  • MHEG: native stack
  • Teletext: native stack
  • HbbTV: HbbTV solution from Vewd Software

In the Android L release, Android TV expects device manufacturers to use systems integrators or the Android solutions for regional TV stacks, pass the surface to TV software stacks, or pass the necessary key code to interact with legacy stacks.

Here's how the broadcast app and TV App interact:

  1. The TV App is in focus, receiving all keys.
  2. The TV App passes keys (eg Red button) to the TV Input device.
  3. The TV Input device internally integrates with legacy TV stack.
  4. On receiving an activation keycode (eg Red button), the TV Input device activates broadcast apps.
  5. A broadcast app takes focus in the TV App and handles user actions.

For voice search/recommendation, the broadcast app may support In-app search for voice search.