Repository navigation
Launch widget configuration through AppWidgetHost - #227
Conversation
There was a problem hiding this comment.
🔵 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
startAppWidgetConfigureActivityForResultcan also throwIllegalArgumentExceptionwhen the bound ID no longer has provider/configuration metadata. The picker keeps anAppWidgetProviderInfosnapshot, 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.startAppWidgetConfigureActivityForResultis only a convenience method: it still starts the provider's component from this activity, so it does not bypass the provider activity'sexported/permission checks. A non-exported or otherwise inaccessible configuration activity will therefore hit the sameSecurityExceptionas 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.
|
One or more custom setup steps configured for this repository failed during this Copilot code review run: 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 |
- Support providers with non-exported configuration activities Fixes #222
4df1198 to
c309c7a
Compare
Summary
AppWidgetHost.Testing