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

Commit c5ee8aa4 authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Pipe display install orientation 2/2"

parents 367c0a6c 80d665bb
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -318,6 +318,12 @@ public final class DisplayInfo implements Parcelable {
    @Nullable
    public RoundedCorners roundedCorners;

    /**
     * Install orientation of the display relative to its natural orientation.
     */
    @Surface.Rotation
    public int installOrientation;

    public static final @android.annotation.NonNull Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() {
        @Override
        public DisplayInfo createFromParcel(Parcel source) {
@@ -389,7 +395,8 @@ public final class DisplayInfo implements Parcelable {
                && brightnessMaximum == other.brightnessMaximum
                && brightnessDefault == other.brightnessDefault
                && Objects.equals(roundedCorners, other.roundedCorners)
                && shouldConstrainMetricsForLauncher == other.shouldConstrainMetricsForLauncher;
                && shouldConstrainMetricsForLauncher == other.shouldConstrainMetricsForLauncher
                && installOrientation == other.installOrientation;
    }

    @Override
@@ -441,6 +448,7 @@ public final class DisplayInfo implements Parcelable {
        brightnessDefault = other.brightnessDefault;
        roundedCorners = other.roundedCorners;
        shouldConstrainMetricsForLauncher = other.shouldConstrainMetricsForLauncher;
        installOrientation = other.installOrientation;
    }

    public void readFromParcel(Parcel source) {
@@ -498,6 +506,7 @@ public final class DisplayInfo implements Parcelable {
            userDisabledHdrTypes[i] = source.readInt();
        }
        shouldConstrainMetricsForLauncher = source.readBoolean();
        installOrientation = source.readInt();
    }

    @Override
@@ -553,6 +562,7 @@ public final class DisplayInfo implements Parcelable {
            dest.writeInt(userDisabledHdrTypes[i]);
        }
        dest.writeBoolean(shouldConstrainMetricsForLauncher);
        dest.writeInt(installOrientation);
    }

    @Override
@@ -809,6 +819,8 @@ public final class DisplayInfo implements Parcelable {
        sb.append(brightnessDefault);
        sb.append(", shouldConstrainMetricsForLauncher ");
        sb.append(shouldConstrainMetricsForLauncher);
        sb.append(", installOrientation ");
        sb.append(Surface.rotationToString(installOrientation));
        sb.append("}");
        return sb.toString();
    }
+6 −3
Original line number Diff line number Diff line
@@ -1831,13 +1831,15 @@ public final class SurfaceControl implements Parcelable {
        public float density;
        public boolean secure;
        public DeviceProductInfo deviceProductInfo;
        public @Surface.Rotation int installOrientation;

        @Override
        public String toString() {
            return "StaticDisplayInfo{isInternal=" + isInternal
                    + ", density=" + density
                    + ", secure=" + secure
                    + ", deviceProductInfo=" + deviceProductInfo + "}";
                    + ", deviceProductInfo=" + deviceProductInfo
                    + ", installOrientation=" + installOrientation + "}";
        }

        @Override
@@ -1848,12 +1850,13 @@ public final class SurfaceControl implements Parcelable {
            return isInternal == that.isInternal
                    && density == that.density
                    && secure == that.secure
                    && Objects.equals(deviceProductInfo, that.deviceProductInfo);
                    && Objects.equals(deviceProductInfo, that.deviceProductInfo)
                    && installOrientation == that.installOrientation;
        }

        @Override
        public int hashCode() {
            return Objects.hash(isInternal, density, secure, deviceProductInfo);
            return Objects.hash(isInternal, density, secure, deviceProductInfo, installOrientation);
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ static struct {
    jfieldID density;
    jfieldID secure;
    jfieldID deviceProductInfo;
    jfieldID installOrientation;
} gStaticDisplayInfoClassInfo;

static struct {
@@ -1210,6 +1211,8 @@ static jobject nativeGetStaticDisplayInfo(JNIEnv* env, jclass clazz, jobject tok
    env->SetBooleanField(object, gStaticDisplayInfoClassInfo.secure, info.secure);
    env->SetObjectField(object, gStaticDisplayInfoClassInfo.deviceProductInfo,
                        convertDeviceProductInfoToJavaObject(env, info.deviceProductInfo));
    env->SetIntField(object, gStaticDisplayInfoClassInfo.installOrientation,
                     static_cast<uint32_t>(info.installOrientation));
    return object;
}

@@ -2152,6 +2155,8 @@ int register_android_view_SurfaceControl(JNIEnv* env)
    gStaticDisplayInfoClassInfo.deviceProductInfo =
            GetFieldIDOrDie(env, infoClazz, "deviceProductInfo",
                            "Landroid/hardware/display/DeviceProductInfo;");
    gStaticDisplayInfoClassInfo.installOrientation =
            GetFieldIDOrDie(env, infoClazz, "installOrientation", "I");

    jclass dynamicInfoClazz = FindClassOrDie(env, "android/view/SurfaceControl$DynamicDisplayInfo");
    gDynamicDisplayInfoClassInfo.clazz = MakeGlobalRefOrDie(env, dynamicInfoClazz);
+6 −6
Original line number Diff line number Diff line
@@ -493,12 +493,6 @@
      "group": "WM_DEBUG_STATES",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-1556507536": {
      "message": "Passing transform hint %d for window %s%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "-1554521902": {
      "message": "showInsets(ime) was requested by different window: %s ",
      "level": "WARN",
@@ -817,6 +811,12 @@
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "-1248290210": {
      "message": "Passing transform hint %d for window %s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "-1228653755": {
      "message": "Launch on display check: displayId=%d callingPid=%d callingUid=%d",
      "level": "DEBUG",
+10 −1
Original line number Diff line number Diff line
@@ -358,6 +358,12 @@ final class DisplayDeviceInfo {
    public float brightnessMaximum;
    public float brightnessDefault;

    /**
     * Install orientation of display panel relative to its natural orientation.
     */
    @Surface.Rotation
    public int installOrientation = Surface.ROTATION_0;

    public void setAssumedDensityForExternalDisplay(int width, int height) {
        densityDpi = Math.min(width, height) * DisplayMetrics.DENSITY_XHIGH / 1080;
        // Technically, these values should be smaller than the apparent density
@@ -417,7 +423,8 @@ final class DisplayDeviceInfo {
                || !BrightnessSynchronizer.floatEquals(brightnessMaximum, other.brightnessMaximum)
                || !BrightnessSynchronizer.floatEquals(brightnessDefault,
                other.brightnessDefault)
                || !Objects.equals(roundedCorners, other.roundedCorners)) {
                || !Objects.equals(roundedCorners, other.roundedCorners)
                || installOrientation != other.installOrientation) {
            diff |= DIFF_OTHER;
        }
        return diff;
@@ -461,6 +468,7 @@ final class DisplayDeviceInfo {
        brightnessMaximum = other.brightnessMaximum;
        brightnessDefault = other.brightnessDefault;
        roundedCorners = other.roundedCorners;
        installOrientation = other.installOrientation;
    }

    // For debugging purposes
@@ -508,6 +516,7 @@ final class DisplayDeviceInfo {
            sb.append(", roundedCorners ").append(roundedCorners);
        }
        sb.append(flagsToString(flags));
        sb.append(", installOrientation ").append(installOrientation);
        sb.append("}");
        return sb.toString();
    }
Loading