• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

修訂f333b9570432d7b847364a145cb36225b7cd07d1 (tree)
時間2019-02-26 06:54:48
作者JP Sugarbroad <jpsugar@goog...>
CommiterJP Sugarbroad

Log Message

Revert "Adding SUPL NI Emergency Extension Time"

This reverts commit 1f6d71f856ee770ecc24df446bd3693e0de0fbe0.

Change Summary

差異

--- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
+++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
@@ -17,7 +17,6 @@
1717 package com.android.internal.location;
1818
1919 import java.io.UnsupportedEncodingException;
20-import java.util.concurrent.TimeUnit;
2120
2221 import android.app.Notification;
2322 import android.app.NotificationManager;
@@ -28,7 +27,6 @@ import android.content.Intent;
2827 import android.content.IntentFilter;
2928 import android.location.LocationManager;
3029 import android.location.INetInitiatedListener;
31-import android.os.SystemClock;
3230 import android.telephony.TelephonyManager;
3331 import android.telephony.PhoneNumberUtils;
3432 import android.telephony.PhoneStateListener;
@@ -51,7 +49,8 @@ public class GpsNetInitiatedHandler {
5149
5250 private static final String TAG = "GpsNetInitiatedHandler";
5351
54- private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
52+ private static final boolean DEBUG = true;
53+ private static final boolean VERBOSE = false;
5554
5655 // NI verify activity for bringing up UI (not used yet)
5756 public static final String ACTION_NI_VERIFY = "android.intent.action.NETWORK_INITIATED_VERIFY";
@@ -94,9 +93,6 @@ public class GpsNetInitiatedHandler {
9493 public static final int GPS_ENC_SUPL_UCS2 = 3;
9594 public static final int GPS_ENC_UNKNOWN = -1;
9695
97- // Limit on SUPL NI emergency mode time extension after emergency sessions ends
98- private static final int MAX_EMERGENCY_MODE_EXTENSION_SECONDS = 300; // 5 minute maximum
99-
10096 private final Context mContext;
10197 private final TelephonyManager mTelephonyManager;
10298 private final PhoneStateListener mPhoneStateListener;
@@ -112,7 +108,7 @@ public class GpsNetInitiatedHandler {
112108 private volatile boolean mIsSuplEsEnabled;
113109
114110 // Set to true if the phone is having emergency call.
115- private volatile boolean mIsInEmergencyCall;
111+ private volatile boolean mIsInEmergency;
116112
117113 // If Location function is enabled.
118114 private volatile boolean mIsLocationEnabled = false;
@@ -122,10 +118,6 @@ public class GpsNetInitiatedHandler {
122118 // Set to true if string from HAL is encoded as Hex, e.g., "3F0039"
123119 static private boolean mIsHexInput = true;
124120
125- // End time of emergency call, and extension, if set
126- private long mCallEndElapsedRealtimeMillis = 0;
127- private long mEmergencyExtensionMillis = 0;
128-
129121 public static class GpsNiNotification
130122 {
131123 public int notificationId;
@@ -156,12 +148,16 @@ public class GpsNetInitiatedHandler {
156148 if (action.equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
157149 String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
158150 /*
159- Tracks the emergency call:
160- mIsInEmergencyCall records if the phone is in emergency call or not. It will
151+ Emergency Mode is when during emergency call or in emergency call back mode.
152+ For checking if it is during emergency call:
153+ mIsInEmergency records if the phone is in emergency call or not. It will
161154 be set to true when the phone is having emergency call, and then will
162155 be set to false by mPhoneStateListener when the emergency call ends.
156+ For checking if it is in emergency call back mode:
157+ Emergency call back mode will be checked by reading system properties
158+ when necessary: SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE)
163159 */
164- mIsInEmergencyCall = PhoneNumberUtils.isEmergencyNumber(phoneNumber);
160+ setInEmergency(PhoneNumberUtils.isEmergencyNumber(phoneNumber));
165161 if (DEBUG) Log.v(TAG, "ACTION_NEW_OUTGOING_CALL - " + getInEmergency());
166162 } else if (action.equals(LocationManager.MODE_CHANGED_ACTION)) {
167163 updateLocationMode();
@@ -201,10 +197,7 @@ public class GpsNetInitiatedHandler {
201197 if (DEBUG) Log.d(TAG, "onCallStateChanged(): state is "+ state);
202198 // listening for emergency call ends
203199 if (state == TelephonyManager.CALL_STATE_IDLE) {
204- if (mIsInEmergencyCall) {
205- mCallEndElapsedRealtimeMillis = SystemClock.elapsedRealtime();
206- mIsInEmergencyCall = false;
207- }
200+ setInEmergency(false);
208201 }
209202 }
210203 };
@@ -238,36 +231,23 @@ public class GpsNetInitiatedHandler {
238231 return mIsLocationEnabled;
239232 }
240233
241- /**
242- * Determines whether device is in user-initiated emergency session based on the following
243- * 1. If the user is making an emergency call, this is provided by actively
244- * monitoring the outgoing phone number;
245- * 2. If the user has recently ended an emergency call, and the device is in a configured time
246- * window after the end of that call.
247- * 3. If the device is in a emergency callback state, this is provided by querying
248- * TelephonyManager.
249- * @return true if is considered in user initiated emergency mode for NI purposes
250- */
234+ // Note: Currently, there are two mechanisms involved to determine if a
235+ // phone is in emergency mode:
236+ // 1. If the user is making an emergency call, this is provided by activly
237+ // monitoring the outgoing phone number;
238+ // 2. If the device is in a emergency callback state, this is provided by
239+ // system properties.
240+ // If either one of above exists, the phone is considered in an emergency
241+ // mode. Because of this complexity, we need to be careful about how to set
242+ // and clear the emergency state.
243+ public void setInEmergency(boolean isInEmergency) {
244+ mIsInEmergency = isInEmergency;
245+ }
246+
251247 public boolean getInEmergency() {
252- boolean isInEmergencyExtension =
253- (SystemClock.elapsedRealtime() - mCallEndElapsedRealtimeMillis) <
254- mEmergencyExtensionMillis;
255248 boolean isInEmergencyCallback = Boolean.parseBoolean(
256249 SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE));
257- return mIsInEmergencyCall || isInEmergencyCallback || isInEmergencyExtension;
258- }
259-
260- public void setEmergencyExtensionSeconds(int emergencyExtensionSeconds) {
261- if (emergencyExtensionSeconds > MAX_EMERGENCY_MODE_EXTENSION_SECONDS) {
262- Log.w(TAG, "emergencyExtensionSeconds " + emergencyExtensionSeconds
263- + " too high, reset to " + MAX_EMERGENCY_MODE_EXTENSION_SECONDS);
264- emergencyExtensionSeconds = MAX_EMERGENCY_MODE_EXTENSION_SECONDS;
265- } else if (emergencyExtensionSeconds < 0) {
266- Log.w(TAG, "emergencyExtensionSeconds " + emergencyExtensionSeconds
267- + " is negative, reset to zero.");
268- emergencyExtensionSeconds = 0;
269- }
270- mEmergencyExtensionMillis = TimeUnit.SECONDS.toMillis(emergencyExtensionSeconds);
250+ return mIsInEmergency || isInEmergencyCallback;
271251 }
272252
273253
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -675,17 +675,6 @@ public class GnssLocationProvider implements LocationProviderInterface {
675675 Log.e(TAG, "unable to parse SUPL_ES: " + suplESProperty);
676676 }
677677 }
678-
679- String emergencyExtensionSecondsString
680- = properties.getProperty("ES_EXTENSION_SEC", "0");
681- try {
682- int emergencyExtensionSeconds =
683- Integer.parseInt(emergencyExtensionSecondsString);
684- mNIHandler.setEmergencyExtensionSeconds(emergencyExtensionSeconds);
685- } catch (NumberFormatException e) {
686- Log.e(TAG, "unable to parse ES_EXTENSION_SEC: "
687- + emergencyExtensionSecondsString);
688- }
689678 }
690679
691680 private void loadPropertiesFromResource(Context context,