Resources + LayoutInflater: throw same Exceptions as on AOSP

This commit is contained in:
Julian Winkler
2023-09-01 12:39:20 +02:00
parent f968bcd7c4
commit c6b98b14f8
4 changed files with 21 additions and 9 deletions

View File

@@ -572,7 +572,7 @@ public final class AssetManager {
* @param fileName The name of the file to retrieve.
*/
public final XmlResourceParser openXmlResourceParser(int cookie,
String fileName) throws /*IO*/ Exception {
String fileName) throws IOException {
/* XmlBlock block = openXmlBlockAsset(cookie, fileName);
XmlResourceParser rp = block.newParser();
block.close();

View File

@@ -940,7 +940,7 @@ public class Resources {
*
* @see #getXml
*/
public XmlResourceParser getLayout(int id) throws /*NotFound*/ Exception {
public XmlResourceParser getLayout(int id) throws NotFoundException {
return loadXmlResourceParser(id, "layout");
}
@@ -2280,7 +2280,7 @@ public class Resources {
}
/*package*/ XmlResourceParser loadXmlResourceParser(int id, String type)
throws /*NotFound*/ Exception {
throws NotFoundException {
synchronized (mAccessLock) {
TypedValue value = mTmpValue;
if (value == null) {
@@ -2297,8 +2297,12 @@ public class Resources {
}
/*package*/ XmlResourceParser loadXmlResourceParser(String file, int id,
int assetCookie, String type) throws /*NotFound*/ Exception {
return mAssets.openXmlResourceParser(assetCookie, file);
int assetCookie, String type) throws NotFoundException {
try {
return mAssets.openXmlResourceParser(assetCookie, file);
} catch (IOException e) {
throw new RuntimeException(e);
}
/* if (id != 0) {
try {
// These may be compiled...