From 0cf1d3990fd1b2e2b0c21cf9d3068caa7d6ec925 Mon Sep 17 00:00:00 2001 From: Beverly Date: Tue, 24 Nov 2020 12:43:40 -0500 Subject: [PATCH] Remove unnecessary catch statement The IllegalFormatConversionException catch statement was added when there was a change in a string that required a new translation in all languages (in P). All translations should be properly updated now, so we shouldn't need this catch statement. [If we do see this exception, we should check the locale and update the string's translation.] Test: manual Fixes: 174014345 Change-Id: I790870cb90ca8f6904ef73f481928a7cdd2faa05 --- .../KeyguardIndicationController.java | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index a252a7a122748..3765e5a26e8ef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -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); } }