т.е. нужно добавить проверку
float textureRatio = TEXTURE_HEIGHT / TEXTURE_WIDTH;
float screenRatio = metrics.heightPixels / metrics.widthPixels;
if (textureRatio < screenRatio){
   float cameraWidth = TEXTURE_WIDTH;
   float cameraHeight = cameraWidth * metrics.heightPixels / metrics.widthPixels;
} else {
   float cameraHeight = TEXTURE_HEIGHT;
   float cameraWidth = cameraHeight * metrics.widthPixels / metrics.heidhtPixels;
}