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

Commit fc490ab2 authored by Hall Liu's avatar Hall Liu
Browse files

Add missing null check in HomeVisibilityListener

Fixes: 178028272
Test: atest HomeVisibilityListenerTest
Change-Id: I3d4158cece84e79b3bfa29efcdb038c65e393d38
parent 6d6a9489
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.app;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.content.ComponentName;
import android.content.Context;
import android.os.Binder;

@@ -101,12 +102,11 @@ public abstract class HomeVisibilityListener {
        }

        // We can assume that the screen is idle if the home application is in the foreground.
        String defaultHomePackage = mContext.getPackageManager()
                .getHomeActivities(new ArrayList<>()).getPackageName();
        if (Objects.equals(top, defaultHomePackage)) {
            return true;
        }
        ComponentName defaultHomeComponent = mContext.getPackageManager()
                .getHomeActivities(new ArrayList<>());
        if (defaultHomeComponent == null) return false;

        return false;
        String defaultHomePackage = defaultHomeComponent.getPackageName();
        return Objects.equals(top, defaultHomePackage);
    }
}