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

Commit 45de789a authored by Nicolas Roard's avatar Nicolas Roard
Browse files

Update to ToT RemoteCompose

Bug: 403275243
Flag: EXEMPT External Libraries
Test: in GoB
Change-Id: I244c8e768b0f2a0319d86b4c8efa6c2f95a69731
parent f262fbb7
Loading
Loading
Loading
Loading
+42 −8
Original line number Diff line number Diff line
@@ -64,16 +64,16 @@ public class CoreDocument implements Serializable {
    private static final boolean DEBUG = false;

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

    // 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
    // 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;

@@ -640,6 +640,32 @@ public class CoreDocument implements Serializable {
            this.minor = minor;
            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 {
@@ -935,12 +961,20 @@ public class CoreDocument implements Serializable {
    /**
     * 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 minorVersion the max minor version supported by the player
     * @param playerMajorVersion the max major 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)
     */
    public boolean canBeDisplayed(int majorVersion, int minorVersion, long capabilities) {
        return mVersion.major <= majorVersion && mVersion.minor <= minorVersion;
    public boolean canBeDisplayed(
            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 Diff line number Diff line
@@ -518,4 +518,16 @@ public abstract class PaintContext {
     * @return the string if found
     */
    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 Diff line number Diff line
@@ -1333,7 +1333,7 @@ public class RemoteComposeBuffer {
     * @return the nan id of float
     */
    public float reserveFloatVariable() {
        int id = mRemoteComposeState.cacheFloat(0f);
        int id = mRemoteComposeState.nextId();
        return Utils.asNan(id);
    }

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

    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() {
        return mDensity;
    }
+5 −0
Original line number Diff line number Diff line
@@ -83,6 +83,11 @@ public class ConditionalOperations extends PaintOperation
    public void updateVariables(RemoteContext context) {
        mVarAOut = Float.isNaN(mVarA) ? context.getFloat(Utils.idFromNan(mVarA)) : mVarA;
        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