Skip to content

Launch widget configuration through AppWidgetHost - #227

Merged
luantak merged 2 commits into
masterfrom
t3code/fix-issue-222
Sep 21, 2026
Merged

luantak merged 2 commits into
masterfrom
t3code/fix-issue-222

Conversation

@luantak

@luantak luantak commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add an internal activity that starts widget configuration through AppWidgetHost.
  • Handle missing or inaccessible provider configuration activities.
  • Update the widget page to use the new configuration flow.

Testing

  • Not run.

Copilot AI lite review requested due to automatic review settings September 18, 2026 01:54

Copilot AI 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.

🔵 Needs a closer look

One or more issues must be addressed before approval.

Pull request overview

Adds an internal activity that launches widget configuration via AppWidgetHost, gracefully handles launch failures, and updates the widget page flow.

Changes:

  • Added WidgetConfigurationActivity.
  • Routed configuration requests through the new activity.
  • Registered the activity in the manifest.
File summaries
File Description
app/src/main/java/com/lu4p/fokuslauncher/WidgetConfigurationActivity.kt Updated as part of this pull request.
app/src/main/java/com/lu4p/fokuslauncher/ui/widgets/WidgetPageViewModel.kt Updated as part of this pull request.
app/src/main/java/com/lu4p/fokuslauncher/ui/widgets/WidgetPageScreen.kt Updated as part of this pull request.
app/src/main/AndroidManifest.xml Updated as part of this pull request.
Review details

Suppressed comments (2)

app/src/main/java/com/lu4p/fokuslauncher/WidgetConfigurationActivity.kt:49

  • startAppWidgetConfigureActivityForResult can also throw IllegalArgumentException when the bound ID no longer has provider/configuration metadata. The picker keeps an AppWidgetProviderInfo snapshot, so that metadata can be stale by the time this activity runs; without handling this exception the new fallback still crashes instead of returning the canceled result described by the PR.
            } catch (_: ActivityNotFoundException) {
                finishWithResult(RESULT_CANCELED, null)
            } catch (_: SecurityException) {
                finishWithResult(RESULT_CANCELED, null)
            }

app/src/main/java/com/lu4p/fokuslauncher/WidgetConfigurationActivity.kt:44

  • AppWidgetHost.startAppWidgetConfigureActivityForResult is only a convenience method: it still starts the provider's component from this activity, so it does not bypass the provider activity's exported/permission checks. A non-exported or otherwise inaccessible configuration activity will therefore hit the same SecurityException as the old direct intent and be canceled by this wrapper, rather than being launched as the KDoc claims; require/filter invokable configuration activities or use a genuinely system-mediated flow.
                AppWidgetHost(applicationContext, WidgetHostManager.HOST_ID)
                        .startAppWidgetConfigureActivityForResult(
                                this,
                                appWidgetId,
                                0,
                                REQUEST_CONFIGURE,
                                null,
                        )
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Copilot AI commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Set up Android SDK

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

- Support providers with non-exported configuration activities

Fixes #222
@luantak
luantak force-pushed the t3code/fix-issue-222 branch from 4df1198 to c309c7a Compare September 19, 2026 15:46
@luantak
luantak merged commit 69033fd into master Sep 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants