
Android TV Input Framework (TIF) ช่วยลดความยุ่งยากในการส่งเนื้อหาสดไปยัง Android TV Android TIF มี API มาตรฐานสำหรับผู้ผลิตเพื่อสร้างโมดูลอินพุตสำหรับควบคุม Android TV และเปิดใช้การค้นหาทีวีสดและคำแนะนำผ่านข้อมูลเมตาที่เผยแพร่โดยอินพุตทีวี
กรอบการทำงานนี้ไม่ได้พยายามที่จะนำมาตรฐานทีวีหรือข้อกำหนดของภูมิภาคไปใช้ แต่ทำให้ผู้ผลิตอุปกรณ์สามารถปฏิบัติตามมาตรฐานการออกอากาศทีวีดิจิทัลในระดับภูมิภาคได้ง่ายขึ้นโดยไม่ต้องดำเนินการซ้ำ เอกสารประกอบในส่วนนี้อาจเป็นประโยชน์สำหรับนักพัฒนาแอปของบริษัทอื่นที่ต้องการสร้างอินพุตทีวีแบบกำหนดเอง
ส่วนประกอบ
การใช้งาน Android TV Input Framework รวมถึง TV Input Manager TIF ทำงานร่วมกับแอพ TV ซึ่งเป็นแอพระบบที่ไม่สามารถแทนที่ด้วยแอพของบุคคลที่สาม เพื่อเข้าถึงช่องในตัวและช่องรับสัญญาณ IP แอพ TV สื่อสารกับโมดูลอินพุตทีวีที่จัดหาโดยผู้ผลิตอุปกรณ์หรือบุคคลอื่นผ่านตัวจัดการอินพุตทีวี
TV Input Framework ประกอบด้วย:
- ผู้ให้บริการทีวี (
com.android.providers.tv.TvProvider
): ฐานข้อมูลของช่อง โปรแกรม และการอนุญาตที่เกี่ยวข้อง - แอพ TV (
com.android.tv.TvActivity
): แอพที่จัดการการโต้ตอบของผู้ใช้ - TV Input Manager (
android.media.tv.TvInputManager
): อนุญาตให้ TV Inputs สื่อสารกับ TV App - อินพุตทีวี: แอปที่แสดงเครื่องรับจริงหรือเสมือนและพอร์ตอินพุต
- อินพุตทีวี HAL (โมดูล
tv_input
): คำจำกัดความของฮาร์ดแวร์ที่อนุญาตให้อินพุตทีวีระบบเข้าถึงฮาร์ดแวร์เฉพาะทีวีเมื่อใช้งาน - Parental Control: เทคโนโลยีที่อนุญาตการบล็อกช่องและโปรแกรมต่างๆ
- HDMI-CEC: เทคโนโลยีที่ช่วยให้สามารถควบคุมอุปกรณ์ต่าง ๆ จากระยะไกลผ่าน HDMI
- Tuner Framework: เฟรมเวิร์กสำหรับอินพุตทีวีจูนเนอร์ในตัว
- MediaCas: เฟรมเวิร์กสำหรับการเข้าถึงแบบมีเงื่อนไข
- Tuner Resource Manager: บริการจัดการทรัพยากรฮาร์ดแวร์สำหรับอินพุตทีวี MediaCas และอินพุตจูนเนอร์ในตัว
ส่วนประกอบเหล่านี้ครอบคลุมรายละเอียดด้านล่าง ดูไดอะแกรมต่อไปนี้สำหรับมุมมองโดยละเอียดของสถาปัตยกรรม Android TV Input Framework

ไหล
นี่คือวิธีการใช้สถาปัตยกรรม:
- ผู้ใช้เห็นและโต้ตอบกับแอพ TV ซึ่งเป็นแอพระบบที่ไม่สามารถแทนที่ด้วยแอพของบุคคลที่สาม
- แอพ TV แสดงเนื้อหา AV จากอินพุตทีวี
- แอพ TV ไม่สามารถสนทนาโดยตรงกับอินพุตทีวีได้ ตัวจัดการอินพุตทีวีจะระบุสถานะของอินพุตทีวีสำหรับแอพ TV ดู TV Input Manager ด้านล่างสำหรับรายละเอียดเพิ่มเติมเกี่ยวกับข้อจำกัดเหล่านี้
สิทธิ์
- มีเพียง
signatureOrSystem
TV Inputs และ TV App เท่านั้นที่สามารถเข้าถึงฐานข้อมูลผู้ให้บริการทีวีได้อย่างเต็มที่และสามารถรับ KeyEvents ได้ - เฉพาะอินพุตทีวีของระบบเท่านั้นที่สามารถเข้าถึงอินพุตทีวี HAL ผ่านบริการ TV Input Manager อินพุตทีวีสามารถเข้าถึงได้แบบตัวต่อตัวผ่านเซสชัน TV Input Manager
- อินพุตทีวีของบุคคลที่สามมีสิทธิ์เข้าถึงฐานข้อมูลผู้ให้บริการทีวีแบบล็อคแพ็คเกจ และสามารถอ่าน/เขียนได้เฉพาะกับแถวแพ็คเกจที่ตรงกันเท่านั้น
- อินพุตทีวีของบุคคลที่สามสามารถแสดงเนื้อหาของตนเองหรือเนื้อหาจากอินพุตทีวีพาสทรูของผู้ผลิตอุปกรณ์ เช่น HDMI1 พวกเขาไม่สามารถแสดงเนื้อหาจากอินพุตทีวีที่ไม่ได้ส่งผ่าน เช่น ในตัวหรือตัวรับสัญญาณ IPTV
- การอนุญาต
TV_INPUT_HARDWARE
สำหรับแอปอินพุตทีวีฮาร์ดแวร์ ส่งสัญญาณบริการตัวจัดการอินพุตทีวีเพื่อแจ้งบริการอินพุตทีวีขณะบู๊ตเพื่อเรียกบริการตัวจัดการอินพุตทีวีและเพิ่มอินพุตทีวี การอนุญาตนี้ทำให้แอปฮาร์ดแวร์อินพุตทีวีรองรับอินพุตทีวีหลายรายการต่อบริการอินพุตทีวีหนึ่งรายการ ตลอดจนสามารถเพิ่มและลบอินพุตทีวีที่รองรับได้แบบไดนามิก
ผู้ให้บริการทีวี
ฐานข้อมูลผู้ให้บริการทีวีจัดเก็บช่องและโปรแกรมจากอินพุตทีวี ผู้ให้บริการทีวียังเผยแพร่และจัดการการอนุญาตที่เกี่ยวข้อง เพื่อให้อินพุตทีวีสามารถดูเฉพาะบันทึกของตนเอง ตัวอย่างเช่น อินพุตทีวีที่ระบุสามารถดูได้เฉพาะช่องและโปรแกรมที่ให้มา และห้ามไม่ให้เข้าถึงช่องและโปรแกรมของอินพุตทีวีอื่นๆ
ผู้ให้บริการทีวีแมป "ประเภทการออกอากาศ" กับ "ประเภทมาตรฐาน" เป็นการภายใน อินพุตทีวีมีหน้าที่เติม "ประเภทการออกอากาศ" ด้วยค่าในมาตรฐานการออกอากาศพื้นฐาน และช่อง "ประเภทที่ยอมรับได้" จะถูกเติมโดยอัตโนมัติด้วยประเภทที่เกี่ยวข้องที่ถูกต้องจาก android.provider.TvContract.Genres
ตัวอย่างเช่น ด้วยมาตรฐานการออกอากาศ ATSC A/65 และรายการที่มีประเภท 0x25 (หมายถึง "กีฬา") อินพุตทีวีจะเติม "ประเภทการออกอากาศ" ด้วยสตริง "กีฬา" และผู้ให้บริการทีวีจะเติมฟิลด์ "ประเภทที่ยอมรับได้" ด้วย ค่าที่แมป android.provider.TvContract.Genres.SPORTS
ดูไดอะแกรมด้านล่างสำหรับมุมมองโดยละเอียดของผู้ให้บริการทีวี

