Merge "Ensure packages in shared user are valid" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2e88677636
@@ -5646,9 +5646,11 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
private int checkUidPermissionImpl(String permName, int uid) {
|
private int checkUidPermissionImpl(String permName, int uid) {
|
||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
final String[] packageNames = getPackagesForUid(uid);
|
final String[] packageNames = getPackagesForUid(uid);
|
||||||
final PackageParser.Package pkg = (packageNames != null && packageNames.length > 0)
|
PackageParser.Package pkg = null;
|
||||||
? mPackages.get(packageNames[0])
|
final int N = packageNames == null ? 0 : packageNames.length;
|
||||||
: null;
|
for (int i = 0; pkg == null && i < N; i++) {
|
||||||
|
pkg = mPackages.get(packageNames[i]);
|
||||||
|
}
|
||||||
// Additional logs for b/111075456; ignore system UIDs
|
// Additional logs for b/111075456; ignore system UIDs
|
||||||
if (pkg == null && UserHandle.getAppId(uid) >= Process.FIRST_APPLICATION_UID) {
|
if (pkg == null && UserHandle.getAppId(uid) >= Process.FIRST_APPLICATION_UID) {
|
||||||
if (packageNames == null || packageNames.length < 2) {
|
if (packageNames == null || packageNames.length < 2) {
|
||||||
@@ -6385,6 +6387,16 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <em>IMPORTANT:</em> Not all packages returned by this method may be known
|
||||||
|
* to the system. There are two conditions in which this may occur:
|
||||||
|
* <ol>
|
||||||
|
* <li>The package is on adoptable storage and the device has been removed</li>
|
||||||
|
* <li>The package is being removed and the internal structures are partially updated</li>
|
||||||
|
* </ol>
|
||||||
|
* The second is an artifact of the current data structures and should be fixed. See
|
||||||
|
* b/111075456 for one such instance.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String[] getPackagesForUid(int uid) {
|
public String[] getPackagesForUid(int uid) {
|
||||||
return getPackagesForUid_debug(uid, false);
|
return getPackagesForUid_debug(uid, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user