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

Commit a04b2055 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add Telecom API and module error metrics" into main

parents 7c181fcf 74a5666b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -101,13 +101,13 @@ message TelecomApiStats {
 * From frameworks/proto_logging/stats/atoms/telecomm/telecom_extension_atom.proto
 */
message TelecomErrorStats {
    // The value should be converted to android.telecom.SubmoduleNameEnum
    // The value should be converted to android.telecom.SubmoduleEnum
    // From frameworks/proto_logging/stats/enums/telecomm/enums.proto
    optional int32 submodule_name = 1;
    optional int32 submodule = 1;

    // The value should be converted to android.telecom.ErrorNameEnum
    // The value should be converted to android.telecom.ErrorEnum
    // From frameworks/proto_logging/stats/enums/telecomm/enums.proto
    optional int32 error_name = 2;
    optional int32 error = 2;

    // The number of times this error occurs
    optional int32 count = 3;
+17 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.internal.os.SomeArgs;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.telecom.bluetooth.BluetoothRouteManager;
import com.android.server.telecom.flags.FeatureFlags;
import com.android.server.telecom.metrics.ErrorStats;
import com.android.server.telecom.metrics.TelecomMetricsController;

import java.util.ArrayList;
@@ -512,6 +513,10 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
        if (destRoute == null || (!destRoute.equals(mStreamingRoute)
                && !getCallSupportedRoutes().contains(destRoute))) {
            Log.i(this, "Ignore routing to unavailable route: %s", destRoute);
            if (mFeatureFlags.telecomMetricsSupport()) {
                mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_AUDIO,
                        ErrorStats.ERROR_AUDIO_ROUTE_UNAVAILABLE);
            }
            return;
        }
        if (mIsPending) {
@@ -559,6 +564,10 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
            wiredHeadsetRoute = mAudioRouteFactory.create(AudioRoute.TYPE_WIRED, null,
                    mAudioManager);
        } catch (IllegalArgumentException e) {
            if (mFeatureFlags.telecomMetricsSupport()) {
                mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_AUDIO,
                        ErrorStats.ERROR_EXTERNAL_EXCEPTION);
            }
            Log.e(this, e, "Can't find available audio device info for route type:"
                    + AudioRoute.DEVICE_TYPE_STRINGS.get(AudioRoute.TYPE_WIRED));
        }
@@ -598,6 +607,10 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
        try {
            dockRoute = mAudioRouteFactory.create(AudioRoute.TYPE_DOCK, null, mAudioManager);
        } catch (IllegalArgumentException e) {
            if (mFeatureFlags.telecomMetricsSupport()) {
                mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_AUDIO,
                        ErrorStats.ERROR_EXTERNAL_EXCEPTION);
            }
            Log.e(this, e, "Can't find available audio device info for route type:"
                    + AudioRoute.DEVICE_TYPE_STRINGS.get(AudioRoute.TYPE_WIRED));
        }
@@ -790,6 +803,10 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
                            mCallsManager.getCurrentUserHandle().getIdentifier(),
                            mContext.getAttributionTag());
                } catch (RemoteException e) {
                    if (mFeatureFlags.telecomMetricsSupport()) {
                        mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_AUDIO,
                                ErrorStats.ERROR_EXTERNAL_EXCEPTION);
                    }
                    Log.e(this, e, "Remote exception while toggling mute.");
                    return;
                }
+38 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ import com.android.server.telecom.callredirection.CallRedirectionProcessor;
import com.android.server.telecom.components.ErrorDialogActivity;
import com.android.server.telecom.components.TelecomBroadcastReceiver;
import com.android.server.telecom.flags.FeatureFlags;
import com.android.server.telecom.metrics.ErrorStats;
import com.android.server.telecom.metrics.TelecomMetricsController;
import com.android.server.telecom.stats.CallFailureCause;
import com.android.server.telecom.ui.AudioProcessingNotification;
@@ -530,6 +531,8 @@ public class CallsManager extends Call.ListenerBase
    private AnomalyReporterAdapter mAnomalyReporter = new AnomalyReporterAdapterImpl();

    private final MmiUtils mMmiUtils = new MmiUtils();

    private TelecomMetricsController mMetricsController;
    /**
     * Listener to PhoneAccountRegistrar events.
     */
@@ -733,6 +736,7 @@ public class CallsManager extends Call.ListenerBase
        mCallStreamingNotification = callStreamingNotification;
        mFeatureFlags = featureFlags;
        mTelephonyFeatureFlags = telephonyFlags;
        mMetricsController = metricsController;
        mBlockedNumbersManager = mFeatureFlags.telecomMainlineBlockedNumbersManager()
                ? mContext.getSystemService(BlockedNumbersManager.class)
                : null;
@@ -2029,10 +2033,18 @@ public class CallsManager extends Call.ListenerBase
                    if (exception != null){
                        Log.e(TAG, exception, "Error retrieving list of potential phone accounts.");
                        if (finalCall.isEmergencyCall()) {
                            if (mFeatureFlags.telecomMetricsSupport()) {
                                mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_MANAGER,
                                        ErrorStats.ERROR_RETRIEVING_ACCOUNT_EMERGENCY);
                            }
                            mAnomalyReporter.reportAnomaly(
                                    EXCEPTION_RETRIEVING_PHONE_ACCOUNTS_EMERGENCY_ERROR_UUID,
                                    EXCEPTION_RETRIEVING_PHONE_ACCOUNTS_EMERGENCY_ERROR_MSG);
                        } else {
                            if (mFeatureFlags.telecomMetricsSupport()) {
                                mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_MANAGER,
                                        ErrorStats.ERROR_RETRIEVING_ACCOUNT);
                            }
                            mAnomalyReporter.reportAnomaly(
                                    EXCEPTION_RETRIEVING_PHONE_ACCOUNTS_ERROR_UUID,
                                    EXCEPTION_RETRIEVING_PHONE_ACCOUNTS_ERROR_MSG);
@@ -2194,6 +2206,11 @@ public class CallsManager extends Call.ListenerBase
                                showErrorMessage(R.string.cant_call_due_to_no_supported_service);
                                mListeners.forEach(l -> l.onCreateConnectionFailed(callToPlace));
                                if (callToPlace.isEmergencyCall()) {
                                    if (mFeatureFlags.telecomMetricsSupport()) {
                                        mMetricsController.getErrorStats().log(
                                                ErrorStats.SUB_CALL_MANAGER,
                                                ErrorStats.ERROR_EMERGENCY_CALL_ABORTED_NO_ACCOUNT);
                                    }
                                    mAnomalyReporter.reportAnomaly(
                                            EMERGENCY_CALL_ABORTED_NO_PHONE_ACCOUNTS_ERROR_UUID,
                                            EMERGENCY_CALL_ABORTED_NO_PHONE_ACCOUNTS_ERROR_MSG);
@@ -2219,6 +2236,11 @@ public class CallsManager extends Call.ListenerBase
                                        PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION)) {
                                    if (SubscriptionManager.getDefaultVoiceSubscriptionId() !=
                                            SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
                                        if (mFeatureFlags.telecomMetricsSupport()) {
                                            mMetricsController.getErrorStats().log(
                                                    ErrorStats.SUB_CALL_MANAGER,
                                                    ErrorStats.ERROR_DEFAULT_MO_ACCOUNT_MISMATCH);
                                        }
                                        mAnomalyReporter.reportAnomaly(
                                                TELEPHONY_HAS_DEFAULT_BUT_TELECOM_DOES_NOT_UUID,
                                                TELEPHONY_HAS_DEFAULT_BUT_TELECOM_DOES_NOT_MSG);
@@ -3033,6 +3055,10 @@ public class CallsManager extends Call.ListenerBase
                    // If an exceptions is thrown while creating the connection, prompt the user to
                    // generate a bugreport and force disconnect.
                    Log.e(TAG, exception, "Exception thrown while establishing connection.");
                    if (mFeatureFlags.telecomMetricsSupport()) {
                        mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_MANAGER,
                                ErrorStats.ERROR_ESTABLISHING_CONNECTION);
                    }
                    mAnomalyReporter.reportAnomaly(
                            EXCEPTION_WHILE_ESTABLISHING_CONNECTION_ERROR_UUID,
                            EXCEPTION_WHILE_ESTABLISHING_CONNECTION_ERROR_MSG);
@@ -4160,6 +4186,10 @@ public class CallsManager extends Call.ListenerBase
                    }, new LoggedHandlerExecutor(mHandler, "CM.pR", mLock))
                    .exceptionally((throwable) -> {
                        Log.e(TAG, throwable, "Error while executing call removal");
                        if (mFeatureFlags.telecomMetricsSupport()) {
                            mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_MANAGER,
                                    ErrorStats.ERROR_REMOVING_CALL);
                        }
                        mAnomalyReporter.reportAnomaly(CALL_REMOVAL_EXECUTION_ERROR_UUID,
                                CALL_REMOVAL_EXECUTION_ERROR_MSG);
                        return null;
@@ -5227,6 +5257,10 @@ public class CallsManager extends Call.ListenerBase

        // If the live call is stuck in a connecting state, prompt the user to generate a bugreport.
        if (liveCall.getState() == CallState.CONNECTING) {
            if (mFeatureFlags.telecomMetricsSupport()) {
                mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_MANAGER,
                        ErrorStats.ERROR_STUCK_CONNECTING_EMERGENCY);
            }
            mAnomalyReporter.reportAnomaly(LIVE_CALL_STUCK_CONNECTING_EMERGENCY_ERROR_UUID,
                    LIVE_CALL_STUCK_CONNECTING_EMERGENCY_ERROR_MSG);
        }
@@ -5343,6 +5377,10 @@ public class CallsManager extends Call.ListenerBase
        if (liveCall.getState() == CallState.CONNECTING
                && ((mClockProxy.elapsedRealtime() - liveCall.getCreationElapsedRealtimeMillis())
                > mTimeoutsAdapter.getNonVoipCallTransitoryStateTimeoutMillis())) {
            if (mFeatureFlags.telecomMetricsSupport()) {
                mMetricsController.getErrorStats().log(ErrorStats.SUB_CALL_MANAGER,
                        ErrorStats.ERROR_STUCK_CONNECTING);
            }
            mAnomalyReporter.reportAnomaly(LIVE_CALL_STUCK_CONNECTING_ERROR_UUID,
                    LIVE_CALL_STUCK_CONNECTING_ERROR_MSG);
            liveCall.disconnect("Force disconnect CONNECTING call.");
+0 −1
Original line number Diff line number Diff line
@@ -1873,7 +1873,6 @@ public class InCallController extends CallsManagerListenerBase implements
        }
    }

    @VisibleForTesting
    public void bringToForeground(boolean showDialpad, UserHandle callingUser) {
        KeyguardManager keyguardManager = mContext.getSystemService(KeyguardManager.class);
        boolean isLockscreenRestricted = keyguardManager != null
+456 −188

File changed.

Preview size limit exceeded, changes collapsed.

Loading