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

Commit 780199d1 authored by Hui Wang's avatar Hui Wang Committed by Android (Google) Code Review
Browse files

Merge "Add telecom commands to support metrics test mode" into main

parents 9de798e9 4ae110c7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2945,6 +2945,13 @@ public class TelecomServiceImpl {
            }
        }

        @Override
        public void setMetricsTestMode(boolean enabled) {
            if (mFeatureFlags.telecomMetricsSupport()) {
                mMetricsController.setTestMode(enabled);
            }
        }

        /**
         * Determines whether there are any ongoing {@link PhoneAccount#CAPABILITY_SELF_MANAGED}
         * calls for a given {@code packageName} and {@code userHandle}.
+10 −0
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ public class TelecomShellCommand extends BasicShellCommandHandler {
    private static final String COMMAND_GET_MAX_PHONES = "get-max-phones";
    private static final String COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER =
            "set-test-emergency-phone-account-package-filter";
    private static final String COMMAND_SET_METRICS_TEST_ENABLED = "set-metrics-test-enabled";
    private static final String COMMAND_SET_METRICS_TEST_DISABLED = "set-metrics-test-disabled";
    /**
     * Command used to emit a distinct "mark" in the logs.
     */
@@ -184,6 +186,12 @@ public class TelecomShellCommand extends BasicShellCommandHandler {
                case COMMAND_LOG_MARK:
                    runLogMark();
                    break;
                case COMMAND_SET_METRICS_TEST_ENABLED:
                    mTelecomService.setMetricsTestMode(true);
                    break;
                case COMMAND_SET_METRICS_TEST_DISABLED:
                    mTelecomService.setMetricsTestMode(false);
                    break;
                default:
                    return handleDefaultCommands(command);
            }
@@ -262,6 +270,8 @@ public class TelecomShellCommand extends BasicShellCommandHandler {
                + "testers to indicate where in the logs various test steps take place.\n"
                + "telecom is-non-ui-in-call-service-bound <PACKAGE>: queries a particular "
                + "non-ui-InCallService in InCallController to determine if it is bound \n"
                + "telecom set-metrics-test-enabled: Enable the metrics test mode.\n"
                + "telecom set-metrics-test-disabled: Disable the metrics test mode.\n"
        );
    }
    private void runSetPhoneAccountEnabled(boolean enabled) throws RemoteException {
+2 −2
Original line number Diff line number Diff line
@@ -169,8 +169,8 @@ public class ApiStats extends TelecomPulledAtom {
    private static final String FILE_NAME = "api_stats";
    private Map<ApiEvent, Integer> mApiStatsMap;

    public ApiStats(@NonNull Context context, @NonNull Looper looper) {
        super(context, looper);
    public ApiStats(@NonNull Context context, @NonNull Looper looper, boolean isTestMode) {
        super(context, looper, isTestMode);
    }

    @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+2 −2
Original line number Diff line number Diff line
@@ -76,8 +76,8 @@ public class AudioRouteStats extends TelecomPulledAtom {
    private Pair<AudioRouteStatsKey, long[]> mCur;
    private boolean mIsOngoing;

    public AudioRouteStats(@NonNull Context context, @NonNull Looper looper) {
        super(context, looper);
    public AudioRouteStats(@NonNull Context context, @NonNull Looper looper, boolean isTestMode) {
        super(context, looper, isTestMode);
    }

    @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
+2 −2
Original line number Diff line number Diff line
@@ -59,8 +59,8 @@ public class CallStats extends TelecomPulledAtom {
    private Map<CallStatsKey, CallStatsData> mCallStatsMap;
    private boolean mHasMultipleAudioDevices;

    public CallStats(@NonNull Context context, @NonNull Looper looper) {
        super(context, looper);
    public CallStats(@NonNull Context context, @NonNull Looper looper, boolean isTestMode) {
        super(context, looper, isTestMode);
    }

    @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
Loading