You cannot import them because they have the @SystemApi annotation. You can check this for the TvContentRatingSystemInfo source code. I also checked WatchedPrograms and it also has @SystemApi annotation. I did not check the other three.
You must be a system application to access them. As you can see here , you need to put your application in the \system\ folder. You can find detailed information about the AOSP build system here .
Solution: changing your android.jar to .jar in this github should allow you to access the system API. The reason is because your standard android.jar does not have a system API. Therefore, you need to get framework.jar (by adb pull ) from the emulator and combine it with core.jar then you can have a new android.jar which contains the system API (system methods and classes are available in framework.jar from the emulator).
Moreover, you must \system\priv-app\ your apk to the \system\priv-app\ folder to access some system API, but I donβt know why I can access the system API without pressing my apk in \system\priv-app\ when I use .jar from this github account.
It seems to me that I am not writing very clearly, but at least now you have more understanding of what you are facing.
Yonathan randyanto
source share