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

Commit 5e690908 authored by Wei Wang's avatar Wei Wang Committed by Android (Google) Code Review
Browse files

Merge "Send load up hint on view inflation"

parents ac6cd614 ac5f7554
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -640,6 +640,10 @@ public abstract class LayoutInflater {
            mConstructorArgs[0] = inflaterContext;
            mConstructorArgs[0] = inflaterContext;
            View result = root;
            View result = root;


            if (root != null && root.getViewRootImpl() != null) {
                root.getViewRootImpl().notifyRendererOfExpensiveFrame();
            }

            try {
            try {
                advanceToRootNode(parser);
                advanceToRootNode(parser);
                final String name = parser.getName();
                final String name = parser.getName();
@@ -662,6 +666,10 @@ public abstract class LayoutInflater {
                    // Temp is the root view that was found in the xml
                    // Temp is the root view that was found in the xml
                    final View temp = createViewFromTag(root, name, inflaterContext, attrs);
                    final View temp = createViewFromTag(root, name, inflaterContext, attrs);


                    if (root == null && temp != null && temp.getViewRootImpl() != null) {
                        temp.getViewRootImpl().notifyRendererOfExpensiveFrame();
                    }

                    ViewGroup.LayoutParams params = null;
                    ViewGroup.LayoutParams params = null;


                    if (root != null) {
                    if (root != null) {
+7 −0
Original line number Original line Diff line number Diff line
@@ -594,6 +594,13 @@ public final class ThreadedRenderer extends HardwareRenderer {
        }
        }
    }
    }


    @Override
    public void notifyExpensiveFrame() {
        if (isEnabled()) {
            super.notifyExpensiveFrame();
        }
    }

    /**
    /**
     * Updates the light position based on the position of the window.
     * Updates the light position based on the position of the window.
     *
     *
+12 −0
Original line number Original line Diff line number Diff line
@@ -2334,6 +2334,18 @@ public final class ViewRootImpl implements ViewParent,
        }
        }
    }
    }


    /**
     * Notifies the HardwareRenderer of an expensive upcoming frame, to
     * allow better handling of power and scheduling requirements.
     *
     * @hide
     */
    void notifyRendererOfExpensiveFrame() {
        if (mAttachInfo.mThreadedRenderer != null) {
            mAttachInfo.mThreadedRenderer.notifyExpensiveFrame();
        }
    }

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    void scheduleTraversals() {
    void scheduleTraversals() {
        if (!mTraversalScheduled) {
        if (!mTraversalScheduled) {
+11 −0
Original line number Original line Diff line number Diff line
@@ -991,6 +991,15 @@ public class HardwareRenderer {
        nNotifyCallbackPending(mNativeProxy);
        nNotifyCallbackPending(mNativeProxy);
    }
    }


    /**
     * Notifies the hardware renderer about upcoming expensive frames.
     *
     * @hide
     */
    public void notifyExpensiveFrame() {
        nNotifyExpensiveFrame(mNativeProxy);
    }

    /**
    /**
     * b/68769804, b/66945974: For low FPS experiments.
     * b/68769804, b/66945974: For low FPS experiments.
     *
     *
@@ -1553,4 +1562,6 @@ public class HardwareRenderer {
    private static native void nSetRtAnimationsEnabled(boolean rtAnimationsEnabled);
    private static native void nSetRtAnimationsEnabled(boolean rtAnimationsEnabled);


    private static native void nNotifyCallbackPending(long nativeProxy);
    private static native void nNotifyCallbackPending(long nativeProxy);

    private static native void nNotifyExpensiveFrame(long nativeProxy);
}
}
+7 −0
Original line number Original line Diff line number Diff line
@@ -822,6 +822,11 @@ static void android_view_ThreadedRenderer_notifyCallbackPending(JNIEnv*, jclass,
    proxy->notifyCallbackPending();
    proxy->notifyCallbackPending();
}
}


static void android_view_ThreadedRenderer_notifyExpensiveFrame(JNIEnv*, jclass, jlong proxyPtr) {
    RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr);
    proxy->notifyExpensiveFrame();
}

// Plumbs the display density down to DeviceInfo.
// Plumbs the display density down to DeviceInfo.
static void android_view_ThreadedRenderer_setDisplayDensityDpi(JNIEnv*, jclass, jint densityDpi) {
static void android_view_ThreadedRenderer_setDisplayDensityDpi(JNIEnv*, jclass, jint densityDpi) {
    // Convert from dpi to density-independent pixels.
    // Convert from dpi to density-independent pixels.
@@ -1000,6 +1005,8 @@ static const JNINativeMethod gMethods[] = {
         (void*)android_view_ThreadedRenderer_setRtAnimationsEnabled},
         (void*)android_view_ThreadedRenderer_setRtAnimationsEnabled},
        {"nNotifyCallbackPending", "(J)V",
        {"nNotifyCallbackPending", "(J)V",
         (void*)android_view_ThreadedRenderer_notifyCallbackPending},
         (void*)android_view_ThreadedRenderer_notifyCallbackPending},
        {"nNotifyExpensiveFrame", "(J)V",
         (void*)android_view_ThreadedRenderer_notifyExpensiveFrame},
};
};


static JavaVM* mJvm = nullptr;
static JavaVM* mJvm = nullptr;
Loading