It looks like no one proposed the obvious solution : use the interrupt pin... The only goal of this pin is for the other half to notify the phone that something is happening. In that case, when a key is pressed, the chip will trigger the interrupt pin, and the phone will know it has to check the chip for which key is pressed/released. No polling involved.
About the slide in/out of the keyboard, this could be done through a contact (for example both parts have a metal part on them, springy on one side, and when closed they enter in contact, or a "real" switch) which is connected as a standard key.
Activating the keyboard will happen via software, so no open/close sensor.