code from AOSP/Camera2