From bc48b3d7ec9df5642a72dac277096dcac4981810 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Tue, 17 Oct 2017 15:41:20 +0200 Subject: [PATCH] [SASNotif] Do not display SAS notif if not in screen locked mode --- src/android/org/linphone/StatusFragment.java | 32 ++++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/android/org/linphone/StatusFragment.java b/src/android/org/linphone/StatusFragment.java index c5845aa86..7d5e8fae0 100644 --- a/src/android/org/linphone/StatusFragment.java +++ b/src/android/org/linphone/StatusFragment.java @@ -17,21 +17,11 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import org.linphone.assistant.AssistantActivity; -import org.linphone.core.CallDirection; -import org.linphone.core.LinphoneCall; -import org.linphone.core.LinphoneContent; -import org.linphone.core.LinphoneCore; -import org.linphone.core.LinphoneCore.MediaEncryption; -import org.linphone.core.LinphoneCore.RegistrationState; -import org.linphone.core.LinphoneCoreListenerBase; -import org.linphone.core.LinphoneEvent; -import org.linphone.core.LinphoneProxyConfig; -import org.linphone.mediastream.Log; import android.app.Activity; import android.app.Dialog; import android.app.Fragment; +import android.app.KeyguardManager; import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; @@ -48,6 +38,18 @@ import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; +import org.linphone.assistant.AssistantActivity; +import org.linphone.core.CallDirection; +import org.linphone.core.LinphoneCall; +import org.linphone.core.LinphoneContent; +import org.linphone.core.LinphoneCore; +import org.linphone.core.LinphoneCore.MediaEncryption; +import org.linphone.core.LinphoneCore.RegistrationState; +import org.linphone.core.LinphoneCoreListenerBase; +import org.linphone.core.LinphoneEvent; +import org.linphone.core.LinphoneProxyConfig; +import org.linphone.mediastream.Log; + public class StatusFragment extends Fragment { private Handler refreshHandler = new Handler(); private TextView statusText, voicemailCount; @@ -413,8 +415,12 @@ public class StatusFragment extends Fragment { zrtpToRead = token.substring(2); } - LinphoneService.instance().displaySasNotification(token); - + // Obiane specific dev : display sas notif only if screen locked + KeyguardManager myKM = (KeyguardManager) getActivity().getSystemService(Context.KEYGUARD_SERVICE); + if( myKM.inKeyguardRestrictedInputMode()) { + //Screen is locked + LinphoneService.instance().displaySasNotification(call.getAuthenticationToken()); + } TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText); String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead) + getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen);