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

Commit f353ef73 authored by Hall Liu's avatar Hall Liu
Browse files

Fix some Telecom CTS behavior for presubmit

* Ignore a potential IllegalArgumentException in InCallController
* Add a method to stop number blocking suppression after an emergency
call

Bug: 158798240
Test: atest CtsTelecomTestCases
Change-Id: I81e8a1650d7a08a2cf4782a434db2a37c681f4af
parent f469a92c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1289,7 +1289,12 @@ public class InCallController extends CallsManagerListenerBase {
     * Unbinds an existing bound connection to the in-call app.
     */
    private void unbindFromServices() {
        try {
            mContext.unregisterReceiver(mPackageChangedReceiver);
        } catch (IllegalArgumentException e) {
            // Ignore this -- we may or may not have registered it, but when we bind, we want to
            // unregister no matter what.
        }
        if (mInCallServiceConnection != null) {
            mInCallServiceConnection.disconnect();
            mInCallServiceConnection = null;
+23 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.os.UserHandle;
import android.provider.BlockedNumberContract;
import android.provider.Settings;
import android.telecom.Log;
import android.telecom.PhoneAccount;
@@ -1476,6 +1477,28 @@ public class TelecomServiceImpl {
            }
        }

        @Override
        public void stopBlockSuppression() {
            try {
                Log.startSession("TSI.sBS");
                enforceModifyPermission();
                if (Binder.getCallingUid() != Process.SHELL_UID
                        && Binder.getCallingUid() != Process.ROOT_UID) {
                    throw new SecurityException("Shell-only API.");
                }
                synchronized (mLock) {
                    long token = Binder.clearCallingIdentity();
                    try {
                        BlockedNumberContract.SystemContract.endBlockSuppression(mContext);
                    } finally {
                        Binder.restoreCallingIdentity(token);
                    }
                }
            } finally {
                Log.endSession();
            }
        }

        @Override
        public TelecomAnalytics dumpCallAnalytics() {
            try {