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

Commit 0e7795fe authored by Hall Liu's avatar Hall Liu Committed by Grace Jia
Browse files

Fix Telecom log traces

Telecom log traces were not being printed for incoming calls due to lack
of log sessions in the call screening service filter. Add these calls to
Log.startSession to fix the issue.

Fixes: 153019748
Test: manual
Change-Id: I88169dfd71e6bbc50cc6e73bc87064476153cfbc
parent c7b13dbb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -148,6 +148,8 @@ public class IncomingCallFilterGraph {
                CompletableFuture.completedFuture(input);
        PostFilterTask postFilterTask = new PostFilterTask(filter);

        // TODO: improve these filter logging names to be more reflective of the filters that are
        // executing
        startFuture.thenComposeAsync(filter::startFilterLookup,
                new LoggedHandlerExecutor(mHandler, "ICFG.sF", null))
                .thenApplyAsync(postFilterTask::whenDone,
+71 −51
Original line number Diff line number Diff line
@@ -66,12 +66,17 @@ public class NewCallScreeningServiceFilter extends CallFilter {
        @Override
        public void allowCall(String callId) {
            Long token = Binder.clearCallingIdentity();
            Log.startSession("NCSSF.aC");
            try {
                if (mCall == null || (!mCall.getId().equals(callId))) {
                    Log.w(this, "allowCall, unknown call id: %s", callId);
                }
                mResultFuture.complete(mPriorStageResult);
            Binder.restoreCallingIdentity(token);
            } finally {
                unbindCallScreeningService();
                Binder.restoreCallingIdentity(token);
                Log.endSession();
            }
        }

        @Override
@@ -79,6 +84,8 @@ public class NewCallScreeningServiceFilter extends CallFilter {
                boolean shouldAddToCallLog, boolean shouldShowNotification,
                ComponentName componentName) {
            long token = Binder.clearCallingIdentity();
            Log.startSession("NCSSF.dC");
            try {
                if (mCall != null && mCall.getId().equals(callId)) {
                    mResultFuture.complete(new CallFilteringResult.Builder()
                            .setShouldAllowCall(false)
@@ -96,13 +103,18 @@ public class NewCallScreeningServiceFilter extends CallFilter {
                    Log.w(this, "disallowCall, unknown call id: %s", callId);
                    mResultFuture.complete(mPriorStageResult);
                }
            Binder.restoreCallingIdentity(token);
            } finally {
                unbindCallScreeningService();
                Log.endSession();
                Binder.restoreCallingIdentity(token);
            }
        }

        @Override
        public void silenceCall(String callId) {
            long token = Binder.clearCallingIdentity();
            Log.startSession("NCSSF.sC");
            try {
                if (mCall != null && mCall.getId().equals(callId)) {
                    mResultFuture.complete(new CallFilteringResult.Builder()
                            .setShouldAllowCall(true)
@@ -116,19 +128,24 @@ public class NewCallScreeningServiceFilter extends CallFilter {
                    Log.w(this, "silenceCall, unknown call id: %s", callId);
                    mResultFuture.complete(mPriorStageResult);
                }
            Binder.restoreCallingIdentity(token);
            } finally {
                unbindCallScreeningService();
                Log.endSession();
                Binder.restoreCallingIdentity(token);
            }
        }

        @Override
        public void screenCallFurther(String callId) {
            long token = Binder.clearCallingIdentity();
            if (mPackagetype != PACKAGE_TYPE_DEFAULT_DIALER) {
                throw new SecurityException("Only the default/system dialer may request screen via"
                    + "background call audio");
            }
            // TODO: add permission check for the additional role-based permission
            long token = Binder.clearCallingIdentity();
            Log.startSession("NCSSF.sCF");

            try {
                if (mCall != null && mCall.getId().equals(callId)) {
                    mResultFuture.complete(new CallFilteringResult.Builder()
                            .setShouldAllowCall(true)
@@ -141,8 +158,11 @@ public class NewCallScreeningServiceFilter extends CallFilter {
                    Log.w(this, "screenCallFurther, unknown call id: %s", callId);
                    mResultFuture.complete(mPriorStageResult);
                }
            Binder.restoreCallingIdentity(token);
            } finally {
                unbindCallScreeningService();
                Log.endSession();
                Binder.restoreCallingIdentity(token);
            }
        }
    }