OS version
Android OS 2.3.5_r1PackageManager class overview
Class for retrieving various kinds of information related to the application packages that are currently installed on the device.PackageManagerService class overview
- Load apks from "system/app/" directory.
- Load apks from "data/data/" directory (= download apks).
- Move package to SD/device.
- Hold information about installed package .
- Hold information about Features this devices supports that were read from the xml file.
Note
- ApplicationPackageManager extended PackageManager is inner class of CotextImpl.
- ApplicationPackageManager has a interface IPackageManager.
- PackageManagerService is the implementation class IPackageManager#stub.
- PackageManagerService holds information about all packages.
information about Features this devices supports
Feature information read from xml file.void readPermissions() { // Read permissions from .../etc/permission directory. File libraryDir = new File(Environment.getRootDirectory(), "etc/permissions"); : : // Iterate over the files in the directory and scan .xml files for (File f : libraryDir.listFiles()) { // We'll read platform.xml last if (f.getPath().endsWith("etc/permissions/platform.xml")) { continue; } : : readPermissionsFromXml(f); } // Read permissions from .../etc/permissions/platform.xml last so it will take precedence final File permFile = new File(Environment.getRootDirectory(), "etc/permissions/platform.xml"); readPermissionsFromXml(permFile); } private void readPermissionsFromXml(File permFile) { : : } else if ("feature".equals(name)) { String fname = parser.getAttributeValue(null, "name"); if (fname == null) { Slog.w(TAG, "without name at " + parser.getPositionDescription()); } else { //Log.i(TAG, "Got feature " + fname); FeatureInfo fi = new FeatureInfo(); fi.name = fname; mAvailableFeatures.put(fname, fi); } XmlUtils.skipCurrentTag(parser); continue; } else { : : }
You can see the following from the above sources.
- read xmls in "system/etc/permissions" directory.
- read "system/etc/permissions/platform.xml".
- holds information to put to mAvailableFeatures of private member in class.
PackageManagerService read xmls from system folder, and put to mAvailableFeatures.
How does xml built into system.img?
Please view the build environment Nexus S Android_2.3.5_r1, so you can find makefile which are written the following.
file : device/samsung/crespo/device_base.mk
# These are the hardware-specific features PRODUCT_COPY_FILES += \ frameworks/base/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \ frameworks/base/data/etc/android.hardware.camera.flash-autofocus.xml:system/etc/permissions/android.hardware.camera.flash-autofocus.xml \ frameworks/base/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \ frameworks/base/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \ frameworks/base/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \ frameworks/base/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \ frameworks/base/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \ frameworks/base/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardware.sensor.gyroscope.xml \ frameworks/base/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \ frameworks/base/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml \ frameworks/base/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \ frameworks/base/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \ packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:system/etc/permissions/android.software.live_wallpaper.xml
it is mean "Copy from 'system/etc/permissions/XXX.xml to 'frameworks/base/data/etc/XXXX.xml".
When you add a device function on its own, may be added here.
No comments:
Post a Comment