Search code examples
androidcolor-depth

How to determine screen color depth in android


I'm trying open and read '/dev/graphics/fb0' to determine screen color depth, but it returns error Permission denied.

Do you have any idea how to determine color depth of device?


Solution

  • Since the fb0 is a buffer file, it is an always-changing file, you should copy it to a certain ACCESSIBLE destination then read it with FileInputStream,

    Like:

    ("cat /dev/graphics/fb0 > /dev/myRawFrame.raw");
    
    File CurrentRawFile = new File("/dev/myRawFrame.raw");
    

    Determine screen color depth in android