Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Who provides implementation(s) of the PackageManager class?

Tags:

android

class

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?

like image 300
mishkin Avatar asked Feb 19 '11 18:02

mishkin


2 Answers

The real implementation for the PackageManager is PackageManagerService located at frameworks/base/services/java/com/android/server/

You can find the source code here in the GrepCode.

like image 94
RamboWang Avatar answered Nov 15 '22 22:11

RamboWang


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.

like image 29
Samuh Avatar answered Nov 15 '22 22:11

Samuh