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

Commit 8a1b51dc authored by Yu-Han Yang's avatar Yu-Han Yang
Browse files

Add GnssNiEvent logging

Bug: 122091220
Test: tested locally on device using statsd_testdrive

Change-Id: I45ab9a7b12e6e674f31bc2398d74fa827d6f8f61
parent 1f49aca8
Loading
Loading
Loading
Loading
+61 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ message Atom {
        DataStallEvent data_stall_event = 121;
        RescuePartyResetReported rescue_party_reset_reported = 122;
        SignedConfigReported signed_config_reported = 123;
        GnssNiEventReported gnss_ni_event_reported = 124;
    }

    // Pulled events will start at field 10000.
@@ -3902,3 +3903,63 @@ message SignedConfigReported {
    // Which key was used to verify the config.
    optional Key verified_with = 5;
}

/*
 * Logs GNSS Network-Initiated (NI) location events.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
 */
message GnssNiEventReported {
    // The type of GnssNiEvent.
    enum EventType {
        UNKNOWN = 0;
        NI_REQUEST = 1;
        NI_RESPONSE = 2;
    }
    optional EventType event_type = 1;

    // An ID generated by HAL to associate NI notifications and UI responses.
    optional int32 notification_id = 2;

    // A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
    optional int32 ni_type = 3;

    // NI requires notification.
    optional bool need_notify = 4;

    // NI requires verification.
    optional bool need_verify = 5;

    // NI requires privacy override, no notification/minimal trace.
    optional bool privacy_override = 6;

    // Timeout period to wait for user response. Set to 0 for no timeout limit. Specified in
    // seconds.
    optional int32 timeout = 7;

    // Default response when timeout.
    optional int32 default_response = 8;

    // String representing the requester of the network inititated location request.
    optional string requestor_id = 9;

    // Notification message text string representing the service(for eg. SUPL-service) who sent the
    // network initiated location request.
    optional string text = 10;

    // requestorId decoding scheme.
    optional int32 requestor_id_encoding = 11;

    // Notification message text decoding scheme.
    optional int32 text_encoding = 12;

    // True if SUPL ES is enabled.
    optional bool is_supl_es_enabled = 13;

    // True if GNSS location is enabled.
    optional bool is_location_enabled = 14;

    // GNSS NI responses which define the response in NI structures.
    optional int32 user_response = 15;
}
+35 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import android.telephony.TelephonyManager;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import android.util.Log;
import android.util.StatsLog;

import com.android.internal.app.IBatteryStats;
import com.android.internal.location.GpsNetInitiatedHandler;
@@ -1704,6 +1705,24 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
                        ", response: " + userResponse);
            }
            native_send_ni_response(notificationId, userResponse);

            StatsLog.write(StatsLog.GNSS_NI_EVENT_REPORTED,
                    StatsLog.GNSS_NI_EVENT_REPORTED__EVENT_TYPE__NI_RESPONSE,
                    notificationId,
                    /* niType= */ 0,
                    /* needNotify= */ false,
                    /* needVerify= */ false,
                    /* privacyOverride= */ false,
                    /* timeout= */ 0,
                    /* defaultResponse= */ 0,
                    /* requestorId= */ null,
                    /* text= */ null,
                    /* requestorIdEncoding= */ 0,
                    /* textEncoding= */ 0,
                    mSuplEsEnabled,
                    mEnabled,
                    userResponse);

            return true;
        }
    };
@@ -1753,6 +1772,22 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
        notification.textEncoding = textEncoding;

        mNIHandler.handleNiNotification(notification);
        StatsLog.write(StatsLog.GNSS_NI_EVENT_REPORTED,
                StatsLog.GNSS_NI_EVENT_REPORTED__EVENT_TYPE__NI_REQUEST,
                notification.notificationId,
                notification.niType,
                notification.needNotify,
                notification.needVerify,
                notification.privacyOverride,
                notification.timeout,
                notification.defaultResponse,
                notification.requestorId,
                notification.text,
                notification.requestorIdEncoding,
                notification.textEncoding,
                mSuplEsEnabled,
                mEnabled,
                /* userResponse= */ 0);
    }

    /**