Sorry, but I think it can't be done for hardware reasons.
The Android headset jack has 4 connections: Tip=LeftAudio, Ring=RightAudio, Ring2=Ground, Sleeve=Mic. (I may have Ring2 & Ground reversed). The HeadsetHook button sends its signal by shorting out Ring2 and Sleeve. So, while pressed it will short out the mic, which explains why you are recording silence. Sucks. Can't do PushToTalk.
One option for you is to start recording on onKeyDown and stop recording when it is clicked again. Even this isn't straightforward because you will get multiple onKeyDowns if the button is pressed long enough. So skip onKeyDown and use onKeyUp. It avoids the "Google Now" MediaButton hassle. Something like...
boolean recording = false;
// don't need to override onKeyDown()
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK) {
if (recording)
stopAndSaveRecording();
else
startRecording();
recording = ! recording;
}
return true;
}
Note that you will be recording silence during the ending click.