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

Commit 216c932a authored by Susheel Yadagiri's avatar Susheel Yadagiri Committed by Linux Build Service Account
Browse files

Add api to get detailed state of DeviceIdleController.

Introduce a hidden api to get the detailed state of the
DeviceIdleController state machine.

Change-Id: Ida76edf21c2ab68cef246724e9ee2fb99c198077
parent 94a0bb20
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35,4 +35,5 @@ interface IDeviceIdleController {
    long addPowerSaveTempWhitelistAppForMms(String name, int userId, String reason);
    long addPowerSaveTempWhitelistAppForSms(String name, int userId, String reason);
    void exitIdle(String reason);
    int getIdleStateDetailed();
}
+7 −1
Original line number Diff line number Diff line
@@ -742,6 +742,12 @@ public class DeviceIdleController extends SystemService
            return isPowerSaveWhitelistExceptIdleAppInternal(name);
        }

        @Override public int getIdleStateDetailed() {
            getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER,
                    null);
            return mState;
        }

        @Override public boolean isPowerSaveWhitelistApp(String name) {
            return isPowerSaveWhitelistAppInternal(name);
        }
@@ -1187,7 +1193,7 @@ public class DeviceIdleController extends SystemService

    void scheduleReportActiveLocked(String activeReason, int activeUid) {
        Message msg = mHandler.obtainMessage(MSG_REPORT_ACTIVE, activeUid,
                mState == STATE_IDLE ? 1 : 0, activeReason);
            ((mState == STATE_IDLE) || (mState == STATE_IDLE_MAINTENANCE)) ? 1 : 0, activeReason);
        mHandler.sendMessage(msg);
    }