Skip to content
Snippets Groups Projects
Commit 35577131 authored by Alexandre Lision's avatar Alexandre Lision
Browse files

* #36360: first work around for OpenSLES broken interfaces

parent 68ee0ace
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,15 @@ ...@@ -50,6 +50,15 @@
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:background="#00000000" android:background="#00000000"
android:src="@drawable/ic_action_dial_pad_light" /> android:src="@drawable/ic_action_dial_pad_light" />
<ToggleButton
android:id="@+id/toggle_speaker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="Speaker" />
</RelativeLayout> </RelativeLayout>
<org.sflphone.model.BubblesView <org.sflphone.model.BubblesView
......
...@@ -31,7 +31,12 @@ ...@@ -31,7 +31,12 @@
*/ */
package org.sflphone.client; package org.sflphone.client;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InvalidObjectException; import java.io.InvalidObjectException;
import java.io.OutputStream;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
...@@ -62,12 +67,14 @@ import android.content.DialogInterface; ...@@ -62,12 +67,14 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.content.res.AssetManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.SipAddress; import android.provider.ContactsContract.CommonDataKinds.SipAddress;
...@@ -236,10 +243,66 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks, ...@@ -236,10 +243,66 @@ public class HomeActivity extends Activity implements DialingFragment.Callbacks,
@Override @Override
protected void onStart() { protected void onStart() {
Log.i(TAG, "onStart"); Log.i(TAG, "onStart");
if (!PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("installed", false)) {
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("installed", true).commit();
copyAssetFolder(getAssets(), "ringtones", getFilesDir().getAbsolutePath() + "/ringtones");
}
super.onStart(); super.onStart();
} }
private static boolean copyAssetFolder(AssetManager assetManager, String fromAssetPath, String toPath) {
try {
String[] files = assetManager.list(fromAssetPath);
new File(toPath).mkdirs();
Log.i(TAG, "Creating :" + toPath);
boolean res = true;
for (String file : files)
if (file.contains(".")) {
Log.i(TAG, "Copying file :" + fromAssetPath + "/" + file + " to " + toPath + "/" + file);
res &= copyAsset(assetManager, fromAssetPath + "/" + file, toPath + "/" + file);
} else {
Log.i(TAG, "Copying folder :" + fromAssetPath + "/" + file + " to " + toPath + "/" + file);
res &= copyAssetFolder(assetManager, fromAssetPath + "/" + file, toPath + "/" + file);
}
return res;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
private static boolean copyAsset(AssetManager assetManager, String fromAssetPath, String toPath) {
InputStream in = null;
OutputStream out = null;
try {
in = assetManager.open(fromAssetPath);
new File(toPath).createNewFile();
out = new FileOutputStream(toPath);
copyFile(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
private static void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
}
/* user gets back to the activity, e.g. through task manager */ /* user gets back to the activity, e.g. through task manager */
@Override @Override
protected void onRestart() { protected void onRestart() {
......
...@@ -68,8 +68,11 @@ import android.view.View; ...@@ -68,8 +68,11 @@ import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ToggleButton;
public class CallFragment extends Fragment implements Callback { public class CallFragment extends Fragment implements Callback {
...@@ -85,6 +88,8 @@ public class CallFragment extends Fragment implements Callback { ...@@ -85,6 +88,8 @@ public class CallFragment extends Fragment implements Callback {
private TextView callStatusTxt; private TextView callStatusTxt;
private TextView codecNameTxt; private TextView codecNameTxt;
private ToggleButton speakers;
private BubblesView view; private BubblesView view;
private BubbleModel model; private BubbleModel model;
...@@ -247,6 +252,21 @@ public class CallFragment extends Fragment implements Callback { ...@@ -247,6 +252,21 @@ public class CallFragment extends Fragment implements Callback {
callStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt); callStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt);
call_icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_call); call_icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_call);
speakers = (ToggleButton) rootView.findViewById(R.id.toggle_speaker);
speakers.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
try {
mCallbacks.getService().toggleSpeakerPhone(isChecked);
} catch (RemoteException e) {
e.printStackTrace();
}
}
});
((ImageButton) rootView.findViewById(R.id.dialpad_btn)).setOnClickListener(new OnClickListener() { ((ImageButton) rootView.findViewById(R.id.dialpad_btn)).setOnClickListener(new OnClickListener() {
@Override @Override
...@@ -373,7 +393,7 @@ public class CallFragment extends Fragment implements Callback { ...@@ -373,7 +393,7 @@ public class CallFragment extends Fragment implements Callback {
return contact_bubble; return contact_bubble;
} }
contact_bubble = new BubbleUser(getActivity(), CallContact.ContactBuilder.buildUserContact(getActivity().getContentResolver()), conf, x, y, BUBBLE_SIZE); contact_bubble = new BubbleUser(getActivity(), CallContact.ContactBuilder.buildUserContact(getActivity().getContentResolver()), conf, x, y, BUBBLE_SIZE * 1.3f);
try { try {
((BubbleUser) contact_bubble).setMute(mCallbacks.getService().isCaptureMuted()); ((BubbleUser) contact_bubble).setMute(mCallbacks.getService().isCaptureMuted());
......
...@@ -21,6 +21,7 @@ import android.content.Context; ...@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.SystemClock;
import android.util.Log; import android.util.Log;
public class IncomingReceiver extends BroadcastReceiver { public class IncomingReceiver extends BroadcastReceiver {
...@@ -83,7 +84,13 @@ public class IncomingReceiver extends BroadcastReceiver { ...@@ -83,7 +84,13 @@ public class IncomingReceiver extends BroadcastReceiver {
SipCall newCall = callBuilder.build(); SipCall newCall = callBuilder.build();
toSend.putExtra("newcall", newCall); toSend.putExtra("newcall", newCall);
HashMap<String, String> callDetails = (HashMap<String, String>) mBinder.getCallDetails(b.getString("CallID")); HashMap<String, String> callDetails = (HashMap<String, String>) mBinder.getCallDetails(b.getString("CallID"));
newCall.setTimestamp_start(Long.parseLong(callDetails.get(ServiceConstants.call.TIMESTAMP_START)));
String stamp = callDetails.get(ServiceConstants.call.TIMESTAMP_START);
if(stamp.length() > 0)
newCall.setTimestamp_start(Long.parseLong(stamp));
else
newCall.setTimestamp_start(System.currentTimeMillis() / 1000);
callback.getCurrent_calls().put(newCall.getCallId(), newCall); callback.getCurrent_calls().put(newCall.getCallId(), newCall);
callback.sendBroadcast(toSend); callback.sendBroadcast(toSend);
......
...@@ -33,8 +33,7 @@ interface ISipService { ...@@ -33,8 +33,7 @@ interface ISipService {
// FIXME // FIXME
List getAudioInputDeviceList(); void toggleSpeakerPhone(in boolean toggle);
List getAudioOutputDeviceList();
/* History */ /* History */
List getHistory(); List getHistory();
......
...@@ -51,6 +51,7 @@ import android.app.Service; ...@@ -51,6 +51,7 @@ import android.app.Service;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.media.AudioManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
...@@ -125,8 +126,6 @@ public class SipService extends Service { ...@@ -125,8 +126,6 @@ public class SipService extends Service {
notificationManager.onServiceCreate(); notificationManager.onServiceCreate();
mediaManager.startService(); mediaManager.startService();
} }
/* called for each startService() */ /* called for each startService() */
...@@ -378,6 +377,7 @@ public class SipService extends Service { ...@@ -378,6 +377,7 @@ public class SipService extends Service {
protected void doRun() throws SameThreadException { protected void doRun() throws SameThreadException {
Log.i(TAG, "SipService.hangUp() thread running..."); Log.i(TAG, "SipService.hangUp() thread running...");
callManagerJNI.hangUp(callID); callManagerJNI.hangUp(callID);
mediaManager.abandonAudioFocus();
} }
}); });
} }
...@@ -592,7 +592,6 @@ public class SipService extends Service { ...@@ -592,7 +592,6 @@ public class SipService extends Service {
AddAccount runInstance = new AddAccount(swigmap); AddAccount runInstance = new AddAccount(swigmap);
getExecutor().execute(runInstance); getExecutor().execute(runInstance);
while (!runInstance.isDone()) { while (!runInstance.isDone()) {
// Log.e(TAG, "Waiting for Nofing");
} }
String accountId = (String) runInstance.getVal(); String accountId = (String) runInstance.getVal();
...@@ -1309,53 +1308,13 @@ public class SipService extends Service { ...@@ -1309,53 +1308,13 @@ public class SipService extends Service {
}); });
} }
/**
* Not working yet
*/
@Override
public List getAudioInputDeviceList() throws RemoteException {
class AudioInputDevices extends SipRunnableWithReturn {
@Override @Override
protected List doRun() throws SameThreadException { public void toggleSpeakerPhone(boolean toggle) throws RemoteException {
Log.i(TAG, "SipService.getCredentials() thread running..."); if (toggle)
StringVect map = configurationManagerJNI.getAudioInputDeviceList(); mediaManager.RouteToSpeaker();
ArrayList<HashMap<String, String>> result = new ArrayList<HashMap<String,String>>(); else
return result; mediaManager.RouteToInternalSpeaker();
}
}
AudioInputDevices runInstance = new AudioInputDevices();
getExecutor().execute(runInstance);
while (!runInstance.isDone()) {
}
return (List) runInstance.getVal();
}
/**
* Not working yet
*/
@Override
public List getAudioOutputDeviceList() throws RemoteException {
class AudioOutputDevices extends SipRunnableWithReturn {
@Override
protected List doRun() throws SameThreadException {
Log.i(TAG, "SipService.getCredentials() thread running...");
StringVect map = configurationManagerJNI.getAudioOutputDeviceList();
ArrayList<HashMap<String, String>> result = new ArrayList<HashMap<String,String>>();
return result;
}
}
AudioOutputDevices runInstance = new AudioOutputDevices();
getExecutor().execute(runInstance);
while (!runInstance.isDone()) {
}
return (List) runInstance.getVal();
} }
}; };
} }
...@@ -68,15 +68,13 @@ public final class Compatibility { ...@@ -68,15 +68,13 @@ public final class Compatibility {
} }
/** /**
* Get the stream id for in call track. Can differ on some devices. Current * Get the stream id for in call track. Can differ on some devices. Current device for which it's different :
* device for which it's different :
* *
* @return * @return
*/ */
public static int getInCallStream(boolean requestBluetooth) { public static int getInCallStream(boolean requestBluetooth) {
/* Archos 5IT */ /* Archos 5IT */
if (android.os.Build.BRAND.equalsIgnoreCase("archos") if (android.os.Build.BRAND.equalsIgnoreCase("archos") && android.os.Build.DEVICE.equalsIgnoreCase("g7a")) {
&& android.os.Build.DEVICE.equalsIgnoreCase("g7a")) {
// Since archos has no voice call capabilities, voice call stream is // Since archos has no voice call capabilities, voice call stream is
// not implemented // not implemented
// So we have to choose the good stream tag, which is by default // So we have to choose the good stream tag, which is by default
...@@ -92,8 +90,7 @@ public final class Compatibility { ...@@ -92,8 +90,7 @@ public final class Compatibility {
} }
public static boolean shouldUseRoutingApi() { public static boolean shouldUseRoutingApi() {
Log.d(THIS_FILE, "Current device " + android.os.Build.BRAND + " - " Log.d(THIS_FILE, "Current device " + android.os.Build.BRAND + " - " + android.os.Build.DEVICE);
+ android.os.Build.DEVICE);
// HTC evo 4G // HTC evo 4G
if (android.os.Build.PRODUCT.equalsIgnoreCase("htc_supersonic")) { if (android.os.Build.PRODUCT.equalsIgnoreCase("htc_supersonic")) {
...@@ -121,14 +118,12 @@ public final class Compatibility { ...@@ -121,14 +118,12 @@ public final class Compatibility {
public static boolean shouldUseModeApi() { public static boolean shouldUseModeApi() {
// ZTE blade et joe // ZTE blade et joe
if (android.os.Build.DEVICE.equalsIgnoreCase("blade") if (android.os.Build.DEVICE.equalsIgnoreCase("blade") || android.os.Build.DEVICE.equalsIgnoreCase("joe")) {
|| android.os.Build.DEVICE.equalsIgnoreCase("joe")) {
return true; return true;
} }
// Samsung GT-S5360 GT-S5830 GT-S6102 ... probably all.. // Samsung GT-S5360 GT-S5830 GT-S6102 ... probably all..
if (android.os.Build.DEVICE.toUpperCase().startsWith("GT-") || if (android.os.Build.DEVICE.toUpperCase().startsWith("GT-") || android.os.Build.PRODUCT.toUpperCase().startsWith("GT-")
android.os.Build.PRODUCT.toUpperCase().startsWith("GT-") || || android.os.Build.DEVICE.toUpperCase().startsWith("YP-")) {
android.os.Build.DEVICE.toUpperCase().startsWith("YP-")) {
return true; return true;
} }
...@@ -141,8 +136,7 @@ public final class Compatibility { ...@@ -141,8 +136,7 @@ public final class Compatibility {
return true; return true;
} }
// LG-E720(b) // LG-E720(b)
if (android.os.Build.MODEL.toUpperCase().startsWith("LG-E720") if (android.os.Build.MODEL.toUpperCase().startsWith("LG-E720") && !Compatibility.isCompatible(9)) {
&& !Compatibility.isCompatible(9)) {
return true; return true;
} }
// LG-LS840 // LG-LS840
...@@ -151,11 +145,9 @@ public final class Compatibility { ...@@ -151,11 +145,9 @@ public final class Compatibility {
} }
// Huawei // Huawei
if (android.os.Build.DEVICE.equalsIgnoreCase("U8150") || if (android.os.Build.DEVICE.equalsIgnoreCase("U8150") || android.os.Build.DEVICE.equalsIgnoreCase("U8110")
android.os.Build.DEVICE.equalsIgnoreCase("U8110") || || android.os.Build.DEVICE.equalsIgnoreCase("U8120") || android.os.Build.DEVICE.equalsIgnoreCase("U8100")
android.os.Build.DEVICE.equalsIgnoreCase("U8120") || || android.os.Build.PRODUCT.equalsIgnoreCase("U8655")) {
android.os.Build.DEVICE.equalsIgnoreCase("U8100") ||
android.os.Build.PRODUCT.equalsIgnoreCase("U8655")) {
return true; return true;
} }
...@@ -210,17 +202,14 @@ public final class Compatibility { ...@@ -210,17 +202,14 @@ public final class Compatibility {
return Integer.toString(0x7); return Integer.toString(0x7);
} }
/* /*
* Too risky in terms of regressions else if (isCompatible(4)) { // * Too risky in terms of regressions else if (isCompatible(4)) { // VOICE_CALL return 0x4; }
* VOICE_CALL return 0x4; }
*/ */
/* /*
* if(android.os.Build.MODEL.equalsIgnoreCase("X10i")) { // VOICE_CALL * if(android.os.Build.MODEL.equalsIgnoreCase("X10i")) { // VOICE_CALL return Integer.toString(0x4); }
* return Integer.toString(0x4); }
*/ */
/* /*
* Not relevant anymore, atrix I tested sounds fine with that * Not relevant anymore, atrix I tested sounds fine with that if(android.os.Build.DEVICE.equalsIgnoreCase("olympus")) { //Motorola atrix bug
* if(android.os.Build.DEVICE.equalsIgnoreCase("olympus")) { //Motorola * // CAMCORDER return Integer.toString(0x5); }
* atrix bug // CAMCORDER return Integer.toString(0x5); }
*/ */
return Integer.toString(AudioSource.DEFAULT); return Integer.toString(AudioSource.DEFAULT);
...@@ -290,26 +279,18 @@ public final class Compatibility { ...@@ -290,26 +279,18 @@ public final class Compatibility {
} }
// All htc except.... // All htc except....
if (android.os.Build.PRODUCT.toLowerCase().startsWith("htc") if (android.os.Build.PRODUCT.toLowerCase().startsWith("htc") || android.os.Build.BRAND.toLowerCase().startsWith("htc")
|| android.os.Build.BRAND.toLowerCase().startsWith("htc")
|| android.os.Build.PRODUCT.toLowerCase().equalsIgnoreCase("inc") /* || android.os.Build.PRODUCT.toLowerCase().equalsIgnoreCase("inc") /*
* For * For Incredible
* Incredible
*/ */
|| android.os.Build.DEVICE.equalsIgnoreCase("passion") /* N1 */) { || android.os.Build.DEVICE.equalsIgnoreCase("passion") /* N1 */) {
if (android.os.Build.DEVICE.equalsIgnoreCase("hero") /* HTC HERO */ if (android.os.Build.DEVICE.equalsIgnoreCase("hero") /* HTC HERO */
|| android.os.Build.DEVICE.equalsIgnoreCase("magic") /* || android.os.Build.DEVICE.equalsIgnoreCase("magic") /*
* Magic * Magic Aka Dev G2
* Aka
* Dev
* G2
*/ */
|| android.os.Build.DEVICE.equalsIgnoreCase("tatoo") /* Tatoo */ || android.os.Build.DEVICE.equalsIgnoreCase("tatoo") /* Tatoo */
|| android.os.Build.DEVICE.equalsIgnoreCase("dream") /* || android.os.Build.DEVICE.equalsIgnoreCase("dream") /*
* Dream * Dream Aka Dev G1
* Aka
* Dev
* G1
*/ */
|| android.os.Build.DEVICE.equalsIgnoreCase("legend") /* Legend */ || android.os.Build.DEVICE.equalsIgnoreCase("legend") /* Legend */
...@@ -331,16 +312,13 @@ public final class Compatibility { ...@@ -331,16 +312,13 @@ public final class Compatibility {
} }
// Dell streak // Dell streak
if (android.os.Build.BRAND.toLowerCase().startsWith("dell") && if (android.os.Build.BRAND.toLowerCase().startsWith("dell") && android.os.Build.DEVICE.equalsIgnoreCase("streak")) {
android.os.Build.DEVICE.equalsIgnoreCase("streak")) {
return true; return true;
} }
// Motorola milestone 1 and 2 & motorola droid & defy not under 2.3 // Motorola milestone 1 and 2 & motorola droid & defy not under 2.3
if ((android.os.Build.DEVICE.toLowerCase().contains("milestone2") || if ((android.os.Build.DEVICE.toLowerCase().contains("milestone2") || android.os.Build.BOARD.toLowerCase().contains("sholes")
android.os.Build.BOARD.toLowerCase().contains("sholes") || || android.os.Build.PRODUCT.toLowerCase().contains("sholes") || android.os.Build.DEVICE.equalsIgnoreCase("olympus") || android.os.Build.DEVICE
android.os.Build.PRODUCT.toLowerCase().contains("sholes") || .toLowerCase().contains("umts_jordan")) && !isCompatible(9)) {
android.os.Build.DEVICE.equalsIgnoreCase("olympus") ||
android.os.Build.DEVICE.toLowerCase().contains("umts_jordan")) && !isCompatible(9)) {
return true; return true;
} }
// Moto defy mini // Moto defy mini
...@@ -357,9 +335,8 @@ public final class Compatibility { ...@@ -357,9 +335,8 @@ public final class Compatibility {
} }
private static boolean needToneWorkaround() { private static boolean needToneWorkaround() {
if (android.os.Build.PRODUCT.toLowerCase().startsWith("gt-i5800") || if (android.os.Build.PRODUCT.toLowerCase().startsWith("gt-i5800") || android.os.Build.PRODUCT.toLowerCase().startsWith("gt-i5801")
android.os.Build.PRODUCT.toLowerCase().startsWith("gt-i5801") || || android.os.Build.PRODUCT.toLowerCase().startsWith("gt-i9003")) {
android.os.Build.PRODUCT.toLowerCase().startsWith("gt-i9003")) {
return true; return true;
} }
return false; return false;
...@@ -369,8 +346,7 @@ public final class Compatibility { ...@@ -369,8 +346,7 @@ public final class Compatibility {
if (isCompatible(9)) { if (isCompatible(9)) {
return false; return false;
} }
if (android.os.Build.DEVICE.toUpperCase().startsWith("GT-I9000") || if (android.os.Build.DEVICE.toUpperCase().startsWith("GT-I9000") || android.os.Build.DEVICE.toUpperCase().startsWith("GT-P1000")) {
android.os.Build.DEVICE.toUpperCase().startsWith("GT-P1000")) {
return true; return true;
} }
return false; return false;
...@@ -395,8 +371,7 @@ public final class Compatibility { ...@@ -395,8 +371,7 @@ public final class Compatibility {
public static boolean shouldSetupAudioBeforeInit() { public static boolean shouldSetupAudioBeforeInit() {
// Setup for GT / GS samsung devices. // Setup for GT / GS samsung devices.
if (android.os.Build.DEVICE.toLowerCase().startsWith("gt-") if (android.os.Build.DEVICE.toLowerCase().startsWith("gt-") || android.os.Build.PRODUCT.toLowerCase().startsWith("gt-")) {
|| android.os.Build.PRODUCT.toLowerCase().startsWith("gt-")) {
return true; return true;
} }
return false; return false;
...@@ -404,8 +379,7 @@ public final class Compatibility { ...@@ -404,8 +379,7 @@ public final class Compatibility {
private static boolean shouldFocusAudio() { private static boolean shouldFocusAudio() {
/* HTC One X */ /* HTC One X */
if (android.os.Build.DEVICE.toLowerCase().startsWith("endeavoru") || if (android.os.Build.DEVICE.toLowerCase().startsWith("endeavoru") || android.os.Build.DEVICE.toLowerCase().startsWith("evita")) {
android.os.Build.DEVICE.toLowerCase().startsWith("evita")) {
return false; return false;
} }
...@@ -432,22 +406,17 @@ public final class Compatibility { ...@@ -432,22 +406,17 @@ public final class Compatibility {
// return SipConfigManager.AUDIO_IMPLEMENTATION_JAVA; // return SipConfigManager.AUDIO_IMPLEMENTATION_JAVA;
// } // }
public static boolean useFlipAnimation() { public static boolean useFlipAnimation() {
if (android.os.Build.BRAND.equalsIgnoreCase("archos") if (android.os.Build.BRAND.equalsIgnoreCase("archos") && android.os.Build.DEVICE.equalsIgnoreCase("g7a")) {
&& android.os.Build.DEVICE.equalsIgnoreCase("g7a")) {
return false; return false;
} }
return true; return true;
} }
public static Intent getContactPhoneIntent() { public static Intent getContactPhoneIntent() {
Intent intent = new Intent(Intent.ACTION_PICK); Intent intent = new Intent(Intent.ACTION_PICK);
/* /*
* intent.setAction(Intent.ACTION_GET_CONTENT); * intent.setAction(Intent.ACTION_GET_CONTENT); intent.setType(Contacts.Phones.CONTENT_ITEM_TYPE);
* intent.setType(Contacts.Phones.CONTENT_ITEM_TYPE);
*/ */
if (isCompatible(5)) { if (isCompatible(5)) {
// Don't use constant to allow backward compat simply // Don't use constant to allow backward compat simply
...@@ -461,7 +430,6 @@ public final class Compatibility { ...@@ -461,7 +430,6 @@ public final class Compatibility {
} }
public static boolean isTabletScreen(Context ctxt) { public static boolean isTabletScreen(Context ctxt) {
boolean isTablet = false; boolean isTablet = false;
if (!isCompatible(4)) { if (!isCompatible(4)) {
...@@ -499,11 +467,9 @@ public final class Compatibility { ...@@ -499,11 +467,9 @@ public final class Compatibility {
PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0);
ApplicationInfo ai = pi.applicationInfo; ApplicationInfo ai = pi.applicationInfo;
return (ai.flags & 0x00040000 /* return (ai.flags & 0x00040000 /*
* ApplicationInfo. * ApplicationInfo. FLAG_EXTERNAL_STORAGE
* FLAG_EXTERNAL_STORAGE
*/) == 0x00040000 /* */) == 0x00040000 /*
* ApplicationInfo. * ApplicationInfo. FLAG_EXTERNAL_STORAGE
* FLAG_EXTERNAL_STORAGE
*/; */;
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
// ignore // ignore
......
...@@ -41,8 +41,21 @@ public class MediaManager implements OnAudioFocusChangeListener{ ...@@ -41,8 +41,21 @@ public class MediaManager implements OnAudioFocusChangeListener{
@Override @Override
public void onAudioFocusChange(int arg0) { public void onAudioFocusChange(int arg0) {
// TODO Stub de la méthode généré automatiquement
} }
public void abandonAudioFocus() {
mAudioManager.abandonAudioFocus(this);
if (mAudioManager.isSpeakerphoneOn()) {
mAudioManager.setSpeakerphoneOn(false);
}
}
public void RouteToSpeaker() {
mAudioManager.setSpeakerphoneOn(true);
}
public void RouteToInternalSpeaker() {
mAudioManager.setSpeakerphoneOn(false);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment