summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Martinz <amartinz@shiftphones.com>2018-07-04 17:10:24 (GMT)
committerJoey Rizzoli <joey@lineageos.org>2018-07-14 13:31:11 (GMT)
commitc64d89382da590b15c15e5ee081a2ff044c321fa (patch)
tree566b19d15c9a80c9055fb792161ce04c7dbcc3ee
parent800007b10b19f7410e94b7945efab7eff5c0c0d5 (diff)
downloadandroid_packages_apps_Trebuchet-c64d89382da590b15c15e5ee081a2ff044c321fa.zip
android_packages_apps_Trebuchet-c64d89382da590b15c15e5ee081a2ff044c321fa.tar.gz
android_packages_apps_Trebuchet-c64d89382da590b15c15e5ee081a2ff044c321fa.tar.bz2
IconsHandler: prevent resource not found exception when getting xml
JavaDoc of Resources#getIdentifier(...): Returns - The associated resource identifier. Returns 0 if no such resource was found. (0 is not a valid resource ID.) Change-Id: Ia9f4ea9efb56bb54d94729f70a3afcec5bce7999 Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
-rw-r--r--src/com/android/launcher3/icons/IconsHandler.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/com/android/launcher3/icons/IconsHandler.java b/src/com/android/launcher3/icons/IconsHandler.java
index 04c2dcc..5cb9dc7 100644
--- a/src/com/android/launcher3/icons/IconsHandler.java
+++ b/src/com/android/launcher3/icons/IconsHandler.java
@@ -215,8 +215,8 @@ public class IconsHandler {
Resources res = mPackageManager.getResourcesForApplication(packageName);
mCurrentIconPackRes = res;
int resource = res.getIdentifier("drawable", "xml", packageName);
- if (resource < 0) {
- return;
+ if (resource <= 0) {
+ throw new NameNotFoundException("Could not get identifier for drawable.xml");
}
xpp = res.getXml(resource);
int eventType = xpp.getEventType();
@@ -234,7 +234,7 @@ public class IconsHandler {
}
} catch (NameNotFoundException | XmlPullParserException | IOException e) {
Log.i(TAG, "Error parsing drawable.xml for package " + packageName +
- " trying appfilter now");
+ ", trying appfilter now");
// fallback onto appfilter if drawable xml fails
loadIconPack(packageName, true);
}