android / android/media-samples

java.lang.NullPointerException: after deploying Picture in Picture sample on devices

Open
#87 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
1.4k
Forks
781
PR merge metrics
No merged PRs in 30d

Description

##### Steps
1) Open Picture in Picture sample In Electric Eel Patch 2 build or Flamingo RC builds
2) Update gradle and AGP versions
3) Try to deploy on the device (I used API 30 Pixel 3 XL)

##### Actual :
I see below exception in Logcat after deployment
```
023-03-23 12:13:40.932 28748-28748 AndroidRuntime com...mple.android.pictureinpicture E FATAL EXCEPTION: main
Process: com.example.android.pictureinpicture, PID: 28748
java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.core.view.WindowInsetsControllerCompat.show(int)' on a null object reference
at com.example.android.pictureinpicture.MainActivity.adjustFullScreen(MainActivity.java:313)
at com.example.android.pictureinpicture.MainActivity.onWindowFocusChanged(MainActivity.java:241)
at androidx.appcompat.view.WindowCallbackWrapper.onWindowFocusChanged(WindowCallbackWrapper.java:124)
at com.android.internal.policy.DecorView.onWindowFocusChanged(DecorView.java:1692)
at android.view.View.dispatchWindowFocusChanged(View.java:13703)
at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1480)
at android.view.ViewRootImpl.handleWindowFocusChanged(ViewRootImpl.java:2870)
at android.view.ViewRootImpl.access$1100(ViewRootImpl.java:142)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4533)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
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)
2023-03-23 12:13:40.949 28748-28748 Process com...mple.android.pictureinpicture I Sending signal. PID: 28748 SIG: 9
2023-03-23 12:13:40.961 1388-1703 InputDispatcher system_process E channel '264e43a com.example.android.pictureinpicture/com.example.android.pictureinpicture.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

Contributor guide

Open the contributing guide

Research direction

Start in MainActivity.java at adjustFullScreen (line 313) and trace its call from onWindowFocusChanged (line 241). Reproduce the Picture in Picture sample on an API 30 Pixel 3 XL after updating Gradle and AGP, then verify deployment no longer produces the reported NullPointerException in Logcat.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.