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

Commit e48ddb53 authored by Haofan Wang's avatar Haofan Wang
Browse files

Fix brightness type bug

When brightness adjusts to 1.0 or 0.0, the double will become integer.
(1 and 0) Now put string brightness value in the json file and handle it
when convert to bundle from Json.

Bug: 421266416
Flag: EXEMPT bugfix
Test: tested on gambit and checked database
Change-Id: I346854aa1f77c89fe3e5d6fb8095aa0d9f9fe7d4
parent 7da535c8
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -1456,7 +1456,7 @@ public final class MediaQualityUtils {
                } else if (value instanceof Boolean) {
                    json.put(key, bundle.getBoolean(key));
                } else if (value instanceof Double) {
                    json.put(key, bundle.getDouble(key));
                    json.put(key, Double.toString(bundle.getDouble(key)));
                }
            } catch (JSONException e) {
                Log.e(TAG, "Unable to serialize ", e);
@@ -1478,7 +1478,15 @@ public final class MediaQualityUtils {
                    Object value = jsonObject.get(key);

                    if (value instanceof String) {
                        if (key.equals(PictureQuality.PARAMETER_BRIGHTNESS)) {
                            try {
                                bundle.putDouble(key, Double.parseDouble((String) value));
                            } catch (NumberFormatException e) {
                                Log.e(TAG, "Error when parsing brightness value as double");
                            }
                        } else {
                            bundle.putString(key, (String) value);
                        }
                    } else if (value instanceof Integer) {
                        bundle.putInt(key, (Integer) value);
                    } else if (value instanceof Boolean) {