Loading location/java/com/android/internal/location/GpsNetInitiatedHandler.java +11 −20 Original line number Original line Diff line number Diff line Loading @@ -360,7 +360,7 @@ public class GpsNetInitiatedHandler { /** /** * Posts a notification in the status bar using the contents in {@code notif} object. * Posts a notification in the status bar using the contents in {@code notif} object. */ */ public synchronized void setNiNotification(GpsNiNotification notif) { private synchronized void setNiNotification(GpsNiNotification notif) { NotificationManager notificationManager = (NotificationManager) mContext NotificationManager notificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); .getSystemService(Context.NOTIFICATION_SERVICE); if (notificationManager == null) { if (notificationManager == null) { Loading Loading @@ -541,35 +541,26 @@ public class GpsNetInitiatedHandler { */ */ static private String decodeString(String original, boolean isHex, int coding) static private String decodeString(String original, boolean isHex, int coding) { { if (coding == GPS_ENC_NONE) { if (coding == GPS_ENC_NONE || coding == GPS_ENC_UNKNOWN) { return original; return original; } } String decoded = original; byte[] input = stringToByteArray(original, isHex); byte[] input = stringToByteArray(original, isHex); switch (coding) { switch (coding) { case GPS_ENC_SUPL_GSM_DEFAULT: case GPS_ENC_SUPL_GSM_DEFAULT: decoded = decodeGSMPackedString(input); return decodeGSMPackedString(input); break; case GPS_ENC_SUPL_UTF8: case GPS_ENC_SUPL_UTF8: decoded = decodeUTF8String(input); return decodeUTF8String(input); break; case GPS_ENC_SUPL_UCS2: case GPS_ENC_SUPL_UCS2: decoded = decodeUCS2String(input); return decodeUCS2String(input); break; case GPS_ENC_UNKNOWN: decoded = original; break; default: default: Log.e(TAG, "Unknown encoding " + coding + " for NI text " + original); Log.e(TAG, "Unknown encoding " + coding + " for NI text " + original); break; return original; } } return decoded; } } // change this to configure notification display // change this to configure notification display Loading services/core/java/com/android/server/location/GnssConfiguration.java +0 −9 Original line number Original line Diff line number Diff line Loading @@ -70,7 +70,6 @@ class GnssConfiguration { private static final String CONFIG_GPS_LOCK = "GPS_LOCK"; private static final String CONFIG_GPS_LOCK = "GPS_LOCK"; private static final String CONFIG_ES_EXTENSION_SEC = "ES_EXTENSION_SEC"; private static final String CONFIG_ES_EXTENSION_SEC = "ES_EXTENSION_SEC"; public static final String CONFIG_NFW_PROXY_APPS = "NFW_PROXY_APPS"; public static final String CONFIG_NFW_PROXY_APPS = "NFW_PROXY_APPS"; public static final String CONFIG_ES_NOTIFY_INT = "ES_NOTIFY_INT"; // Limit on NI emergency mode time extension after emergency sessions ends // Limit on NI emergency mode time extension after emergency sessions ends private static final int MAX_EMERGENCY_MODE_EXTENSION_SECONDS = 300; // 5 minute maximum private static final int MAX_EMERGENCY_MODE_EXTENSION_SECONDS = 300; // 5 minute maximum Loading Loading @@ -199,14 +198,6 @@ class GnssConfiguration { return proxyApps; return proxyApps; } } /** * Returns the value of config parameter ES_NOTIFY_INT or {@code defaulEsNotify} if no * value is provided or if there is an error parsing the configured value. */ int getEsNotify(int defaulEsNotify) { return getIntConfig(CONFIG_ES_NOTIFY_INT, defaulEsNotify); } /** /** * Updates the GNSS HAL satellite blacklist. * Updates the GNSS HAL satellite blacklist. */ */ Loading services/core/java/com/android/server/location/GnssVisibilityControl.java +42 −47 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.server.location; import android.annotation.SuppressLint; import android.annotation.SuppressLint; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading @@ -35,6 +38,7 @@ import android.util.StatsLog; import com.android.internal.R; import com.android.internal.R; import com.android.internal.location.GpsNetInitiatedHandler; import com.android.internal.location.GpsNetInitiatedHandler; import com.android.internal.notification.SystemNotificationChannels; import java.util.Arrays; import java.util.Arrays; import java.util.List; import java.util.List; Loading @@ -58,11 +62,6 @@ class GnssVisibilityControl { // Max wait time for synchronous method onGpsEnabledChanged() to run. // Max wait time for synchronous method onGpsEnabledChanged() to run. private static final long ON_GPS_ENABLED_CHANGED_TIMEOUT_MILLIS = 3 * 1000; private static final long ON_GPS_ENABLED_CHANGED_TIMEOUT_MILLIS = 3 * 1000; // Valid values for config parameter es_notify_int for posting notification in the status // bar for non-framework location requests in user-initiated emergency use cases. private static final int ES_NOTIFY_NONE = 0; private static final int ES_NOTIFY_ALL = 1; // Wakelocks // Wakelocks private static final String WAKELOCK_KEY = TAG; private static final String WAKELOCK_KEY = TAG; private static final long WAKELOCK_TIMEOUT_MILLIS = 60 * 1000; private static final long WAKELOCK_TIMEOUT_MILLIS = 60 * 1000; Loading @@ -74,9 +73,9 @@ class GnssVisibilityControl { private final Handler mHandler; private final Handler mHandler; private final Context mContext; private final Context mContext; private final GpsNetInitiatedHandler mNiHandler; private final GpsNetInitiatedHandler mNiHandler; private final Notification mEmergencyLocationUserNotification; private boolean mIsGpsEnabled; private boolean mIsGpsEnabled; private boolean mEsNotify; // Number of non-framework location access proxy apps is expected to be small (< 5). // Number of non-framework location access proxy apps is expected to be small (< 5). private static final int ARRAY_MAP_INITIAL_CAPACITY_PROXY_APP_TO_LOCATION_PERMISSIONS = 7; private static final int ARRAY_MAP_INITIAL_CAPACITY_PROXY_APP_TO_LOCATION_PERMISSIONS = 7; Loading @@ -94,6 +93,7 @@ class GnssVisibilityControl { mNiHandler = niHandler; mNiHandler = niHandler; mAppOps = mContext.getSystemService(AppOpsManager.class); mAppOps = mContext.getSystemService(AppOpsManager.class); mPackageManager = mContext.getPackageManager(); mPackageManager = mContext.getPackageManager(); mEmergencyLocationUserNotification = createEmergencyLocationUserNotification(mContext); // Complete initialization as the first event to run in mHandler thread. After that, // Complete initialization as the first event to run in mHandler thread. After that, // all object state read/update events run in the mHandler thread. // all object state read/update events run in the mHandler thread. Loading Loading @@ -135,22 +135,7 @@ class GnssVisibilityControl { void onConfigurationUpdated(GnssConfiguration configuration) { void onConfigurationUpdated(GnssConfiguration configuration) { // The configuration object must be accessed only in the caller thread and not in mHandler. // The configuration object must be accessed only in the caller thread and not in mHandler. List<String> nfwLocationAccessProxyApps = configuration.getProxyApps(); List<String> nfwLocationAccessProxyApps = configuration.getProxyApps(); int esNotify = configuration.getEsNotify(ES_NOTIFY_NONE); runOnHandler(() -> handleUpdateProxyApps(nfwLocationAccessProxyApps)); runOnHandler(() -> { setEsNotify(esNotify); handleUpdateProxyApps(nfwLocationAccessProxyApps); }); } private void setEsNotify(int esNotify) { if (esNotify != ES_NOTIFY_NONE && esNotify != ES_NOTIFY_ALL) { Log.e(TAG, "Config parameter " + GnssConfiguration.CONFIG_ES_NOTIFY_INT + " is set to invalid value: " + esNotify + ". Using default value: " + ES_NOTIFY_NONE); esNotify = ES_NOTIFY_NONE; } mEsNotify = (esNotify == ES_NOTIFY_ALL); } } private void handleInitialize() { private void handleInitialize() { Loading Loading @@ -278,9 +263,6 @@ class GnssVisibilityControl { private static final byte NFW_RESPONSE_TYPE_ACCEPTED_NO_LOCATION_PROVIDED = 1; private static final byte NFW_RESPONSE_TYPE_ACCEPTED_NO_LOCATION_PROVIDED = 1; private static final byte NFW_RESPONSE_TYPE_ACCEPTED_LOCATION_PROVIDED = 2; private static final byte NFW_RESPONSE_TYPE_ACCEPTED_LOCATION_PROVIDED = 2; // This must match with NfwProtocolStack enum in IGnssVisibilityControlCallback.hal. private static final byte NFW_PROTOCOL_STACK_SUPL = 1; private final String mProxyAppPackageName; private final String mProxyAppPackageName; private final byte mProtocolStack; private final byte mProtocolStack; private final String mOtherProtocolStackName; private final String mOtherProtocolStackName; Loading Loading @@ -341,10 +323,6 @@ class GnssVisibilityControl { private boolean isEmergencyRequestNotification() { private boolean isEmergencyRequestNotification() { return mInEmergencyMode && !isRequestAttributedToProxyApp(); return mInEmergencyMode && !isRequestAttributedToProxyApp(); } } private boolean isRequestTypeSupl() { return mProtocolStack == NFW_PROTOCOL_STACK_SUPL; } } } private void handlePermissionsChanged(int uid) { private void handlePermissionsChanged(int uid) { Loading Loading @@ -517,25 +495,42 @@ class GnssVisibilityControl { logEvent(nfwNotification, isPermissionMismatched); logEvent(nfwNotification, isPermissionMismatched); if (mEsNotify && nfwNotification.isLocationProvided()) { if (nfwNotification.isLocationProvided()) { postEmergencyLocationUserNotification(nfwNotification); } } private void postEmergencyLocationUserNotification(NfwNotification nfwNotification) { // Emulate deprecated IGnssNi.hal user notification of emergency NI requests. // Emulate deprecated IGnssNi.hal user notification of emergency NI requests. GpsNetInitiatedHandler.GpsNiNotification notification = NotificationManager notificationManager = (NotificationManager) mContext new GpsNetInitiatedHandler.GpsNiNotification(); .getSystemService(Context.NOTIFICATION_SERVICE); notification.notificationId = 0; if (notificationManager == null) { notification.niType = nfwNotification.isRequestTypeSupl() Log.w(TAG, "Could not notify user of emergency location request. Notification: " ? GpsNetInitiatedHandler.GPS_NI_TYPE_EMERGENCY_SUPL + nfwNotification); : GpsNetInitiatedHandler.GPS_NI_TYPE_UMTS_CTRL_PLANE; return; notification.needNotify = true; notification.needVerify = false; notification.privacyOverride = false; notification.timeout = 0; notification.defaultResponse = GpsNetInitiatedHandler.GPS_NI_RESPONSE_NORESP; notification.requestorId = nfwNotification.mRequestorId; notification.requestorIdEncoding = GpsNetInitiatedHandler.GPS_ENC_NONE; notification.text = mContext.getString(R.string.global_action_emergency); notification.textEncoding = GpsNetInitiatedHandler.GPS_ENC_NONE; mNiHandler.setNiNotification(notification); } } notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0, mEmergencyLocationUserNotification, UserHandle.ALL); } private static Notification createEmergencyLocationUserNotification(Context context) { String firstLineText = context.getString(R.string.gpsNotifTitle); String secondLineText = context.getString(R.string.global_action_emergency); String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS) .setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on) .setWhen(0) .setOngoing(true) .setAutoCancel(true) .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)) .setDefaults(0) .setTicker(accessibilityServicesText) .setContentTitle(firstLineText) .setContentText(secondLineText) .setContentIntent(PendingIntent.getBroadcast(context, 0, new Intent(), 0)) .build(); } } private void logEvent(NfwNotification notification, boolean isPermissionMismatched) { private void logEvent(NfwNotification notification, boolean isPermissionMismatched) { Loading telephony/java/android/telephony/CarrierConfigManager.java +0 −9 Original line number Original line Diff line number Diff line Loading @@ -2793,14 +2793,6 @@ public class CarrierConfigManager { */ */ public static final String KEY_NFW_PROXY_APPS_STRING = KEY_PREFIX + "nfw_proxy_apps"; public static final String KEY_NFW_PROXY_APPS_STRING = KEY_PREFIX + "nfw_proxy_apps"; /** * Specify whether to post a notification on the status bar whenever device location is * provided for non-framework location requests in user-initiated emergency use cases. * 0 - Do not post notification. This is default. * 1 - Post notification for all request types. */ public static final String KEY_ES_NOTIFY_INT = KEY_PREFIX + "es_notify_int"; private static PersistableBundle getDefaults() { private static PersistableBundle getDefaults() { PersistableBundle defaults = new PersistableBundle(); PersistableBundle defaults = new PersistableBundle(); defaults.putBoolean(KEY_PERSIST_LPP_MODE_BOOL, true); defaults.putBoolean(KEY_PERSIST_LPP_MODE_BOOL, true); Loading @@ -2815,7 +2807,6 @@ public class CarrierConfigManager { defaults.putString(KEY_GPS_LOCK_STRING, "3"); defaults.putString(KEY_GPS_LOCK_STRING, "3"); defaults.putString(KEY_ES_EXTENSION_SEC_STRING, "0"); defaults.putString(KEY_ES_EXTENSION_SEC_STRING, "0"); defaults.putString(KEY_NFW_PROXY_APPS_STRING, ""); defaults.putString(KEY_NFW_PROXY_APPS_STRING, ""); defaults.putInt(KEY_ES_NOTIFY_INT, 0); return defaults; return defaults; } } } } Loading Loading
location/java/com/android/internal/location/GpsNetInitiatedHandler.java +11 −20 Original line number Original line Diff line number Diff line Loading @@ -360,7 +360,7 @@ public class GpsNetInitiatedHandler { /** /** * Posts a notification in the status bar using the contents in {@code notif} object. * Posts a notification in the status bar using the contents in {@code notif} object. */ */ public synchronized void setNiNotification(GpsNiNotification notif) { private synchronized void setNiNotification(GpsNiNotification notif) { NotificationManager notificationManager = (NotificationManager) mContext NotificationManager notificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); .getSystemService(Context.NOTIFICATION_SERVICE); if (notificationManager == null) { if (notificationManager == null) { Loading Loading @@ -541,35 +541,26 @@ public class GpsNetInitiatedHandler { */ */ static private String decodeString(String original, boolean isHex, int coding) static private String decodeString(String original, boolean isHex, int coding) { { if (coding == GPS_ENC_NONE) { if (coding == GPS_ENC_NONE || coding == GPS_ENC_UNKNOWN) { return original; return original; } } String decoded = original; byte[] input = stringToByteArray(original, isHex); byte[] input = stringToByteArray(original, isHex); switch (coding) { switch (coding) { case GPS_ENC_SUPL_GSM_DEFAULT: case GPS_ENC_SUPL_GSM_DEFAULT: decoded = decodeGSMPackedString(input); return decodeGSMPackedString(input); break; case GPS_ENC_SUPL_UTF8: case GPS_ENC_SUPL_UTF8: decoded = decodeUTF8String(input); return decodeUTF8String(input); break; case GPS_ENC_SUPL_UCS2: case GPS_ENC_SUPL_UCS2: decoded = decodeUCS2String(input); return decodeUCS2String(input); break; case GPS_ENC_UNKNOWN: decoded = original; break; default: default: Log.e(TAG, "Unknown encoding " + coding + " for NI text " + original); Log.e(TAG, "Unknown encoding " + coding + " for NI text " + original); break; return original; } } return decoded; } } // change this to configure notification display // change this to configure notification display Loading
services/core/java/com/android/server/location/GnssConfiguration.java +0 −9 Original line number Original line Diff line number Diff line Loading @@ -70,7 +70,6 @@ class GnssConfiguration { private static final String CONFIG_GPS_LOCK = "GPS_LOCK"; private static final String CONFIG_GPS_LOCK = "GPS_LOCK"; private static final String CONFIG_ES_EXTENSION_SEC = "ES_EXTENSION_SEC"; private static final String CONFIG_ES_EXTENSION_SEC = "ES_EXTENSION_SEC"; public static final String CONFIG_NFW_PROXY_APPS = "NFW_PROXY_APPS"; public static final String CONFIG_NFW_PROXY_APPS = "NFW_PROXY_APPS"; public static final String CONFIG_ES_NOTIFY_INT = "ES_NOTIFY_INT"; // Limit on NI emergency mode time extension after emergency sessions ends // Limit on NI emergency mode time extension after emergency sessions ends private static final int MAX_EMERGENCY_MODE_EXTENSION_SECONDS = 300; // 5 minute maximum private static final int MAX_EMERGENCY_MODE_EXTENSION_SECONDS = 300; // 5 minute maximum Loading Loading @@ -199,14 +198,6 @@ class GnssConfiguration { return proxyApps; return proxyApps; } } /** * Returns the value of config parameter ES_NOTIFY_INT or {@code defaulEsNotify} if no * value is provided or if there is an error parsing the configured value. */ int getEsNotify(int defaulEsNotify) { return getIntConfig(CONFIG_ES_NOTIFY_INT, defaulEsNotify); } /** /** * Updates the GNSS HAL satellite blacklist. * Updates the GNSS HAL satellite blacklist. */ */ Loading
services/core/java/com/android/server/location/GnssVisibilityControl.java +42 −47 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.server.location; import android.annotation.SuppressLint; import android.annotation.SuppressLint; import android.app.AppOpsManager; import android.app.AppOpsManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; Loading @@ -35,6 +38,7 @@ import android.util.StatsLog; import com.android.internal.R; import com.android.internal.R; import com.android.internal.location.GpsNetInitiatedHandler; import com.android.internal.location.GpsNetInitiatedHandler; import com.android.internal.notification.SystemNotificationChannels; import java.util.Arrays; import java.util.Arrays; import java.util.List; import java.util.List; Loading @@ -58,11 +62,6 @@ class GnssVisibilityControl { // Max wait time for synchronous method onGpsEnabledChanged() to run. // Max wait time for synchronous method onGpsEnabledChanged() to run. private static final long ON_GPS_ENABLED_CHANGED_TIMEOUT_MILLIS = 3 * 1000; private static final long ON_GPS_ENABLED_CHANGED_TIMEOUT_MILLIS = 3 * 1000; // Valid values for config parameter es_notify_int for posting notification in the status // bar for non-framework location requests in user-initiated emergency use cases. private static final int ES_NOTIFY_NONE = 0; private static final int ES_NOTIFY_ALL = 1; // Wakelocks // Wakelocks private static final String WAKELOCK_KEY = TAG; private static final String WAKELOCK_KEY = TAG; private static final long WAKELOCK_TIMEOUT_MILLIS = 60 * 1000; private static final long WAKELOCK_TIMEOUT_MILLIS = 60 * 1000; Loading @@ -74,9 +73,9 @@ class GnssVisibilityControl { private final Handler mHandler; private final Handler mHandler; private final Context mContext; private final Context mContext; private final GpsNetInitiatedHandler mNiHandler; private final GpsNetInitiatedHandler mNiHandler; private final Notification mEmergencyLocationUserNotification; private boolean mIsGpsEnabled; private boolean mIsGpsEnabled; private boolean mEsNotify; // Number of non-framework location access proxy apps is expected to be small (< 5). // Number of non-framework location access proxy apps is expected to be small (< 5). private static final int ARRAY_MAP_INITIAL_CAPACITY_PROXY_APP_TO_LOCATION_PERMISSIONS = 7; private static final int ARRAY_MAP_INITIAL_CAPACITY_PROXY_APP_TO_LOCATION_PERMISSIONS = 7; Loading @@ -94,6 +93,7 @@ class GnssVisibilityControl { mNiHandler = niHandler; mNiHandler = niHandler; mAppOps = mContext.getSystemService(AppOpsManager.class); mAppOps = mContext.getSystemService(AppOpsManager.class); mPackageManager = mContext.getPackageManager(); mPackageManager = mContext.getPackageManager(); mEmergencyLocationUserNotification = createEmergencyLocationUserNotification(mContext); // Complete initialization as the first event to run in mHandler thread. After that, // Complete initialization as the first event to run in mHandler thread. After that, // all object state read/update events run in the mHandler thread. // all object state read/update events run in the mHandler thread. Loading Loading @@ -135,22 +135,7 @@ class GnssVisibilityControl { void onConfigurationUpdated(GnssConfiguration configuration) { void onConfigurationUpdated(GnssConfiguration configuration) { // The configuration object must be accessed only in the caller thread and not in mHandler. // The configuration object must be accessed only in the caller thread and not in mHandler. List<String> nfwLocationAccessProxyApps = configuration.getProxyApps(); List<String> nfwLocationAccessProxyApps = configuration.getProxyApps(); int esNotify = configuration.getEsNotify(ES_NOTIFY_NONE); runOnHandler(() -> handleUpdateProxyApps(nfwLocationAccessProxyApps)); runOnHandler(() -> { setEsNotify(esNotify); handleUpdateProxyApps(nfwLocationAccessProxyApps); }); } private void setEsNotify(int esNotify) { if (esNotify != ES_NOTIFY_NONE && esNotify != ES_NOTIFY_ALL) { Log.e(TAG, "Config parameter " + GnssConfiguration.CONFIG_ES_NOTIFY_INT + " is set to invalid value: " + esNotify + ". Using default value: " + ES_NOTIFY_NONE); esNotify = ES_NOTIFY_NONE; } mEsNotify = (esNotify == ES_NOTIFY_ALL); } } private void handleInitialize() { private void handleInitialize() { Loading Loading @@ -278,9 +263,6 @@ class GnssVisibilityControl { private static final byte NFW_RESPONSE_TYPE_ACCEPTED_NO_LOCATION_PROVIDED = 1; private static final byte NFW_RESPONSE_TYPE_ACCEPTED_NO_LOCATION_PROVIDED = 1; private static final byte NFW_RESPONSE_TYPE_ACCEPTED_LOCATION_PROVIDED = 2; private static final byte NFW_RESPONSE_TYPE_ACCEPTED_LOCATION_PROVIDED = 2; // This must match with NfwProtocolStack enum in IGnssVisibilityControlCallback.hal. private static final byte NFW_PROTOCOL_STACK_SUPL = 1; private final String mProxyAppPackageName; private final String mProxyAppPackageName; private final byte mProtocolStack; private final byte mProtocolStack; private final String mOtherProtocolStackName; private final String mOtherProtocolStackName; Loading Loading @@ -341,10 +323,6 @@ class GnssVisibilityControl { private boolean isEmergencyRequestNotification() { private boolean isEmergencyRequestNotification() { return mInEmergencyMode && !isRequestAttributedToProxyApp(); return mInEmergencyMode && !isRequestAttributedToProxyApp(); } } private boolean isRequestTypeSupl() { return mProtocolStack == NFW_PROTOCOL_STACK_SUPL; } } } private void handlePermissionsChanged(int uid) { private void handlePermissionsChanged(int uid) { Loading Loading @@ -517,25 +495,42 @@ class GnssVisibilityControl { logEvent(nfwNotification, isPermissionMismatched); logEvent(nfwNotification, isPermissionMismatched); if (mEsNotify && nfwNotification.isLocationProvided()) { if (nfwNotification.isLocationProvided()) { postEmergencyLocationUserNotification(nfwNotification); } } private void postEmergencyLocationUserNotification(NfwNotification nfwNotification) { // Emulate deprecated IGnssNi.hal user notification of emergency NI requests. // Emulate deprecated IGnssNi.hal user notification of emergency NI requests. GpsNetInitiatedHandler.GpsNiNotification notification = NotificationManager notificationManager = (NotificationManager) mContext new GpsNetInitiatedHandler.GpsNiNotification(); .getSystemService(Context.NOTIFICATION_SERVICE); notification.notificationId = 0; if (notificationManager == null) { notification.niType = nfwNotification.isRequestTypeSupl() Log.w(TAG, "Could not notify user of emergency location request. Notification: " ? GpsNetInitiatedHandler.GPS_NI_TYPE_EMERGENCY_SUPL + nfwNotification); : GpsNetInitiatedHandler.GPS_NI_TYPE_UMTS_CTRL_PLANE; return; notification.needNotify = true; notification.needVerify = false; notification.privacyOverride = false; notification.timeout = 0; notification.defaultResponse = GpsNetInitiatedHandler.GPS_NI_RESPONSE_NORESP; notification.requestorId = nfwNotification.mRequestorId; notification.requestorIdEncoding = GpsNetInitiatedHandler.GPS_ENC_NONE; notification.text = mContext.getString(R.string.global_action_emergency); notification.textEncoding = GpsNetInitiatedHandler.GPS_ENC_NONE; mNiHandler.setNiNotification(notification); } } notificationManager.notifyAsUser(/* tag= */ null, /* notificationId= */ 0, mEmergencyLocationUserNotification, UserHandle.ALL); } private static Notification createEmergencyLocationUserNotification(Context context) { String firstLineText = context.getString(R.string.gpsNotifTitle); String secondLineText = context.getString(R.string.global_action_emergency); String accessibilityServicesText = firstLineText + " (" + secondLineText + ")"; return new Notification.Builder(context, SystemNotificationChannels.NETWORK_ALERTS) .setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on) .setWhen(0) .setOngoing(true) .setAutoCancel(true) .setColor(context.getColor( com.android.internal.R.color.system_notification_accent_color)) .setDefaults(0) .setTicker(accessibilityServicesText) .setContentTitle(firstLineText) .setContentText(secondLineText) .setContentIntent(PendingIntent.getBroadcast(context, 0, new Intent(), 0)) .build(); } } private void logEvent(NfwNotification notification, boolean isPermissionMismatched) { private void logEvent(NfwNotification notification, boolean isPermissionMismatched) { Loading
telephony/java/android/telephony/CarrierConfigManager.java +0 −9 Original line number Original line Diff line number Diff line Loading @@ -2793,14 +2793,6 @@ public class CarrierConfigManager { */ */ public static final String KEY_NFW_PROXY_APPS_STRING = KEY_PREFIX + "nfw_proxy_apps"; public static final String KEY_NFW_PROXY_APPS_STRING = KEY_PREFIX + "nfw_proxy_apps"; /** * Specify whether to post a notification on the status bar whenever device location is * provided for non-framework location requests in user-initiated emergency use cases. * 0 - Do not post notification. This is default. * 1 - Post notification for all request types. */ public static final String KEY_ES_NOTIFY_INT = KEY_PREFIX + "es_notify_int"; private static PersistableBundle getDefaults() { private static PersistableBundle getDefaults() { PersistableBundle defaults = new PersistableBundle(); PersistableBundle defaults = new PersistableBundle(); defaults.putBoolean(KEY_PERSIST_LPP_MODE_BOOL, true); defaults.putBoolean(KEY_PERSIST_LPP_MODE_BOOL, true); Loading @@ -2815,7 +2807,6 @@ public class CarrierConfigManager { defaults.putString(KEY_GPS_LOCK_STRING, "3"); defaults.putString(KEY_GPS_LOCK_STRING, "3"); defaults.putString(KEY_ES_EXTENSION_SEC_STRING, "0"); defaults.putString(KEY_ES_EXTENSION_SEC_STRING, "0"); defaults.putString(KEY_NFW_PROXY_APPS_STRING, ""); defaults.putString(KEY_NFW_PROXY_APPS_STRING, ""); defaults.putInt(KEY_ES_NOTIFY_INT, 0); return defaults; return defaults; } } } } Loading