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

Commit 4cead2d5 authored by Hakjun Choi's avatar Hakjun Choi
Browse files

Add metric info for SOS message recommender

currently initial version for testing and get right position to capture

Bug: 266016321
Test: emergency dialer emulation test on pixel
Change-Id: Ieba624136a7eb34f7a9e55989321024edd26f1b2
parent b1bc77e3
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.ims.ImsException;
import com.android.ims.ImsManager;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.metrics.SatelliteStats;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -262,7 +263,7 @@ public class SatelliteSOSMessageRecommender extends Handler {
            mEmergencyConnection.sendConnectionEvent(Call.EVENT_DISPLAY_SOS_MESSAGE, null);
            isDialerNotified = true;
        }
        reportMetrics(isDialerNotified);
        reportEsosRecommenderDecision(isDialerNotified);
        cleanUpResources();
    }

@@ -289,7 +290,7 @@ public class SatelliteSOSMessageRecommender extends Handler {
        }

        if (!shouldTrackCall(state)) {
            reportMetrics(false);
            reportEsosRecommenderDecision(false);
            cleanUpResources();
        }
    }
@@ -309,14 +310,14 @@ public class SatelliteSOSMessageRecommender extends Handler {
        }
    }

    private void reportMetrics(boolean isDialerNotified) {
        /**
         * TODO: We need to report the following info
         * - Whether the Dialer is notified with the event DISPLAY_SOS_MESSAGE (isDialerNotified).
         * - Number of times the timer is started (mCountOfTimerStarted).
         * - Whether IMS is registered (mIsImsRegistered).
         * - The cellular service state (mCellularServiceState).
         */
    private void reportEsosRecommenderDecision(boolean isDialerNotified) {
        SatelliteStats.getInstance().onSatelliteSosMessageRecommender(
                new SatelliteStats.SatelliteSosMessageRecommenderParams.Builder()
                        .setDisplaySosMessageSent(isDialerNotified)
                        .setCountOfTimerStarted(mCountOfTimerStarted)
                        .setImsRegistered(mIsImsRegistered.get())
                        .setCellularServiceState(mCellularServiceState.get())
                        .build());
    }

    private void cleanUpResources() {