question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Impossible to add widget with Android 7

See original GitHub issue

Home Assistant Android version: 2021.12.0-full

Android version: 7

Phone model: Huawai P9 SLA-L22

Home Assistant version: Home Assistant 2021.12.4

Last working Home Assistant release (if known): unknow

**Description of problem: Widget don’t drop when i want to add it **

Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):

E/HwLauncher: Launcher startActivityForResult is failed,the intent = Intent { act=android.appwidget.action.APPWIDGET_CONFIGURE cmp=io.homeassistant.companion.android/.widgets.button.ButtonWidgetConfigureActivity (has extras) }
    java.lang.SecurityException: Permission Denial: starting Intent { act=android.appwidget.action.APPWIDGET_CONFIGURE cmp=io.homeassistant.companion.android/.widgets.button.ButtonWidgetConfigureActivity (has extras) } from ProcessRecord{3140339 3011:com.huawei.android.launcher/u0a64} (pid=3011, uid=10064) not exported from uid 10134
        at android.os.Parcel.readException(Parcel.java:1673)
        at android.os.Parcel.readException(Parcel.java:1626)
        at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3097)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1539)
        at android.app.Activity.startActivityForResult(Activity.java:4391)
        at android.app.Activity.startActivityForResult(Activity.java:4335)
        at com.huawei.android.launcher.Launcher.startActivityForResult(Launcher.java:4309)
        at com.huawei.android.launcher.Launcher.startActivityForResultSafely(Launcher.java:5548)
        at com.huawei.android.launcher.Launcher.addAppWidgetImpl(Launcher.java:4441)
        at com.huawei.android.launcher.Launcher.addAppWidgetFromDrop(Launcher.java:4521)
        at com.huawei.android.launcher.Workspace.addPendingAddItemInfoToDesktop(Workspace.java:10389)
        at com.huawei.android.launcher.Workspace$9.run(Workspace.java:5898)
        at com.huawei.android.launcher.DragLayer$3.onAnimationEnd(DragLayer.java:1150)
        at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1149)
        at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1309)
        at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
        at android.animation.AnimationHandler.-wrap2(AnimationHandler.java)
        at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:931)
        at android.view.Choreographer.doCallbacks(Choreographer.java:742)
        at android.view.Choreographer.doFrame(Choreographer.java:671)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:919)
        at android.os.Handler.handleCallback(Handler.java:761)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:156)
        at android.app.ActivityThread.main(ActivityThread.java:6617)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

Screenshot of problem:

**Additional information: I have recently change SSL algo to RSA, because Android 7 don"t accept secp384r1 **

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dbalazuccommented, Dec 24, 2021

I have had similar issues on another application.

Android apps targeting 12 or up now require to have the “exported” attribute of each activity explicitly set in AndroidManifest.xml. The activities for the APPWIDGET_CONFIGURE actions with “exported” set to “false” work for most deployments but custom launchers require the “exported” flag set to "true’ or the provided error occurs.

Since the app does not export APPWIDGET_CONFIGURE activities and the provided stacktrace indicates that the request is from a custom launcher (com.huawei.android.launcher.Launcher), this is most likely the cause of the issue.

Now, exporting activities should be considered with caution and there is probably a better fix than setting “exported” to “true” for those widget configuration activities, but I am not aware of it.

eg:

 <activity android:name=".widgets.button.ButtonWidgetConfigureActivity"
    android:exported="true">
    <intent-filter>
        <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
    </intent-filter>
</activity>
1reaction
dbalazuccommented, Dec 24, 2021

If we were required to have the export feature set to true then nobody would be able to add widgets but that is not the case. I can add widgets using pixel launcher. Export flag does not trigger a permission denial, the error message would actually mention the export issue as we have seen already.

It is not reproducible on stock Android and as I mention, only with a custom launcher, maybe some old ones only (APEX Launcher is one that used to cause this issue in my experience)

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Ways to Fix Unresponsive Widgets on Android - MakeUseOf
7 Ways to Fix Unresponsive Widgets on Android · 1. Launch the App · 2. Restart Your Device · 3. Remove and Re-Add...
Read more >
Fix: Android App Widgets Not Appearing - Technipages
Fix 1 · Open the “Settings” app. · Select “Apps“. On many Samsung devices, you would select “Applications” > “Application manager“. · Select...
Read more >
What Are the Issues with Android App Widgets and ... - Medium
The most common reason for a widget to disappear is when Android users transfer applications to a memory card. Widgets may also disappear...
Read more >
Top 8 Ways to Fix Widgets Not Updating on Android
Top 8 Ways to Fix Widgets Not Updating on Android · 1. Check Internet Connectivity · 2. Restart Your Device · 3. Remove...
Read more >
"Add widget" option not appearing on home screen
On Android Go the default launcher has no widget support. This is the reason this option is missing. I am not sure if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found