RDKEAPPRT-879,324 - Remove CEC Plugin Activation/Deactivation from CEC Control Setting - #224
RDKEAPPRT-879,324 - Remove CEC Plugin Activation/Deactivation from CEC Control Setting #224SudarsananComcast wants to merge 11 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to remove direct Thunder plugin activation/deactivation side effects from the “CEC Control” setting, shifting the control flow toward toggling the CEC enabled state instead of activating/deactivating the org.rdk.HdmiCecSource plugin.
Changes:
- Commented out CEC plugin activation logic in
_init(). - Refactored
toggleCEC()to compute a target enabled state and callsetEnabled(...), then update the toggle icon accordingly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // get the current state and toggle it | ||
| const newEnabledState = !res.enabled | ||
| this.cecApi.setEnabled({ enabled: newEnabledState }) | ||
| .then(() => { |
| const newEnabledState = !(res && res.enabled) | ||
| this.cecApi.setEnabled(newEnabledState) | ||
| .then(() => { | ||
| const imageSrc = newEnabledState | ||
| ? 'images/settings/ToggleOnOrange.png' | ||
| : 'images/settings/ToggleOffWhite.png' | ||
| this.tag('CECControl.Button').src = Utils.asset(imageSrc) | ||
| }) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| this.cecApi.setEnabled(newEnabledState) | ||
| .then(() => { | ||
| // Update UI based on new state | ||
| const imageSrc = newEnabledState | ||
| ? 'images/settings/ToggleOnOrange.png' | ||
| : 'images/settings/ToggleOffWhite.png' | ||
| this.tag('CECControl.Button').src = Utils.asset(imageSrc) | ||
| if (newEnabledState) { | ||
| this.performOTPAction() | ||
| } | ||
| }) |
| this.cecApi.setEnabled(newEnabledState) | ||
| .then(() => { | ||
| // Update UI based on new state | ||
| const imageSrc = newEnabledState | ||
| ? 'images/settings/ToggleOnOrange.png' | ||
| : 'images/settings/ToggleOffWhite.png' | ||
| this.tag('CECControl.Button').src = Utils.asset(imageSrc) | ||
| if (newEnabledState) { | ||
| this.performOTPAction() | ||
| } | ||
| }) |
| const isEnabled = !!(res && res.enabled) | ||
| console.log(`CEC initial status: ${isEnabled}`) | ||
|
|
| // get the current state and toggle it. | ||
| const newEnabledState = !(res && res.enabled) | ||
| this.cecApi.setEnabled(newEnabledState) | ||
| .then(() => { | ||
| // Update UI based on new state | ||
| const imageSrc = newEnabledState | ||
| ? 'images/settings/ToggleOnOrange.png' | ||
| : 'images/settings/ToggleOffWhite.png' | ||
| this.tag('CECControl.Button').src = Utils.asset(imageSrc) | ||
| if (newEnabledState) { | ||
| this.performOTPAction() | ||
| } | ||
| }) |
| const isEnabled = !!(res && res.enabled) | ||
| console.log(`CEC initial status: ${isEnabled}`) |
arun-madhavan-013
left a comment
There was a problem hiding this comment.
CEC plugin activation is needed. UI is common for both Source & Sink devices.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
accelerator-home-ui/src/screens/OtherSettingsScreens/AdvancedSettingsScreen.js:248
toggleCEC()still callscecApi.activate()and unconditionally updates UI/storage in.then(() => ...)even whensetEnabled()fails (it can resolve{ success: false }on error). This conflicts with the PR goal of removing plugin activation/deactivation from the setting (the plugin is already activated inApp.js) and can desync the toggle UI from the real CEC state. Prefer callingsetEnabled(newEnabledState)directly and gate UI/storage updates on a successful result.
const newEnabledState = !(res && res.enabled)
// if newEnabledState is true,then first activate CEC and then setEnabled to true,
// else just setEnabled to false
const togglePromise = newEnabledState
? this.cecApi.activate().then(() => this.cecApi.setEnabled(true))
accelerator-home-ui/src/overlays/OtherSettings/AdvancedSettingsScreenOverlay.js:233
toggleCEC()still callscecApi.activate()and unconditionally updates UI/storage in.then(() => ...)even whensetEnabled()fails (it can resolve{ success: false }on error). This conflicts with the PR goal of removing plugin activation/deactivation from the setting (the plugin is already activated inApp.js) and can desync the toggle UI from the real CEC state. Prefer callingsetEnabled(newEnabledState)directly and gate UI/storage updates on a successful result.
const newEnabledState = !(res && res.enabled)
// if newEnabledState is true,then first activate CEC and then setEnabled to true,
// else just setEnabled to false
const togglePromise = newEnabledState
? this.cecApi.activate().then(() => this.cecApi.setEnabled(true))
|
Hi @arun-madhavan-013 CEC is activated in app.js file. just removed where the activate function call is not required. |
No description provided.