Rename pmInternal#getPackageUidInternal (2/4)

This method was added to operate as an internal variant of the
public getPackageUid method since pmInternal#getPackageUid already
exist. However, pmInternal#getPackageUid method just called to the
public interface, and enforcing permissions and visibility checks.

Since we don't expect any UID/permission checks in a local service,
any callers to this method requiring permission checks should be
migrated onto the PackageManager public method. Remove the original
pmInternal#getPackageUid and rename #getPackageUidInternal to take
its place.

Bug: 148235092
Test: Build pass and boot
Change-Id: Iebf51ab7f35710dea2b9c34c64138277c44cf30a
This commit is contained in:
Jackal Guo
2020-08-18 13:38:12 +08:00
parent 0f54ce6bd2
commit 816efd1cc0
2 changed files with 3 additions and 3 deletions

View File

@@ -2131,7 +2131,7 @@ public class AppStandbyController implements AppStandbyInternal {
}
public List<UserHandle> getValidCrossProfileTargets(String pkg, int userId) {
final int uid = mPackageManagerInternal.getPackageUidInternal(pkg, 0, userId);
final int uid = mPackageManagerInternal.getPackageUid(pkg, /* flags= */ 0, userId);
final AndroidPackage aPkg = mPackageManagerInternal.getPackage(uid);
if (uid < 0
|| aPkg == null

View File

@@ -1654,8 +1654,8 @@ public class UsageStatsService extends SystemService implements
// If the calling app is asking about itself, continue, else check for permission.
if (packageName.equals(callingPackage)) {
final int actualCallingUid = mPackageManagerInternal.getPackageUidInternal(
callingPackage, 0, userId);
final int actualCallingUid = mPackageManagerInternal.getPackageUid(
callingPackage, /* flags= */ 0, userId);
if (actualCallingUid != callingUid) {
return false;
}