private static MeteringRectangle[] regionsForNormalizedCoord(float nx,float ny,float fraction,final Rect cropRegion,int sensorOrientation){
  int minCropEdge=Math.min(cropRegion.width(),cropRegion.height());
  int halfSideLength=(int)(0.5f * fraction * minCropEdge);
  PointF nsc=CameraUtil.normalizedSensorCoordsForNormalizedDisplayCoords(nx,ny,sensorOrientation);
  int xCenterSensor=(int)(cropRegion.left + nsc.x * cropRegion.width());
  int yCenterSensor=(int)(cropRegion.top + nsc.y * cropRegion.height());
  Rect meteringRegion=new Rect(xCenterSensor - halfSideLength,yCenterSensor - halfSideLength,xCenterSensor + halfSideLength,yCenterSensor + halfSideLength);
  meteringRegion.left=CameraUtil.clamp(meteringRegion.left,cropRegion.left,cropRegion.right);
  meteringRegion.top=CameraUtil.clamp(meteringRegion.top,cropRegion.top,cropRegion.bottom);
  meteringRegion.right=CameraUtil.clamp(meteringRegion.right,cropRegion.left,cropRegion.right);
  meteringRegion.bottom=CameraUtil.clamp(meteringRegion.bottom,cropRegion.top,cropRegion.bottom);
  return new MeteringRectangle[]{new MeteringRectangle(meteringRegion,CAMERA2_REGION_WEIGHT)};
}

private static MeteringRectangle [ ] regionsForNormalizedCoord ( float nx , float ny , float fraction , final Rect cropRegion , int sensorOrientation ) { int minCropEdge = Math . min ( cropRegion . width ( ) , cropRegion . height ( ) ) ; int halfSideLength = ( int ) ( 0.5f * fraction * minCropEdge ) ; PointF nsc = CameraUtil . normalizedSensorCoordsForNormalizedDisplayCoords ( nx , ny , sensorOrientation ) ; int xCenterSensor = ( int ) ( cropRegion . left + nsc . x * cropRegion . width ( ) ) ; int yCenterSensor = ( int ) ( cropRegion . top + nsc . y * cropRegion . height ( ) ) ; Rect meteringRegion = new Rect ( xCenterSensor - halfSideLength , yCenterSensor - halfSideLength , xCenterSensor + halfSideLength , yCenterSensor + halfSideLength ) ; meteringRegion . left = CameraUtil . clamp ( meteringRegion . left , cropRegion . left , cropRegion . right ) ; meteringRegion . top = CameraUtil . clamp ( meteringRegion . top , cropRegion . top , cropRegion . bottom ) ; meteringRegion . right = CameraUtil . clamp ( meteringRegion . right , cropRegion . left , cropRegion . right ) ; meteringRegion . bottom = CameraUtil . clamp ( meteringRegion . bottom , cropRegion . top , cropRegion . bottom ) ; return new MeteringRectangle [ ] { new MeteringRectangle ( meteringRegion , CAMERA2_REGION_WEIGHT ) } ; }
compute 3a regions for a sensor - referenced touch coordinate . returns a meteringrectangle [ ] with length 1 .
