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

Commit 9c033c22 authored by Josh Guilfoyle's avatar Josh Guilfoyle
Browse files

Disable Zygote preloaded drawables.

With a theme applied, most of these preloaded drawables go unused.  Any
assets the theme has redirected will need to be loaded with each app
process regardless.  Worse, preloads make it impossible to do asset
redirection for constituent parts of a preloaded drawable (for instance,
individual states of a StateListDrawable cannot be redirected).

Some day it might be nice to revisit this and see if there's a way to
reintroduce the drawable cache in a way that can be altered at runtime
without significant complexity or runtime penalty.
parent a478f39e
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -95,7 +95,7 @@ public class ZygoteInit {
    private static final String PRELOADED_CLASSES = "preloaded-classes";
    private static final String PRELOADED_CLASSES = "preloaded-classes";


    /** Controls whether we should preload resources during zygote init. */
    /** Controls whether we should preload resources during zygote init. */
    private static final boolean PRELOAD_RESOURCES = true;
    private static final boolean PRELOAD_RESOURCES = false;


    /**
    /**
     * List of methods we "warm up" in the register map cache.  These were
     * List of methods we "warm up" in the register map cache.  These were
@@ -407,6 +407,8 @@ public class ZygoteInit {
                N = preloadColorStateLists(runtime, ar);
                N = preloadColorStateLists(runtime, ar);
                Log.i(TAG, "...preloaded " + N + " resources in "
                Log.i(TAG, "...preloaded " + N + " resources in "
                        + (SystemClock.uptimeMillis()-startTime) + "ms.");
                        + (SystemClock.uptimeMillis()-startTime) + "ms.");
            } else {
                Log.i(TAG, "Preload resources disabled, skipped.");
            }
            }
            mResources.finishPreloading();
            mResources.finishPreloading();
        } catch (RuntimeException e) {
        } catch (RuntimeException e) {