From 58de9371e0035194d71c4ae4c4c548c3d1f83d93 Mon Sep 17 00:00:00 2001 From: Teclib Date: Tue, 6 Oct 2020 09:49:31 +0200 Subject: [PATCH] feat(inventory): retrieve more informations from camera Signed-off-by: Teclib --- inventory/build.gradle | 3 --- .../flyve/inventory/categories/Cameras.java | 26 ++++++++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/inventory/build.gradle b/inventory/build.gradle index 4dc8b4bd7..8d2ae0cb8 100644 --- a/inventory/build.gradle +++ b/inventory/build.gradle @@ -63,9 +63,6 @@ ext { libraryName = 'inventory' artifact = 'inventory' - - - task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs classifier = 'sources' diff --git a/inventory/src/main/java/org/flyve/inventory/categories/Cameras.java b/inventory/src/main/java/org/flyve/inventory/categories/Cameras.java index 5ca13d1dd..afed6ba05 100644 --- a/inventory/src/main/java/org/flyve/inventory/categories/Cameras.java +++ b/inventory/src/main/java/org/flyve/inventory/categories/Cameras.java @@ -92,7 +92,8 @@ public Cameras(Context xCtx) { Category c = new Category("CAMERAS", "cameras"); CameraCharacteristics chars = getCharacteristics(xCtx, index); if (chars != null) { - c.put("RESOLUTION", new CategoryValue(getResolution(chars), "RESOLUTION", "resolution")); + c.put("DESIGNATION", new CategoryValue(Integer.toString(index), "DESIGNATION", "designation")); + c.put("RESOLUTIONIMAGE", new CategoryValue(getResolution(chars), "RESOLUTIONIMAGE", "resolutionimage")); c.put("LENSFACING", new CategoryValue(getFacingState(chars), "LENSFACING", "lensfacing")); c.put("FLASHUNIT", new CategoryValue(getFlashUnit(chars), "FLASHUNIT", "flashunit")); c.put("IMAGEFORMATS", new CategoryValue(getImageFormat(chars), "IMAGEFORMATS", "imageformats")); @@ -159,7 +160,9 @@ public CameraCharacteristics getCharacteristics(Context xCtx, int index) { * @param characteristics CameraCharacteristics * @return String resolution camera */ - public String getResolution(CameraCharacteristics characteristics) { + public ArrayList getResolution(CameraCharacteristics characteristics) { + ArrayList resolutions = new ArrayList<>(); + String value = "N/A"; try { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { @@ -172,23 +175,28 @@ public String getResolution(CameraCharacteristics characteristics) { if (rect != null) { width = rect.width(); height = rect.height(); + value = width + "x" + height; + resolutions.add(value); } } else { - Size size = outputSizes[outputSizes.length - 1]; - width = size.getWidth(); - height = size.getHeight(); + for (int i = 0; i