问题描述
我正在查看 PackageManager
类的源代码,它是抽象的以及所有的方法。制造商应该为它写一个真正的实现,还是我错过了什么?
I am looking at source code for the PackageManager
class and it is abstract as well as all the methods. Are manufacturers supposed to write a real implementation for it, or I am missing something?
推荐答案
PackageManager
是抽象的,需要提供具体的实现命令调用实例方法。这个类的实现可以作为 ApplicationContext
的包私有静态类找到,它本身在 ContextImpl
中可用。 (有关源代码)。注意,PackageManager的这个实现是最终的,因此不能被覆盖。
PackageManager
is abstract and a concrete implementation needs to be provided in order to invoke instance methods. An implementation of this class can be found as a package private static class of ApplicationContext
which itself is available in ContextImpl
. (For source code see here). Note that this implementation of PackageManager is final and so cannot be overriden.
还有一个实施,您可能会感兴趣。
There is also a MockPackageManager implementation that might interest you.
这篇关于谁提供PackageManager类的实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!