title: Android: Inject fake camera preview for testing purpose
body: <p>I am writing some black-box, acceptance tests that run on a physical android device. The application under test (AUT) relies on the camera's preview. Specifically, it uses the <code>setOneShotPreviewCallback</code> method of the <code>android.hardware.Camera</code> class. I am looking for a way to inject a fake preview picture to test the app's behavior.</p>
  
  <p>I thought I could fool the Camera object by having the test code call the AUT's <code>PreviewCallback</code> object, but unfortunately, the instance variable <code>mPreviewCallback</code> is private to the Camera object and thus my test code has no way to get a reference to the <code>PreviewCallback</code> object.</p>
  
  <p>Another way I thought about was to send a <code>Message</code> to the Camera's <code>EventHandler</code>, but again the field <code>mEventHandler</code> is private, so the test code has no way to get a reference to the Handler.</p>