Stop invoke initAppOps in Camera default constructor.

Camera default constructor does not create the underlying native camera
object. Thus calling _enableShutterSound after the default constuctor
causes application crash.

Bug: 80498247
Test: Manually modify the code to return MODE_IGNORED for
      AppOpsService#checkAudioOperation() and to return false for
      CameraManager#supportsCamera2ApiLocked. Then start voice call in
      Hangouts.

Change-Id: Id738c4d46a8e3625bc3b1142b11acac9cfb0b603
This commit is contained in:
Daichi Hirono
2018-06-25 11:16:41 +09:00
parent 43dcdf898c
commit cb63c640cd

View File

@@ -571,9 +571,7 @@ public class Camera {
/**
* An empty Camera for testing purpose.
*/
Camera() {
initAppOps();
}
Camera() {}
private void initAppOps() {
IBinder b = ServiceManager.getService(Context.APP_OPS_SERVICE);