เฉพาะแอพในพาร์ติชันระบบที่ได้รับสิทธิพิเศษเท่านั้นที่สามารถอ่านฐานข้อมูลผู้ให้บริการทีวีทั้งหมดได้
อินพุตทีวีแบบพาสทรูไม่จัดเก็บช่องและโปรแกรม
นอกจากฟิลด์มาตรฐานสำหรับช่องและโปรแกรมแล้ว ฐานข้อมูลผู้ให้บริการทีวียังมีฟิลด์ประเภท 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
: มองเห็นได้เฉพาะแอปพลิเคชันระบบเท่านั้น จำกัดช่องไม่ให้ดูโดยบัญชีที่ไม่ถูกต้องโดยไม่ต้องป้อนรหัส PINCOLUMN_LOCKED = 1
หมายถึงช่องควรได้รับการป้องกันโดยการควบคุมโดยผู้ปกครอง
สำหรับรายการฟิลด์ที่ละเอียดยิ่งขึ้น โปรดดูที่ android/frameworks/base/media/java/android/media/tv/TvContract.java
สิทธิ์และการควบคุมการเข้าถึง
ฟิลด์ทั้งหมดจะปรากฏแก่ทุกคนที่มีสิทธิ์เข้าถึงแถวที่เกี่ยวข้อง ไม่มีฟิลด์ใดที่ผู้ใช้สามารถเข้าถึงได้โดยตรง พวกเขาเห็นเฉพาะส่วนใดของแอพ TV, แอพระบบ หรืออินพุตทีวี
- แต่ละแถวมี
PACKAGE_NAME
แพ็กเกจ (แอป) ที่เป็นเจ้าของแถวนั้น ตรวจสอบใน Query, Insert, Update ผ่าน TvProvider.java อินพุตทีวีอาจเข้าถึงเฉพาะข้อมูลที่เขียนและถูกปิดล้อมจากข้อมูลที่ได้รับจากอินพุตทีวีอื่น - อ่าน, เขียนสิทธิ์ผ่าน AndroidManifest.xml (ต้องได้รับความยินยอมจากผู้ใช้) เพื่อกำหนดช่องทางที่มีอยู่
- เฉพาะแอป
signatureOrSystem
เท่านั้นที่สามารถรับสิทธิ์ACCESS_ALL_EPG_DATA
เพื่อเข้าถึงฐานข้อมูลทั้งหมด
ตัวจัดการอินพุตทีวี
TV Input Manager มี API ของระบบส่วนกลางให้กับ Android TV Input Framework โดยรวม ตัดสินการโต้ตอบระหว่างแอพและอินพุตทีวีและให้ฟังก์ชันการควบคุมโดยผู้ปกครอง เซสชันตัวจัดการอินพุตทีวีต้องสร้างแบบหนึ่งต่อหนึ่งด้วยอินพุตทีวี ตัวจัดการอินพุตทีวีอนุญาตให้เข้าถึงอินพุตทีวีที่ติดตั้ง ดังนั้นแอพอาจ:
- แสดงรายการอินพุตทีวีและตรวจสอบสถานะ
- สร้างเซสชันและจัดการผู้ฟัง
สำหรับเซสชัน แอปทีวีอาจปรับอินพุตทีวีได้เฉพาะกับ URI ที่เพิ่มลงในฐานข้อมูลผู้ให้บริการทีวี ยกเว้นอินพุตทีวีแบบพาสทรูที่สามารถปรับแต่งได้โดยใช้ TvContract.buildChannelUriForPassthroughInput()
อินพุตทีวีอาจมีการตั้งค่าระดับเสียงไว้ด้วย อินพุตทีวีที่จัดหาและลงนามโดยผู้ผลิตอุปกรณ์ (แอปลายเซ็น) หรือแอปอื่นๆ ที่ติดตั้งในพาร์ติชันระบบจะสามารถเข้าถึงฐานข้อมูลผู้ให้บริการทีวีทั้งหมดได้ การเข้าถึงนี้สามารถใช้เพื่อสร้างแอพเพื่อเรียกดูและค้นหาในช่องและรายการทีวีที่มีอยู่ทั้งหมด
แอปอาจสร้างและลงทะเบียน TvInputCallback
กับ android.media.tv.TvInputManager
เพื่อให้เรียกกลับเมื่อสถานะของอินพุตทีวีเปลี่ยนหรือเมื่อเพิ่มหรือลบอินพุตทีวี ตัวอย่างเช่น แอพ TV สามารถตอบสนองเมื่ออินพุตทีวีถูกตัดการเชื่อมต่อโดยแสดงเป็นไม่ได้เชื่อมต่อและป้องกันการเลือก
ตัวจัดการอินพุตทีวีสรุปการสื่อสารระหว่างแอพทีวีและอินพุตทีวี อินเทอร์เฟซมาตรฐานของ TV Input Manager และ TV Input ช่วยให้ผู้ผลิตอุปกรณ์หลายรายสามารถสร้าง TV Apps ของตนเองได้ ในขณะที่ช่วยให้ TV Inputs ของบุคคลที่สามทั้งหมดทำงานบน TV Apps ทั้งหมด
อินพุตทีวี
อินพุตทีวีเป็นแอป Android ในแง่ที่มี AndroidManifest.xml และติดตั้ง (ผ่าน Play ติดตั้งล่วงหน้า หรือไซด์โหลด) Android TV รองรับแอพระบบที่ติดตั้งไว้ล่วงหน้า แอพที่ลงนามโดยผู้ผลิตอุปกรณ์ และอินพุตทีวีของบริษัทอื่น
อินพุตบางอย่าง เช่น อินพุต HDMI หรืออินพุตจูนเนอร์ในตัว สามารถจัดเตรียมได้โดยผู้ผลิตเท่านั้น เนื่องจากผู้ผลิตจะเชื่อมต่อกับฮาร์ดแวร์พื้นฐานโดยตรง บุคคลที่สามเช่น IPTV, place-shifting และ STB ภายนอกสามารถจัดหาโดยบุคคลที่สามเป็น APK บน Google Play Store เมื่อดาวน์โหลดและติดตั้งแล้ว จะสามารถเลือกอินพุตใหม่ได้ภายในแอพ TV
ตัวอย่างการป้อนข้อมูลแบบพาสทรู

