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

Commit b4393f78 authored by jiadongz's avatar jiadongz
Browse files

Update HD tag on status bar for IMS registration

Listen ims registeration state change and
add HD tag to network names on status bar.

Change-Id: If6ec8a58ff0270d11fdf95f69ca9da39fdb9a954
parent 8b09d9ec
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -935,4 +935,5 @@

    <!-- Accessibility string for current zen mode and selected exit condition. A template that simply concatenates existing mode string and the current condition description. [CHAR LIMIT=20] -->
    <string name="zen_mode_and_condition"><xliff:g id="zen_mode" example="Priority interruptions only">%1$s</xliff:g>. <xliff:g id="exit_condition" example="For one hour">%2$s</xliff:g></string>
    <string name="high_definiation_voice">(HD)</string>
</resources>
+16 −1
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.SubInfoRecord;
import android.telephony.TelephonyManager;
import android.telephony.VoLteServiceState;

import android.text.TextUtils;
import android.util.Slog;
import android.view.View;
@@ -250,7 +252,8 @@ public class MSimNetworkControllerImpl extends NetworkControllerImpl {
                                        | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
                                        | PhoneStateListener.LISTEN_CALL_STATE
                                        | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
                                        | PhoneStateListener.LISTEN_DATA_ACTIVITY);
                                        | PhoneStateListener.LISTEN_DATA_ACTIVITY
                                        | PhoneStateListener.LISTEN_VOLTE_STATE);
                    } else {
                        mMSimPhoneStateListener[i] = null;
                    }
@@ -602,6 +605,18 @@ public class MSimNetworkControllerImpl extends NetworkControllerImpl {
                updateDataIcon(phoneId);
                refreshViews(phoneId);
            }

            @Override
            public void onVoLteServiceStateChanged(VoLteServiceState stateInfo) {
                int phoneId = getPhoneId(mSubId);
                if (stateInfo.getSrvccState() == VoLteServiceState.IMS_REGISTERED) {
                    updateImsRegistrationForNewtorkName(true);
                    refreshViews(phoneId);
                } else if (stateInfo.getSrvccState() == VoLteServiceState.IMS_UNREGISTERED) {
                    updateImsRegistrationForNewtorkName(false);
                    refreshViews(phoneId);
                }
            }
        };
        return mMSimPhoneStateListener;
    }
+28 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.telephony.VoLteServiceState;

import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.TelephonyIntents;
@@ -317,7 +318,8 @@ public class NetworkControllerImpl extends BroadcastReceiver
                        | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
                        | PhoneStateListener.LISTEN_CALL_STATE
                        | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
                        | PhoneStateListener.LISTEN_DATA_ACTIVITY);
                        | PhoneStateListener.LISTEN_DATA_ACTIVITY
                        | PhoneStateListener.LISTEN_VOLTE_STATE);
    }

    public void addPhoneSignalIconView(ImageView v) {
@@ -688,6 +690,17 @@ public class NetworkControllerImpl extends BroadcastReceiver
            updateDataIcon();
            refreshViews();
        }

        @Override
        public void onVoLteServiceStateChanged(VoLteServiceState stateInfo) {
            if (stateInfo.getSrvccState() == VoLteServiceState.IMS_REGISTERED) {
                updateImsRegistrationForNewtorkName(true);
                refreshViews();
            } else if (stateInfo.getSrvccState() == VoLteServiceState.IMS_UNREGISTERED) {
                updateImsRegistrationForNewtorkName(false);
                refreshViews();
            }
        }
    };

    private void updateCarrierText() {
@@ -1071,6 +1084,20 @@ public class NetworkControllerImpl extends BroadcastReceiver
        }
        return opeartorName;
    }

    public void updateImsRegistrationForNewtorkName(boolean registered) {
        String hdTag = mContext.getResources().getString(R.string.high_definiation_voice);
        Log.d(TAG, "updateIMSRegistrationForNewtorkName " + hdTag
                + ";" + registered);
        if (registered) {
            mNetworkName = mNetworkName + hdTag;
        } else {
            if (mNetworkName.contains(hdTag)) {
                mNetworkName = mNetworkName.replace(hdTag, "");
            }
        }
    }

    // ===== Wifi ===================================================================

    class WifiHandler extends Handler {
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ public final class VoLteServiceState implements Parcelable {
    public static final int HANDOVER_FAILED    = 2;
    public static final int HANDOVER_CANCELED  = 3;

    public static final int IMS_REGISTERED = 4;
    public static final int IMS_UNREGISTERED = 5;
    private int mSrvccState;

    /**