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

Commit 4fece3c1 authored by Sindhu's avatar Sindhu
Browse files

Fix: DozeUi scheduling alarms causing jank on wakeup

Passing the background handler while instantiating AlarmTimeout class so that all its calls will be executed in background.

Test: Manual
Flag: android.systemui.Flags.dozeuiSchedulingAlarmsBackgroundExecution disabled
Bug: 330492575
Change-Id: Ic8ceeb93c9b5607693807d022dd2376465da99e7
parent bf648c4b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1033,3 +1033,13 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "dozeui_scheduling_alarms_background_execution"
  namespace: "systemui"
  description: "Decide whether to execute binder calls to schedule alarms in background thread"
  bug: "330492575"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+9 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.doze;

import static com.android.systemui.doze.DozeMachine.State.DOZE;
import static com.android.systemui.doze.DozeMachine.State.DOZE_AOD_PAUSED;
import static com.android.systemui.Flags.dozeuiSchedulingAlarmsBackgroundExecution;

import android.app.AlarmManager;
import android.content.Context;
@@ -70,6 +71,7 @@ public class DozeUi implements DozeMachine.Part {
    @Inject
    public DozeUi(Context context, AlarmManager alarmManager,
            WakeLock wakeLock, DozeHost host, @Main Handler handler,
            @Background Handler bgHandler,
            DozeParameters params,
            @Background DelayableExecutor bgExecutor,
            DozeLog dozeLog) {
@@ -80,7 +82,13 @@ public class DozeUi implements DozeMachine.Part {
        mBgExecutor = bgExecutor;
        mCanAnimateTransition = !params.getDisplayNeedsBlanking();
        mDozeParameters = params;
        mTimeTicker = new AlarmTimeout(alarmManager, this::onTimeTick, "doze_time_tick", handler);
        if (dozeuiSchedulingAlarmsBackgroundExecution()) {
            mTimeTicker = new AlarmTimeout(alarmManager, this::onTimeTick, "doze_time_tick",
                    bgHandler);
        } else {
            mTimeTicker = new AlarmTimeout(alarmManager, this::onTimeTick, "doze_time_tick",
                    handler);
        }
        mDozeLog = dozeLog;
    }

+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public class DozeUiTest extends SysuiTestCase {
        mHandler = mHandlerThread.getThreadHandler();
        mFakeExecutor = new FakeExecutor(new FakeSystemClock());
        mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler,
                mDozeParameters, mFakeExecutor, mDozeLog);
                mHandler, mDozeParameters, mFakeExecutor, mDozeLog);
        mDozeUi.setDozeMachine(mMachine);
    }