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

Commit d4753fb6 authored by Stanislav Zholnin's avatar Stanislav Zholnin
Browse files

Use updated DeviceConfig API's new getters to simplify invocations.

Test: manual verification
Change-Id: I609d9a1a3e1ab17fc1aee9ca4d5663d49ca17260
parent d9737e5a
Loading
Loading
Loading
Loading
+8 −42
Original line number Diff line number Diff line
@@ -65,52 +65,18 @@ public class SystemSettingsUtil {
    }

    public boolean enableRampingRingerFromDeviceConfig() {
        String enableRampingRinger = DeviceConfig.getProperty(
            DeviceConfig.NAMESPACE_TELEPHONY, RAMPING_RINGER_ENABLED);
        if (enableRampingRinger == null) {
            Log.i(this, "Telephony.RAMPING_RINGER_ENABLED is null");
            return false;
        }
        try {
            return Boolean.valueOf(enableRampingRinger);
        } catch (Exception e) {
            Log.wtf(this,
                "Error parsing Telephony.RAMPING_RINGER_ENABLED: " + e);
            return false;
        }
        return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_TELEPHONY, RAMPING_RINGER_ENABLED,
                false);
   }

    public int getRampingRingerDuration() {
        String rampingRingerDuration = DeviceConfig.getProperty(
                DeviceConfig.NAMESPACE_TELEPHONY, RAMPING_RINGER_DURATION_MILLIS);
        if (rampingRingerDuration == null) {
            Log.i(this, "Telephony.RAMPING_RINGER_DURATION is null");
            return -1;
        }
        try {
            return Integer.parseInt(rampingRingerDuration);
        } catch (Exception e) {
            Log.wtf(this,
                "Error parsing Telephony.RAMPING_RINGER_DURATION: " + e);
            return -1;
        }
	return DeviceConfig.getInt(DeviceConfig.NAMESPACE_TELEPHONY,
                RAMPING_RINGER_DURATION_MILLIS, -1);
    }

    public int getRampingRingerVibrationDuration() {
        String rampingRingerVibrationDuration = DeviceConfig.getProperty(
                DeviceConfig.NAMESPACE_TELEPHONY, RAMPING_RINGER_VIBRATION_DURATION);
        if (rampingRingerVibrationDuration == null) {
            Log.i(this,
                "Telephony.RAMPING_RINGER_VIBRATION_DURATION is null");
            return 0;
        }
        try {
            return Integer.parseInt(rampingRingerVibrationDuration);
        } catch (Exception e) {
            Log.wtf(this,
                "Error parsing Telephony.RAMPING_RINGER_VIBRATION_DURATION: " + e);
            return 0;
        }
        return DeviceConfig.getInt(DeviceConfig.NAMESPACE_TELEPHONY, 
                RAMPING_RINGER_VIBRATION_DURATION, 0);
    }
}