OSDN Git Service

Add checking values not to save illegal value to appwidgets.xml
authorTakamasa Kuramitsu <takamasa.kuramitsu@sonymobile.com>
Mon, 18 Sep 2017 01:49:41 +0000 (10:49 +0900)
committerTakamasa Kuramitsu <takamasa.kuramitsu@sonymobile.com>
Tue, 19 Sep 2017 07:27:24 +0000 (16:27 +0900)
commitd6da1e3ee20ca24781a0fa49a67f8500896fab9f
treea78700d1ef6ecb7d31a60153f95f0aad40912d1d
parent67d16ec1ab8354ff9ab4ef2a7ad86363903241db
Add checking values not to save illegal value to appwidgets.xml

Symptom:
All AppWidgets on Home screen disppear after appwidgets.xml updated
with invalid value.

Root cause:
The issue occurs when size information of an AppWidget is set to 0
via AppWidgetHostView#updateAppWidgetSize() API.
Since width and height are taken positive padding, so they become
negative number and are sent to
AppWidgetServiceImpl#updateAppWidgetOptions().
In updateAppWidgetOptions(), convert values by
Integer.toHexString() to save widget parameters to appwidgets.xml,
but negative numbers become illegal values for Integer.parseInt().
After device is rebooted, widgets cannot be reloaded because parsing
appwidgets.xml fail by NumberFormatException at Integer.parseInt().

Solution:
When writing the widget's info to appwidgets.xml, check the size
parameters and replace with 0 if they're negative value.

Bug: 65705916

Change-Id: I48f69fbf081201a176ea1093094ba6cdb120e5f5
services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java