Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Wallpaper in background #5665

Merged

Conversation

shashankiitbhu
Copy link
Contributor

@shashankiitbhu shashankiitbhu commented Mar 27, 2024

Description (required)

Fixes #5556

What changes did you make and why?

Set Wallpaper is now a background task with a worker.

Tests performed (required)

Tested ProdDebug on Xiaomi 11 Lite NE with API level 33

WhatsApp.Video.2024-03-27.at.9.30.15.PM.mp4

@nicolas-raoul
Copy link
Member

I am consistantly getting this crash, would you know why?

screen-20240329-202800.mp4
APP_VERSION_NAME=4.2.1-debug-kanahia1-issue953
ANDROID_VERSION=14
PHONE_MODEL=Pixel 7 Pro
STACK_TRACE=java.lang.RuntimeException: Unable to start activity ComponentInfo{fr.free.nrw.commons/fr.free.nrw.commons.contributions.MainActivity}: java.lang.NullPointerException: Attempt to read from field 'androidx.viewpager.widget.ViewPager fr.free.nrw.commons.databinding.FragmentMediaDetailPagerBinding.mediaDetailsPager' on a null object reference in method 'void fr.free.nrw.commons.media.MediaDetailPagerFragment.onCreate(android.os.Bundle)'
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3946)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4126)
at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6165)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6056)
at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:77)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:60)
at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:195)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:157)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:90)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2544)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8501)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
Caused by: java.lang.NullPointerException: Attempt to read from field 'androidx.viewpager.widget.ViewPager fr.free.nrw.commons.databinding.FragmentMediaDetailPagerBinding.mediaDetailsPager' on a null object reference in method 'void fr.free.nrw.commons.media.MediaDetailPagerFragment.onCreate(android.os.Bundle)'
at fr.free.nrw.commons.media.MediaDetailPagerFragment.onCreate(MediaDetailPagerFragment.java:167)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2949)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:475)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
at androidx.fragment.app.FragmentManager.dispatchCreate(FragmentManager.java:3061)
at androidx.fragment.app.Fragment.restoreChildFragmentState(Fragment.java:1891)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:479)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:278)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
at androidx.fragment.app.FragmentManager.dispatchCreate(FragmentManager.java:3061)
at androidx.fragment.app.FragmentController.dispatchCreate(FragmentController.java:240)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:276)
at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:106)
at fr.free.nrw.commons.di.CommonsDaggerAppCompatActivity.onCreate(CommonsDaggerAppCompatActivity.java:24)
at fr.free.nrw.commons.theme.BaseActivity.onCreate(BaseActivity.java:28)
at fr.free.nrw.commons.contributions.MainActivity.onCreate(MainActivity.java:119)
at android.app.Activity.performCreate(Activity.java:8767)
at android.app.Activity.performCreate(Activity.java:8745)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1519)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3928)
... 16 more

@shashankiitbhu
Copy link
Contributor Author

shashankiitbhu commented Mar 29, 2024

APP_VERSION_NAME=4.2.1-debug-kanahia1-issue953

@nicolas-raoul you are checking wrong branch it seems

@nicolas-raoul
Copy link
Member

You're right, very sorry about this and thanks for pointing out!

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more crash, thanks!
Very minor thing: When setting the wallpaper, I am kicked out of the media details activity. Is this intended?

@nicolas-raoul nicolas-raoul merged commit 4c687b4 into commons-app:main Mar 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Set Wallpaper Not Working Correctly
3 participants