Instead of two "inSampleSize" methods wouldn't it be easier just to limit the targetWidth/targetHeight to within MAX_TEXTURE_SIZE?