Fix NullPointerException in PackageManagerService
Add null check before calling equals() on packageName to prevent a potential NullPointerException that could cause system restart. When executing certain package manager service calls, packageName could be null, leading to a fatal exception in the system process. This change adds a null check before the equals() invocation to safely handle the null case. Test: Manual testing with service call, no crash observed Change-Id: Idbbff663cc68614677a2c0d21a8941c4d9c7dd04 Signed-off-by: Jia Jia <jia.jia@zte.com.cn> Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
@@ -3410,7 +3410,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
|
||||
// TODO Do we have to do it even if userId != UserHandle.USER_ALL? Otherwise,
|
||||
// this check is probably not needed, since DO should be registered as a device
|
||||
// admin on some user too. (Original bug for this: b/17657954)
|
||||
if (packageName.equals(deviceOwnerPackageName)) {
|
||||
if (packageName != null && packageName.equals(deviceOwnerPackageName)) {
|
||||
return true;
|
||||
}
|
||||
// Does it contain a device admin for any user?
|
||||
|
||||
Reference in New Issue
Block a user