There are five conditions that proximity sensor disable during a phone call.

These conditions is default settings of Phone application in android.


You can find the source code in,

 boolean screenOnImmediately = (isHeadsetPlugged()

                            || PhoneUtils.isSpeakerOn(this)
                            || ((mBtHandsfree != null) && mBtHandsfree.isAudioOn())
                            || mIsHardKeyboardOpen
                            || mOrientation == AccelerometerListener.ORIENTATION_HORIZONTAL);


(1) isHeadsetPlugged(): When user headset is plugged, proximity sensor will be disable

(2) isSpeakerOn: When user turn on the speaker, proximity sensor will be disable

(3) BT device is connected and audio path is On

(4) Hardware Keyboard is opened.

(5) DUT is at Horizional state.

You can check the code in and customize what you want.

Check it out.

創作者 owenhuangtw 的頭像

Mr. Cooooooooooooode

owenhuangtw 發表在 痞客邦 留言(0) 人氣()