Skip to content

Commit

Permalink
ChargingControl: Additional log lines for deadline
Browse files Browse the repository at this point in the history
Change-Id: I9ceb3b0df0095cb12408a6ae47be8fd8af6678a8
Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com>
  • Loading branch information
t-m-w authored and bheatleyyy committed Sep 28, 2023
1 parent 2a76f59 commit 57ca212
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -399,6 +399,8 @@ private ChargeTime getChargeTime() {
return null;
}

Log.i(TAG, "Target time is " + msToString(targetTime));

return new ChargeTime(startTime, targetTime);
}

Expand Down Expand Up @@ -584,20 +586,24 @@ private void updateChargeDeadline() {
if (!mConfigEnabled || t == null || mIsControlCancelledOnce) {
deadline = -1;
targetTime = 0;
Log.i(TAG, "Canceling charge deadline");
} else {
if (t.getTargetTime() == mSavedTargetTime) {
return;
}
targetTime = t.getTargetTime();
final long currentTime = System.currentTimeMillis();
deadline = (targetTime - currentTime) / 1000;
Log.i(TAG, "Setting charge deadline: Current time: " + msToString(currentTime));
Log.i(TAG, "Setting charge deadline: Target time: " + msToString(targetTime));
Log.i(TAG, "Setting charge deadline: Deadline (seconds): " + deadline);
}

try {
mChargingControl.setChargingDeadline(deadline);
mSavedTargetTime = targetTime;
} catch (IllegalStateException | RemoteException | UnsupportedOperationException e) {
Log.e(TAG, "Failed to set charge deadline");
Log.e(TAG, "Failed to set charge deadline", e);
}
}

Expand Down

0 comments on commit 57ca212

Please sign in to comment.