treat application/activity names in AndroidManifest.xml as dot-prefixed when they don't contain any dots

This commit is contained in:
Mis012
2024-03-07 15:44:21 +01:00
parent 6d587a19e5
commit ecaf968da1
2 changed files with 11 additions and 25 deletions

View File

@@ -101,9 +101,10 @@ public class Context extends Object {
Application application;
ResXmlAttribute application_name = manifest.getApplicationElement().searchAttributeByResourceId(AndroidManifestBlock.ID_name);
String className = (application_name != null) ? application_name.getValueAsString() : "android.app.Application";
if (className.startsWith(".")) {
if(className.indexOf('.') == -1)
className = "." + className;
if (className.startsWith("."))
className = manifest.getPackageName() + className;
}
Class<? extends Application> cls = Class.forName(className).asSubclass(Application.class);
Constructor<? extends Application> constructor = cls.getConstructor();
application = constructor.newInstance();