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

Commit 515e09b8 authored by Santos Cordon's avatar Santos Cordon Committed by Android (Google) Code Review
Browse files

Merge "Update showCallScreen to use Telecomm (1/6)" into lmp-preview-dev

parents f69af6b6 3534ede5
Loading
Loading
Loading
Loading
+4 −13
Original line number Original line Diff line number Diff line
@@ -43,7 +43,6 @@ import android.view.View;
import android.widget.Button;
import android.widget.Button;


import com.android.internal.R;
import com.android.internal.R;
import com.android.internal.telephony.ITelephony;
import com.google.android.collect.Lists;
import com.google.android.collect.Lists;


import java.security.MessageDigest;
import java.security.MessageDigest;
@@ -1360,19 +1359,11 @@ public class LockPatternUtils {
    /**
    /**
     * Resumes a call in progress. Typically launched from the EmergencyCall button
     * Resumes a call in progress. Typically launched from the EmergencyCall button
     * on various lockscreens.
     * on various lockscreens.
     *
     * @return true if we were able to tell InCallScreen to show.
     */
     */
    public boolean resumeCall() {
    public void resumeCall() {
        ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
        TelephonyManager telephonyManager =
        try {
                (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
            if (phone != null && phone.showCallScreen()) {
        telephonyManager.showCallScreen();
                return true;
            }
        } catch (RemoteException e) {
            // What can we do?
        }
        return false;
    }
    }


    private void finishBiometricWeak() {
    private void finishBiometricWeak() {
+17 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ public abstract class InCallService extends Service {
    private static final int MSG_SET_POST_DIAL = 4;
    private static final int MSG_SET_POST_DIAL = 4;
    private static final int MSG_SET_POST_DIAL_WAIT = 5;
    private static final int MSG_SET_POST_DIAL_WAIT = 5;
    private static final int MSG_ON_AUDIO_STATE_CHANGED = 6;
    private static final int MSG_ON_AUDIO_STATE_CHANGED = 6;
    private static final int MSG_BRING_TO_FOREGROUND = 7;


    /** Default Handler used to consolidate binder method calls onto a single thread. */
    /** Default Handler used to consolidate binder method calls onto a single thread. */
    private final Handler mHandler = new Handler(Looper.getMainLooper()) {
    private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@@ -83,6 +84,9 @@ public abstract class InCallService extends Service {
                case MSG_ON_AUDIO_STATE_CHANGED:
                case MSG_ON_AUDIO_STATE_CHANGED:
                    onAudioStateChanged((CallAudioState) msg.obj);
                    onAudioStateChanged((CallAudioState) msg.obj);
                    break;
                    break;
                case MSG_BRING_TO_FOREGROUND:
                    bringToForeground(msg.arg1 == 1);
                    break;
                default:
                default:
                    break;
                    break;
            }
            }
@@ -130,6 +134,12 @@ public abstract class InCallService extends Service {
        public void onAudioStateChanged(CallAudioState audioState) {
        public void onAudioStateChanged(CallAudioState audioState) {
            mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, audioState).sendToTarget();
            mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, audioState).sendToTarget();
        }
        }

        /** {@inheritDoc} */
        @Override
        public void bringToForeground(boolean showDialpad) {
            mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget();
        }
    }
    }


    private final InCallServiceBinder mBinder;
    private final InCallServiceBinder mBinder;
@@ -206,4 +216,11 @@ public abstract class InCallService extends Service {
     * @param audioState The new {@link CallAudioState}.
     * @param audioState The new {@link CallAudioState}.
     */
     */
    protected abstract void onAudioStateChanged(CallAudioState audioState);
    protected abstract void onAudioStateChanged(CallAudioState audioState);

    /**
     * Brings the in-call screen to the foreground.
     *
     * @param showDialpad If true, put up the dialpad when the screen is shown.
     */
    protected abstract void bringToForeground(boolean showDialpad);
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -40,4 +40,6 @@ oneway interface IInCallService {
    void setPostDialWait(String callId, String remaining);
    void setPostDialWait(String callId, String remaining);


    void onAudioStateChanged(in CallAudioState audioState);
    void onAudioStateChanged(in CallAudioState audioState);

    void bringToForeground(boolean showDialpad);
}
}
+8 −1
Original line number Original line Diff line number Diff line
@@ -21,7 +21,7 @@ package com.android.internal.telecomm;
 * commands that were previously handled by ITelephony.
 * commands that were previously handled by ITelephony.
 * {@hide}
 * {@hide}
 */
 */
oneway interface ITelecommService {
interface ITelecommService {


    /**
    /**
     * Silence the ringer if an incoming call is currently ringing.
     * Silence the ringer if an incoming call is currently ringing.
@@ -31,4 +31,11 @@ oneway interface ITelecommService {
     * even if there's no incoming call.  (If so, this method will do nothing.)
     * even if there's no incoming call.  (If so, this method will do nothing.)
     */
     */
    void silenceRinger();
    void silenceRinger();

    /**
     * Brings the in-call screen to the foreground if there is an active call.
     *
     * @param showDialpad if true, make the dialpad visible initially.
     */
    void showCallScreen(boolean showDialpad);
}
}
+6 −4
Original line number Original line Diff line number Diff line
@@ -1980,9 +1980,10 @@ public class TelephonyManager {
    @PrivateApi
    @PrivateApi
    public boolean showCallScreen() {
    public boolean showCallScreen() {
        try {
        try {
            return getITelephony().showCallScreen();
            getTelecommService().showCallScreen(false);
            return true;
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#showCallScreen", e);
            Log.e(TAG, "Error calling ITelecommService#showCallScreen", e);
        }
        }
        return false;
        return false;
    }
    }
@@ -1991,9 +1992,10 @@ public class TelephonyManager {
    @PrivateApi
    @PrivateApi
    public boolean showCallScreenWithDialpad(boolean showDialpad) {
    public boolean showCallScreenWithDialpad(boolean showDialpad) {
        try {
        try {
            return getITelephony().showCallScreenWithDialpad(showDialpad);
            getTelecommService().showCallScreen(showDialpad);
            return true;
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelephony#showCallScreenWithDialpad", e);
            Log.e(TAG, "Error calling ITelecommService#showCallScreen(" + showDialpad + ")", e);
        }
        }
        return false;
        return false;
    }
    }
Loading