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

Endless loop when clicking on "Cancel" with certain activity themes #44

Open
rfc2822 opened this issue Dec 16, 2015 · 5 comments
Open

Comments

@rfc2822
Copy link
Contributor

rfc2822 commented Dec 16, 2015

Hello,

I'm trying to use MemorizingTrustManager with HttpsUrlConnection (setSSLSocketFactory, setHostnameVerifier). It's a quite simple setup so I don't think I've done anything wrong; it' works quite well, but there is one problem:

When clicking on "Cancel" (= the certificate shall not be used), the HttpsUrlConnection (I think it's the getInputStream() method) takes forever and according to adb, there's an endless loop + a memory leak, too.

Have you ever heard of such issues with HttpsUrlConnection and "Cancel", or do you know a working example of HttpsUrlConnection + MTM?

Thanks for your work.

@ge0rg
Copy link
Owner

ge0rg commented Dec 16, 2015

Hi, the default example in the repository's example directory is using HttpsURLConnection, and there are no known issues with the "Cancel" button. I just verified that on Android6. Can you provide more information or maybe a stack trace?

@rfc2822
Copy link
Contributor Author

rfc2822 commented Dec 16, 2015

Thanks for testing this. The problem is that it doesn't crash… I'll try to find out how to get a stack trace or maybe profiling information to see what's actually going on.

@rfc2822
Copy link
Contributor Author

rfc2822 commented Dec 16, 2015

Funny, it's related to the android:theme of MemorizingActivity. With android:theme="@android:style/Theme.Translucent.NoTitleBar", it works as expected, but with android:theme="@style/Theme.AppCompat.Light.NoActionBar" (which I have used before; it's a support library theme) there's an UI endless loop (maybe only on Samsung, as I have seen com.samsung.* classes in the profiling results).

Do you have any hints which themes are acceptable / how the support library's Material theme can be used?

@rfc2822 rfc2822 changed the title HttpsUrlConnection: endless loop when clicking on "Cancel" Endless loop when clicking on "Cancel" with certain activity themes Dec 16, 2015
@rfc2822
Copy link
Contributor Author

rfc2822 commented Dec 16, 2015

From various tested themes, only @android:style/Theme.Translucent.NoTitleBar and @style/Theme.AppCompat.Light.Dialog seem to work, while the endless loop occurs for all others… very strange, but I guess this is not related to MTM.

Maybe it would be good to mention which themes are usable (and even better, why) in the documentation.

@ge0rg
Copy link
Owner

ge0rg commented Dec 16, 2015

To be honest, I wasn't even aware that this is a problem, and I have no idea what the cause is.

I had the hope to bring #29 into a shape that would allow completely removing the MTM activity, but there was no progress in a looong time. I will keep this issue open for now, for documentation reasons, and make a statement in the README someday ;-)

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

No branches or pull requests

2 participants