Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d37ea309 authored by dankoman's avatar dankoman Committed by Adnan Begovic
Browse files

[1/2] Frameworks: let InCallUI handle proximity sensor for incoming calls

Fixes "while 'prevent accidental wake-up' is on, proximity sensor
doesn't control screen state on incoming call. Must manually
turn on screen to see who's calling."

Change-Id: I738b3bbd328992c8a8010a0c8d9aa1e444cfa9f9
parent 0ff0a189
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -66,6 +66,7 @@ import android.os.UserHandle;
import android.os.WorkSource;
import android.os.WorkSource;
import android.provider.Settings;
import android.provider.Settings;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamManagerInternal;
import android.telephony.TelephonyManager;
import android.util.EventLog;
import android.util.EventLog;
import android.util.Log;
import android.util.Log;
import android.util.Slog;
import android.util.Slog;
@@ -3167,7 +3168,13 @@ public final class PowerManagerService extends SystemService
                // There is already a message queued;
                // There is already a message queued;
                return;
                return;
            }
            }
            if (mProximityWakeSupported && mProximityWakeEnabled && mProximitySensor != null) {

            TelephonyManager tm = (TelephonyManager)mContext.getSystemService(
                    Context.TELEPHONY_SERVICE);
            boolean hasIncomingCall = tm.getCallState() == TelephonyManager.CALL_STATE_RINGING;

            if (mProximityWakeSupported && mProximityWakeEnabled && mProximitySensor != null
                    && !hasIncomingCall) {
                Message msg = mHandler.obtainMessage(MSG_WAKE_UP);
                Message msg = mHandler.obtainMessage(MSG_WAKE_UP);
                msg.obj = r;
                msg.obj = r;
                mHandler.sendMessageDelayed(msg, mProximityTimeOut);
                mHandler.sendMessageDelayed(msg, mProximityTimeOut);