Merge "Remove unnecessary catch statement"

This commit is contained in:
TreeHugger Robot
2020-12-02 09:22:25 +00:00
committed by Android (Google) Code Review

View File

@@ -69,7 +69,6 @@ import com.android.systemui.util.wakelock.WakeLock;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.text.NumberFormat;
import java.util.IllegalFormatConversionException;
import javax.inject.Inject;
@@ -575,24 +574,12 @@ public class KeyguardIndicationController implements StateListener,
String percentage = NumberFormat.getPercentInstance()
.format(mBatteryLevel / 100f);
if (hasChargingTime) {
// We now have battery percentage in these strings and it's expected that all
// locales will also have it in the future. For now, we still have to support the old
// format until all languages get the new translations.
String chargingTimeFormatted = Formatter.formatShortElapsedTimeRoundingUpToMinutes(
mContext, mChargingTimeRemaining);
try {
return mContext.getResources().getString(chargingId, chargingTimeFormatted,
percentage);
} catch (IllegalFormatConversionException e) {
return mContext.getResources().getString(chargingId, chargingTimeFormatted);
}
return mContext.getResources().getString(chargingId, chargingTimeFormatted,
percentage);
} else {
// Same as above
try {
return mContext.getResources().getString(chargingId, percentage);
} catch (IllegalFormatConversionException e) {
return mContext.getResources().getString(chargingId);
}
return mContext.getResources().getString(chargingId, percentage);
}
}