Skip to content

Simplify native-activity, remove now duplicate native-plasma.#1140

Merged
DanAlbert merged 4 commits intoandroid:mainfrom
DanAlbert:remove-native-plasma
Sep 17, 2025
Merged

Simplify native-activity, remove now duplicate native-plasma.#1140
DanAlbert merged 4 commits intoandroid:mainfrom
DanAlbert:remove-native-plasma

Conversation

@DanAlbert
Copy link
Copy Markdown

We don't need OpenGL just to do a color fill. Save that for the OpenGL samples. Replace that with a trivial AHardwareBuffer based color fill.

I've altered the old animation which didn't really work the way I think it was intended to. It looks like someone had intended for the accelerometer to alter the color, but it actually only animated between black and bright green. I've removed the sensor code as superfluous anyway, so just do something simpler: switch from red, to green, to blue every second. I kept some amount of animation rather than just clearing a solid color because if we only draw once and have no update cycle then choreographer and most of the event handling code also becomes useless, and without that the sample no longer bears any resemblance to a real app.

Fixes #1139.

Comment thread native-activity/app/src/main/cpp/main.cpp
Comment thread native-activity/app/src/main/cpp/main.cpp Outdated
Copy link
Copy Markdown
Collaborator

@enh-google enh-google left a comment

Choose a reason for hiding this comment

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

signs you programmed old computers include looking at a manual fill of a whole screen's worth of pixels done as a nested for loop and think "surely that's too slow?!".

@DanAlbert DanAlbert enabled auto-merge (rebase) September 17, 2025 20:31
Dan Albert added 4 commits September 17, 2025 13:32
We already have a separate sensor-graph sample. There's no need to
complicate this NativeActivity hello world with accelerometer logspam.

android#1139
We don't need OpenGL just to do a color fill. Save that for the OpenGL
samples. Replace that with a trivial AHardwareBuffer based color fill.

I've altered the old animation which didn't really work the way I think
it was intended to. It looks like someone had intended for the
accelerometer to alter the color, but it actually only animated between
black and bright green. I've removed the sensor code as superfluous
anyway, so just do something simpler: switch from red, to green, to blue
every second. I kept some amount of animation rather than just clearing
a solid color because if we only draw once and have no update cycle then
choreographer and most of the event handling code also becomes useless,
and without that the sample no longer bears any resemblance to a real
app.

android#1139
This is just native-activity with extra steps.

Fixes android#1139.
@DanAlbert DanAlbert merged commit c2c70d4 into android:main Sep 17, 2025
2 checks passed
@DanAlbert DanAlbert deleted the remove-native-plasma branch September 17, 2025 20:51
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

Successfully merging this pull request may close these issues.

Merge native-activity and native-plasma

2 participants