Avoid NullPointerException in enableSystemApp if the app is absent.
In enableSystemApp: if the app is absent, throw a IllegalArgumentException instead of failing with a NullPointerException. BUG:19321306 Change-Id: I4ec09a0a77d29ca04e8d52f5546c1e4d0f8641e5
This commit is contained in:
@@ -5072,6 +5072,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
throws RemoteException {
|
||||
ApplicationInfo appInfo = pm.getApplicationInfo(packageName, GET_UNINSTALLED_PACKAGES,
|
||||
userId);
|
||||
if (appInfo == null) {
|
||||
throw new IllegalArgumentException("The application " + packageName +
|
||||
" is not present on this device");
|
||||
}
|
||||
return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user