In hardware testing i want to display colours like red, green, blue etc.., on the android screen i.e., Amoled display. Can you help to do this through commands and how the invoke the android display feature in android shell.

(full screen should display colour).

Is there android tools to do it or any other procedure.

Android version : lollipop

  • 1
    What commands do you have in mind? Via a terminal app / adb shell (as the bash tag suggests – though it's not clear whether the device in question is equipped with a Bash interpreter), via some other app, or are you looking for development sources? – Izzy Feb 16 '16 at 10:19
  • I mean that through adb commands – G murali Madhav Feb 16 '16 at 10:21
  • Might be a case for SuperUser then: How can I change the colors of my xterm using Ansi escape sequences? explains about the necessary ANSI sequences. – Izzy Feb 16 '16 at 10:24
  • 1
    @Izzy But that just changes the colours displayed at the command line: if you do it in an adb shell, the only change will be on the computer you're running adb from. – Dan Hulme Feb 16 '16 at 11:24
  • @DanHulme Ooops – right, I still was thinking "terminal app", sorry. – Izzy Feb 16 '16 at 12:35

You can achieve this by writing to the framebuffer directly using dd There's no standard procedure or tool, because the details of what you need to write depend on the framebuffer format in your platform; i.e. it's different for every model of device.

dd if=/dev/urandom of=/dev/graphics/fb0

will get you a random colour in every pixel of your framebuffer. (If the framebuffer isn't at /dev/graphics/fb0 on your device, you'll need to change the command accordingly.) To get a solid colour of your choice or a pattern, you'll need to find out what the framebuffer format is and think about it a bit.

An alternative way to do it is to set up the framebuffer with another application (e.g. a normal Android app that displays a full-screen colour), and then save the framebuffer to a file. This post explains the details of how to do it. The post is written for desktop Linux machines, but it works exactly the same way in Android, which uses the Linux kernel.

| improve this answer | |
  • dd if=/dev/urandom of=/dev/graphics/fb0 I tried this but it showing that 'No such device' – G murali Madhav Feb 17 '16 at 5:30
  • 1
    As I said, "If the framebuffer isn't at /dev/graphics/fb0 on your device, you'll need to change the command accordingly." I don't know exactly where it will be on your device, so you'll have to investigate for yourself a little. – Dan Hulme Feb 17 '16 at 9:27
  • The framebuffer is at /dev/graphics/fb0, but i didn't know how to display colour. – G murali Madhav Feb 17 '16 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.