路径:packages/apps/Camera2/src/com/android/camera/settings/PictureSizeLoader.java
用 Collections 对相机具备的像素集合数据进行排序。
s2与s1的先后顺序决定:将像素按高度从高到低还是从低到高进行排序
s2.getHeight()-s1.getHeight()
private List<Size> computeSizesForCamera(CameraDeviceSelector facingSelector) {
....
+ //wangrui Resolution sort
+ try {
+ Collections.sort(sizes, new Comparator<Size>() {
+ @Override
+ public int compare(Size o1, Size o2) {
+ if (o1 instanceof Size && o2 instanceof Size){
+ Size s1 = (Size) o1;
+ Size s2 = (Size) o2;
+ return s2.getHeight()-s1.getHeight();
+ }
+ throw new ClassCastException("Cannot be converted to Size type");
+ }
+ });
+ }catch (Exception e){
+ e.printStackTrace();
+ }
...
}