Android O: AConfiguration_getOrientation() no longer works in APP_CMD_CONFIG_CHANGED

349 views
Skip to first unread message

Andreas Falkenhahn

unread,
Sep 20, 2017, 11:42:09 AM9/20/17
to andro...@googlegroups.com
I've recently updated my Nexus 5X to Android O and it seems that
AConfiguration_getOrientation() no longer returns the new device
orientation after receiving APP_CMD_CONFIG_CHANGED. I'm doing
something like the following:

case APP_CMD_CONFIG_CHANGED:
__android_log_print(ANDROID_LOG_INFO, "LogTag", "New orientation: %d", AConfiguration_getOrientation(app->config));

However, this never prints the new orientation but always the
orientation that was current when my app was started, i.e.
if the app was started in portrait mode, it will always
return ACONFIGURATION_ORIENTATION_PORT. If the app was started
in landscape mode, it will always return ACONFIGURATION_ORIENTATION_LAND.

On all previous Android versions it works correctly. Only on
Android O it doesn't work any more. What could be the reason
for this?

--
Best regards,
Andreas Falkenhahn mailto:and...@falkenhahn.com

Dan Albert

unread,
Sep 20, 2017, 3:24:04 PM9/20/17
to android-ndk
File a bug?

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/10710607250.20170920165501%40falkenhahn.com.
For more options, visit https://groups.google.com/d/optout.

Andreas Falkenhahn

unread,
Sep 20, 2017, 6:37:34 PM9/20/17
to andro...@googlegroups.com
Okay, filed an issue:
https://issuetracker.google.com/issues/66196606

But it seems hard to imagine that this should be really broken in
Android O because I think it's one of the essential APIs in the Android
NDK and if it were really broken in Android O other people would have
complained as well.

So if there is anyone for whom AConfiguration_getOrientation() is
still working after APP_CMD_CONFIG_CHANGED on Android O please step
forward and let me know.

Until then, I'll consider it broken for the moment.

On 20.09.2017 at 21:23 'Dan Albert' via android-ndk wrote:

> File a bug?

> On Sep 20, 2017 08:42, "Andreas Falkenhahn" <and...@falkenhahn.com> wrote:

> I've recently updated my Nexus 5X to Android O and it seems that
> AConfiguration_getOrientation() no longer returns the new device
> orientation after receiving APP_CMD_CONFIG_CHANGED. I'm doing
> something like the following:
>
> case APP_CMD_CONFIG_CHANGED:
> __android_log_print(ANDROID_LOG_INFO, "LogTag", "New
> orientation: %d", AConfiguration_getOrientation(app->config));
>
> However, this never prints the new orientation but always the
> orientation that was current when my app was started, i.e.
> if the app was started in portrait mode, it will always
> return ACONFIGURATION_ORIENTATION_PORT. If the app was started
> in landscape mode, it will always return ACONFIGURATION_ORIENTATION_LAND.
>
> On all previous Android versions it works correctly. Only on
> Android O it doesn't work any more. What could be the reason
> for this?
>
> --
> Best regards,
> Andreas Falkenhahn mailto:and...@falkenhahn.com
>
> --
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to android-ndk...@googlegroups.com.
> To post to this group, send email to andro...@googlegroups.com.
> Visit this group at https://groups.google.com/group/android-ndk.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-ndk/10710607250.20170920165501%40falkenhahn.com.
> For more options, visit https://groups.google.com/d/optout.
>


Andreas Falkenhahn

unread,
Dec 8, 2017, 3:57:29 PM12/8/17
to andro...@googlegroups.com
By the way, could someone enlighten me concerning the comments for this issue on the bugtracker? On Sept 20th I filed an issue about this bug here: https://issuetracker.google.com/issues/66196606

The comments so far were:
1) kkam: can you move this to the frameworks componenet?
2) Hi Dave, please triage for Framework team. Thx, Kathy
3) I really want to join your team
4) unassigning to get picked up by the triage queue

So what does this discussion tell me? Has this bug been accepted and will there be a fix for it? I'm a little worried because people are unassigning from the issue but then I don't know what a triage queue is...

On 20.09.2017 at 21:23 'Dan Albert' via android-ndk wrote:

> File a bug?

> On Sep 20, 2017 08:42, "Andreas Falkenhahn" <and...@falkenhahn.com> wrote:

