Grant the privileged app - SampleTunerTvInputService access to the Tuner HAL service

We have a new Tuner HAL design in Android R to support Android TV Broadcast TV solution
Please see the design doc: https://docs.google.com/document/d/1ZeCs4BYCWB27fZnYRDW5O6i3HMsXE4ZGimiWugrmxDg/edit?usp=sharing

The overall structure of this design is:
Privileged apps use Tuner java framework to access the Tuner HAL through the Tuner JNI
There is a system service - TunerResourceManager that would be used in the Tuner java framework to manager Tuner related resources
Whenever the privileged apps request a resource, the TunerResourceManager checks its permission and priority to help Tuner java make decision
Tuner HAL service access is also protected by the selinux policy

Tuner HAL 1.0: https://source.corp.google.com/android/hardware/interfaces/tv/tuner/1.0/
Tuner HAL service sepolicy: https://source.corp.google.com/android/system/sepolicy/public/hal_tv_tuner.te?q=hal_tv_tuner.te
TunerJava: https://source.corp.google.com/android/frameworks/base/media/java/android/media/tv/tuner/Tuner.java;l=197?q=%22This%20class%20is%20used%20to%20interact%20with%20hardware%20tuners%20devices.%22
TunerJNI: https://source.corp.google.com/android/frameworks/base/media/jni/android_media_tv_Tuner.cpp;l=926?q=android_media_tv_tuner
TunerResourceManager: https://source.corp.google.com/android/frameworks/base/media/java/android/media/tv/tunerresourcemanager/TunerResourceManager.java?q=tunerresourcemanager

SampleTunerTvInputService is an internal reference design of the privileged apps for vendors to refer
It runs on the virtual Android device Cuttlefish TV with the default Tuner HAL implementation

SampleTunerTvInputService: https://source.corp.google.com/android/packages/apps/TV/tuner/sampletunertvinput/

Test: Running SampleTunerTvInputService with LiveChannels on Cuttlefish to access Tuner HAL

$adb shell ps -Z | grep sampletunertvinput
u:r:sample_tuner_tis_app:s0:c232,c259,c512,c768 system 3459 345 932208 110828 0              0 S com.android.tv.samples.sampletunertvinput

Bug: 158868205
Change-Id: I5d7bb49c9ad5ead4a4ea726afdb915c86433a9a9
2 files changed
tree: d34277a80c131aa7595d3f8329cf93bd1091242f
  1. common/
  2. guest/
  3. host/
  4. recovery/
  5. shared/
  6. tests/
  7. tools/
  8. vsoc_arm64/
  9. vsoc_arm64_only/
  10. vsoc_x86/
  11. vsoc_x86_64/
  12. vsoc_x86_64_only/
  13. vsoc_x86_noapex/
  14. Android.bp
  15. Android.mk
  16. AndroidProducts.mk
  17. CleanSpec.mk
  18. default-permissions.xml
  19. dtb.img
  20. fetcher.mk
  21. host_package.mk
  22. METADATA
  23. OWNERS
  24. README.md
  25. required_images
  26. TEST_MAPPING
README.md

So you want to try cuttlefish?

  1. Download, build, and install the host debian package:
git clone https://github.com/google/android-cuttlefish
cd android-cuttlefish
debuild -i -us -uc -b
sudo dpkg -i ../cuttlefish-common_*_amd64.deb
sudo apt-get install -f
  1. Go to http://ci.android.com/
  2. Enter a branch name. Start with aosp-master if you don‘t know what you’re looking for
  3. Navigate to aosp_cf_x86_phone and click on userdebug for the latest build
  4. Click on Artifacts
  5. Scroll down to the OTA images. These packages look like aosp_cf_x86_phone-img-xxxxxx.zip -- it will always have img in the name. Download this file
  6. Scroll down to cvd-host_package.tar.gz. You should always download a host package from the same build as your images.
  7. On your local system, combine the packages:
mkdir cf
cd cf
tar xvf /path/to/cvd-host_package.tar.gz
unzip /path/to/aosp_cf_x86_phone-img-xxxxxx.zip
  1. Launch cuttlefish with:

    $ HOME=$PWD ./bin/launch_cvd

  2. Stop cuttlefish with:

$ HOME=$PWD ./bin/stop_cvd

So you want to debug cuttlefish?

You can use adb to debug it, just like a physical device:

$ ./bin/adb -e shell

So you want to see cuttlefish?

You can use the TightVNC JViewer. Once you have downloaded the TightVNC Java Viewer JAR in a ZIP archive, run it with

$ java -jar tightvnc-jviewer.jar -ScalingFactor=50 -Tunneling=no -host=localhost -port=6444

Click “Connect” and you should see a lock screen!