@ -0,0 +1,3 @@
|
||||
-dontwarn org.webrtc.NetworkMonitorAutoDetect
|
||||
-dontwarn android.net.Network
|
||||
-keep class org.webrtc.** { *; }
|
||||
@ -0,0 +1,3 @@
|
||||
|
||||
all:
|
||||
protoc --java_out=../src/ WebRtcData.proto
|
||||
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (C) 2014-2016 Open Whisper Systems
|
||||
*
|
||||
* Licensed according to the LICENSE file in this repository.
|
||||
*/
|
||||
|
||||
package signal;
|
||||
|
||||
option java_package = "org.thoughtcrime.securesms.webrtc";
|
||||
option java_outer_classname = "WebRtcDataProtos";
|
||||
|
||||
message Connected {
|
||||
optional uint64 id = 1;
|
||||
}
|
||||
|
||||
message Hangup {
|
||||
optional uint64 id = 1;
|
||||
}
|
||||
|
||||
message VideoStreamingStatus {
|
||||
optional uint64 id = 1;
|
||||
optional bool enabled = 2;
|
||||
}
|
||||
|
||||
message Data {
|
||||
|
||||
optional Connected connected = 1;
|
||||
optional Hangup hangup = 2;
|
||||
optional VideoStreamingStatus videoStreamingStatus = 3;
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 553 B |
|
After Width: | Height: | Size: 428 B |
|
After Width: | Height: | Size: 468 B |
|
After Width: | Height: | Size: 483 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 138 B |
|
After Width: | Height: | Size: 365 B |
|
After Width: | Height: | Size: 389 B |
|
After Width: | Height: | Size: 288 B |
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 325 B |
|
After Width: | Height: | Size: 131 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 251 B |
|
After Width: | Height: | Size: 712 B |
|
After Width: | Height: | Size: 484 B |
|
After Width: | Height: | Size: 547 B |
|
After Width: | Height: | Size: 601 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 152 B |
|
After Width: | Height: | Size: 455 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 713 B |
|
After Width: | Height: | Size: 830 B |
|
After Width: | Height: | Size: 882 B |
|
After Width: | Height: | Size: 234 B |
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 654 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 902 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 290 B |
|
After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 878 B |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval" >
|
||||
<solid android:color="#22000000" />
|
||||
</shape>
|
||||
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/compoundBackgroundItem" android:drawable="@drawable/webrtc_control_background"/>
|
||||
|
||||
<item android:id="@+id/moreIndicatorItem"
|
||||
android:top="5dp"
|
||||
android:left="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="5dp">
|
||||
<bitmap android:src="@drawable/redphone_ic_more_indicator_holo_dark"
|
||||
android:gravity="bottom|right" />
|
||||
</item>
|
||||
|
||||
<item android:id="@+id/bluetoothItem"
|
||||
android:top="5dp"
|
||||
android:left="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="5dp">
|
||||
<bitmap android:src="@drawable/ic_phone_bluetooth_speaker_white_24dp"
|
||||
android:gravity="center" />
|
||||
</item>
|
||||
|
||||
<!-- Handset earpiece is active -->
|
||||
<item android:id="@+id/handsetItem" android:top="5dp"
|
||||
android:left="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="5dp">
|
||||
<bitmap android:src="@drawable/ic_phone_in_talk_white_24dp"
|
||||
android:gravity="center" />
|
||||
</item>
|
||||
|
||||
<!-- Speakerphone icon showing 'speaker on' state -->
|
||||
<item android:id="@+id/speakerphoneOnItem" android:top="5dp"
|
||||
android:left="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="5dp">
|
||||
<bitmap android:src="@drawable/ic_volume_up_white_24dp"
|
||||
android:gravity="center" />
|
||||
</item>
|
||||
|
||||
<!--<!– Speakerphone icon showing 'speaker off' state –>-->
|
||||
<!--<item android:id="@+id/speakerphoneOffItem">-->
|
||||
<!--<bitmap android:src="@drawable/ic_volume_mute_white_24dp"-->
|
||||
<!--android:gravity="center" />-->
|
||||
<!--</item>-->
|
||||
|
||||
</layer-list>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/circle_alpha" android:state_checked="true"/>
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/webrtc_control_background"/>
|
||||
<item android:top="5dp"
|
||||
android:left="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="5dp"
|
||||
android:drawable="@drawable/ic_mic_off_white_24dp"/>
|
||||
</layer-list>
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/webrtc_control_background"/>
|
||||
<item android:top="5dp"
|
||||
android:left="5dp"
|
||||
android:right="5dp"
|
||||
android:bottom="5dp"
|
||||
android:drawable="@drawable/ic_videocam_white_24dp"/>
|
||||
</layer-list>
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<org.thoughtcrime.securesms.components.webrtc.WebRtcCallScreen android:id="@+id/callScreen"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" />
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/inCallControls"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
tools:background="@color/textsecure_primary">
|
||||
|
||||
<ToggleButton android:id="@+id/audioButton"
|
||||
style="@style/WebRtcCallCompoundButton"
|
||||
android:background="@drawable/webrtc_audio_button"
|
||||
tools:checked="true"
|
||||
android:layout_marginRight="15dp"/>
|
||||
|
||||
|
||||
<ToggleButton android:id="@+id/muteButton"
|
||||
style="@style/WebRtcCallCompoundButton"
|
||||
android:background="@drawable/webrtc_mute_button"
|
||||
android:contentDescription="@string/redphone_call_controls__mute"
|
||||
android:layout_marginRight="15dp"
|
||||
tools:checked="false"
|
||||
/>
|
||||
|
||||
<ToggleButton android:id="@+id/video_mute_button"
|
||||
style="@style/WebRtcCallCompoundButton"
|
||||
android:background="@drawable/webrtc_video_mute_button"/>
|
||||
|
||||
</merge>
|
||||
@ -0,0 +1,249 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2007 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/incall_screen"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- "Call info" block #1, for the foreground call. -->
|
||||
<RelativeLayout android:id="@+id/call_info_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- Contact photo for call_info_1 -->
|
||||
<FrameLayout android:id="@+id/image_container"
|
||||
android:layout_below="@+id/call_banner_1"
|
||||
android:gravity="top|center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView android:id="@+id/photo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/black"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="visible"
|
||||
tools:src="@drawable/ic_contact_picture_large"
|
||||
/>
|
||||
|
||||
<LinearLayout android:id="@+id/untrusted_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/grey_400"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView android:id="@+id/untrusted_explanation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:maxWidth="270dp"
|
||||
android:lineSpacingExtra="2sp"
|
||||
tools:text="The safety numbers for your conversation with Masha have changed. This could either mean that someone is trying to intercept your communication, or that Masha simply re-installed Signal. You may wish to verify safety numbers for this contact."/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="20dp"
|
||||
android:maxWidth="250dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button android:id="@+id/accept_safety_numbers"
|
||||
android:text="Accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"/>
|
||||
|
||||
<Button android:id="@+id/cancel_safety_numbers"
|
||||
android:text="Cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<org.thoughtcrime.securesms.components.webrtc.PercentFrameLayout
|
||||
android:id="@+id/remote_render_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:visibility="invisible"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.webrtc.PercentFrameLayout
|
||||
android:id="@+id/local_render_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:visibility="invisible"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!-- "Call Banner" for call #1, the foregound or ringing call.
|
||||
The "call banner" is a block of info about a single call,
|
||||
including the contact name, phone number, call time counter,
|
||||
and other status info. This info is shown as a "banner"
|
||||
overlaid across the top of contact photo. -->
|
||||
<RelativeLayout android:id="@+id/call_banner_1"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="80dp"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:background="@color/textsecure_primary"
|
||||
>
|
||||
|
||||
<!-- Name (or the phone number, if we don't have a name to display). -->
|
||||
<TextView android:id="@+id/name"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="50sp"
|
||||
android:textSize="40sp"
|
||||
android:textColor="#FFFFFF"
|
||||
android:singleLine="true"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
tools:text="Ali Connors"
|
||||
/>
|
||||
|
||||
<!-- Label (like "Mobile" or "Work", if present) and phone number, side by side -->
|
||||
<LinearLayout android:id="@+id/labelAndNumber"
|
||||
android:layout_below="@id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingRight="50sp"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<TextView android:id="@+id/label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFFFFF"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="@string/redphone_call_card__signal_call"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
<TextView android:id="@+id/phoneNumber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="#FFFFFF"
|
||||
android:singleLine="true"
|
||||
tools:text="+14152222222"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Elapsed time indication for a call in progress. -->
|
||||
<TextView android:id="@+id/elapsedTime"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="#FFFFFF"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
|
||||
<!-- Call type indication: a special label and/or branding
|
||||
for certain kinds of calls (like "Internet call" for a SIP call.) -->
|
||||
<TextView android:id="@+id/callTypeLabel"
|
||||
android:layout_below="@id/labelAndNumber"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="#FFFFFF"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:visibility="gone"
|
||||
android:text="@string/redphone_call_card__signal_call"
|
||||
/>
|
||||
|
||||
<!-- Social status (currently unused) -->
|
||||
<TextView android:id="@+id/socialStatus"
|
||||
android:layout_below="@id/callTypeLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="#FFFFFF"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.webrtc.WebRtcCallControls
|
||||
android:id="@+id/inCallControls"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/labelAndNumber"/>
|
||||
|
||||
|
||||
</RelativeLayout> <!-- End of call_banner for call_info #1. -->
|
||||
|
||||
<!-- The "call state label": In some states, this shows a special
|
||||
indication like "Dialing" or "Incoming call" or "Call ended".
|
||||
It's unused for the normal case of an active ongoing call. -->
|
||||
<!-- This is visually part of the call banner, but it's not actually
|
||||
part of the "call_banner_1" RelativeLayout since it needs a
|
||||
different background color. -->
|
||||
<TextView android:id="@+id/callStateLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/call_banner_1"
|
||||
android:gravity="right"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingRight="24dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textAllCaps="true"
|
||||
android:background="#8033b5e5"
|
||||
tools:text="connected"
|
||||
/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/hangup_fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:src="@drawable/ic_call_end_white_48dp"
|
||||
android:focusable="true"
|
||||
app:backgroundTint="@color/red_500"
|
||||
android:visibility="visible"
|
||||
android:contentDescription="End call"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.thoughtcrime.securesms.components.webrtc.WebRtcIncomingCallOverlay
|
||||
android:id="@+id/callControls"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.thoughtcrime.redphone.util.multiwaveview.MultiWaveView
|
||||
android:id="@+id/incomingCallWidget"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="-46dp"
|
||||
android:background="@android:color/black"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView android:id="@+id/redphone_banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/incomingCallWidget"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textAllCaps="true"
|
||||
android:background="@color/textsecure_primary"
|
||||
android:text="@string/redphone_call_controls__signal_call"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@ -1,46 +0,0 @@
|
||||
package org.thoughtcrime.redphone;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class RedPhoneShare extends Activity {
|
||||
|
||||
private static final String TAG = RedPhone.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
if (getIntent().getData() != null && "content".equals(getIntent().getData().getScheme())) {
|
||||
Cursor cursor = null;
|
||||
|
||||
try {
|
||||
cursor = getContentResolver().query(getIntent().getData(), null, null, null, null);
|
||||
|
||||
if (cursor != null && cursor.moveToNext()) {
|
||||
String destination = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.RawContacts.Data.DATA1));
|
||||
|
||||
if (!TextUtils.isEmpty(destination)) {
|
||||
Intent serviceIntent = new Intent(this, RedPhoneService.class);
|
||||
serviceIntent.setAction(RedPhoneService.ACTION_OUTGOING_CALL);
|
||||
serviceIntent.putExtra(RedPhoneService.EXTRA_REMOTE_NUMBER, destination);
|
||||
startService(serviceIntent);
|
||||
|
||||
Intent activityIntent = new Intent(this, RedPhone.class);
|
||||
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(activityIntent);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null) cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package org.thoughtcrime.redphone;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.service.WebRtcCallService;
|
||||
import org.thoughtcrime.securesms.util.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
|
||||
public class VoiceCallShare extends Activity {
|
||||
|
||||
private static final String TAG = VoiceCallShare.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
if (getIntent().getData() != null && "content".equals(getIntent().getData().getScheme())) {
|
||||
Cursor cursor = null;
|
||||
|
||||
try {
|
||||
cursor = getContentResolver().query(getIntent().getData(), null, null, null, null);
|
||||
|
||||
if (cursor != null && cursor.moveToNext()) {
|
||||
String destination = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.RawContacts.Data.DATA1));
|
||||
|
||||
if (!TextUtils.isEmpty(destination)) {
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(this, destination, true);
|
||||
DirectoryHelper.UserCapabilities capabilities = DirectoryHelper.getUserCapabilities(this, recipients);
|
||||
|
||||
if (TextSecurePreferences.isWebrtcCallingEnabled(this) &&
|
||||
capabilities.getVideoCapability() == DirectoryHelper.UserCapabilities.Capability.SUPPORTED)
|
||||
{
|
||||
Intent serviceIntent = new Intent(this, WebRtcCallService.class);
|
||||
serviceIntent.setAction(WebRtcCallService.ACTION_OUTGOING_CALL);
|
||||
serviceIntent.putExtra(WebRtcCallService.EXTRA_REMOTE_NUMBER, destination);
|
||||
startService(serviceIntent);
|
||||
|
||||
Intent activityIntent = new Intent(this, WebRtcCallActivity.class);
|
||||
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(activityIntent);
|
||||
} else {
|
||||
Intent serviceIntent = new Intent(this, RedPhoneService.class);
|
||||
serviceIntent.setAction(RedPhoneService.ACTION_OUTGOING_CALL);
|
||||
serviceIntent.putExtra(RedPhoneService.EXTRA_REMOTE_NUMBER, destination);
|
||||
startService(serviceIntent);
|
||||
|
||||
Intent activityIntent = new Intent(this, RedPhone.class);
|
||||
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(activityIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null) cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,404 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Open Whisper Systems
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Configuration;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import org.thoughtcrime.redphone.util.AudioUtils;
|
||||
import org.thoughtcrime.securesms.components.webrtc.WebRtcCallControls;
|
||||
import org.thoughtcrime.securesms.components.webrtc.WebRtcCallScreen;
|
||||
import org.thoughtcrime.securesms.components.webrtc.WebRtcIncomingCallOverlay;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.IdentityDatabase;
|
||||
import org.thoughtcrime.securesms.events.WebRtcCallEvent;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.service.WebRtcCallService;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.whispersystems.libsignal.IdentityKey;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
public class WebRtcCallActivity extends Activity {
|
||||
|
||||
private static final String TAG = WebRtcCallActivity.class.getSimpleName();
|
||||
|
||||
private static final int STANDARD_DELAY_FINISH = 1000;
|
||||
public static final int BUSY_SIGNAL_DELAY_FINISH = 5500;
|
||||
|
||||
public static final String ANSWER_ACTION = WebRtcCallActivity.class.getCanonicalName() + ".ANSWER_ACTION";
|
||||
public static final String DENY_ACTION = WebRtcCallActivity.class.getCanonicalName() + ".DENY_ACTION";
|
||||
public static final String END_CALL_ACTION = WebRtcCallActivity.class.getCanonicalName() + ".END_CALL_ACTION";
|
||||
|
||||
private WebRtcCallScreen callScreen;
|
||||
private BroadcastReceiver bluetoothStateReceiver;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.webrtc_call_activity);
|
||||
|
||||
setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);
|
||||
|
||||
initializeResources();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
initializeScreenshotSecurity();
|
||||
EventBus.getDefault().registerSticky(this);
|
||||
registerBluetoothReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent){
|
||||
if (ANSWER_ACTION.equals(intent.getAction())) {
|
||||
handleAnswerCall();
|
||||
} else if (DENY_ACTION.equals(intent.getAction())) {
|
||||
handleDenyCall();
|
||||
} else if (END_CALL_ACTION.equals(intent.getAction())) {
|
||||
handleEndCall();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
EventBus.getDefault().unregister(this);
|
||||