When is ProcessRecord#uid set ?
com.android.server.am.ProcessList#startProcessLocked(j)
com.android.server.am.ProcessList#newProcessRecordLocked(): get uid from ApplicationInfo.
com.android.server.am.ProcessList#newProcessRecordLocked call new ProcessRecord().
When is ApplicationInfo#uid set ?
when install apk ,first generate a appid(PackageSetting#mAppId) ,then use this appid to generate a uid( ApplicationInfo#uid) .
After installation, the UID will not change
com.android.server.pm.parsing.PackageInfoUtils#generateApplicationInfo
com.android.server.pm.parsing.PackageInfoUtils#initForUser() set the ApplicationInfo uid .
ApplicationInfo#uid
ProcessList#addProcessNameLocked will create a UidRecord ,
then put this UidRecord into ProcessList#mActiveUids .