Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90af6d73 authored by Nicolas Prevot's avatar Nicolas Prevot
Browse files

Fixing a NullPointerException in isProfileOwnerApp.

Fixing a NullPointerException in isProfileOwnerApp of DevicePolicyManager
if there is no profile owner.

BUG: 16673376
Change-Id: I912fcd38343d3c1893313e6335802d26014a2e9d
parent 22f2ee56
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2296,9 +2296,10 @@ public class DevicePolicyManager {
    public boolean isProfileOwnerApp(String packageName) {
        if (mService != null) {
            try {
                String profileOwnerPackage = mService.getProfileOwner(
                        Process.myUserHandle().getIdentifier()).getPackageName();
                return profileOwnerPackage != null && profileOwnerPackage.equals(packageName);
                ComponentName profileOwner = mService.getProfileOwner(
                        Process.myUserHandle().getIdentifier());
                return profileOwner != null
                        && profileOwner.getPackageName().equals(packageName);
            } catch (RemoteException re) {
                Log.w(TAG, "Failed to check profile owner");
            }