Skip to content

Commit cd79b35

Browse files
Jamie GennisAndroid (Google) Code Review
authored andcommitted
Merge "Surface: add the PhysicalDisplayInfo#secure field" into jb-mr1-dev
2 parents d401a53 + 95429c3 commit cd79b35

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

core/java/android/view/Surface.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ public static final class PhysicalDisplayInfo {
758758
public float density;
759759
public float xDpi;
760760
public float yDpi;
761+
public boolean secure;
761762

762763
public PhysicalDisplayInfo() {
763764
}
@@ -778,7 +779,8 @@ public boolean equals(PhysicalDisplayInfo other) {
778779
&& refreshRate == other.refreshRate
779780
&& density == other.density
780781
&& xDpi == other.xDpi
781-
&& yDpi == other.yDpi;
782+
&& yDpi == other.yDpi
783+
&& secure == other.secure;
782784
}
783785

784786
@Override
@@ -793,13 +795,15 @@ public void copyFrom(PhysicalDisplayInfo other) {
793795
density = other.density;
794796
xDpi = other.xDpi;
795797
yDpi = other.yDpi;
798+
secure = other.secure;
796799
}
797800

798801
// For debugging purposes
799802
@Override
800803
public String toString() {
801804
return "PhysicalDisplayInfo{" + width + " x " + height + ", " + refreshRate + " fps, "
802-
+ "density " + density + ", " + xDpi + " x " + yDpi + " dpi}";
805+
+ "density " + density + ", " + xDpi + " x " + yDpi + " dpi, secure " + secure
806+
+ "}";
803807
}
804808
}
805809

core/jni/android_view_Surface.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static struct {
8989
jfieldID density;
9090
jfieldID xDpi;
9191
jfieldID yDpi;
92+
jfieldID secure;
9293
} gPhysicalDisplayInfoClassInfo;
9394

9495

@@ -714,6 +715,7 @@ static jboolean nativeGetDisplayInfo(JNIEnv* env, jclass clazz,
714715
env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.density, info.density);
715716
env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.xDpi, info.xdpi);
716717
env->SetFloatField(infoObj, gPhysicalDisplayInfoClassInfo.yDpi, info.ydpi);
718+
env->SetBooleanField(infoObj, gPhysicalDisplayInfoClassInfo.secure, info.secure);
717719
return JNI_TRUE;
718720
}
719721

@@ -907,6 +909,7 @@ int register_android_view_Surface(JNIEnv* env)
907909
gPhysicalDisplayInfoClassInfo.density = env->GetFieldID(clazz, "density", "F");
908910
gPhysicalDisplayInfoClassInfo.xDpi = env->GetFieldID(clazz, "xDpi", "F");
909911
gPhysicalDisplayInfoClassInfo.yDpi = env->GetFieldID(clazz, "yDpi", "F");
912+
gPhysicalDisplayInfoClassInfo.secure = env->GetFieldID(clazz, "secure", "Z");
910913
return err;
911914
}
912915

0 commit comments

Comments
 (0)