[SASNotif] Do not display SAS notif if not in screen locked mode

This commit is contained in:
Brieuc Viel 2017-10-17 15:41:20 +02:00
parent de62b3e778
commit bc48b3d7ec

View file

@ -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 along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 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.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.app.Fragment; import android.app.Fragment;
import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -48,6 +38,18 @@ import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; 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 { public class StatusFragment extends Fragment {
private Handler refreshHandler = new Handler(); private Handler refreshHandler = new Handler();
private TextView statusText, voicemailCount; private TextView statusText, voicemailCount;
@ -413,8 +415,12 @@ public class StatusFragment extends Fragment {
zrtpToRead = token.substring(2); 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); TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText);
String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead) String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead)
+ getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen); + getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen);