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

Commit 6f4b1853 authored by Hall Liu's avatar Hall Liu
Browse files

Split "Mobile Network Type" indication in Settings

Display data and voice network type for clarity

Change-Id: I26e52dcc564dfd96e36e45d94d6e69225ea4a80f
Fixes: 70938010
Test: manual, unit
parent 47862916
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -105,13 +105,26 @@

        <TextView
            style="@style/device_info_dialog_label"
            android:id="@+id/network_type_label"
            android:id="@+id/voice_network_type_label"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/status_network_type"/>
            android:text="@string/status_voice_network_type"/>
        <TextView
            style="@style/device_info_dialog_value"
            android:id="@+id/network_type_value"
            android:id="@+id/voice_network_type_value"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/device_info_not_available"/>

        <TextView
            style="@style/device_info_dialog_label"
            android:id="@+id/data_network_type_label"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/status_data_network_type"/>
        <TextView
            style="@style/device_info_dialog_value"
            android:id="@+id/data_network_type_value"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/device_info_not_available"/>
+3 −1
Original line number Diff line number Diff line
@@ -2751,7 +2751,9 @@
    <!-- About phone, status item title.  The ICCID of the current LTE device. [CHAR LIMIT=30] -->
    <string name="status_icc_id">ICCID</string>
    <!-- About phone, status item title for the type of data phone network we're connected to, for example 3G or Edge or GPRS -->
    <string name="status_network_type">Mobile network type</string>
    <string name="status_data_network_type">Mobile data network type</string>
    <!-- About phone, status item title for the type of voice phone network we're connected to, for example 3G or Edge or GPRS -->
    <string name="status_voice_network_type">Mobile voice network type</string>
    <!-- About phone, status item title for the latest area info cell broadcast received (Brazil only). -->
    <string name="status_latest_area_info">Operator info</string>
    <!-- About phone, status item title. The status of data access.  For example, the value may be "Connected" -->
+0 −97
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/sim_status_title">

    <Preference android:key="operator_name"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_operator"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="signal_strength"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_signal_strength"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="network_type"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_network_type"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="latest_area_info"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_latest_area_info"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="service_state"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_service_state"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="roaming_state"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_roaming"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="data_state"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_data_state"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="number"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_number"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="imei"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_imei"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="imei_sv"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_imei_sv"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

    <Preference android:key="iccid"
        android:enabled="false"
        android:shouldDisableView="false"
        android:title="@string/status_iccid"
        android:summary="@string/device_info_not_available"
        android:persistent="false" />

</PreferenceScreen>
+20 −9
Original line number Diff line number Diff line
@@ -77,7 +77,9 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
    @VisibleForTesting
    final static int SIGNAL_STRENGTH_VALUE_ID = R.id.signal_strength_value;
    @VisibleForTesting
    final static int CELLULAR_NETWORK_TYPE_VALUE_ID = R.id.network_type_value;
    final static int CELL_VOICE_NETWORK_TYPE_VALUE_ID = R.id.voice_network_type_value;
    @VisibleForTesting
    final static int CELL_DATA_NETWORK_TYPE_VALUE_ID = R.id.data_network_type_value;
    @VisibleForTesting
    final static int ROAMING_INFO_VALUE_ID = R.id.roaming_state_value;
    @VisibleForTesting
@@ -318,14 +320,16 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O

    private void updateNetworkType() {
        // Whether EDGE, UMTS, etc...
        String networktype = null;
        String dataNetworkTypeName = null;
        String voiceNetworkTypeName = null;
        final int subId = mSubscriptionInfo.getSubscriptionId();
        final int actualDataNetworkType = mTelephonyManager.getDataNetworkType(subId);
        final int actualVoiceNetworkType = mTelephonyManager.getVoiceNetworkType(subId);
        if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualDataNetworkType) {
            networktype = mTelephonyManager.getNetworkTypeName(actualDataNetworkType);
        } else if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualVoiceNetworkType) {
            networktype = mTelephonyManager.getNetworkTypeName(actualVoiceNetworkType);
            dataNetworkTypeName = mTelephonyManager.getNetworkTypeName(actualDataNetworkType);
        }
        if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualVoiceNetworkType) {
            voiceNetworkTypeName = mTelephonyManager.getNetworkTypeName(actualVoiceNetworkType);
        }

        boolean show4GForLTE = false;
@@ -336,13 +340,20 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
                    "bool" /* default type */, "com.android.systemui" /* default package */);
            show4GForLTE = con.getResources().getBoolean(id);
        } catch (PackageManager.NameNotFoundException e) {
            Log.e(TAG, "NameNotFoundException for show4GFotLTE");
            Log.e(TAG, "NameNotFoundException for show4GForLTE");
        }

        if (TextUtils.equals(networktype, "LTE") && show4GForLTE) {
            networktype = "4G";
        if (show4GForLTE) {
            if ("LTE".equals(dataNetworkTypeName)) {
                dataNetworkTypeName = "4G";
            }
            if ("LTE".equals(voiceNetworkTypeName)) {
                voiceNetworkTypeName = "4G";
            }
        mDialog.setText(CELLULAR_NETWORK_TYPE_VALUE_ID, networktype);
        }

        mDialog.setText(CELL_VOICE_NETWORK_TYPE_VALUE_ID, voiceNetworkTypeName);
        mDialog.setText(CELL_DATA_NETWORK_TYPE_VALUE_ID, dataNetworkTypeName);
    }

    private void updateRoamingStatus(ServiceState serviceState) {
+15 −3
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@

package com.android.settings.deviceinfo.simstatus;

import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELLULAR_NETWORK_TYPE_VALUE_ID;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_DATA_NETWORK_TYPE_VALUE_ID;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_VOICE_NETWORK_TYPE_VALUE_ID;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.EID_INFO_VALUE_ID;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_LABEL_ID;
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_VALUE_ID;
@@ -188,13 +189,24 @@ public class SimStatusDialogControllerTest {
    }

    @Test
    public void initialize_updateNetworkTypeWithEdge_shouldUpdateSettingToEdge() {
    public void initialize_updateVoiceNetworkTypeWithEdge_shouldUpdateSettingToEdge() {
        when(mTelephonyManager.getVoiceNetworkType(anyInt())).thenReturn(
                TelephonyManager.NETWORK_TYPE_EDGE);

        mController.initialize();

        verify(mDialog).setText(CELL_VOICE_NETWORK_TYPE_VALUE_ID,
                TelephonyManager.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE));
    }

    @Test
    public void initialize_updateDataNetworkTypeWithEdge_shouldUpdateSettingToEdge() {
        when(mTelephonyManager.getDataNetworkType(anyInt())).thenReturn(
                TelephonyManager.NETWORK_TYPE_EDGE);

        mController.initialize();

        verify(mDialog).setText(CELLULAR_NETWORK_TYPE_VALUE_ID,
        verify(mDialog).setText(CELL_DATA_NETWORK_TYPE_VALUE_ID,
                TelephonyManager.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE));
    }