> I've recently updated my Nexus 5X to Android O and it seems that
> AConfiguration_getOrientation() no longer returns the new device
> orientation after receiving APP_CMD_CONFIG_CHANGED. I'm doing
> something like the following:
>
> case APP_CMD_CONFIG_CHANGED:
> __android_log_print(ANDROID_LOG_INFO, "LogTag", "New
> orientation: %d", AConfiguration_getOrientation(app->config));
>
> However, this never prints the new orientation but always the
> orientation that was current when my app was started, i.e.
> if the app was started in portrait mode, it will always
> return ACONFIGURATION_ORIENTATION_PORT. If the app was started
> in landscape mode, it will always return ACONFIGURATION_ORIENTATION_LAND.
>
> On all previous Android versions it works correctly. Only on
> Android O it doesn't work any more. What could be the reason
> for this?
>
> --
> Best regards,
> Andreas Falkenhahn mailto:and...@falkenhahn.com
>
> --
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to android-ndk...@googlegroups.com.
> To post to this group, send email to andro...@googlegroups.com.
> Visit this group at https://groups.google.com/group/android-ndk.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-ndk/10710607250.20170920165501%40falkenhahn.com.
> For more options, visit https://groups.google.com/d/optout.
>


Dan Albert

unread,
Dec 8, 2017, 4:00:42 PM12/8/17
to android-ndk
Unassigned bugs are supposed to show up in a triage queue, but I guess that didn't happen. I'll follow up on it and see what happened.


>  To post to this group, send email to andro...@googlegroups.com.
>  Visit this group at https://groups.google.com/group/android-ndk.
>  To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-ndk/10710607250.20170920165501%40falkenhahn.com.
>  For more options, visit https://groups.google.com/d/optout.
>


--
Best regards,
 Andreas Falkenhahn                            mailto:and...@falkenhahn.com

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.

Andreas Falkenhahn

unread,
Dec 12, 2017, 11:05:06 AM12/12/17
to 'Dan Albert' via android-ndk
On 08.12.2017 at 22:00 'Dan Albert' via android-ndk wrote:

> Unassigned bugs are supposed to show up in a triage queue, but I
> guess that didn't happen. I'll follow up on it and see what happened.

So any news on this? I'd really like to know if there will be a fix for this or not because it's really critical for my app.

Dan Albert

unread,
Dec 14, 2017, 3:32:45 PM12/14/17
to android-ndk
Sorry again for the delay. Triage snafu meant your bug ended up way at the bottom of the list for some reason. I added some people myself a couple days ago and that got it into the right hands it seems.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.

Andreas Falkenhahn

unread,
Jan 27, 2018, 11:15:21 AM1/27/18
to 'Dan Albert' via android-ndk
Any news on this? I've now implemented a workaround which calls into the
following Java code:

public int getCurrentOrientation() {
return getResources().getConfiguration().orientation;
}

This solves the issue for me but of course it would be much nicer
if AConfiguration_getOrientation() could be used instead...

On 14.12.2017 at 21:32 'Dan Albert' via android-ndk wrote:

> Sorry again for the delay. Triage snafu meant your bug ended up way
> at the bottom of the list for some reason. I added some people
> myself a couple days ago and that got it into the right hands it seems.

> On Dec 12, 2017 08:05, "Andreas Falkenhahn" <and...@falkenhahn.com> wrote:

> On 08.12.2017 at 22:00 'Dan Albert' via android-ndk wrote:
>
>> Unassigned bugs are supposed to show up in a triage queue, but I
>> guess that didn't happen. I'll follow up on it and see what happened.
>
> So any news on this? I'd really like to know if there will be a
> fix for this or not because it's really critical for my app.
>
> --
> Best regards,
> Andreas Falkenhahn mailto:and...@falkenhahn.com
>
> --
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to android-ndk...@googlegroups.com.
> To post to this group, send email to andro...@googlegroups.com.
> Visit this group at https://groups.google.com/group/android-ndk.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-ndk/1386596815.20171212170453%40falkenhahn.com.
> For more options, visit https://groups.google.com/d/optout.
>


Dan Albert

unread,
Jan 31, 2018, 2:43:21 PM1/31/18
to android-ndk
I've pinged the bug again. Unfortunately that's about the limit of my powers in that part of Android :(

On Sat, Jan 27, 2018 at 8:15 AM, Andreas Falkenhahn <and...@falkenhahn.com> wrote:
Any news on this? I've now implemented a workaround which calls into the
following Java code:

        public int getCurrentOrientation() {
                return getResources().getConfiguration().orientation;
        }

This solves the issue for me but of course it would be much nicer
if AConfiguration_getOrientation() could be used instead...

On 14.12.2017 at 21:32 'Dan Albert' via android-ndk wrote:

> Sorry again for the delay. Triage snafu meant your bug ended up way
> at the bottom of the list for some reason. I added some people
> myself a couple days ago and that got it into the right hands it seems.

> On Dec 12, 2017 08:05, "Andreas Falkenhahn" <and...@falkenhahn.com> wrote:

> On 08.12.2017 at 22:00 'Dan Albert' via android-ndk wrote:
>
 >> Unassigned bugs are supposed to show up in a triage queue, but I
 >> guess that didn't happen. I'll follow up on it and see what happened.
>
>  So any news on this? I'd really like to know if there will be a
> fix for this or not because it's really critical for my app.
>
>  --
>  Best regards,
>   Andreas Falkenhahn                            mailto:and...@falkenhahn.com
>
>  --
>  You received this message because you are subscribed to the Google Groups "android-ndk" group.
>  To unsubscribe from this group and stop receiving emails from it,

>  To post to this group, send email to andro...@googlegroups.com.
>  Visit this group at https://groups.google.com/group/android-ndk.
>  To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-ndk/1386596815.20171212170453%40falkenhahn.com.
>  For more options, visit https://groups.google.com/d/optout.
>


--
Best regards,
 Andreas Falkenhahn                            mailto:and...@falkenhahn.com

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.

Dan Albert

unread,
Jan 31, 2018, 2:46:54 PM1/31/18
to android-ndk
Bumped the priority back up too. Not sure why it was lowered.

Diego Medina

unread,
Jan 3, 2019, 3:17:33 PM1/3/19
to android-ndk
After all this time this is still an issue. It even happens when you override the callback pointer and use AConfiguration_fromAssetManager.

Andreas Falkenhahn

unread,
Jan 3, 2019, 4:33:23 PM1/3/19
to Diego Medina
Yep, I'm of the impression that nobody at Google really cares for NativeActivity any more. I have dropped it in my app some time ago and I'm now using AppCompatActivity which gives me much more power and less headaches than NativeActivity...
Reply all
Reply to author
Forward
0 new messages