Skip to content

RDKEAPPRT-899 If QueryPowerState is standby ,after reboot QueryPowerState is shown ON - #236

Closed
suryag23 wants to merge 6 commits into
developfrom
899
Closed

RDKEAPPRT-899 If QueryPowerState is standby ,after reboot QueryPowerState is shown ON#236
suryag23 wants to merge 6 commits into
developfrom
899

Conversation

@suryag23

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts power-state restoration logic during/after reboot so that a device previously in STANDBY is not incorrectly treated as ON after reboot, and adds a session-scoped guard intended to avoid re-running restoration logic on UI reloads (e.g., language changes).

Changes:

  • Removes logic that forcibly converted POWER_STATE_STANDBY to POWER_STATE_ON during reboot handling.
  • Adds a sessionStorage flag (powerStateRestored) to skip power-state restoration on subsequent UI reloads within the same session.
  • Updates _getPowerStatebeforeReboot() to short-circuit to current power state when the session flag is set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread accelerator-home-ui/src/App.js Outdated
Comment thread accelerator-home-ui/src/App.js
Merge remote-tracking branch 'origin/develop' into 899
Copilot AI review requested due to automatic review settings August 6, 2026 06:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

accelerator-home-ui/src/App.js:993

  • sessionStorage.powerStateRestored is set even when appApi.setPowerState(...) reports failure (res === false). In that case the power state was not actually restored, but subsequent UI reloads will skip restoration due to the flag, potentially leaving the device/UI in an incorrect state.
				sessionStorage.setItem('powerStateRestored', 'true');

Copilot AI review requested due to automatic review settings August 6, 2026 06:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

accelerator-home-ui/src/App.js:993

  • powerStateRestored is set even when appApi.setPowerState(...) resolves false (it does not reject on failure). That can cause subsequent UI reloads in the same session to skip restoration even though the power state was never successfully applied.
						GLOBALS.powerState = res.currentState;
					});
					this.LOG("_PowerStateHandlingWhileReboot: powerstate after setting to new powerstate " + JSON.stringify(GLOBALS.powerState) + " and ");
				}
				sessionStorage.setItem('powerStateRestored', 'true');

Copilot AI review requested due to automatic review settings August 6, 2026 09:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

accelerator-home-ui/src/App.js:1043

  • In the UI-reload short-circuit path, getPowerState() failure currently forces GLOBALS.powerState to POWER_STATE_ON, which is inconsistent with _getPowerStateWhileReboot() (defaults to STANDBY on error) and can incorrectly show ON when the device is actually in standby. Align the fallback state handling.
			}).catch(err => {
				this.LOG("_getPowerStatebeforeReboot: Error getting current power state: " + JSON.stringify(err));
				GLOBALS.powerState = PowerState.POWER_STATE_ON;
			});

Comment thread accelerator-home-ui/src/App.js
Copilot AI review requested due to automatic review settings August 6, 2026 09:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

accelerator-home-ui/src/App.js:994

  • The log line uses GLOBALS.powerState immediately after triggering appApi.getPowerState(), but the promise hasn’t resolved yet. This makes the log (and any debugging based on it) unreliable, and the call also lacks a .catch() here (unlike other getPowerState() usages in this file). Consider logging after the state is actually read, with an error path.
					appApi.getPowerState().then(res => {
						GLOBALS.powerState = res.currentState;
					});
					this.LOG("_PowerStateHandlingWhileReboot: powerstate after setting to new powerstate " + JSON.stringify(GLOBALS.powerState) + " and ");
					sessionStorage.setItem('powerStateRestored', 'true');

Copilot AI review requested due to automatic review settings August 6, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

accelerator-home-ui/src/App.js:987

  • The comment says the restored-session flag is only set after a confirmed successful restore, but the code also sets powerStateRestored in the res === false branch. This is misleading and makes it harder to reason about the intended behavior (success-only vs. "handled once per UI session").
				// setPowerState resolves false when the call did not succeed, so only
				// mark the state as restored after a confirmed successful restore.

accelerator-home-ui/src/App.js:994

  • appApi.getPowerState() is called after a successful setPowerState(), but the promise chain has no .catch(). If getPowerState() rejects, this becomes an unhandled rejection; also the subsequent log can print a stale GLOBALS.powerState value because it runs before the async update completes.
					appApi.getPowerState().then(res => {
						GLOBALS.powerState = res.currentState;
					});
					this.LOG("_PowerStateHandlingWhileReboot: powerstate after setting to new powerstate " + JSON.stringify(GLOBALS.powerState) + " and ");
					sessionStorage.setItem('powerStateRestored', 'true');

@yashaswini-rk yashaswini-rk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@suryag23

suryag23 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

getting the checks failed so trying to raise PR again

@suryag23 suryag23 closed this Aug 7, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants