TBog / TBLauncher

based on https://github.com/Neamar/KISS
GNU General Public License v3.0
140 stars 18 forks source link

widgets that have a customization prompt don't work #461

Closed pine-serpent closed 5 months ago

pine-serpent commented 6 months ago

Description

When trying to add a widget that has a popup customization prompt they simply to don't work and never offer the prompt.

Context

Example is the Antennapod widget. Normally when adding this widget a full screen option prompt opens so tiu can select opacity, buttonzns.

Steps to Reproduce

  1. Hold on widget screen.
  2. Tap add widget.
  3. Select antennapod widget.
  4. Nothing happens.

Expected behavior

Expect full screen widget options to popup.

Device info

TBog commented 6 months ago

Thanks for finding this issue. I'll look into it while working on #456

pine-serpent commented 6 months ago

also fails to work with the home assistant companion app which confirms my thinking that this affects any widgets that require some sort or additional popup to edit and confirm the placement of the widget.

t-e-s-tweb commented 6 months ago

Thanks for finding this issue. I'll look into it while working on #456

just wanted to let you know that this is probably solved by that. i am on latest devtest build and antennapod and every single other widget which has problems like Google clock and others work correctly now. Screenshot_2024-05-12-22-16-18-370-edit_rocks tbog tblauncher

TBog commented 6 months ago

I think this only happens on Android 14 Not sure why but the request to open the configuration / customization for the widget returns with "cancel". I've found a way around it but I'm not yet sure if this is the intended behavior.

TBog commented 6 months ago

Found the reason. https://developer.android.com/about/versions/14/behavior-changes-14

For apps targeting Android 14 (API level 34) or higher, the system further restricts when apps are allowed to start activities from the background:

When an app sends a PendingIntent using PendingIntent#send() or similar methods, the app must opt in if it wants to grant its own background activity launch privileges to start the pending intent. To opt in, the app should pass an ActivityOptions bundle with setPendingIntentBackgroundActivityStartMode(MODE_BACKGROUND_ACTIVITY_START_ALLOWED).

I'm not sure why the configuration intent needs it, but this fixes the problem: https://github.com/TBog/TBLauncher/blob/54b24d0f1b1527dd5bf9e1d67563f7d92b2ae492/app/src/main/java/rocks/tbog/tblauncher/widgets/WidgetManager.java#L655-L667