ในตัวอย่างนี้ อินพุตทีวีที่ผู้ผลิตอุปกรณ์ให้มานั้นเชื่อถือได้และมีสิทธิ์เข้าถึงผู้ให้บริการทีวีได้อย่างเต็มที่ ในฐานะที่เป็นอินพุตทีวีแบบพาสทรู จะไม่มีการลงทะเบียนช่องหรือโปรแกรมใดๆ กับผู้ให้บริการทีวี ในการรับ URI ที่ใช้อ้างอิงอินพุตพาสทรู ให้ใช้วิธียูทิลิตี้ android.media.tv.TvContract
buildChannelUriForPassthroughInput(String inputId)
แอพ TV สื่อสารกับ TV Input Manager เพื่อเข้าถึงอินพุต HDMI TV
ตัวอย่างจูนเนอร์ในตัว

ในตัวอย่างนี้ อินพุตทีวีจูนเนอร์ในตัวที่ผู้ผลิตอุปกรณ์ให้มานั้นเชื่อถือได้และมีสิทธิ์เข้าถึงผู้ให้บริการทีวีได้อย่างเต็มที่
ตัวอย่างการป้อนข้อมูลของบุคคลที่สาม

ในตัวอย่างนี้ บุคคลที่สามเป็นผู้จัดเตรียมอินพุตทีวี STB ภายนอก เนื่องจากอินพุตทีวีนั้นไม่สามารถเข้าถึงฟีดวิดีโอ HDMI ที่เข้ามาได้โดยตรง จึงต้องผ่านตัวจัดการอินพุตทีวีและใช้อินพุตทีวี HDMI ที่ผู้ผลิตอุปกรณ์ให้มา
ผ่านตัวจัดการอินพุตทีวี อินพุตทีวี STB ภายนอกสามารถพูดกับอินพุตทีวี HDMI และขอให้แสดงวิดีโอบน HDMI1 ดังนั้น อินพุตทีวี STB จึงสามารถควบคุมทีวีได้ในขณะที่อินพุตทีวี HDMI ที่ผู้ผลิตให้มาแสดงผลวิดีโอ
ตัวอย่างภาพซ้อนภาพ (PIP)

แผนภาพด้านบนแสดงวิธีการส่งปุ่มบนรีโมทคอนโทรลไปยังอินพุตทีวีเฉพาะสำหรับการแสดงภาพซ้อนภาพ (PIP) การกดปุ่มเหล่านั้นถูกตีความโดยไดรเวอร์ฮาร์ดแวร์ที่ผู้ผลิตอุปกรณ์ให้มา แปลงรหัสสแกนฮาร์ดแวร์เป็นรหัสคีย์ของ Android และส่งต่อไปยังฟังก์ชัน InputReader
และ InputDispatcher
ไปป์ไลน์อินพุต มาตรฐานของ Android เป็น KeyEvents สิ่งเหล่านี้จะทำให้เกิดเหตุการณ์ในแอพ TV หากอยู่ในโฟกัส
เฉพาะอินพุตทีวีของระบบเท่านั้นที่มีสิทธิ์รับ InputEvents
และต่อเมื่อได้รับอนุญาตจากระบบ RECEIVE_INPUT_EVENT
อินพุตทีวีมีหน้าที่กำหนดว่า InputEvents ใดที่จะใช้ และควรอนุญาตให้แอป TV จัดการกับคีย์ที่ไม่จำเป็นต้องใช้
แอป TV มีหน้าที่รับผิดชอบในการรู้ว่าอินพุตทีวีระบบใดทำงานอยู่ ซึ่งหมายถึงผู้ใช้เลือก และแยกแยะ KeyEvents
ที่เข้ามาและกำหนดเส้นทางไปยังเซสชัน TV Input Manager ที่ถูกต้อง การเรียกใช้ dispatchInputEvent()
เพื่อส่งต่อเหตุการณ์ไปยังอินพุตทีวีที่เกี่ยวข้อง .
ตัวอย่างอินพุต MHEG-5
ไดอะแกรมต่อไปนี้แสดงมุมมองโดยละเอียดเพิ่มเติมเกี่ยวกับวิธีกำหนดเส้นทาง KeyEvents
ผ่าน Android TIF

