title: sinch video call camera permission problem with Android pei (9)
body: <p><strong>update</strong></p>
  
  <p>I am developing a small app which requires camera permission. I can handle the run time permission but the real problem is that when I relay to <code>Sinchpayload</code> and go to incomming call activity. This activity should request permissions (camera and other 2 permissions). But instead of showing the permission dialogue, it crash my app because of security exception. <strong>this thing happen only if I request camera permission - not happen to other permissions and only on Android 9 with camera "2" Api - Android 8.1 and lower works fine</strong> . <strong>THIS PROBLEM STILL HAPPEN WITH THE SINCH SAMPLE PUSH</strong>. The permission dialogue will show if start activity with intent as usual. This is the error :</p>
  
  <pre><code>-------- beginning of crash
  2019-02-10 22:11:55.390 2113-2681/com.example.myapp.app E/AndroidRuntime: FATAL EXCEPTION: VideoCapturerThread
     Process: com.example.myapp.app, PID: 2113
     java.lang.SecurityException: validateClientPermissionsLocked:1054: Caller "com.example.myapp.app" (PID 10319, UID 2113) cannot open camera "1" without camera permission
         at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:747)
         at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:405)
         at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:567)
         at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:495)
         at org.webrtc.Camera2Session.openCamera(Unknown Source:44)
         at org.webrtc.Camera2Session.start(Unknown Source:60)
         at org.webrtc.Camera2Session.&lt;init&gt;(Unknown Source:73)
         at org.webrtc.Camera2Session.create(Unknown Source:17)
         at org.webrtc.Camera2Capturer.createCameraSession(Unknown Source:17)
         at org.webrtc.CameraCapturer$5.run(Unknown Source:52)
         at android.os.Handler.handleCallback(Handler.java:891)
         at android.os.Handler.dispatchMessage(Handler.java:102)
         at android.os.Looper.loop(Looper.java:207)
         at android.os.HandlerThread.run(HandlerThread.java:65)
      Caused by: android.os.ServiceSpecificException: validateClientPermissionsLocked:1054: Caller "com.example.myapp.app" (PID 10319, UID 2113) cannot open camera "1" without camera permission (code 1)
         at android.os.Parcel.createException(Parcel.java:1967)
         at android.os.Parcel.readException(Parcel.java:1921)
         at android.os.Parcel.readException(Parcel.java:1871)
         at android.hardware.ICameraService$Stub$Proxy.connectDevice(ICameraService.java:343)
         at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:369)
         at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:567) 
         at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:495) 
         at org.webrtc.Camera2Session.openCamera(Unknown Source:44) 
         at org.webrtc.Camera2Session.start(Unknown Source:60) 
         at org.webrtc.Camera2Session.&lt;init&gt;(Unknown Source:73) 
         at org.webrtc.Camera2Session.create(Unknown Source:17) 
         at org.webrtc.Camera2Capturer.createCameraSession(Unknown Source:17) 
         at org.webrtc.CameraCapturer$5.run(Unknown Source:52) 
         at android.os.Handler.handleCallback(Handler.java:891) 
         at android.os.Handler.dispatchMessage(Handler.java:102) 
         at android.os.Looper.loop(Looper.java:207) 
         at android.os.HandlerThread.run(HandlerThread.java:65)`
  
  </code></pre>
  
  <p>and this is my code to request permissions :</p>
  
  <pre><code>if (Build.VERSION.SDK_INT&gt;=23)
      {
   if (GlobalConstants.isAllPermissionsGrantedBefore_Video_Call(this)==false)
              ActivityCompat.requestPermissions(
                      Video_incomming_call.this,
                     GlobalConstants.mPermissions_Video_Chat,
                      GlobalConstants.VIDEO_RECIEVE_CODE);
          else {
              Start_Calling();
          }
  
      } else Start_Calling();
  </code></pre>