Camera: Remap camera IDs by property if it is defined
Some legacy camera HALs defines a specific property that defines camera IDs mapping for particular cameras. Xiaomi camera HALs exports defines persist.vendor.camera.xiaomi.remapid that is a string property containing a string of space separated camera IDs. For example, on pyxis: pyxis:/ $ getprop persist.vendor.camera.xiaomi.remapid 0 1 21 20 62 60 63 61 91 90 100 101 This example defines mapping: 0->0, 1->1, 2->21, 3->20, ... Implement this ID remapping by getting a value of property named vendor.camera.remapid. If it is not defined or value of this property is empty the identity mapping of camera IDs is provided to preserve existing behavior. This functionality allows to get rid of camera provider blobs that are shipped by some devices. Only thing that is needed by a device maintainer is to either patch an elf blob that defines a real property name (in case of Xiaomi it is placed in com.qti.chi.override.so) or the maintainer can provide this property in vendor.prop statically. The following snipper I'm using for Pyxis: <code> 'vendor/lib/hw/com.qti.chi.override.so': blob_fixup() .binary_regex_replace( b'persist.vendor.camera.xiaomi.remapid', b'vendor.camera.remapid\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'), Tested using stock camera, Aperture and this dump: pyxis:/ $ dumpsys media.camera | head -20 == Service global info: == Number of camera devices: 12 Number of normal camera devices: 12 Number of public camera devices visible to API1: 12 Device 0 maps to "0" Device 1 maps to "1" Device 2 maps to "20" Device 3 maps to "21" Device 4 maps to "60" Device 5 maps to "61" Device 6 maps to "62" Device 7 maps to "63" Device 8 maps to "90" Device 9 maps to "91" Device 10 maps to "100" Device 11 maps to "101" Active Camera Clients: [] Change-Id: I13a3bd186e7fc48e797e3c6f9039a1dae1fb733f
Loading
Please register or sign in to comment