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

Commit ef405012 authored by Deepanshu Gupta's avatar Deepanshu Gupta Committed by android-build-merger
Browse files

Merge "AppCompatActionBar: use findClass to test presence" into mnc-ub-dev

am: 42a893b5

* commit '42a893b5':
  AppCompatActionBar: use findClass to test presence
parents 66840955 42a893b5
Loading
Loading
Loading
Loading
+9 −10
Original line number Original line Diff line number Diff line
@@ -76,19 +76,18 @@ public class AppCompatActionBar extends BridgeActionBar {
            Class[] constructorParams = {View.class};
            Class[] constructorParams = {View.class};
            Object[] constructorArgs = {getDecorContent()};
            Object[] constructorArgs = {getDecorContent()};
            LayoutlibCallback callback = params.getLayoutlibCallback();
            LayoutlibCallback callback = params.getLayoutlibCallback();
            // First try to load the class as was available before appcompat v23.1.1, without

            // logging warnings.
            // Check if the old action bar class is present.
            String actionBarClass = WINDOW_ACTION_BAR_CLASS;
            try {
            try {
                mWindowDecorActionBar = callback.loadClass(WINDOW_ACTION_BAR_CLASS,
                callback.findClass(actionBarClass);
                        constructorParams, constructorArgs);
            } catch (ClassNotFoundException expected) {
            } catch (ClassNotFoundException ignore) {
                // Failed to find the old class, use the newer one.
            }
                actionBarClass = WINDOW_ACTION_BAR_CLASS_NEW;
            if (mWindowDecorActionBar == null) {
                // If failed, load the new class, while logging warnings.
                mWindowDecorActionBar = callback.loadView(WINDOW_ACTION_BAR_CLASS_NEW,
                        constructorParams, constructorArgs);
            }
            }


            mWindowDecorActionBar = callback.loadView(actionBarClass,
                    constructorParams, constructorArgs);
            mWindowActionBarClass = mWindowDecorActionBar == null ? null :
            mWindowActionBarClass = mWindowDecorActionBar == null ? null :
                    mWindowDecorActionBar.getClass();
                    mWindowDecorActionBar.getClass();
            setupActionBar();
            setupActionBar();