OpenLauncherTeam / openlauncher

Customizable and Open Source Launcher for Android
Apache License 2.0
1.41k stars 413 forks source link

fix `api 30+` error on `_recreateAfterGettingApps=true` #629

Closed niektuytel closed 3 years ago

niektuytel commented 3 years ago

        at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5111)
        at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5140)
        at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5432)
        at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5362)
        at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:58)
        at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5415)
        at android.app.ActivityThread.access$3300(ActivityThread.java:237)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2076)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.NullPointerException: Attempt to read from field 'com.android.server.appwidget.AppWidgetServiceImpl$ProviderId ```

reproduce run app on android `api 30+` and open hide apps in the settings, than click on the back arrow >> error
the thing is when you recreate the Activity he will crash on his `onDestroy()` so that is why I change it to `onContentChanged()` on line 239

kind regards Niek Tuytel (Okido)

<!-- 

Hello, and thanks for contributing!

Please always auto-reformat code before creating a pull request. In Android Studio, right click the java file and select reformat, then check the first two options. After creating the request, please wait patiently until somebody from the team has time to review the changes.

## Contributors
Feel free to add yourself to the list of contributors! When adding your information to the `CONTRIBUTORS.md` file, please use the following format.

Schema:  **[Name](Reference)**<br/>~° Text

Where:
  * Name: username, full name
  * Reference: email, website
  * Text: information about your contribution

Example:
* **[Nice Guy](http://niceguy.web)**<br/>~° German localization

-->