It does not seems safe to do this with an asynchronous API.  If getPreferredResolution() does not call the callback immediately, then we don't know whether setPreviewSize() will be called before or after we attempt to actually start the preview.

If you can prove to yourself that the resolution will always be known here, then please just use this._preferredImageResolution and don't call the function that looks async.

If you can't prove that, then I think you will have to wait in the init or deferred init methods for the settings query to complete so that you  so have a guarantee that the preferred resolution is already known and you don't have to be asynchronous here.

I think I was also the reviewer for the patch that added getPreferredRecordingSizes() below. Obviously it is asynchronous as well.  I approved it because the camera starts by default in still picture mode. Also, when launched by activity to record videos, I think I was able to analyze the startup path and could prove to myself that the recording size would already be known by this point and the function would not be async. But if you fix your code here to be synchronous, then you might also want to fix the code below to be sync as well.