Prevent index out of bounds when using String.substring.

Change-Id: Ib30f9646e9895b6a2f065a0b2e51cf53e821b087
This commit is contained in:
Filip Gruszczynski
2014-10-14 12:06:06 -07:00
parent 72f6e8ce81
commit 5a589430b3

View File

@@ -275,9 +275,10 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
} else {
mWallpaper.lastDiedTime = SystemClock.uptimeMillis();
}
final String flattened = name.flattenToString();
EventLog.writeEvent(EventLogTags.WP_WALLPAPER_CRASHED,
name.flattenToString().substring(0,
MAX_WALLPAPER_COMPONENT_LOG_LENGTH));
flattened.substring(0, Math.min(flattened.length(),
MAX_WALLPAPER_COMPONENT_LOG_LENGTH)));
}
}
}