File tree Expand file tree Collapse file tree 5 files changed +43
-13
lines changed
telephony/java/com/android/internal/telephony Expand file tree Collapse file tree 5 files changed +43
-13
lines changed Original file line number Diff line number Diff line change @@ -676,6 +676,15 @@ public boolean getAnyDataEnabled() {
676676 return result ;
677677 }
678678
679+ protected boolean isEmergency () {
680+ final boolean result ;
681+ synchronized (mDataEnabledLock ) {
682+ result = mPhone .isInEcm () || mPhone .isInEmergencyCall ();
683+ }
684+ log ("isEmergency: result=" + result );
685+ return result ;
686+ }
687+
679688 protected int apnTypeToId (String type ) {
680689 if (TextUtils .equals (type , Phone .APN_TYPE_DEFAULT )) {
681690 return APN_DEFAULT_ID ;
@@ -981,17 +990,14 @@ public boolean setInternalDataEnabled(boolean enable) {
981990
982991 protected void onSetInternalDataEnabled (boolean enabled ) {
983992 synchronized (mDataEnabledLock ) {
984- final boolean prevEnabled = getAnyDataEnabled ();
985- if (mInternalDataEnabled != enabled ) {
986- mInternalDataEnabled = enabled ;
987- if (prevEnabled != getAnyDataEnabled ()) {
988- if (!prevEnabled ) {
989- resetAllRetryCounts ();
990- onTrySetupData (Phone .REASON_DATA_ENABLED );
991- } else {
992- cleanUpAllConnections (null );
993- }
994- }
993+ mInternalDataEnabled = enabled ;
994+ if (enabled ) {
995+ log ("onSetInternalDataEnabled: changed to enabled, try to setup data call" );
996+ resetAllRetryCounts ();
997+ onTrySetupData (Phone .REASON_DATA_ENABLED );
998+ } else {
999+ log ("onSetInternalDataEnabled: changed to disabled, cleanUpAllConnections" );
1000+ cleanUpAllConnections (null );
9951001 }
9961002 }
9971003 }
Original file line number Diff line number Diff line change @@ -832,6 +832,22 @@ public void notifyOtaspChanged(int otaspMode) {
832832 mNotifier .notifyOtaspChanged (this , otaspMode );
833833 }
834834
835+ /**
836+ * @return true if a mobile originating emergency call is active
837+ */
838+ public boolean isInEmergencyCall () {
839+ return false ;
840+ }
841+
842+ /**
843+ * @return true if we are in the emergency call back mode. This is a period where
844+ * the phone should be using as little power as possible and be ready to receive an
845+ * incoming call from the emergency operator.
846+ */
847+ public boolean isInEcm () {
848+ return false ;
849+ }
850+
835851 public abstract String getPhoneName ();
836852
837853 public abstract int getPhoneType ();
Original file line number Diff line number Diff line change @@ -848,6 +848,14 @@ void notifyUnknownConnection() {
848848 mUnknownConnectionRegistrants .notifyResult (this );
849849 }
850850
851+ public boolean isInEmergencyCall () {
852+ return mCT .isInEmergencyCall ();
853+ }
854+
855+ public boolean isInEcm () {
856+ return mIsPhoneInEcmState ;
857+ }
858+
851859 void sendEmergencyCallbackModeChange (){
852860 //Send an Intent
853861 Intent intent = new Intent (TelephonyIntents .ACTION_EMERGENCY_CALLBACK_MODE_CHANGED );
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ private boolean trySetupData(String reason) {
248248 boolean desiredPowerState = mCdmaPhone .mSST .getDesiredPowerState ();
249249
250250 if ((mState == State .IDLE || mState == State .SCANNING ) &&
251- isDataAllowed () && getAnyDataEnabled ()) {
251+ isDataAllowed () && getAnyDataEnabled () && ! isEmergency () ) {
252252 boolean retValue = setupData (reason );
253253 notifyOffApnsOfAvailability (reason );
254254 return retValue ;
Original file line number Diff line number Diff line change @@ -686,7 +686,7 @@ private boolean trySetupData(ApnContext apnContext) {
686686 boolean desiredPowerState = mPhone .getServiceStateTracker ().getDesiredPowerState ();
687687
688688 if ((apnContext .getState () == State .IDLE || apnContext .getState () == State .SCANNING ) &&
689- isDataAllowed (apnContext ) && getAnyDataEnabled ()) {
689+ isDataAllowed (apnContext ) && getAnyDataEnabled () && ! isEmergency () ) {
690690
691691 if (apnContext .getState () == State .IDLE ) {
692692 ArrayList <ApnSetting > waitingApns = buildWaitingApns (apnContext .getApnType ());
You can’t perform that action at this time.
0 commit comments