Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc489aba authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Use Class.forName instead of ClassLoader.loadClass."

parents 847de831 7ef80307
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -512,7 +512,7 @@ public abstract class LayoutInflater {
        String layout = res.getResourceEntryName(resource);
        String layout = res.getResourceEntryName(resource);


        try {
        try {
            Class clazz = mPrecompiledClassLoader.loadClass("" + pkg + ".CompiledView");
            Class clazz = Class.forName("" + pkg + ".CompiledView", false, mPrecompiledClassLoader);
            Method inflater = clazz.getMethod(layout, Context.class, int.class);
            Method inflater = clazz.getMethod(layout, Context.class, int.class);
            View view = (View) inflater.invoke(null, mContext, resource);
            View view = (View) inflater.invoke(null, mContext, resource);


@@ -731,8 +731,8 @@ public abstract class LayoutInflater {


            if (constructor == null) {
            if (constructor == null) {
                // Class not found in the cache, see if it's real, and try to add it
                // Class not found in the cache, see if it's real, and try to add it
                clazz = mContext.getClassLoader().loadClass(
                clazz = Class.forName(prefix != null ? (prefix + name) : name, false,
                        prefix != null ? (prefix + name) : name).asSubclass(View.class);
                        mContext.getClassLoader()).asSubclass(View.class);


                if (mFilter != null && clazz != null) {
                if (mFilter != null && clazz != null) {
                    boolean allowed = mFilter.onLoadClass(clazz);
                    boolean allowed = mFilter.onLoadClass(clazz);
@@ -750,8 +750,8 @@ public abstract class LayoutInflater {
                    Boolean allowedState = mFilterMap.get(name);
                    Boolean allowedState = mFilterMap.get(name);
                    if (allowedState == null) {
                    if (allowedState == null) {
                        // New class -- remember whether it is allowed
                        // New class -- remember whether it is allowed
                        clazz = mContext.getClassLoader().loadClass(
                        clazz = Class.forName(prefix != null ? (prefix + name) : name, false,
                                prefix != null ? (prefix + name) : name).asSubclass(View.class);
                                mContext.getClassLoader()).asSubclass(View.class);


                        boolean allowed = clazz != null && mFilter.onLoadClass(clazz);
                        boolean allowed = clazz != null && mFilter.onLoadClass(clazz);
                        mFilterMap.put(name, allowed);
                        mFilterMap.put(name, allowed);