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

Commit 71820034 authored by Gil Dekel's avatar Gil Dekel
Browse files

SurfaceControl: Pipe port to StaticDisplayInfo

DM should be able to cache display port information in order for
DisplayAddresses to be created with one (vs. assuming it based on an
xml file).

This CL plumbs the already existing port information in SF's
StaticDisplayInfo to its counterpart in Java.

Bug: 421413639
Bug: 382346249
Bug: 440582579
Flag: EXEMPT PURE_REFACTOR
Test: presubmit
Change-Id: I88490830d0a974e967c2828e18a6b4a74e9ec8c2
parent 34524679
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1958,6 +1958,7 @@ public final class SurfaceControl implements Parcelable {
     */
    public static final class StaticDisplayInfo {
        public boolean isInternal;
        public int port;
        public float density;
        public boolean secure;
        public DeviceProductInfo deviceProductInfo;
@@ -1967,6 +1968,7 @@ public final class SurfaceControl implements Parcelable {
        @Override
        public String toString() {
            return "StaticDisplayInfo{isInternal=" + isInternal
                    + ", port=" + port
                    + ", density=" + density
                    + ", secure=" + secure
                    + ", deviceProductInfo=" + deviceProductInfo
@@ -1980,6 +1982,7 @@ public final class SurfaceControl implements Parcelable {
            if (o == null || getClass() != o.getClass()) return false;
            StaticDisplayInfo that = (StaticDisplayInfo) o;
            return isInternal == that.isInternal
                    && port == that.port
                    && density == that.density
                    && secure == that.secure
                    && Objects.equals(deviceProductInfo, that.deviceProductInfo)
@@ -1989,7 +1992,7 @@ public final class SurfaceControl implements Parcelable {

        @Override
        public int hashCode() {
            return Objects.hash(isInternal, density, secure, deviceProductInfo,
            return Objects.hash(isInternal, port, density, secure, deviceProductInfo,
                installOrientation, screenPartStatus);
        }
    }
+3 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ static struct {
    jclass clazz;
    jmethodID ctor;
    jfieldID isInternal;
    jfieldID port;
    jfieldID density;
    jfieldID secure;
    jfieldID deviceProductInfo;
@@ -1548,6 +1549,7 @@ static jobject nativeGetStaticDisplayInfo(JNIEnv* env, jclass clazz, jlong id) {

    const bool isInternal = info.connectionType == ui::DisplayConnectionType::Internal;
    env->SetBooleanField(object, gStaticDisplayInfoClassInfo.isInternal, isInternal);
    env->SetIntField(object, gStaticDisplayInfoClassInfo.port, info.port);
    env->SetFloatField(object, gStaticDisplayInfoClassInfo.density, info.density);
    env->SetBooleanField(object, gStaticDisplayInfoClassInfo.secure, info.secure);
    env->SetObjectField(object, gStaticDisplayInfoClassInfo.deviceProductInfo,
@@ -2906,6 +2908,7 @@ int register_android_view_SurfaceControl(JNIEnv* env)
    gStaticDisplayInfoClassInfo.clazz = MakeGlobalRefOrDie(env, infoClazz);
    gStaticDisplayInfoClassInfo.ctor = GetMethodIDOrDie(env, infoClazz, "<init>", "()V");
    gStaticDisplayInfoClassInfo.isInternal = GetFieldIDOrDie(env, infoClazz, "isInternal", "Z");
    gStaticDisplayInfoClassInfo.port = GetFieldIDOrDie(env, infoClazz, "port", "I");
    gStaticDisplayInfoClassInfo.density = GetFieldIDOrDie(env, infoClazz, "density", "F");
    gStaticDisplayInfoClassInfo.secure = GetFieldIDOrDie(env, infoClazz, "secure", "Z");
    gStaticDisplayInfoClassInfo.deviceProductInfo =