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 PhoneApp.java,

 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 PhoneApp.java and customize what you want.

Check it out.

創作者介紹

Mr. Cooooooooooooode

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