Skip to content

feat(windows): honour Windows "metered connection" flag for downloading updates#16099

Open
rc-swag wants to merge 3 commits into
masterfrom
feat/windows/13566/check-metered-connection
Open

feat(windows): honour Windows "metered connection" flag for downloading updates#16099
rc-swag wants to merge 3 commits into
masterfrom
feat/windows/13566/check-metered-connection

Conversation

@rc-swag

@rc-swag rc-swag commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This adds a helper unit which uses the windows API to obtain a ConnectionProfile. This profile provides information about the connection status and connectivity statistics. This includes the connection costs, roaming, restricted etc. It also can check to see if background networking activity has been restricted.

Using the recommened example this commit combines these to determine if a network is metered. It also provides access to the background network being restricted.

There is a call that IsBackgroundUpdateAllowed that will return true if a background update is allowed.

This is then use in the Update State Machine and also by update pop up.
UpdateStateMachine
Before downloading IsBackgroundUpdateAllowed is called

Update Pop Up
This uses the IsMetered call and adds a warning if to the user who is wanting to Install Now.
This message would be better as a banner in the Update Configuration tab, rather than a delphi tab. This is the most efficent place to add the message for now.

Fixes: #13566

User Testing

Mark connection as metered

For this we need to use windows setting to set the test machines network to metered. Right click the network connection icon in the Windows System tray and select network & internet settings Selected the connected work and the change the toggle for Metered connection to On

Windows 11
Keyman_network_Metered

Windwos 10
image

TEST_WARNING_MESSAGE

Use a keyboard update to test.

  1. Install Keyman version attached to his PR
  2. Download and install this older version of euro_latin
  3. Make sure you have change the connected network to metered as explanined above.
  4. Go into the Keyman Configuration and the Update Tab
  5. Press the check for updates button.
  6. It should find an update for Euro Latin.
  7. Press install updates ovbserve the warning is shown.
metered_warning

TEST_NO_WARNING_MESSAGE_PART1

This is to make sure a warning message is not present on non-metered connection.

  1. Install Keyman version attached to his PR
  2. Download and install this older version of euro_latin
  3. Run Keyman.
  4. Make sure you have change the connected network to metered OFF
  5. Go into the Keyman Configuration and the Update Tab
  6. Press the check for updates button.
  7. It should find an update for Euro Latin.
  8. Press install updates observe the metered warning is not shown.
not_metered_warning

TEST_NO_WARNING_MESSAGE_PART2

This is to make sure a warning message is not present on a metered connection when
we already have the download and are just in the WaitingRestart State.

  1. Install Keyman version attached to his PR
  2. Download and install this older version of euro_latin
  3. Make sure you have change the connected network to metered OFF
  4. Go into the Keyman Configuration and the Update Tab
  5. Press the check for updates button.
  6. It should find an update for Euro Latin.
  7. Close Configuration and the Keyman Splash screen if open.
    1. Do not Run Keyman if Keyman has run you will need to sign out of the current windows session.
  8. Start Keyman
  9. A pop saying an update is ready observe the metered warning is not shown.
not_metered_warning

TEST_NO_BACKGROUND_UPDATE

  1. Install Keyman version attached to his PR
  2. Download and install this older version of sil_euro_latin.zip
  3. Close Keyman an Keyman Configuration
  4. Make sure you have change the connected network to metered as explanined above.
  5. Open Regedit WinR type regedit
  6. Go to the current user key update state found at (Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Engine).
  7. If required set the update state back to usIdle
  8. Delete last update check time. This needs to be done otherwise it will stay in usIdle for 7 days.
  9. Open Windows Explorer at "C:\Users"yourusername"\AppData\Local\Keyman\UpdateCache" folder.
  10. Delete any *.kmp and *.exe files.
  11. Open a command prompt and go to where kmshell is installed e.g c:\Program Files (x86)\Keyman\Keyman Desktop
  12. run kmshell.exe -c This will run the configuration
  13. Go to the Window Explorer window that is looking at the UpdateCache folder press F5 to refresh the window. No *.kmp or *.exe should appear as we are on metetered connection.

TEST_BACKGROUND_UPDATE

This is a regresion test.

  1. Install Keyman version attached to his PR
  2. Download and install this older version of sil_euro_latin.zip
  3. Close Keyman an Keyman Configuration
  4. Make sure you have change the connected network metered to OFF as explanined above.
  5. Open Regedit WinR type regedit
  6. Go to the current user key update state found at (Computer\HKEY_CURRENT_USER\SOFTWARE\Keyman\Keyman Engine).
  7. If required set the update state back to usIdle
  8. Delete last update check time. This needs to be done otherwise it will stay in usIdle for 7 days.
  9. Open Windows Explorer at "C:\Users"yourusername"\AppData\Local\Keyman\UpdateCache" folder.
  10. Delete any *.kmp and *.exe files.
  11. Open a command prompt and go to where kmshell is installed e.g c:\Program Files (x86)\Keyman\Keyman Desktop
  12. run kmshell.exe -c This will run the configuration
  13. Go to the Window Explorer window that is looking at the UpdateCache folder press F5 to refresh the window. The sil_euro_latin.kmp should appear as we are not on a metered connection.

This adds a helper unit which uses the windows API to obtain a
ConnectionProfile. This profile provides information about the
connection status and connectivity statistics. This includes
the connection costs, roaming, restricted etc. It also can
check to see if background networking activity has been restricted.

Using the recommened example this commit combines these to determine
if a network is metered. It also provides access to the background
network being restricted.

Fixes: #13566
@github-project-automation github-project-automation Bot moved this to Todo in Keyman Jun 16, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added the user-test-missing User tests have not yet been defined for the PR label Jun 16, 2026
@rc-swag rc-swag self-assigned this Jun 16, 2026
@keymanapp-test-bot

keymanapp-test-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

User Test Results

Test specification and instructions

  • TEST_WARNING_MESSAGE (OPEN)
  • TEST_NO_WARNING_MESSAGE_PART1 (OPEN)
  • TEST_NO_WARNING_MESSAGE_PART2 (OPEN)
  • TEST_NO_BACKGROUND_UPDATE (OPEN)
  • TEST_BACKGROUND_UPDATE (OPEN)
Results Template
# Test Results

* **TEST_WARNING_MESSAGE (OPEN):** notes
* **TEST_NO_WARNING_MESSAGE_PART1 (OPEN):** notes
* **TEST_NO_WARNING_MESSAGE_PART2 (OPEN):** notes
* **TEST_NO_BACKGROUND_UPDATE (OPEN):** notes
* **TEST_BACKGROUND_UPDATE (OPEN):** notes

Test Artifacts

@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S31 milestone Jun 16, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added has-user-test user-test-required User tests have not been completed and removed user-test-missing User tests have not yet been defined for the PR labels Jun 16, 2026
rc-swag added 2 commits June 16, 2026 15:58
If the download has already occured before calling the pop up
then there is no reason to warn about the metered connection.
@rc-swag rc-swag marked this pull request as ready for review June 17, 2026 03:57
@rc-swag rc-swag requested a review from mcdurdin June 17, 2026 03:58
@rc-swag rc-swag changed the title feat(windows): add network connectivity tool feat(windows): honour Windows "metered connection" flag for downloading updates Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

feat(windows): honour Windows "metered connection" flag for downloading updates

2 participants