Fix shell command 'list staged-sessions'

After applying visibility to get session info APIs, ROOT_UID should
still be able to list staged-sessions via adb shell.

Bug: 204141763
Test: manually test 'pm list staged-sessions' via adb shell with and
      without root to verify if the result is the same.
Change-Id: I09a8a146be82deba10d3b11deea7a0b344a36c56
This commit is contained in:
Jackal Guo
2021-10-26 14:59:29 +08:00
parent 4adb565849
commit 06ad0f5a85

View File

@@ -8914,7 +8914,8 @@ public class PackageManagerService extends IPackageManager.Stub
* return {@code true} if any one application belongs to the shared user ID meets the criteria.
*/
boolean canQueryPackage(int callingUid, @Nullable String targetPackageName) {
if (targetPackageName == null) {
// Since getSettingLPr returns null for ROOT_UID, add an extra check for it here.
if (callingUid == Process.ROOT_UID || targetPackageName == null) {
return true;
}
synchronized (mLock) {