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

Commit 837f453c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add GnssNfwNotificationReported and GnssConfigurationReported"

parents 384ec029 14d5fb45
Loading
Loading
Loading
Loading
+96 −5
Original line number Diff line number Diff line
@@ -191,6 +191,8 @@ message Atom {
        AppDowngraded app_downgraded = 128;
        AppOptimizedAfterDowngraded app_optimized_after_downgraded = 129;
        LowStorageStateChanged low_storage_state_changed = 130;
        GnssNfwNotificationReported gnss_nfw_notification_reported = 131;
        GnssConfigurationReported gnss_configuration_reported = 132;
    }

    // Pulled events will start at field 10000.
@@ -4132,7 +4134,7 @@ message GnssNiEventReported {
    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;
    optional android.server.location.GnssNiType ni_type = 3;

    // NI requires notification.
    optional bool need_notify = 4;
@@ -4148,7 +4150,7 @@ message GnssNiEventReported {
    optional int32 timeout = 7;

    // Default response when timeout.
    optional int32 default_response = 8;
    optional android.server.location.GnssUserResponseType default_response = 8;

    // String representing the requester of the network inititated location request.
    optional string requestor_id = 9;
@@ -4158,10 +4160,10 @@ message GnssNiEventReported {
    optional string text = 10;

    // requestorId decoding scheme.
    optional int32 requestor_id_encoding = 11;
    optional android.server.location.GnssNiEncodingType requestor_id_encoding = 11;

    // Notification message text decoding scheme.
    optional int32 text_encoding = 12;
    optional android.server.location.GnssNiEncodingType text_encoding = 12;

    // True if SUPL ES is enabled.
    optional bool is_supl_es_enabled = 13;
@@ -4170,5 +4172,94 @@ message GnssNiEventReported {
    optional bool is_location_enabled = 14;

    // GNSS NI responses which define the response in NI structures.
    optional int32 user_response = 15;
    optional android.server.location.GnssUserResponseType user_response = 15;
}

/**
 * Logs GNSS non-framework (NFW) location notification.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/location/GnssLocationProvider.java
 */
message GnssNfwNotificationReported {
    // Package name of the Android proxy application representing the non-framework entity that
    // requested location. Set to empty string if unknown.
    optional string proxy_app_package_name = 1;

    // Protocol stack that initiated the non-framework location request.
    optional android.server.location.NfwProtocolStack protocol_stack = 2;

    // Name of the protocol stack if protocol_stack field is set to OTHER_PROTOCOL_STACK. Otherwise,
    // set to empty string. This field is opaque to the framework and used for logging purposes.
    optional string other_protocol_stack_name = 3;

    // Source initiating/receiving the location information.
    optional android.server.location.NfwRequestor requestor = 4;

    // Identity of the endpoint receiving the location information. For example, carrier name, OEM
    // name, SUPL SLP/E-SLP FQDN, chipset vendor name, etc. This field is opaque to the framework
    // and used for logging purposes.
    optional string requestor_id = 5;

    // Indicates whether location information was provided for this request.
    optional android.server.location.NfwResponseType response_type = 6;

    // True if the device is in user initiated emergency session.
    optional bool in_emergency_mode = 7;

    // True if cached location is provided.
    optional bool is_cached_location = 8;

    // True if proxy app permission mismatch between framework and GNSS HAL.
    optional bool is_permission_mismatched = 9;
}

/**
 * Logs GNSS configuration as defined in IGnssConfiguration.hal.
 *
 * Logged from:
 *   frameworks/base/services/core/java/com/android/server/location/GnssConfiguration.java
 */
message GnssConfigurationReported {
    // SUPL host name.
    optional string supl_host = 1;

    // SUPL port number.
    optional int32 supl_port = 2;

    // C2K host name.
    optional string c2k_host = 3;

    // C2K port number.
    optional int32 c2k_port = 4;

    // The SUPL version requested by Carrier.
    optional int32 supl_ver = 5;

    // The SUPL mode.
    optional android.server.location.SuplMode supl_mode = 6;

    // True if NI emergency SUPL restrictions is enabled.
    optional bool supl_es = 7;

    // LTE Positioning Profile settings
    optional android.server.location.LppProfile lpp_profile = 8;

    // Positioning protocol on A-Glonass system.
    optional android.server.location.GlonassPosProtocol a_glonass_pos_protocol_select = 9;

    // True if emergency PDN is used. Otherwise, regular PDN is used.
    optional bool use_emergency_pdn_for_emergency_supl= 10;

    // Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
    optional android.server.location.GpsLock gps_lock = 11;

    // Number of seconds to extend the emergency session duration post emergency call.
    optional int32 es_extension_sec = 12;

    // The full list of package names of proxy Android applications representing the non-framework
    // location access entities (on/off the device) for which the framework user has granted
    // non-framework location access permission. The package names are concatenated in one string
    // with spaces as separators.
    optional string enabled_proxy_app_package_name_list = 13;
}
+102 −0
Original line number Diff line number Diff line
@@ -28,3 +28,105 @@ enum GpsSignalQualityEnum {
    GPS_SIGNAL_QUALITY_POOR = 0;
    GPS_SIGNAL_QUALITY_GOOD = 1;
}

// A type which distinguishes different categories of NI request, such as VOICE, UMTS_SUPL etc.
enum GnssNiType {
    VOICE = 1;
    UMTS_SUPL = 2;
    UMTS_CTRL_PLANE = 3;
    EMERGENCY_SUPL = 4;
};

// GNSS NI responses, used to define the response in NI structures.
enum GnssUserResponseType {
    RESPONSE_ACCEPT = 1;
    RESPONSE_DENY = 2;
    RESPONSE_NORESP = 3;
};

// GNSS NI data encoding scheme.
enum GnssNiEncodingType {
    ENC_NONE = 0;
    ENC_SUPL_GSM_DEFAULT = 1;
    ENC_SUPL_UTF8 = 2;
    ENC_SUPL_UCS2 = 3;
    ENC_UNKNOWN = -1;
};

// Protocol stack that initiated the non-framework location request.
enum NfwProtocolStack {
    // Cellular control plane requests.
    CTRL_PLANE = 0;
    // All types of SUPL requests.
    SUPL = 1;
    // All types of requests from IMS.
    IMS = 10;
    // All types of requests from SIM.
    SIM = 11;
    // Requests from other protocol stacks.
    OTHER_PROTOCOL_STACK = 100;
};

// Source initiating/receiving the location information.
enum NfwRequestor  {
    // Wireless service provider.
    CARRIER = 0;
    // Device manufacturer.
    OEM = 10;
    // Modem chipset vendor.
    MODEM_CHIPSET_VENDOR = 11;
    // GNSS chipset vendor.
    GNSS_CHIPSET_VENDOR = 12;
    // Other chipset vendor.
    OTHER_CHIPSET_VENDOR = 13;
    // Automobile client.
    AUTOMOBILE_CLIENT = 20;
    // Other sources.
    OTHER_REQUESTOR = 100;
};

// Indicates whether location information was provided for this request.
enum NfwResponseType {
    // Request rejected because framework has not given permission for this use case.
    REJECTED = 0;
    // Request accepted but could not provide location because of a failure.
    ACCEPTED_NO_LOCATION_PROVIDED = 1;
    // Request accepted and location provided.
    ACCEPTED_LOCATION_PROVIDED = 2;
};

// The SUPL mode.
enum SuplMode {
    // Mobile Station Based.
    MSB = 0x01;
    // Mobile Station Assisted.
    MSA = 0x02;
};

// Enum that hold the bit masks for various LTE Positioning Profile settings (LPP_PROFILE
// configuration parameter). If none of the bits in the enum are set, the default setting is
// Radio Resource Location Protocol(RRLP).
enum LppProfile {
    // Enable LTE Positioning Protocol user plane.
    USER_PLANE = 0x01;
    // Enable LTE Positioning Protocol Control plane.
    CONTROL_PLANE = 0x02;
};

// Positioning protocol on A-Glonass system.
enum GlonassPosProtocol {
    // Radio Resource Control(RRC) control-plane.
    RRC_CPLANE = 0x01;
    // Radio Resource Location user-plane.
    RRLP_CPLANE = 0x02;
    // LTE Positioning Protocol User plane.
    LPP_UPLANE = 0x04;
};

// Configurations of how GPS functionalities should be locked when user turns off GPS On setting.
enum GpsLock {
    // Lock Mobile Originated GPS functionalitues.
    MO = 0x01;
    // Lock Network Initiated GPS functionalities.
    NI = 0x02;
};
+20 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.util.Log;
import android.util.StatsLog;

import libcore.io.IoUtils;

@@ -231,6 +232,8 @@ class GnssConfiguration {

        mEsExtensionSec = getRangeCheckedConfigEsExtensionSec();

        logConfigurations();

        final HalInterfaceVersion gnssConfigurationIfaceVersion =
                native_get_gnss_configuration_version();
        if (gnssConfigurationIfaceVersion != null) {
@@ -282,6 +285,23 @@ class GnssConfiguration {
        }
    }

    private void logConfigurations() {
        StatsLog.write(StatsLog.GNSS_CONFIGURATION_REPORTED,
                getSuplHost(),
                getSuplPort(0),
                getC2KHost(),
                getC2KPort(0),
                getIntConfig(CONFIG_SUPL_VER, 0),
                getSuplMode(0),
                getSuplEs(0) == 1,
                getIntConfig(CONFIG_LPP_PROFILE, 0),
                getIntConfig(CONFIG_A_GLONASS_POS_PROTOCOL_SELECT, 0),
                getIntConfig(CONFIG_USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, 0) == 1,
                getIntConfig(CONFIG_GPS_LOCK, 0),
                getEsExtensionSec(),
                mProperties.getProperty(CONFIG_NFW_PROXY_APPS));
    }

    /**
     * Loads GNSS properties from carrier config file.
     */
+27 −5
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.PowerManager;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import android.util.StatsLog;

import java.util.Arrays;
import java.util.HashMap;
@@ -278,14 +279,24 @@ class GnssVisibilityControl {
        if (DEBUG) Log.d(TAG, nfwNotification.toString());

        final String proxyAppPackageName = nfwNotification.mProxyAppPackageName;
        Boolean isLocationPermissionEnabled = mProxyAppToLocationPermissions.get(
                proxyAppPackageName);
        boolean isLocationRequestAccepted =
                nfwNotification.mResponseType != NfwNotification.NFW_RESPONSE_TYPE_REJECTED;
        boolean isPermissionMismatched;
        if (isLocationPermissionEnabled == null) {
            isPermissionMismatched = isLocationRequestAccepted;
        } else {
            isPermissionMismatched = (isLocationPermissionEnabled != isLocationRequestAccepted);
        }
        logEvent(nfwNotification, isPermissionMismatched);

        if (TextUtils.isEmpty(proxyAppPackageName)) {
            Log.e(TAG, "ProxyAppPackageName field is not set. Not sending intent to proxy app for "
                    + nfwNotification);
            return;
        }

        Boolean isLocationPermissionEnabled = mProxyAppToLocationPermissions.get(
                proxyAppPackageName);
        if (isLocationPermissionEnabled == null) {
            // App is not in the configured list.
            Log.e(TAG, "Could not find proxy app with name: " + proxyAppPackageName + " in the "
@@ -317,9 +328,7 @@ class GnssVisibilityControl {
        mAppOps.noteOpNoThrow(AppOpsManager.OP_FINE_LOCATION, clsAppUid, proxyAppPackageName);

        // Log proxy app permission mismatch between framework and GNSS HAL.
        boolean isLocationRequestAccepted =
                nfwNotification.mResponseType != NfwNotification.NFW_RESPONSE_TYPE_REJECTED;
        if (isLocationPermissionEnabled != isLocationRequestAccepted) {
        if (isPermissionMismatched) {
            Log.w(TAG, "Permission mismatch. Framework proxy app " + proxyAppPackageName
                    + " location permission is set to " + isLocationPermissionEnabled
                    + " but GNSS non-framework location access response type is "
@@ -338,6 +347,19 @@ class GnssVisibilityControl {
        }
    }

    private void logEvent(NfwNotification notification, boolean isPermissionMismatched) {
        StatsLog.write(StatsLog.GNSS_NFW_NOTIFICATION_REPORTED,
                notification.mProxyAppPackageName,
                notification.mProtocolStack,
                notification.mOtherProtocolStackName,
                notification.mRequestor,
                notification.mRequestorId,
                notification.mResponseType,
                notification.mInEmergencyMode,
                notification.mIsCachedLocation,
                isPermissionMismatched);
    }

    private void postEvent(Runnable event) {
        // Hold a wake lock until this message is delivered.
        // Note that this assumes the message will not be removed from the queue before