// CaptureActivity.jaca // line 266 && line 443 mHolder = surfaceHolder; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) { if (ContextCompat.checkSelfPermission(CaptureActivity.this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { // 先判断有没有权限 ,没有就在这里进行权限的申请 ActivityCompat.requestPermissions(CaptureActivity.this, newString[]{Manifest.permission.CAMERA}, CAMERA_OK); } else { // 说明已经获取到摄像头权限了 initCamera(surfaceHolder); } } else { initCamera(surfaceHolder); }
// line 803 @Override publicvoidonRequestPermissionsResult(int requestCode , @NonNull String[] permissions, @NonNullint[] grantResults) { // If request is cancelled, the result arrays are empty. if (requestCode == CAMERA_OK) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was granted, yay! Do the // contacts-related task you need to do. initCamera(mHolder); } } }