(AudioRecord.ERROR_BAD_VALUE | AudioRecord.ERROR )
Means -2 | -1, which equals -1, which equals AudioRecord.ERROR
, which is why you're never getting the result you expect.
So this
if(bufferSize8000 != (AudioRecord.ERROR_BAD_VALUE | AudioRecord.ERROR )) {
Should be
if (bufferSize8000 != Audiorecord.ERROR_BAD_VALUE && bufferSize8000 != AudioRecord.ERROR) {