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

[TIMOB-25382] Android: Fix Wrong thread error in DrawerLayout when not running on main thread #9516

Merged
merged 6 commits into from Nov 13, 2017

Conversation

gaspardle
Copy link
Contributor

@gaspardle gaspardle commented Oct 10, 2017

JIRA: https://jira.appcelerator.org/browse/TIMOB-25382

Optional Description:
It makes sure that action on the menu are run on the UI thread.

@hansemannn hansemannn changed the title [AC-5196] Wrong thread error in DrawerLayout when not running on main thread [TIMOB-25382] Android: Fix Wrong thread error in DrawerLayout when not running on main thread Oct 10, 2017
Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

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

CR: PASS

@tidev tidev deleted a comment from build Oct 12, 2017
@build
Copy link
Contributor

build commented Oct 12, 2017

Fails
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

Messages
📖

🎉 Another contribution from our awesome community member, gaspardle! Thanks again for helping us make Titanium SDK better. 👍

Generated by 🚫 dangerJS

@hansemannn hansemannn added this to the 7.0.0 milestone Oct 17, 2017
@Kroll.constant public static final int LOCK_MODE_UNLOCKED = DrawerLayout.LOCK_MODE_UNLOCKED;
@Kroll.constant public static final int LOCK_MODE_UNDEFINED = DrawerLayout.LOCK_MODE_UNDEFINED;

private static final int MSG_FIRST_ID = KrollProxy.MSG_LAST_ID + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a potential future bug here. The MSG_FIRST_ID constant should be using TiViewProxy.MSG_LAST_ID and not KrollProxy.MSG_LAST_ID in order to avoid ID collision.

private static final int MSG_FIRST_ID = TiViewProxy.MSG_LAST_ID + 1;

@garymathews
Copy link
Contributor

@jquick-axway Updated PR

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

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

CR: Pass

@lokeshchdhry
Copy link
Contributor

FR Passed.

With run-on-main-thread set to false no CalledFromWrongThreadException is thrown.

Studio Ver: 4.10.0.201709271713
SDK Ver: 7.0.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.10
Appc CLI: 6.3.0
Ti CLI Ver: 5.0.14
Alloy Ver: 1.10.7
Node Ver: 7.10.1
Java Ver: 1.8.0_101
Devices: ⇨ google Nexus 5 --- Android 6.0.1
⇨ google Nexus 6P --- Android 8.0.0

@lokeshchdhry
Copy link
Contributor

lokeshchdhry commented Nov 11, 2017

@sgtcoolguy , Please merge as this is a community PR.

@TylerZubke
Copy link

I'm still seeing a similar error in 7.0.2. It doesn't happen often, but when it does I think it's failing when calling setDisplayHomeAsUp.

Here's the call stack:

[WARN] W/System.err: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
[WARN] W/System.err: at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6829)
[WARN] W/System.err: at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:975)
[WARN] W/System.err: at android.view.ViewGroup.invalidateChild(ViewGroup.java:5126)
[WARN] W/System.err: at android.view.View.invalidateInternal(View.java:12788)
[WARN] W/System.err: at android.view.View.invalidate(View.java:12752)
[WARN] W/System.err: at android.view.View.invalidate(View.java:12736)
[WARN] W/System.err: at android.widget.ImageView.invalidateDrawable(ImageView.java:248)
[WARN] W/System.err: at android.graphics.drawable.Drawable.invalidateSelf(Drawable.java:385)
[WARN] W/System.err: at android.graphics.drawable.Drawable.setVisible(Drawable.java:764)
[WARN] W/System.err: at android.widget.ImageView.onDetachedFromWindow(ImageView.java:1494)
[WARN] W/System.err: at android.view.View.dispatchDetachedFromWindow(View.java:14637)
[WARN] W/System.err: at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4648)
[WARN] W/System.err: at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4621)
[WARN] W/System.err: at android.view.ViewGroup.removeView(ViewGroup.java:4552)
[WARN] W/System.err: at android.support.v7.widget.Toolbar.setNavigationIcon(Toolbar.java:962)
[WARN] W/System.err: at android.support.v7.widget.ToolbarWidgetWrapper.updateNavigationIcon(ToolbarWidgetWrapper.java:613)
[WARN] W/System.err: at android.support.v7.widget.ToolbarWidgetWrapper.setDisplayOptions(ToolbarWidgetWrapper.java:392)
[WARN] W/System.err: at android.support.v7.app.ToolbarActionBar.setDisplayOptions(ToolbarActionBar.java:260)
[WARN] W/System.err: at android.support.v7.app.ToolbarActionBar.setDisplayOptions(ToolbarActionBar.java:254)
[WARN] W/System.err: at org.appcelerator.titanium.proxy.ActionBarProxy.(ActionBarProxy.java:60)
[WARN] W/System.err: at org.appcelerator.titanium.proxy.ActivityProxy.getActionBar(ActivityProxy.java:258)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[WARN] W/System.err: at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:936)
[WARN] W/System.err: at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1159)
[WARN] W/System.err: at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:363)
[WARN] W/System.err: at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:116)
[WARN] W/System.err: at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:468)
[WARN] W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] W/System.err: at android.os.Looper.loop(Looper.java:148)
[WARN] W/System.err: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)

Any ideas?

@guiled
Copy link

guiled commented May 2, 2018

The bug still occurs with 7.1 and is very blocking for the users when it happens.

@guiled
Copy link

guiled commented May 31, 2018

Any news about it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants