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

Commit 0dc5968b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 0daee531 d4753fb6
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);
    }
}