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

Commit 47a17224 authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Adds EventManager and SessionManager callbacks for Analytics am: 2eebf1d7 am: 26c47199

am: 7a504069

Change-Id: I6bb386aa1fb418be44d9087e2efd00bf725d177b
parents fae50079 7a504069
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.telecom.Logging.EventManager.TimedEventPair;
public class LogUtils {

    private static final String TAG = "Telecom";
    private static final String LOGUTILS_TAG = "LogUtils";

    public static final boolean SYSTRACE_DEBUG = false; /* STOP SHIP if true */

@@ -156,6 +157,23 @@ public class LogUtils {
        }
    }

    private static void eventRecordAdded(EventManager.EventRecord eventRecord) {
        // Only Calls will be added as event records in this case
        EventManager.Loggable recordEntry = eventRecord.getRecordEntry();
        if (recordEntry instanceof Call) {
            Call callRecordEntry = (Call) recordEntry;
            android.telecom.Log.i(LOGUTILS_TAG, "EventRecord added as Call: " + callRecordEntry);
            Analytics.CallInfo callInfo = callRecordEntry.getAnalytics();
            if(callInfo != null) {
                callInfo.setCallEvents(eventRecord);
            } else {
                android.telecom.Log.w(LOGUTILS_TAG, "Could not get Analytics CallInfo.");
            }
        } else {
            android.telecom.Log.w(LOGUTILS_TAG, "Non-Call EventRecord Added.");
        }
    }

    public static void initLogging(Context context) {
        android.telecom.Log.setTag(TAG);
        android.telecom.Log.setSessionContext(context);
@@ -163,5 +181,8 @@ public class LogUtils {
        for (EventManager.TimedEventPair p : Events.Timings.sTimedEvents) {
            android.telecom.Log.addRequestResponsePair(p);
        }
        android.telecom.Log.registerEventListener(LogUtils::eventRecordAdded);
        // Store analytics about recently completed Sessions.
        android.telecom.Log.registerSessionListener(Analytics::addSessionTiming);
    }
}
+10 −4
Original line number Diff line number Diff line
@@ -611,6 +611,11 @@ public class TelecomSystemTest extends TelecomTestCase {
        // called correctly in order to continue.
        verify(localAppContext).sendBroadcastAsUser(actionCallIntent, UserHandle.SYSTEM);
        mTelecomSystem.getCallIntentProcessor().processIntent(actionCallIntent);
        // Wait for handler to start CallerInfo lookup.
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
        // Send the CallerInfo lookup reply.
        mCallerInfoAsyncQueryFactoryFixture.mRequests.forEach(
                CallerInfoAsyncQueryFactoryFixture.Request::reply);

        if (!hasInCallAdapter) {
            verify(mInCallServiceFixtureX.getTestDouble())
@@ -742,10 +747,11 @@ public class TelecomSystemTest extends TelecomTestCase {
                .createConnection(any(PhoneAccountHandle.class), anyString(),
                        any(ConnectionRequest.class), eq(true), eq(false), any());

        for (CallerInfoAsyncQueryFactoryFixture.Request request :
                mCallerInfoAsyncQueryFactoryFixture.mRequests) {
            request.reply();
        }
        // Wait for the handler to start the CallerInfo lookup
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
        // Process the CallerInfo lookup reply
        mCallerInfoAsyncQueryFactoryFixture.mRequests.forEach(
                CallerInfoAsyncQueryFactoryFixture.Request::reply);

        IContentProvider blockedNumberProvider =
                mSpyContext.getContentResolver().acquireProvider(BlockedNumberContract.AUTHORITY);