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

Commit cbc9569f authored by Rupesh Bansal's avatar Rupesh Bansal
Browse files

ActivityManagerInternal null check while checking process state

Bug: 390107600
Test: atest DisplayManagerServiceTest
Flag: com.android.server.display.feature.flags.refresh_rate_event_for_foreground_apps
Change-Id: I2977e221ad342a026c915f5869e825ed102925be
parent 5ed3fbe6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4157,7 +4157,8 @@ public final class DisplayManagerService extends SystemService {

        public boolean shouldReceiveRefreshRateWithChangeUpdate(int event) {
            if (mFlags.isRefreshRateEventForForegroundAppsEnabled()
                    && event == DisplayManagerGlobal.EVENT_DISPLAY_REFRESH_RATE_CHANGED) {
                    && event == DisplayManagerGlobal.EVENT_DISPLAY_REFRESH_RATE_CHANGED
                    && mActivityManagerInternal != null) {
                int procState = mActivityManagerInternal.getUidProcessState(mUid);
                int importance = ActivityManager.RunningAppProcessInfo
                        .procStateToImportance(procState);
+3 −2
Original line number Diff line number Diff line
@@ -2126,11 +2126,12 @@ public class DisplayManagerServiceTest {

    @Test
    public void test_displayChangedNotified_displayInfoFramerateOverridden() {
        when(mMockFlags.isFramerateOverrideTriggersRrCallbacksEnabled()).thenReturn(false);

        DisplayManagerService displayManager =
                new DisplayManagerService(mContext, mShortMockedInjector);
                new DisplayManagerService(mContext, mBasicInjector);
        DisplayManagerService.BinderService displayManagerBinderService =
                displayManager.new BinderService();
        when(mMockFlags.isFramerateOverrideTriggersRrCallbacksEnabled()).thenReturn(false);

        registerDefaultDisplays(displayManager);
        displayManager.onBootPhase(SystemService.PHASE_WAIT_FOR_DEFAULT_DISPLAY);