openid / AppAuth-Android

Android client SDK for communicating with OAuth 2.0 and OpenID Connect providers.
https://openid.github.io/AppAuth-Android
Apache License 2.0
2.82k stars 881 forks source link

Crash on API 26: Only fullscreen activities can request orientation #352

Open Jacobjepsen27 opened 6 years ago

Jacobjepsen27 commented 6 years ago

When starting the AuthorizationManagementActivity i get the follow error message:

java.lang.IllegalStateException: Only fullscreen activities can request orientation at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2946) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046) at android.app.ActivityThread.-wrap11(Unknown Source) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6798) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Target and Compile SDK version is 27.

iainmcgin commented 6 years ago

Are you recompiling the library, or using a released version? If so, which?

We don't define any complex properties for that activity, just android:theme="@android:style/Theme.Translucent.NoTitleBar". I'll take a look and see if that is now deprecated as of API 27 or something.

Jacobjepsen27 commented 6 years ago

I am using your released version, 0.7.0, from bintray.

KumarSonal commented 6 years ago

We are getting same issue as well. Adding complete stacktrace below:

Caused by java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation at android.app.Activity.onCreate(Activity.java:1038) at net.openid.appauth.AuthorizationManagementActivity.onCreate(SourceFile:199) at android.app.Activity.performCreate(Activity.java:7174) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2908) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030) at android.app.ActivityThread.-wrap11(Unknown Source) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Jacobjepsen27 commented 6 years ago

I managed to find a fix but i don't like it.

I have some activities where i'd like to set the screen orientation to portrait. To prevent hardcoding this to each activity in my application (or in the manifest), i registered ActivityLifecycleCallbacks in my Application class to be able to dynamically set the screen orientation. Apparently, this was the issue but only for API 26.

If i hardcode the portrait screen orientation to my activity everything is fine.

zsoltboldizsar commented 6 years ago

We might need to live with it: https://issuetracker.google.com/issues/68454482

iainmcgin commented 6 years ago

Hmm, disappointing thread from Google. It may be possible to provide an alternate theme for API 26 that avoids the issue. If anyone has bandwidth to investigate whether that would work I would appreciate it, my time is limited right now.