Prevent NFE in SystemUI when parsing invalid int

A user can change the sysui_rounded_content_padding setting via adb.

If the value set is not an integer, SystemUI will end up in an exception
loop.

Bug: 117152006
Test: No crash when running:
      adb exec-out settings put secure sysui_rounded_content_padding a
Change-Id: I49cace6087effae20170eab9175fc84ebcd21781
This commit is contained in:
Edward Savage-Jones
2018-10-02 17:27:27 +02:00
committed by Ed Savage-Jones
parent 45db25d742
commit 9a17312da5

View File

@@ -51,7 +51,9 @@ public class TunablePadding implements Tunable {
public void onTuningChanged(String key, String newValue) {
int dimen = mDefaultSize;
if (newValue != null) {
dimen = (int) (Integer.parseInt(newValue) * mDensity);
try {
dimen = (int) (Integer.parseInt(newValue) * mDensity);
} catch (NumberFormatException ex) {}
}
int left = mView.isLayoutRtl() ? FLAG_END : FLAG_START;
int right = mView.isLayoutRtl() ? FLAG_START : FLAG_END;