Remove deprecated methods from CameraEnumerationAndroid.

Following methods are removed:
getDeviceNames
getDeviceCount
getDeviceName(index)
getNameOfFrontFacingDevice
getNameOfBackFacingDevice

BUG=webrtc:6606,webrtc:5519

Review-Url: https://codereview.webrtc.org/2448393003
Cr-Commit-Position: refs/heads/master@{#14966}
This commit is contained in:
sakal
2016-11-08 02:06:38 -08:00
committed by Commit bot
parent d4d2f6009e
commit b6e857d30b
2 changed files with 3 additions and 66 deletions

View File

@ -10,12 +10,10 @@
package org.webrtc; package org.webrtc;
import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
import android.os.SystemClock; import android.os.SystemClock;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class Camera1Enumerator implements CameraEnumerator { public class Camera1Enumerator implements CameraEnumerator {
@ -89,7 +87,7 @@ public class Camera1Enumerator implements CameraEnumerator {
static synchronized List<CaptureFormat> getSupportedFormats(int cameraId) { static synchronized List<CaptureFormat> getSupportedFormats(int cameraId) {
if (cachedSupportedFormats == null) { if (cachedSupportedFormats == null) {
cachedSupportedFormats = new ArrayList<List<CaptureFormat>>(); cachedSupportedFormats = new ArrayList<List<CaptureFormat>>();
for (int i = 0; i < CameraEnumerationAndroid.getDeviceCount(); ++i) { for (int i = 0; i < android.hardware.Camera.getNumberOfCameras(); ++i) {
cachedSupportedFormats.add(enumerateFormats(i)); cachedSupportedFormats.add(enumerateFormats(i));
} }
} }
@ -164,7 +162,7 @@ public class Camera1Enumerator implements CameraEnumerator {
static int getCameraIndex(String deviceName) { static int getCameraIndex(String deviceName) {
Logging.d(TAG, "getCameraIndex: " + deviceName); Logging.d(TAG, "getCameraIndex: " + deviceName);
for (int i = 0; i < android.hardware.Camera.getNumberOfCameras(); ++i) { for (int i = 0; i < android.hardware.Camera.getNumberOfCameras(); ++i) {
if (deviceName.equals(CameraEnumerationAndroid.getDeviceName(i))) { if (deviceName.equals(getDeviceName(i))) {
return i; return i;
} }
} }

View File

@ -13,7 +13,6 @@ package org.webrtc;
import static java.lang.Math.abs; import static java.lang.Math.abs;
import android.graphics.ImageFormat; import android.graphics.ImageFormat;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
@ -114,51 +113,6 @@ public class CameraEnumerationAndroid {
} }
} }
/**
* @deprecated
* Please use Camera1Enumerator.getDeviceNames() instead.
*/
@Deprecated
public static String[] getDeviceNames() {
return new Camera1Enumerator().getDeviceNames();
}
/**
* @deprecated
* Please use Camera1Enumerator.getDeviceNames().length instead.
*/
@Deprecated
public static int getDeviceCount() {
return new Camera1Enumerator().getDeviceNames().length;
}
/**
* @deprecated
* Please use Camera1Enumerator.getDeviceNames().get(index) instead.
*/
@Deprecated
public static String getDeviceName(int index) {
return new Camera1Enumerator().getDeviceName(index);
}
/**
* @deprecated
* Please use Camera1Enumerator.isFrontFacing(String deviceName) instead.
*/
@Deprecated
public static String getNameOfFrontFacingDevice() {
return getNameOfDevice(android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
}
/**
* @deprecated
* Please use Camera1Enumerator.isBackFacing(String deviceName) instead.
*/
@Deprecated
public static String getNameOfBackFacingDevice() {
return getNameOfDevice(android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK);
}
// Helper class for finding the closest supported format for the two functions below. It creates a // Helper class for finding the closest supported format for the two functions below. It creates a
// comparator based on the difference to some requested parameters, where the element with the // comparator based on the difference to some requested parameters, where the element with the
// minimum difference is the element that is closest to the requested parameters. // minimum difference is the element that is closest to the requested parameters.
@ -215,19 +169,4 @@ public class CameraEnumerationAndroid {
} }
}); });
} }
private static String getNameOfDevice(int facing) {
final android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
for (int i = 0; i < android.hardware.Camera.getNumberOfCameras(); ++i) {
try {
android.hardware.Camera.getCameraInfo(i, info);
if (info.facing == facing) {
return getDeviceName(i);
}
} catch (Exception e) {
Logging.e(TAG, "getCameraInfo() failed on index " + i, e);
}
}
return null;
}
} }