Skip to content
This repository has been archived by the owner on Apr 17, 2021. It is now read-only.

Move to new version of Activity.onCreateView #1247

Closed
mcomella opened this issue Oct 3, 2018 · 13 comments
Closed

Move to new version of Activity.onCreateView #1247

mcomella opened this issue Oct 3, 2018 · 13 comments
Labels
chore Task to improve tooling, do something not product/user facing help wanted P3 Low impact and frequency

Comments

@mcomella
Copy link
Contributor

mcomella commented Oct 3, 2018

i.e. https://developer.android.com/reference/android/app/Activity.html#onCreateView(android.view.View,%20java.lang.String,%20android.content.Context,%20android.util.AttributeSet)

The old implementation caused obscure crash bugs on fennec (see bugs duped to this) so we should move to the new one.

@devinreams devinreams added help wanted P3 Low impact and frequency chore Task to improve tooling, do something not product/user facing and removed good first issue labels Mar 6, 2019
@unicorn-io
Copy link
Contributor

I'll try my best to solve this!

@mcomella
Copy link
Contributor Author

@unicorn-io Sorry I missed you on IRC! The code is in MainActivity: https://searchfox.org/mozilla-mobile/rev/5a56c1a6fc20f4eae318d378e717244a7e136824/firefox-tv/app/src/main/java/org/mozilla/tv/firefox/MainActivity.kt#206

For future reference, you should be able to find it with plain text search in Android Studio, on the command line, GitHub code search, etc.

@unicorn-io
Copy link
Contributor

I have moved the version am I supposed to apply for pull request?

@mcomella
Copy link
Contributor Author

@unicorn-io Yes, please open a pull request and (if GitHub lets you) flag me for review!

@unicorn-io
Copy link
Contributor

unicorn-io commented May 20, 2019

@mcomella i have flagged you for review

unicorn-io added a commit to unicorn-io/firefox-tv that referenced this issue May 21, 2019
…eView

The old implementation caused obscure bugs. Now we have moved to the Latest version of Activity.onCreateView giving better compatibility
unicorn-io added a commit to unicorn-io/firefox-tv that referenced this issue May 21, 2019
…eView

The old implementation caused obscure bugs. Now we have moved to the Latest version of Activity.onCreateView giving better compatibility by adding a new argument in the argument list. Google specifies that the argument may be null
unicorn-io added a commit to unicorn-io/firefox-tv that referenced this issue May 21, 2019
…eView

The old implementation caused obscure bugs. Now we have moved to the Latest version of Activity.onCreateView giving better compatibility, as the latest version required new argument in the argument list. Google specifies that the argument may be null.
@unicorn-io
Copy link
Contributor

unicorn-io commented May 22, 2019

@mcomella please review the changes

mcomella pushed a commit that referenced this issue May 22, 2019
The old implementation caused obscure bugs. Now we have moved to the Latest version of Activity.onCreateView giving better compatibility, as the latest version required new argument in the argument list. Google specifies that the argument may be null.
@mcomella
Copy link
Contributor Author

Closed by #2295.

@mcomella mcomella added this to the 2019 Q2 Sprint 4 milestone May 22, 2019
severinrudie added a commit to severinrudie/firefox-tv that referenced this issue May 22, 2019
….onCreateView"

This reverts commit 7789714.

This caused a crash upon startup.  We will work out why after fixing master
severinrudie added a commit that referenced this issue May 22, 2019
This reverts commit 7789714.

This caused a crash upon startup.  We will work out why after fixing master
@mcomella
Copy link
Contributor Author

This created a start-up crash on master and was backed out in bdc868d

@mcomella mcomella reopened this May 24, 2019
@severinrudie
Copy link
Contributor

I believe the issue is that the platform type was described as nonnull, while the activity will pass a null parent on startup. I haven't verified, though.

@mcomella
Copy link
Contributor Author

With the backed out PR, I get the following stack trace:

Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter parent
        at org.mozilla.tv.firefox.MainActivity.onCreateView(Unknown Source:33)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1901)
        at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2579)
        at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2652)
        at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2066)
        at org.mozilla.tv.firefox.MainActivity.onCreate(MainActivity.kt:67)

@unicorn-io We get a crash on startup and had to back out your changes: did you see this locally when you wrote the patch? Can you try to fix the issue and open a new PR?

@unicorn-io
Copy link
Contributor

I will try to fix it.

@unicorn-io
Copy link
Contributor

I believe the issue is that the platform type was described as nonnull, while the activity will pass a null parent on startup. I haven't verified, though.

this seems to be the issue as per my checks

unicorn-io added a commit to unicorn-io/firefox-tv that referenced this issue May 30, 2019
…eView

The old implementation caused obscure bugs. Now we have moved to the Latest version of Activity.onCreateView giving better compatibility, as the latest version required new argument in the argument list. Google specifies that the argument may be null.
unicorn-io added a commit to unicorn-io/firefox-tv that referenced this issue May 30, 2019
…teView

The old implementation caused obscure bugs. Now we have moved to the latest version of Activity.onCreateView giving better compatibility. The new parameter was specified nullable as google specifies that the argument may be null.
mcomella pushed a commit that referenced this issue May 30, 2019
The old implementation caused obscure bugs. Now we have moved to the latest version of Activity.onCreateView giving better compatibility. The new parameter was specified nullable as google specifies that the argument may be null.
@mcomella
Copy link
Contributor Author

mcomella commented Jun 3, 2019

Merged in #2356

@mcomella mcomella closed this as completed Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
chore Task to improve tooling, do something not product/user facing help wanted P3 Low impact and frequency
Projects
None yet
Development

No branches or pull requests

4 participants