mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 04:28:10 +00:00
Support GalaxyS SC-02B.
This commit is contained in:
parent
61604d00fd
commit
4dd30dcf60
5 changed files with 45 additions and 13 deletions
19
Hacks.java
19
Hacks.java
|
|
@ -29,7 +29,15 @@ public final class Hacks {
|
|||
private Hacks() {}
|
||||
|
||||
public static boolean isGalaxyS() {
|
||||
return Build.DEVICE.startsWith("GT-I9000");
|
||||
return isGT9000() || isSC02B();
|
||||
}
|
||||
|
||||
public static boolean needGalaxySAudioHack() {
|
||||
return isGalaxySOrTab();
|
||||
}
|
||||
|
||||
public static boolean isGalaxySOrTabWithFrontCamera() {
|
||||
return isGalaxySOrTab() && !isGalaxySOrTabWithoutFrontCamera();
|
||||
}
|
||||
|
||||
public static boolean isGalaxySOrTab() {
|
||||
|
|
@ -37,7 +45,14 @@ public final class Hacks {
|
|||
}
|
||||
|
||||
public static boolean isGalaxyTab() {
|
||||
return Build.DEVICE.startsWith("GT-P1000");
|
||||
return isGTP1000();
|
||||
}
|
||||
|
||||
private static boolean isGT9000() {return Build.DEVICE.startsWith("GT-I9000");}
|
||||
private static boolean isSC02B() {return Build.DEVICE.startsWith("SC-02B");}
|
||||
private static boolean isGTP1000() {return Build.DEVICE.startsWith("GT-P1000");}
|
||||
private static boolean isGalaxySOrTabWithoutFrontCamera() {
|
||||
return isSC02B();
|
||||
}
|
||||
|
||||
/* private static final boolean log(final String msg) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ import android.os.Build;
|
|||
*/
|
||||
public class Version {
|
||||
|
||||
private static final int buildVersion = Integer.parseInt(Build.VERSION.SDK);
|
||||
private static final int buildVersion =
|
||||
Integer.parseInt(Build.VERSION.SDK);
|
||||
// 8; // 2.2
|
||||
// 7; // 2.1
|
||||
|
||||
public static final boolean sdkAboveOrEqual(int value) {
|
||||
|
|
|
|||
|
|
@ -33,10 +33,15 @@ interface AndroidCameraConf {
|
|||
|
||||
boolean isFrontCamera(int cameraId);
|
||||
|
||||
/**
|
||||
* Default: no front; rear=0; default=rear
|
||||
* @author Guillaume Beraudo
|
||||
*
|
||||
*/
|
||||
class AndroidCameras {
|
||||
Integer front;
|
||||
Integer rear;
|
||||
Integer defaultC;
|
||||
Integer rear = 0;
|
||||
Integer defaultC = rear;
|
||||
|
||||
boolean hasFrontCamera() { return front != null; }
|
||||
boolean hasRearCamera() { return rear != null; }
|
||||
|
|
|
|||
|
|
@ -30,12 +30,17 @@ class AndroidCameraConf5 implements AndroidCameraConf {
|
|||
public AndroidCameraConf5() {
|
||||
Log.i(tag, "Detecting cameras");
|
||||
|
||||
// Defaults 0/0/0
|
||||
// Defaults
|
||||
foundCameras = new AndroidCameras();
|
||||
|
||||
if (Hacks.isGalaxySOrTab()) {
|
||||
Log.d(tag, "Hack Galaxy S : has 2 cameras front=2; rear=1");
|
||||
foundCameras.front = 2;
|
||||
Log.d(tag, "Hack Galaxy S : has one or more cameras");
|
||||
if (Hacks.isGalaxySOrTabWithFrontCamera()) {
|
||||
Log.d(tag, "Hack Galaxy S : HAVE a front camera");
|
||||
foundCameras.front = 2;
|
||||
} else {
|
||||
Log.d(tag, "Hack Galaxy S : NO front camera");
|
||||
}
|
||||
foundCameras.rear = 1;
|
||||
foundCameras.defaultC = foundCameras.rear;
|
||||
}
|
||||
|
|
@ -44,7 +49,7 @@ class AndroidCameraConf5 implements AndroidCameraConf {
|
|||
|
||||
public int getNumberOfCameras() {
|
||||
Log.i(tag, "Detecting the number of cameras");
|
||||
if (Hacks.isGalaxySOrTab()) {
|
||||
if (Hacks.isGalaxySOrTabWithFrontCamera()) {
|
||||
Log.d(tag, "Hack Galaxy S : has 2 cameras");
|
||||
return 2;
|
||||
} else
|
||||
|
|
@ -55,8 +60,8 @@ class AndroidCameraConf5 implements AndroidCameraConf {
|
|||
|
||||
public int getCameraOrientation(int cameraId) {
|
||||
// Use hacks to guess orientation of the camera
|
||||
if (Hacks.isGalaxySOrTab() && !isFrontCamera(cameraId)) {
|
||||
Log.d(tag, "Hack Galaxy S : rear camera mounted landscape");
|
||||
if (Hacks.isGalaxySOrTab() && isFrontCamera(cameraId)) {
|
||||
Log.d(tag, "Hack Galaxy S : front camera mounted landscape");
|
||||
// mounted in landscape for a portrait phone orientation
|
||||
// |^^^^^^^^|
|
||||
// | ____ |
|
||||
|
|
@ -72,7 +77,6 @@ class AndroidCameraConf5 implements AndroidCameraConf {
|
|||
|
||||
|
||||
|
||||
|
||||
public boolean isFrontCamera(int cameraId) {
|
||||
// Use hacks to guess facing of the camera
|
||||
if (cameraId == 2 && Hacks.isGalaxySOrTab()) {
|
||||
|
|
|
|||
|
|
@ -76,11 +76,17 @@ public class AndroidCameraRecordManager {
|
|||
public boolean hasSeveralCameras() {
|
||||
return cc.getFoundCameras().hasSeveralCameras();
|
||||
}
|
||||
public boolean hasFrontCamera() {
|
||||
return cc.getFoundCameras().front != null;
|
||||
}
|
||||
|
||||
|
||||
public void setUseFrontCamera(boolean value) {
|
||||
if (!hasFrontCamera()) {
|
||||
Log.e(tag, "setUseFrontCamera(true) while no front camera detected on device: using rear");
|
||||
value = false;
|
||||
}
|
||||
if (cc.isFrontCamera(cameraId) == value) return; // already OK
|
||||
|
||||
toggleUseFrontCamera();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue