More warnings removed

This commit is contained in:
Sylvain Berfini 2012-08-02 13:21:51 +02:00
parent cf1c1712d0
commit 7959949ab9
4 changed files with 12 additions and 19 deletions

View file

@ -53,6 +53,7 @@ public class IncomingCallActivity extends Activity implements LinphoneOnCallStat
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.incoming); setContentView(R.layout.incoming);
mNameView = (TextView) findViewById(R.id.incoming_caller_name); mNameView = (TextView) findViewById(R.id.incoming_caller_name);

View file

@ -25,7 +25,6 @@ import static android.media.AudioManager.ROUTE_EARPIECE;
import static android.media.AudioManager.ROUTE_SPEAKER; import static android.media.AudioManager.ROUTE_SPEAKER;
import static android.media.AudioManager.STREAM_RING; import static android.media.AudioManager.STREAM_RING;
import static android.media.AudioManager.STREAM_VOICE_CALL; import static android.media.AudioManager.STREAM_VOICE_CALL;
import static android.media.AudioManager.VIBRATE_TYPE_RINGER;
import static org.linphone.R.string.pref_codec_amr_key; import static org.linphone.R.string.pref_codec_amr_key;
import static org.linphone.R.string.pref_codec_amrwb_key; import static org.linphone.R.string.pref_codec_amrwb_key;
import static org.linphone.R.string.pref_codec_ilbc_key; import static org.linphone.R.string.pref_codec_ilbc_key;
@ -944,8 +943,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
// Brighten screen for at least 10 seconds // Brighten screen for at least 10 seconds
WakeLock wl = mPowerManager.newWakeLock( WakeLock wl = mPowerManager.newWakeLock(
PowerManager.ACQUIRE_CAUSES_WAKEUP PowerManager.ACQUIRE_CAUSES_WAKEUP
|PowerManager.ON_AFTER_RELEASE |PowerManager.ON_AFTER_RELEASE,
|PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
"incoming_call"); "incoming_call");
wl.acquire(10000); wl.acquire(10000);
@ -1041,7 +1039,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
} }
try { try {
if (mAudioManager.shouldVibrate(VIBRATE_TYPE_RINGER) && mVibrator !=null) { if ((mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE || mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) && mVibrator !=null) {
long[] patern = {0,1000,1000}; long[] patern = {0,1000,1000};
mVibrator.vibrate(patern, 1); mVibrator.vibrate(patern, 1);
} }

View file

@ -152,7 +152,9 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNM = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNM.cancel(INCALL_NOTIF_ID); // in case of crash the icon is not removed mNM.cancel(INCALL_NOTIF_ID); // in case of crash the icon is not removed
mNotif = new Notification(R.drawable.status_level, "", System.currentTimeMillis()); mNotif = new Notification();
mNotif.icon = R.drawable.status_level;
mNotif.when = System.currentTimeMillis();
mNotif.iconLevel=IC_LEVEL_ORANGE; mNotif.iconLevel=IC_LEVEL_ORANGE;
mNotif.flags |= Notification.FLAG_ONGOING_EVENT; mNotif.flags |= Notification.FLAG_ONGOING_EVENT;
@ -403,7 +405,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
sb.append("MODEL=").append(Build.MODEL).append("\n"); sb.append("MODEL=").append(Build.MODEL).append("\n");
//MANUFACTURER doesn't exist in android 1.5. //MANUFACTURER doesn't exist in android 1.5.
//sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n"); //sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n");
sb.append("SDK=").append(Build.VERSION.SDK); sb.append("SDK=").append(Build.VERSION.SDK_INT);
Log.i(sb.toString()); Log.i(sb.toString());
} }

View file

@ -24,11 +24,8 @@ import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView;
import android.os.Bundle; import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.GestureDetector.OnDoubleTapListener; import android.view.GestureDetector.OnDoubleTapListener;
@ -40,13 +37,13 @@ import android.view.SurfaceView;
import android.view.View; import android.view.View;
import android.view.View.OnTouchListener; import android.view.View.OnTouchListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager;
/** /**
* @author Sylvain Berfini * @author Sylvain Berfini
*/ */
@TargetApi(5) @TargetApi(5)
public class VideoCallFragment extends Fragment implements OnGestureListener, OnDoubleTapListener { public class VideoCallFragment extends Fragment implements OnGestureListener, OnDoubleTapListener {
private WakeLock mWakeLock;
private SurfaceView mVideoView; private SurfaceView mVideoView;
private SurfaceView mCaptureView; private SurfaceView mCaptureView;
private AndroidVideoWindowImpl androidVideoWindowImpl; private AndroidVideoWindowImpl androidVideoWindowImpl;
@ -55,12 +52,15 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
private float mZoomFactor; private float mZoomFactor;
private float mZoomCenterX, mZoomCenterY; private float mZoomCenterX, mZoomCenterY;
@SuppressWarnings("deprecation") // Warning useless because value is ignored and automatically set by new APIs.
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
View view = inflater.inflate(R.layout.video, container, false); View view = inflater.inflate(R.layout.video, container, false);
mGestureDetector = new GestureDetector(this); mGestureDetector = new GestureDetector(getActivity(), this);
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface); mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface);
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface); mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface);
@ -96,9 +96,6 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
}); });
androidVideoWindowImpl.init(); androidVideoWindowImpl.init();
PowerManager pm = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, Log.TAG);
mVideoView.setOnTouchListener(new OnTouchListener() { mVideoView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
inCallActivity.displayVideoCallControlsIfHidden(); inCallActivity.displayVideoCallControlsIfHidden();
@ -150,8 +147,6 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl); LinphoneManager.getLc().setVideoWindow(androidVideoWindowImpl);
} }
} }
mWakeLock.acquire();
} }
@Override @Override
@ -164,9 +159,6 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
LinphoneManager.getLc().setVideoWindow(null); LinphoneManager.getLc().setVideoWindow(null);
} }
if (mWakeLock.isHeld())
mWakeLock.release();
super.onPause(); super.onPause();
if (mVideoView != null) if (mVideoView != null)