Skip to content

Commit 58de937

Browse files
committed
feat(inventory): retrieve more informations from camera
Signed-off-by: Teclib <skita@teclib.com>
1 parent 7f705de commit 58de937

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

inventory/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ ext {
6363
libraryName = 'inventory'
6464
artifact = 'inventory'
6565

66-
67-
68-
6966
task sourcesJar(type: Jar) {
7067
from android.sourceSets.main.java.srcDirs
7168
classifier = 'sources'

inventory/src/main/java/org/flyve/inventory/categories/Cameras.java

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public Cameras(Context xCtx) {
9292
Category c = new Category("CAMERAS", "cameras");
9393
CameraCharacteristics chars = getCharacteristics(xCtx, index);
9494
if (chars != null) {
95-
c.put("RESOLUTION", new CategoryValue(getResolution(chars), "RESOLUTION", "resolution"));
95+
c.put("DESIGNATION", new CategoryValue(Integer.toString(index), "DESIGNATION", "designation"));
96+
c.put("RESOLUTIONIMAGE", new CategoryValue(getResolution(chars), "RESOLUTIONIMAGE", "resolutionimage"));
9697
c.put("LENSFACING", new CategoryValue(getFacingState(chars), "LENSFACING", "lensfacing"));
9798
c.put("FLASHUNIT", new CategoryValue(getFlashUnit(chars), "FLASHUNIT", "flashunit"));
9899
c.put("IMAGEFORMATS", new CategoryValue(getImageFormat(chars), "IMAGEFORMATS", "imageformats"));
@@ -159,7 +160,9 @@ public CameraCharacteristics getCharacteristics(Context xCtx, int index) {
159160
* @param characteristics CameraCharacteristics
160161
* @return String resolution camera
161162
*/
162-
public String getResolution(CameraCharacteristics characteristics) {
163+
public ArrayList<String> getResolution(CameraCharacteristics characteristics) {
164+
ArrayList<String> resolutions = new ArrayList<>();
165+
163166
String value = "N/A";
164167
try {
165168
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
@@ -172,23 +175,28 @@ public String getResolution(CameraCharacteristics characteristics) {
172175
if (rect != null) {
173176
width = rect.width();
174177
height = rect.height();
178+
value = width + "x" + height;
179+
resolutions.add(value);
175180
}
176181
} else {
177-
Size size = outputSizes[outputSizes.length - 1];
178-
width = size.getWidth();
179-
height = size.getHeight();
182+
for (int i = 0; i <outputSizes.length; i++ ) {
183+
Size size = outputSizes[i];
184+
width = size.getWidth();
185+
height = size.getHeight();
186+
value = width + "x" + height;
187+
resolutions.add(value);
188+
}
180189
}
181-
value = width + "x" + height;
182190
} else {
183-
return value;
191+
return resolutions;
184192
}
185193
} else {
186-
return value;
194+
return resolutions;
187195
}
188196
} catch (Exception ex) {
189197
InventoryLog.e(InventoryLog.getMessage(context, CommonErrorType.CAMERA_RESOLUTION, ex.getMessage()));
190198
}
191-
return value;
199+
return resolutions;
192200
}
193201

194202
/**

0 commit comments

Comments
 (0)