Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

Draft: Fixes crash when trying to access weather widget on stock roms

Description

Hi, I installed Blisslauncher on my stock pixel 3a device and it was crashing whenever I tried to access the weather widget due to the weather service from LineageOS being required. This happens also on the stock emulator.

Here follows the stacktrace I was getting:

2020-11-20 11:08:10.923 7468-7468/foundation.e.blisslauncher.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: foundation.e.blisslauncher.debug, PID: 7468
    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=cyanogenmod.intent.action.MANAGE_WEATHER_PROVIDER_SERVICES }
        at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2051)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1709)
        at android.app.Activity.startActivityForResult(Activity.java:5192)
        at android.app.Activity.startActivityForResult(Activity.java:5150)
        at android.app.Activity.startActivity(Activity.java:5521)
        at android.app.Activity.startActivity(Activity.java:5489)
        at android.preference.Preference.performClick(Preference.java:1181)
        at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:260)
        at android.widget.AdapterView.performItemClick(AdapterView.java:330)
        at android.widget.AbsListView.performItemClick(AbsListView.java:1190)
        at android.widget.AbsListView$PerformClick.run(AbsListView.java:3198)
        at android.widget.AbsListView.onTouchUp(AbsListView.java:4128)
        at android.widget.AbsListView.onTouchEvent(AbsListView.java:3886)
        at android.view.View.dispatchTouchEvent(View.java:13415)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3054)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2741)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3060)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2755)
        at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:465)
        at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1849)
        at android.app.Activity.dispatchTouchEvent(Activity.java:3993)
        at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:423)
        at android.view.View.dispatchPointerEvent(View.java:13674)
        at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5482)
        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5285)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4788)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4841)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4807)
        at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4947)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4815)
        at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5004)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4788)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4841)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4807)
        at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4815)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4788)
        at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7505)
        at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7474)
        at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7435)
        at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7630)
        at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188)
2020-11-20 11:08:10.923 7468-7468/foundation.e.blisslauncher.debug E/AndroidRuntime:     at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:336)
        at android.os.Looper.loop(Looper.java:174)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

With this patch, the weather widget is not listed anymore whenever the required service is not installed. I know this is probably a poor way of handling it guys, but I don't think I should add another kind of weather provider that maybe collects data and doesn't respect privacy. The user could always install a third-party weather widget and at least the user won't be forced to have a fixed widget there that doesn't start. Please let me know what you guys think and how I could improve it in case.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

How has this been tested?

I installed the branch with my patches on both the emulator and my phone and saw that the widget wasn't listed anymore.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Notes:

  • Do I have to update any documentation? If yes, can you point me to it?
  • I think I did not change the codestyle and just left whatever AS had as default, but in case you have a .xml for the codestyle I'll be happy to apply it!
  • I could not find any Unit tests on the project. am I missing something or is it ok like this?
  • Shall I point this towards the development branch instead of master?

Hope I didn't forget anything, thanks a lot in advance for the patience! 🙏

Edited by Giovanni

Merge request reports

Loading