Deduplicate adapter-of-installed-packages code.

Change-Id: I454ba79eddaaff86233a2cc341f4c8bebe94729e
Merge pull request #18 from CyanogenMod/cm-11.0

Deduplicate adapter-of-installed-packages code.