มันแสดงให้เห็นการไหลของแอพปุ่มสีแดงซึ่งพบได้ทั่วไปในยุโรปเพื่อให้ผู้ใช้เข้าถึงแอพแบบโต้ตอบบนโทรทัศน์ สามารถส่งแอปผ่านสตรีมการขนส่งนี้ได้ เมื่อคลิกปุ่ม ผู้ใช้จะโต้ตอบกับแอปออกอากาศเหล่านี้ได้ ตัวอย่างเช่น คุณอาจใช้แอปออกอากาศเหล่านี้เพื่อเข้าถึงหน้าเว็บที่เกี่ยวข้องหรือคะแนนกีฬา
ดูส่วน แอปออกอากาศ เพื่อเรียนรู้วิธีที่แอปออกอากาศโต้ตอบกับแอป TV
ในตัวอย่างนี้:
- แอพ TV อยู่ในโฟกัสและรับคีย์ทั้งหมด
-
KeyEvents
(เช่น ปุ่มสีแดง) จะถูกส่งผ่านไปยังอินพุตทีวีที่ใช้งานอยู่เป็นInputEvents.
- อินพุตทีวีของระบบทำงานร่วมกับสแต็ก MHEG-5 และได้รับอนุญาตจากระบบ
RECEIVE_INPUT_EVENT
- เมื่อได้รับรหัสเปิดใช้งาน (เช่น ปุ่มสีแดง) อินพุตทีวีจะเปิดใช้งานแอปออกอากาศ
- อินพุตทีวีใช้
KeyEvents
เป็นInputEvents
และแอปออกอากาศเป็นโฟกัสและจัดการInputEvents
จนกว่าจะถูกปิด
หมายเหตุ : อินพุตทีวีของบุคคลที่สามจะไม่ได้รับคีย์
อินพุตทีวี HAL
อินพุตทีวี HAL ช่วยในการพัฒนาอินพุตทีวีเพื่อเข้าถึงฮาร์ดแวร์เฉพาะทีวี เช่นเดียวกับ Android HAL อื่นๆ TV Input HAL ( tv_input
) มีอยู่ในแผนผังต้นทาง AOSP และผู้ขายพัฒนาการใช้งาน
แอพทีวี
แอพระบบทีวีนำเสนอเนื้อหาทีวีสดแก่ผู้ใช้ แอปทีวีอ้างอิง (Live TV) มีให้พร้อมกับแพลตฟอร์ม Android ซึ่งสามารถใช้ตามที่เป็นอยู่ ปรับแต่ง ขยาย หรือแทนที่โดยผู้ผลิตอุปกรณ์ ซอร์สโค้ด มีอยู่ใน Android Open Source Project และคุณสามารถเริ่มต้นใช้งานได้ในบทความ เกี่ยวกับแอป Reference TV
ผู้ผลิตอุปกรณ์อาจขยายแอพ TV ของตนเพื่อใช้คุณสมบัติเฉพาะของผู้ผลิตอุปกรณ์หรือประเทศ อย่างไรก็ตาม สิ่งนี้ไม่อยู่ในขอบเขตของ TIF หรือแอพ TV อ้างอิง
อย่างน้อยที่สุด แอพ TV ของระบบจำเป็นต้องจัดการงานต่อไปนี้:
การตั้งค่าและการกำหนดค่า
- ตรวจจับอินพุตทีวีอัตโนมัติ
- ให้อินพุตทีวีเริ่มต้นการตั้งค่าช่อง
- ควบคุมการตั้งค่าโดยผู้ปกครอง
- แก้ไขช่อง
กำลังดู
- เข้าถึงและนำทางช่องทีวีทั้งหมด
- เข้าถึงแถบข้อมูลรายการทีวี
- แสดงข้อมูล Electronic Programming Guide (EPG)
- รองรับแทร็กเสียงและคำบรรยายหลายรายการ
- จัดหาความท้าทาย PIN สำหรับการควบคุมโดยผู้ปกครอง
- อนุญาตการซ้อนทับ UI อินพุตทีวีสำหรับมาตรฐานทีวี (HbbTV ฯลฯ)
- เติมผลการค้นหาสำหรับช่องทีวีและรายการต่างๆ
- แสดงการ์ดเชื่อมโยงแอป
- รองรับ API การปรับเวลา
- จัดการการทำงานของ DVR และรองรับ API การบันทึกทีวี
ชุดคุณสมบัตินี้จะเพิ่มขึ้นตามเวอร์ชัน Android ใหม่ที่มีการขยาย TIF API ของแพลตฟอร์ม CTS Verifier ให้ความคุ้มครองการทดสอบความเข้ากันได้
รองรับอินพุตทีวีของบุคคลที่สาม
Android TV มี API สำหรับนักพัฒนาซอฟต์แวร์สำหรับอินพุตทีวีของบุคคลที่สาม ทำให้แอปที่ติดตั้งสามารถส่งช่องซอฟต์แวร์เข้าสู่ประสบการณ์ทีวีถ่ายทอดสดได้ เพื่อให้แน่ใจว่ามีการใช้งานอุปกรณ์ Android ที่ใช้งานร่วมกันได้ แอพ TV ของระบบมีหน้าที่รับผิดชอบบางประการเกี่ยวกับการแสดงอินพุตและช่องทีวีของบุคคลที่สามให้กับผู้ใช้ แอพอ้างอิง Live TV ให้การใช้งานที่เข้ากันได้ หากเปลี่ยนแอป TV ระบบ ผู้ผลิตอุปกรณ์ต้องแน่ใจว่าแอปของตนมีความเข้ากันได้ที่คล้ายคลึงกัน เพื่อให้เป็นไปตามความคาดหวังของนักพัฒนาในอุปกรณ์ Android TV ทั้งหมด
แอพทีวีระบบต้องแสดงอินพุตของบุคคลที่สามควบคู่ไปกับบริการถ่ายทอดสดทางทีวีเริ่มต้นของอุปกรณ์ คำมั่นสัญญาของ API ของนักพัฒนาคือผู้ใช้จะสามารถค้นหาช่อง (เมื่อติดตั้งแล้ว) ภายในประสบการณ์ทีวีมาตรฐานของพวกเขา
อนุญาตให้ใช้ภาพแยกความแตกต่างระหว่างช่องในตัวและช่องของบุคคลที่สาม ตามที่กำหนดไว้ในส่วนแอพ TV ของ Android CDD
ส่วนต่อไปนี้แสดงให้เห็นว่าแอปพลิเคชัน Live TV ปฏิบัติตามข้อกำหนด CDD อย่างไร
การตั้งค่าช่องใหม่
การเพิ่มอินพุต/ช่องสัญญาณของบุคคลที่สามใหม่เริ่มจากการที่ผู้ใช้ค้นหาและติดตั้งอินพุตทีวีจากร้านแอปพลิเคชัน เช่น Google Play
อินพุตทีวีของบุคคลที่สามบางตัวจะเพิ่มช่องไปยังฐานข้อมูล TvProvider โดยอัตโนมัติ อย่างไรก็ตาม ส่วนใหญ่จะมีกิจกรรมการตั้งค่าเพื่อให้ผู้ใช้สามารถตั้งค่าช่องของพวกเขา ให้รายละเอียดการเข้าสู่ระบบ และการดำเนินการอื่นๆ แอป TV ของระบบจำเป็นต้องตรวจสอบให้แน่ใจว่าผู้ใช้สามารถเปิดใช้งานกิจกรรมการตั้งค่านี้ได้ ซึ่งเป็นสาเหตุที่ CDD กำหนดให้ใช้อินพุตจากบุคคลที่สามเป็นการดำเนินการนำทางให้น้อยที่สุดจากแอป TV หลัก
แอพอ้างอิง Live TV มีเมนู Channel Sources สำหรับการเข้าถึงอินพุต




