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

Commit feda2d42 authored by Nicolas Roard's avatar Nicolas Roard Committed by Android (Google) Code Review
Browse files

Merge "Update to ToT RemoteCompose" into main

parents 143644e6 45de789a
Loading
Loading
Loading
Loading
+42 −8
Original line number Original line Diff line number Diff line
@@ -64,16 +64,16 @@ public class CoreDocument implements Serializable {
    private static final boolean DEBUG = false;
    private static final boolean DEBUG = false;


    // Semantic version
    // Semantic version
    public static final int MAJOR_VERSION = 0;
    public static final int MAJOR_VERSION = 1;
    public static final int MINOR_VERSION = 4;
    public static final int MINOR_VERSION = 0;
    public static final int PATCH_VERSION = 0;
    public static final int PATCH_VERSION = 0;


    // Internal version level
    // Internal version level
    public static final int DOCUMENT_API_LEVEL = 4;
    public static final int DOCUMENT_API_LEVEL = 5;


    // We also keep a more fine-grained BUILD number, exposed as
    // We also keep a more fine-grained BUILD number, exposed as
    // ID_API_LEVEL = DOCUMENT_API_LEVEL + BUILD
    // ID_API_LEVEL = DOCUMENT_API_LEVEL + BUILD
    static final float BUILD = 0.8f;
    static final float BUILD = 0.0f;


    private static final boolean UPDATE_VARIABLES_BEFORE_LAYOUT = false;
    private static final boolean UPDATE_VARIABLES_BEFORE_LAYOUT = false;


@@ -640,6 +640,32 @@ public class CoreDocument implements Serializable {
            this.minor = minor;
            this.minor = minor;
            this.patchLevel = patchLevel;
            this.patchLevel = patchLevel;
        }
        }

        /**
         * Returns true if the document has been encoded for at least the given version MAJOR.MINOR
         *
         * @param major major version number
         * @param minor minor version number
         * @param patch patch version number
         * @return true if the document was written at least with the given version
         */
        public boolean supportsVersion(int major, int minor, int patch) {
            if (major > this.major) {
                return false;
            }
            if (major < this.major) {
                return true;
            }
            // major is the same
            if (minor > this.minor) {
                return false;
            }
            if (minor < this.minor) {
                return true;
            }
            // minor is the same
            return patch <= this.patchLevel;
        }
    }
    }


    public static class ClickAreaRepresentation {
    public static class ClickAreaRepresentation {
@@ -935,12 +961,20 @@ public class CoreDocument implements Serializable {
    /**
    /**
     * Returns true if the document can be displayed given this version of the player
     * Returns true if the document can be displayed given this version of the player
     *
     *
     * @param majorVersion the max major version supported by the player
     * @param playerMajorVersion the max major version supported by the player
     * @param minorVersion the max minor version supported by the player
     * @param playerMinorVersion the max minor version supported by the player
     * @param capabilities a bitmask of capabilities the player supports (unused for now)
     * @param capabilities a bitmask of capabilities the player supports (unused for now)
     */
     */
    public boolean canBeDisplayed(int majorVersion, int minorVersion, long capabilities) {
    public boolean canBeDisplayed(
        return mVersion.major <= majorVersion && mVersion.minor <= minorVersion;
            int playerMajorVersion, int playerMinorVersion, long capabilities) {
        if (mVersion.major < playerMajorVersion) {
            return true;
        }
        if (mVersion.major > playerMajorVersion) {
            return false;
        }
        // same major version
        return mVersion.minor <= playerMinorVersion;
    }
    }


    /**
    /**
+12 −0
Original line number Original line Diff line number Diff line
@@ -518,4 +518,16 @@ public abstract class PaintContext {
     * @return the string if found
     * @return the string if found
     */
     */
    public abstract @Nullable String getText(int textID);
    public abstract @Nullable String getText(int textID);

    /**
     * Returns true if the document has been encoded for at least the given version MAJOR.MINOR
     *
     * @param major major version number
     * @param minor minor version number
     * @param patch patch version number
     * @return true if the document was written at least with the given version
     */
    public boolean supportsVersion(int major, int minor, int patch) {
        return mContext.supportsVersion(major, minor, patch);
    }
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -1333,7 +1333,7 @@ public class RemoteComposeBuffer {
     * @return the nan id of float
     * @return the nan id of float
     */
     */
    public float reserveFloatVariable() {
    public float reserveFloatVariable() {
        int id = mRemoteComposeState.cacheFloat(0f);
        int id = mRemoteComposeState.nextId();
        return Utils.asNan(id);
        return Utils.asNan(id);
    }
    }


+12 −0
Original line number Original line Diff line number Diff line
@@ -68,6 +68,18 @@ public abstract class RemoteContext {


    private boolean mUseChoreographer = true;
    private boolean mUseChoreographer = true;


    /**
     * Returns true if the document has been encoded for at least the given version MAJOR.MINOR
     *
     * @param major major version number
     * @param minor minor version number
     * @param patch patch version number
     * @return true if the document was written at least with the given version
     */
    public boolean supportsVersion(int major, int minor, int patch) {
        return mDocument.mVersion.supportsVersion(major, minor, patch);
    }

    public float getDensity() {
    public float getDensity() {
        return mDensity;
        return mDensity;
    }
    }
+5 −0
Original line number Original line Diff line number Diff line
@@ -83,6 +83,11 @@ public class ConditionalOperations extends PaintOperation
    public void updateVariables(RemoteContext context) {
    public void updateVariables(RemoteContext context) {
        mVarAOut = Float.isNaN(mVarA) ? context.getFloat(Utils.idFromNan(mVarA)) : mVarA;
        mVarAOut = Float.isNaN(mVarA) ? context.getFloat(Utils.idFromNan(mVarA)) : mVarA;
        mVarBOut = Float.isNaN(mVarB) ? context.getFloat(Utils.idFromNan(mVarB)) : mVarB;
        mVarBOut = Float.isNaN(mVarB) ? context.getFloat(Utils.idFromNan(mVarB)) : mVarB;
        for (Operation op : mList) {
            if (op instanceof VariableSupport && op.isDirty()) {
                ((VariableSupport) op).updateVariables(context);
            }
        }
    }
    }


    /**
    /**
Loading