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

Commit cac657fd authored by Naveen Kalla's avatar Naveen Kalla
Browse files

Rename TelephonyMonitor to ConnectivityMonitor

TelephonyMonitor can be extended to catch WIFI and GPS
issues.

Bug: 38422753
Test: Unit tests and manual testing
Change-Id: I71f9cf75fdc792452dd35a3581ef0f5fcc0c1ab0
parent 2d6ca033
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@
    <!-- When true enable color temperature setting. -->
    <bool name="config_enableColorTemperature">false</bool>

    <!-- Whether to show TelphonyMonitor switch in Developer Options -->
    <bool name="config_show_telephony_monitor">false</bool>
    <!-- Whether to show Connectivity Monitor switch in Developer Options -->
    <bool name="config_show_connectivity_monitor">false</bool>

    <!-- Whether to show Camera HAL HDR+ switch in Developer Options -->
    <bool name="config_show_camera_hal_hdrplus">false</bool>
+8 −2
Original line number Diff line number Diff line
@@ -8247,8 +8247,14 @@
    <!-- Toast message letting the user know the color temperature setting is not immediate -->
    <string name="color_temperature_toast">To apply color change, turn off screen</string>
    <!-- Toast message letting the user know the how to trigger telephony monitor -->
    <string name="telephony_monitor_toast">To apply telephony monitor change, reboot device</string>
    <!-- UI debug setting: title for ConnectivityMonitor switch [CHAR LIMIT=50] -->
    <string name="connectivity_monitor_switch">Connectivity Monitor</string>
    <!-- UI debug setting: summary for switch of ConnectivityMonitor [CHAR LIMIT=500] -->
    <string name="connectivity_monitor_switch_summary">ConnectivityMonitor will collect logs when it detects a connectivity problem and prompt notification to user to file a bug</string>
    <!-- Toast message letting the user know the how to apply connectivity monitor change -->
    <string name="connectivity_monitor_toast">To apply connectivity monitor change, reboot device</string>
    <!-- Title for Camera HAL HDR+ switch [CHAR LIMIT=50] -->
    <string name="camera_hal_hdrplus_switch">Camera HAL HDR+</string>
+3 −3
Original line number Diff line number Diff line
@@ -159,9 +159,9 @@
            android:entryValues="@array/select_logpersist_values" />

        <SwitchPreference
            android:key="telephony_monitor_switch"
            android:title="@string/telephony_monitor_switch"
            android:summary="@string/telephony_monitor_switch_summary"/>
            android:key="connectivity_monitor_switch"
            android:title="@string/connectivity_monitor_switch"
            android:summary="@string/connectivity_monitor_switch_summary"/>

        <SwitchPreference
            android:key="camera_laser_sensor_switch"
+16 −15
Original line number Diff line number Diff line
@@ -28,14 +28,14 @@ import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.R;
import com.android.settingslib.core.AbstractPreferenceController;

public class TelephonyMonitorPreferenceController extends AbstractPreferenceController implements
public class ConnectivityMonitorPreferenceController extends AbstractPreferenceController implements
        PreferenceControllerMixin {

    private static final String KEY_TELEPHONY_MONITOR_SWITCH = "telephony_monitor_switch";
    private static final String KEY_CONNECTIVITY_MONITOR_SWITCH = "connectivity_monitor_switch";
    @VisibleForTesting
    static final String BUILD_TYPE = "ro.build.type";
    @VisibleForTesting
    static final String PROPERTY_TELEPHONY_MONITOR = "persist.radio.enable_tel_mon";
    static final String PROPERTY_CONNECTIVITY_MONITOR = "persist.radio.enable_tel_mon";

    @VisibleForTesting
    static final String ENABLED_STATUS = "enabled";
@@ -48,7 +48,7 @@ public class TelephonyMonitorPreferenceController extends AbstractPreferenceCont

    private SwitchPreference mPreference;

    public TelephonyMonitorPreferenceController(Context context) {
    public ConnectivityMonitorPreferenceController(Context context) {
        super(context);
    }

@@ -56,19 +56,19 @@ public class TelephonyMonitorPreferenceController extends AbstractPreferenceCont
    public void displayPreference(PreferenceScreen screen) {
        super.displayPreference(screen);
        if (isAvailable()) {
            mPreference = (SwitchPreference) screen.findPreference(KEY_TELEPHONY_MONITOR_SWITCH);
            mPreference.setChecked(isTelephonyMonitorEnabled());
            mPreference = (SwitchPreference) screen.findPreference(KEY_CONNECTIVITY_MONITOR_SWITCH);
            mPreference.setChecked(isConnectivityMonitorEnabled());
        }
    }

    @Override
    public String getPreferenceKey() {
        return KEY_TELEPHONY_MONITOR_SWITCH;
        return KEY_CONNECTIVITY_MONITOR_SWITCH;
    }

    @Override
    public boolean isAvailable() {
        return mContext.getResources().getBoolean(R.bool.config_show_telephony_monitor) &&
        return mContext.getResources().getBoolean(R.bool.config_show_connectivity_monitor) &&
                (SystemProperties.get(BUILD_TYPE).equals("userdebug") ||
                        SystemProperties.get(BUILD_TYPE).equals("eng"));
    }
@@ -80,11 +80,11 @@ public class TelephonyMonitorPreferenceController extends AbstractPreferenceCont

    @Override
    public boolean handlePreferenceTreeClick(Preference preference) {
        if (KEY_TELEPHONY_MONITOR_SWITCH.equals(preference.getKey())) {
        if (KEY_CONNECTIVITY_MONITOR_SWITCH.equals(preference.getKey())) {
            final SwitchPreference switchPreference = (SwitchPreference) preference;
            SystemProperties.set(PROPERTY_TELEPHONY_MONITOR,
            SystemProperties.set(PROPERTY_CONNECTIVITY_MONITOR,
                    switchPreference.isChecked() ? USER_ENABLED_STATUS : USER_DISABLED_STATUS);
            Toast.makeText(mContext, R.string.telephony_monitor_toast,
            Toast.makeText(mContext, R.string.connectivity_monitor_toast,
                    Toast.LENGTH_LONG).show();
            return true;
        }
@@ -101,14 +101,15 @@ public class TelephonyMonitorPreferenceController extends AbstractPreferenceCont
        if (!isAvailable()) {
            return false;
        }
        final boolean enabled = isTelephonyMonitorEnabled();
        final boolean enabled = isConnectivityMonitorEnabled();
        mPreference.setChecked(enabled);
        return enabled;
    }

    private boolean isTelephonyMonitorEnabled() {
        final String tmStatus = SystemProperties.get(PROPERTY_TELEPHONY_MONITOR, DISABLED_STATUS);
        return ENABLED_STATUS.equals(tmStatus) || USER_ENABLED_STATUS.equals(tmStatus);
    private boolean isConnectivityMonitorEnabled() {
        final String cmStatus = SystemProperties.get(PROPERTY_CONNECTIVITY_MONITOR,
                DISABLED_STATUS);
        return ENABLED_STATUS.equals(cmStatus) || USER_ENABLED_STATUS.equals(cmStatus);
    }

}
+6 −6
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
    private DevelopmentSwitchBarController mSwitchBarController;
    private BugReportPreferenceController mBugReportController;
    private BugReportInPowerPreferenceController mBugReportInPowerController;
    private TelephonyMonitorPreferenceController mTelephonyMonitorController;
    private ConnectivityMonitorPreferenceController mConnectivityMonitorController;
    private CameraHalHdrplusPreferenceController mCameraHalHdrplusController;
    private CameraLaserSensorPreferenceController mCameraLaserSensorController;

@@ -374,7 +374,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment

        mBugReportController = new BugReportPreferenceController(getActivity());
        mBugReportInPowerController = new BugReportInPowerPreferenceController(getActivity());
        mTelephonyMonitorController = new TelephonyMonitorPreferenceController(getActivity());
        mConnectivityMonitorController = new ConnectivityMonitorPreferenceController(getActivity());
        mLogdSizeController = new LogdSizePreferenceController(getActivity());
        mLogpersistController = new LogpersistPreferenceController(getActivity(), getLifecycle());
        mWebViewAppPrefController = new WebViewAppPreferenceController(getActivity());
@@ -412,7 +412,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment

        mBugReportController.displayPreference(preferenceScreen);
        mBugReportInPowerController.displayPreference(preferenceScreen);
        mTelephonyMonitorController.displayPreference(preferenceScreen);
        mConnectivityMonitorController.displayPreference(preferenceScreen);
        mLogdSizeController.displayPreference(preferenceScreen);
        mLogpersistController.displayPreference(preferenceScreen);
        mWebViewAppPrefController.displayPreference(preferenceScreen);
@@ -624,7 +624,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
        }
        mEnableAdbController.enablePreference(enabled);
        mBugReportInPowerController.enablePreference(enabled);
        mTelephonyMonitorController.enablePreference(enabled);
        mConnectivityMonitorController.enablePreference(enabled);
        mLogdSizeController.enablePreference(enabled);
        mLogpersistController.enablePreference(enabled);
        mWebViewAppPrefController.enablePreference(enabled);
@@ -774,7 +774,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
                            == PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
        }
        mHaveDebugSettings |= mBugReportInPowerController.updatePreference();
        mHaveDebugSettings |= mTelephonyMonitorController.updatePreference();
        mHaveDebugSettings |= mConnectivityMonitorController.updatePreference();
        mHaveDebugSettings |= mCameraHalHdrplusController.updatePreference();
        mHaveDebugSettings |= mCameraLaserSensorController.updatePreference();
        updateSwitchPreference(mKeepScreenOn, Settings.Global.getInt(cr,
@@ -2210,7 +2210,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
            return true;
        }

        if (mTelephonyMonitorController.handlePreferenceTreeClick(preference)) {
        if (mConnectivityMonitorController.handlePreferenceTreeClick(preference)) {
            return true;
        }

Loading