นอกจากนี้ การ์ดแจ้งเตือนจะแสดงที่ด้านบนของเมนูแอพ TV หลังจากติดตั้ง TvInput ใหม่แล้ว เพื่อนำผู้ใช้ไปที่การตั้งค่าโดยตรง:

หากผู้ใช้ดำเนินการผ่านการแจ้งเตือน ผู้ใช้สามารถเลือกตั้งค่าแหล่งที่มาได้ดังแสดงในรูปที่ 10
ดู กำหนดบริการอินพุตทีวีของคุณ สำหรับความคาดหวังของนักพัฒนาในพื้นที่นี้
ปรับแต่งรายการช่อง
ผู้ผลิตอุปกรณ์อาจจัดเตรียม UI เพื่อซ่อนบางช่องและให้ผู้ใช้จัดการ EPG ของตนเองได้ รายการสดทางโทรทัศน์รวมถึงสิ่งอำนวยความสะดวกนี้


EPG
นักพัฒนาการป้อนข้อมูลจากบุคคลที่สามต้องมีความมั่นใจว่าผู้ใช้สามารถนำทางไปยังช่องของตนได้อย่างง่ายดายระหว่างการใช้งานทั่วไปในอุปกรณ์ Android TV ที่เข้ากันได้ทั้งหมด
ช่องสัญญาณจากอินพุตของบุคคลที่สามต้องแสดงเป็นส่วนหนึ่งของประสบการณ์ถ่ายทอดสดทางทีวี EPG มาตรฐานของอุปกรณ์ สามารถใช้การแยกภาพหรือแยกหมวดหมู่สำหรับช่องของบุคคลที่สาม (ดูส่วนแอพ TV ของ Android CDD) สิ่งสำคัญคือผู้ใช้สามารถค้นหาช่องที่ติดตั้งไว้ได้
ค้นหา
ผู้ผลิตต้องติดตั้งแอพ TV เพื่อรวมผลการค้นหาสำหรับคำขอค้นหาทั่วโลก เพื่อให้มั่นใจว่าผู้ใช้จะได้รับประสบการณ์ที่ดีที่สุด Live TV ให้การใช้งาน (ดู ว่ารายการใดให้ผลลัพธ์จากอินพุตของบุคคลที่สาม (จำเป็นสำหรับความเข้ากันได้ของแพลตฟอร์ม) รวมถึงอินพุตในตัว
เวลาเปลี่ยน
สำหรับอุปกรณ์ที่ใช้ Android 6.0 ขึ้นไป แอพ TV จะต้องรองรับ API การปรับกรอบเวลา ของ Android นอกจากนี้ ผู้ผลิตจะต้องใช้การควบคุมการเล่นในแอพ TV ซึ่งอนุญาตให้ผู้ใช้หยุดชั่วคราว เล่นต่อ ย้อนกลับ และกรอการเล่นไปข้างหน้า
สำหรับอินพุตทีวีที่รองรับการเลื่อนเวลา แอพ TV จำเป็นต้องแสดงการควบคุมการเล่น

เครื่องบันทึกภาพ
สำหรับอุปกรณ์ที่ใช้ Android 7.0 ขึ้นไป แอป TV จะต้องรองรับ API การบันทึกทีวี เฟรมเวิร์กของ Android เพื่อรองรับ แสดงรายการ และเล่นรายการที่บันทึกไว้
ซึ่งช่วยให้ผู้ผลิตอุปกรณ์เสียบระบบย่อย DVR ของตนเข้ากับ TIF และลดความพยายามในการผสานรวมที่ต้องใช้ในการเปิดใช้งานหรือผสานรวมฟังก์ชันการทำงานของ DVR บนอุปกรณ์ทีวีได้อย่างมาก นอกจากนี้ยังช่วยให้บุคคลที่สามสามารถจัดหาระบบ DVR หลังการขายที่สามารถเสียบเข้ากับอุปกรณ์ Android TV
นอกจากการบันทึกเนื้อหาสดแล้ว แอพ TV ยังจัดการความขัดแย้งของทรัพยากรอีกด้วย ตัวอย่างเช่น หากอุปกรณ์มีจูนเนอร์สองตัว ก็สามารถบันทึกสองโปรแกรมพร้อมกันได้ หากผู้ใช้ขอให้บันทึกสามรายการ แอพ TV จะต้องจัดการกับข้อขัดแย้งและควรแสดงการแจ้งเตือนหรือคำขอให้ผู้ใช้จัดกำหนดการลำดับความสำคัญสำหรับคำขอเหล่านี้
แอป TV ยังสามารถใช้ตรรกะที่ซับซ้อนมากขึ้น เช่น ถามผู้ใช้ว่าต้องการบันทึกตอนในอนาคตทั้งหมดในซีรีส์หรือไม่ เมื่อพวกเขาขอบันทึกหนึ่งตอน
ดูไดอะแกรมต่อไปนี้เพื่อดูการใช้งาน DVR ที่เป็นไปได้ใน Android TV

- บริการอินพุตทีวีจะบอกแอพ TV ว่ามีเครื่องรับจำนวนเท่าใด เพื่อให้แอพ TV สามารถจัดการกับความขัดแย้งของทรัพยากรที่อาจเกิดขึ้นได้
- แอพ TV ได้รับคำขอที่เริ่มต้นโดยผู้ใช้เพื่อบันทึกรายการทีวี
- แอพ TV จัดเก็บตารางการบันทึกไว้ในฐานข้อมูลภายใน
- เมื่อถึงเวลาบันทึก แอพ TV จะส่งคำขอให้ปรับไปยังช่องที่เกี่ยวข้องกับการบันทึก
- บริการอินพุตทีวีได้รับคำขอนี้ ตอบกลับว่ามีทรัพยากรที่เหมาะสมหรือไม่ และปรับแต่งช่อง
- จากนั้นแอพ TV จะส่งคำขอให้เริ่มบันทึกไปยัง TV Input Manager
- บริการอินพุตทีวีได้รับคำขอนี้และเริ่มบันทึก
- บริการอินพุตทีวีจัดเก็บข้อมูลวิดีโอจริงในที่เก็บข้อมูลซึ่งอาจเป็นที่เก็บข้อมูลภายนอกหรือที่เก็บข้อมูลบนคลาวด์
- เมื่อถึงเวลาสิ้นสุดการบันทึก แอพ TV จะส่งคำขอหยุดการบันทึกไปยัง TV Input Manager
- เมื่อบริการอินพุตทีวีได้รับคำขอ ก็จะหยุดการบันทึกและเพิ่มข้อมูลเมตาที่เกี่ยวข้องไปยังผู้ให้บริการทีวี เพื่อให้แอพทีวีสามารถแสดงการบันทึกต่อผู้ใช้เมื่อมีการร้องขอ
สำหรับข้อมูลเพิ่มเติมเกี่ยวกับการใช้คุณสมบัติการบันทึกในบริการอินพุตทีวีของคุณ โปรดดูบทความ การบันทึกทีวี นี้
แหล่งข้อมูลที่เป็นประโยชน์
- Android CDD และ API ของนักพัฒนาที่เป็นเอกสารเป็นข้อมูลอ้างอิงขั้นสุดท้าย
- CTS Verifier ใช้ APIs เป็นส่วนหนึ่งของโปรแกรมทดสอบความเข้ากันได้ การเรียกใช้สิ่งนี้กับ Live TV อาจเป็นวิธีที่มีประโยชน์ในการดู EPG, การค้นหา, การควบคุมโดยผู้ปกครอง และข้อกำหนดอื่นๆ ในบริบทของการป้อนข้อมูลจากบุคคลที่สาม
- ดู กำหนดบริการอินพุตทีวีของคุณ สำหรับความคาดหวังของนักพัฒนาในพื้นที่นี้
การควบคุมโดยผู้ปกครอง
การควบคุมโดยผู้ปกครองอนุญาตให้ผู้ใช้บล็อกช่องและโปรแกรมที่ไม่ต้องการ แต่ข้ามการบล็อกด้วยการป้อนรหัส PIN
ความรับผิดชอบสำหรับฟังก์ชันการควบคุมโดยผู้ปกครองนั้นใช้ร่วมกันระหว่างแอพ TV, บริการ TV Input Manager, TV Provider และ TV Input
จำเป็นต้องมีการควบคุมโดยผู้ปกครองและครอบคลุมโดย CTS Verifier
หลายประเทศได้กำหนดระบบการให้คะแนนที่อินพุตทีวีสามารถใช้ผ่าน TVContentRating API นอกจากนี้ TV Inputs สามารถลงทะเบียนระบบการให้คะแนนที่กำหนดเองได้ตามที่แสดงโดยการทดสอบ CTS Verifier ซึ่งแนะนำการจัดเรต 'ปลอม' สำหรับประเทศที่มีระบบการให้คะแนนมาตรฐาน ผู้ผลิตอุปกรณ์ได้รับการสนับสนุนให้รวม TV Input Framework Framework Parental Control เข้ากับกลไกอื่นๆ ที่อาจรวมอยู่ด้วย
ผู้ให้บริการทีวี
แต่ละแถวของช่องมีช่อง COLUMN_LOCKED
ที่ใช้เพื่อล็อกช่องเฉพาะไม่ให้รับชมโดยไม่ต้องป้อนรหัส PIN ฟิลด์โปรแกรม COLUMN_CONTENT_RATING
มีไว้สำหรับแสดงและไม่ได้ใช้เพื่อบังคับใช้การควบคุมโดยผู้ปกครอง
ตัวจัดการอินพุตทีวี
TV Input Manager จะจัดเก็บ TvContentRating
ทุกรายการที่ถูกบล็อกและตอบสนองต่อ isRatingBlocked()
เพื่อแนะนำว่าควรบล็อกเนื้อหาที่มีการให้คะแนนที่กำหนดหรือไม่
อินพุตทีวี
อินพุตทีวีจะตรวจสอบว่าควรบล็อกเนื้อหาปัจจุบันหรือไม่โดยการเรียก isRatingBlocked()
บน TV Input Manager เมื่อการจัดอันดับของเนื้อหาที่แสดงมีการเปลี่ยนแปลง (ในรายการหรือการเปลี่ยนช่อง) หรือการตั้งค่าการควบคุมโดยผู้ปกครองมีการเปลี่ยนแปลง (ใน ACTION_BLOCKED_RATINGS_CHANGED
และ ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED
) . หากเนื้อหาควรถูกบล็อก อินพุตทีวีจะปิดใช้งานเสียงและวิดีโอ และแจ้งแอปทีวีว่าเนื้อหาปัจจุบันถูกบล็อกโดยการ notifyContentBlocked(TvContentRating)
หากไม่ควรบล็อกเนื้อหา อินพุตทีวีจะเปิดใช้งานเสียงและวิดีโอ และแจ้งแอปทีวีว่าเนื้อหาปัจจุบันได้รับอนุญาตโดยการ notifyContentAllowed()
แอพทีวี
เพื่อให้เป็นไปตาม API การควบคุมโดยผู้ปกครอง และสร้างแพลตฟอร์มที่เข้ากันได้ แอพ TV ของระบบจำเป็นต้องจัดเตรียมวิธีสำหรับผู้ใช้ในการจัดการการควบคุมโดยผู้ปกครอง รวมถึงการจัดเรตแบบกำหนดเองใดๆ ที่ลงทะเบียนโดยแอพเฉพาะ
แอพ TV แสดง UI รหัส PIN เมื่อได้รับแจ้งจากอินพุตทีวีว่าเนื้อหาปัจจุบันถูกบล็อกหรือเมื่อผู้ใช้พยายามดูช่องที่ถูกบล็อก
แอพ TV ไม่ได้จัดเก็บการตั้งค่าการควบคุมโดยผู้ปกครองโดยตรง เมื่อผู้ใช้เปลี่ยนการตั้งค่าการควบคุมโดยผู้ปกครอง ทุก TvContentRating
ที่ถูกบล็อกจะถูกจัดเก็บโดย TV Input Manager และช่องที่ถูกบล็อกจะถูกจัดเก็บโดยผู้ให้บริการทีวี
แอพ TV จำเป็นต้องประกาศการอนุญาต android.permission.MODIFY_PARENTAL_CONTROLS
เพื่อเปลี่ยนการตั้งค่าการควบคุมโดยผู้ปกครอง
ผู้ผลิตอุปกรณ์ได้รับการสนับสนุนให้:
- ใช้การทดสอบการควบคุมโดยผู้ปกครองของ CTS Verifier กับแอปพลิเคชัน Live TV อ้างอิงเพื่อสาธิตข้อกำหนดความเข้ากันได้
- ใช้แอป Live TV เป็นข้อมูลอ้างอิงสำหรับแอป TV ของตนเอง โดยเฉพาะอย่างยิ่ง โปรดดูที่แหล่งที่มาของ ContentRatingsManager และ RatingSystemsFragment และวิธีจัดการกับการจัดเรตที่กำหนดเอง
HDMI-CEC
HDMI-CEC ช่วยให้อุปกรณ์เครื่องหนึ่งสามารถควบคุมอุปกรณ์อีกเครื่องหนึ่งได้ จึงทำให้รีโมทคอนโทรลเพียงเครื่องเดียวสามารถควบคุมอุปกรณ์หลายเครื่องในโฮมเธียเตอร์ได้ Android TV ใช้เพื่อเพิ่มความเร็วในการตั้งค่าและอนุญาตให้ควบคุมอินพุตทีวีต่างๆ จากระยะไกลผ่านแอพ Central TV ตัวอย่างเช่น อาจสลับอินพุต เปิดหรือปิดอุปกรณ์ และอื่นๆ
Android TIF ใช้ HDMI-CEC เป็นบริการควบคุม HDMI ดังนั้นผู้ผลิตอุปกรณ์จึงจำเป็นต้องพัฒนาไดรเวอร์ระดับต่ำที่โต้ตอบกับ Android TV HAL ที่มีน้ำหนักเบา โดยข้ามตรรกะทางธุรกิจที่ซับซ้อนมากขึ้น ในการจัดเตรียมการใช้งานมาตรฐาน Android พยายามที่จะลดปัญหาความเข้ากันได้โดยการลดการใช้งานที่แยกส่วนและการสนับสนุนคุณสมบัติที่เลือก บริการควบคุม HDMI ใช้บริการ Android ที่มีอยู่ รวมถึงอินพุตและพลังงาน
ซึ่งหมายความว่าการใช้งาน HDMI-CEC ที่มีอยู่จะต้องได้รับการออกแบบใหม่เพื่อทำงานร่วมกับ Android TIF เราขอแนะนำให้แพลตฟอร์มฮาร์ดแวร์ประกอบด้วยไมโครโปรเซสเซอร์เพื่อรับการเปิดเครื่อง CEC และคำสั่งอื่นๆ

- บัส CEC รับคำสั่งจากแหล่งที่ใช้งานอยู่ในปัจจุบันเพื่อสลับไปยังแหล่งอื่น
- ไดรเวอร์ส่งคำสั่งไปยัง HDMI-CEC HAL
- HAL แจ้งเตือน
ActiveSourceChangeListeners
ทั้งหมด - บริการควบคุม HDMI จะได้รับแจ้งถึงการเปลี่ยนแปลงแหล่งที่มาผ่าน
ActiveSourceChangeListener
- บริการ TV Input Manager สร้างความตั้งใจให้แอพ TV เปลี่ยนแหล่งที่มา
- จากนั้นแอพ TV จะสร้างเซสชันตัวจัดการอินพุตทีวีสำหรับอินพุตทีวีที่สลับไปใช้และเรียกใช้
setMain
ในเซสชันนั้น - เซสชันตัวจัดการอินพุตทีวีจะส่งข้อมูลนี้ไปยังอินพุตทีวี HDMI
- อินพุต HDMI TV ร้องขอการตั้งค่าพื้นผิวแถบด้านข้าง
- บริการตัวจัดการอินพุตทีวีจะสร้างคำสั่งควบคุมการกำหนดเส้นทางที่สอดคล้องกันกลับไปยังบริการควบคุม HDMI เมื่อตั้งค่าพื้นผิว
หลักเกณฑ์การรวมทีวี
แอปออกอากาศ
เนื่องจากแต่ละประเทศมีข้อกำหนดเฉพาะสำหรับการออกอากาศ (MHEG, เทเลเท็กซ์, HbbTV และอื่นๆ) ผู้ผลิตจึงคาดหวังที่จะจัดหาโซลูชันของตนเองสำหรับแอปออกอากาศ ตัวอย่างเช่น:
- MHEG: สแต็กดั้งเดิม
- เทเลเท็กซ์: สแต็กเนทีฟ
- HbbTV: โซลูชัน HbbTV จากซอฟต์แวร์ Vewd
ในการเปิดตัว Android L นั้น Android TV คาดหวังให้ผู้ผลิตอุปกรณ์ใช้ผู้รวมระบบหรือโซลูชัน Android สำหรับสแต็คทีวีระดับภูมิภาค ส่งพื้นผิวไปยังสแต็คซอฟต์แวร์ทีวี หรือส่งรหัสคีย์ที่จำเป็นเพื่อโต้ตอบกับสแต็คดั้งเดิม
ต่อไปนี้คือวิธีที่แอปออกอากาศและแอป TV โต้ตอบ:
- แอป TV อยู่ในโฟกัส รับคีย์ทั้งหมด
- แอพ TV ส่งปุ่ม (เช่น ปุ่มสีแดง) ไปยังอุปกรณ์อินพุตทีวี
- อุปกรณ์อินพุตทีวีผสานรวมภายในกับสแต็กทีวีรุ่นเก่า
- เมื่อได้รับรหัสเปิดใช้งาน (เช่น ปุ่มสีแดง) อุปกรณ์อินพุตทีวีจะเปิดใช้งานแอพออกอากาศ
- แอพออกอากาศให้ความสำคัญกับแอพ TV และจัดการการกระทำของผู้ใช้
สำหรับการค้นหาด้วยเสียง/คำแนะนำ แอปออกอากาศอาจรองรับการค้นหาในแอปสำหรับการค้นหาด้วยเสียง
,
Android TV Input Framework (TIF) ช่วยลดความยุ่งยากในการส่งเนื้อหาสดไปยัง Android TV Android TIF มี API มาตรฐานสำหรับผู้ผลิตเพื่อสร้างโมดูลอินพุตสำหรับควบคุม Android TV และเปิดใช้การค้นหาทีวีสดและคำแนะนำผ่านข้อมูลเมตาที่เผยแพร่โดยอินพุตทีวี
กรอบการทำงานนี้ไม่ได้พยายามที่จะนำมาตรฐานทีวีหรือข้อกำหนดของภูมิภาคไปใช้ แต่ทำให้ผู้ผลิตอุปกรณ์สามารถปฏิบัติตามมาตรฐานการออกอากาศทีวีดิจิทัลในระดับภูมิภาคได้ง่ายขึ้นโดยไม่ต้องดำเนินการซ้ำ เอกสารประกอบในส่วนนี้อาจเป็นประโยชน์สำหรับนักพัฒนาแอปของบริษัทอื่นที่ต้องการสร้างอินพุตทีวีแบบกำหนดเอง
ส่วนประกอบ
การใช้งาน Android TV Input Framework รวมถึง TV Input Manager TIF ทำงานร่วมกับแอพ TV ซึ่งเป็นแอพระบบที่ไม่สามารถแทนที่ด้วยแอพของบุคคลที่สาม เพื่อเข้าถึงช่องในตัวและช่องรับสัญญาณ IP แอพ TV สื่อสารกับโมดูลอินพุตทีวีที่จัดหาโดยผู้ผลิตอุปกรณ์หรือบุคคลอื่นผ่านตัวจัดการอินพุตทีวี
TV Input Framework ประกอบด้วย:
- ผู้ให้บริการทีวี (
com.android.providers.tv.TvProvider
): ฐานข้อมูลของช่อง โปรแกรม และการอนุญาตที่เกี่ยวข้อง - แอพ TV (
com.android.tv.TvActivity
): แอพที่จัดการการโต้ตอบของผู้ใช้ - TV Input Manager (
android.media.tv.TvInputManager
): อนุญาตให้ TV Inputs สื่อสารกับ TV App - อินพุตทีวี: แอปที่แสดงเครื่องรับจริงหรือเสมือนและพอร์ตอินพุต
- อินพุตทีวี HAL (โมดูล
tv_input
): คำจำกัดความของฮาร์ดแวร์ที่อนุญาตให้อินพุตทีวีระบบเข้าถึงฮาร์ดแวร์เฉพาะทีวีเมื่อใช้งาน - Parental Control: เทคโนโลยีที่อนุญาตการบล็อกช่องและโปรแกรมต่างๆ
- HDMI-CEC: เทคโนโลยีที่ช่วยให้สามารถควบคุมอุปกรณ์ต่าง ๆ จากระยะไกลผ่าน HDMI
- Tuner Framework: เฟรมเวิร์กสำหรับอินพุตทีวีจูนเนอร์ในตัว
- MediaCas: เฟรมเวิร์กสำหรับการเข้าถึงแบบมีเงื่อนไข
- Tuner Resource Manager: บริการจัดการทรัพยากรฮาร์ดแวร์สำหรับอินพุตทีวี MediaCas และอินพุตจูนเนอร์ในตัว
ส่วนประกอบเหล่านี้ครอบคลุมรายละเอียดด้านล่าง ดูไดอะแกรมต่อไปนี้สำหรับมุมมองโดยละเอียดของสถาปัตยกรรม Android TV Input Framework

ไหล
นี่คือวิธีการใช้สถาปัตยกรรม:
- ผู้ใช้เห็นและโต้ตอบกับแอพ TV ซึ่งเป็นแอพระบบที่ไม่สามารถแทนที่ด้วยแอพของบุคคลที่สาม
- แอพ TV แสดงเนื้อหา AV จากอินพุตทีวี
- แอพ TV ไม่สามารถสนทนาโดยตรงกับอินพุตทีวีได้ ตัวจัดการอินพุตทีวีจะระบุสถานะของอินพุตทีวีสำหรับแอพ TV ดู TV Input Manager ด้านล่างสำหรับรายละเอียดเพิ่มเติมเกี่ยวกับข้อจำกัดเหล่านี้
สิทธิ์
- มีเพียง
signatureOrSystem
TV Inputs และ TV App เท่านั้นที่สามารถเข้าถึงฐานข้อมูลผู้ให้บริการทีวีได้อย่างเต็มที่และสามารถรับ KeyEvents ได้ - เฉพาะอินพุตทีวีของระบบเท่านั้นที่สามารถเข้าถึงอินพุตทีวี HAL ผ่านบริการ TV Input Manager อินพุตทีวีสามารถเข้าถึงได้แบบตัวต่อตัวผ่านเซสชัน 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.

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, likeCOLUMN_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 acquireACCESS_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

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

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

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

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.

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:
- The TV App is in focus and receives all keys.
-
KeyEvents
(eg the Red button) is passed to the active TV Input asInputEvents.
- The system TV Input integrates with MHEG-5 stack and has the
RECEIVE_INPUT_EVENT
system permission. - On receiving activation keycode (eg Red button), the TV Input activates broadcast app.
- TV input consumes
KeyEvents
asInputEvents
and the broadcast app is the focus and handlesInputEvents
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.




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:

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.


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.
Search
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.

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.

- The TV Input Service tells the TV App how many tuners are available so that the TV App can handle possible resource conflict.
- The TV App receives a user-initiated request to record a TV program.
- The TV App stores the recording schedule in its internal database.
- When it's time to record, the TV App passes a request to tune to the channel associated with the recording.
- The TV Input Service receives this request, responds with whether or not there are appropriate resources, and tunes to the channel.
- Then the TV App passes a request to start recording to the TV Input Manager.
- The TV Input Service receives this request and starts recording.
- The TV Input Service stores the actual video data in its storage, which can be external storage or cloud storage.
- When it's time to finish the recording, the TV App passes the stop recording request to the TV Input Manager.
- 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.

- The CEC bus receives a command from the currently active source to switch to a different source.
- The driver passes the command to the HDMI-CEC HAL.
- The HAL notifies all
ActiveSourceChangeListeners
. - THe HDMI Control Service is notified of source change via
ActiveSourceChangeListener
. - The TV Input Manager service generates an intent for the TV App to switch the source.
- The TV App then creates a TV Input Manager Session for the TV Input being switched to and calls
setMain
on that session. - The TV Input Manager Session passes this information on to the HDMI TV Input.
- The HDMI TV input requests to set sideband surface.
- 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:
- The TV App is in focus, receiving all keys.
- The TV App passes keys (eg Red button) to the TV Input device.
- The TV Input device internally integrates with legacy TV stack.
- On receiving an activation keycode (eg Red button), the TV Input device activates broadcast apps.
- 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.