The method packageManagerService.getNextCodePath(String oldCodePath, String prefix, String suffix) threw StringIndexOutOfBoundsException if oldCodePath does not contain prefix, and prefix is longer than oldCodePath, or if the preix and suffix overlap. Fixes http://b/issue?id=2404232 Change-Id: Ib8abb16f8bfd08f607476d9289f46d170c43a076