Handle possibly null from getPackagesForUid call.
Added documentation