Skip to content
Snippets Groups Projects
Commit 4bb26e07 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

call: show activity on incoming call and lock screen

* launch CallActivity on incoming call
* make CallActivity available on lock screen

Uses API 27 (Android 8.1) so update the platform.

Change-Id: Ie4f89fdd728def5c58fb1012b41ff141c22a3544
parent ac87703c
No related branches found
No related tags found
No related merge requests found
......@@ -50,8 +50,8 @@ RUN (while sleep 1; do echo "y"; done) | sdkmanager --update
# Android SDK libraries, NDK
ENV ANDROID_DEPS=\
'build-tools;26.0.2 \
platforms;android-26 \
'build-tools;26.0.3 \
platforms;android-27 \
extras;android;m2repository \
extras;google;m2repository \
ndk-bundle'
......
......@@ -41,12 +41,12 @@ dependencies {
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 27
buildToolsVersion "26.0.3"
defaultConfig {
minSdkVersion 18
targetSdkVersion 26
targetSdkVersion 27
vectorDrawables.useSupportLibrary = true
}
......
......@@ -157,6 +157,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
android:label="@string/app_name"
android:screenOrientation="fullUser"
android:theme="@style/AppTheme.ActionBar.Transparent"
android:showOnLockScreen="true"
android:windowSoftInputMode="adjustPan|stateHidden">
<intent-filter>
<action android:name="android.intent.action.CALL" />
......@@ -276,6 +277,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<activity
android:name="cx.ring.tv.call.TVCallActivity"
android:showOnLockScreen="true"
android:theme="@style/AppThemeBase">
<intent-filter>
<action android:name="cx.ring.action.CALL" />
......
......@@ -26,10 +26,12 @@ import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import cx.ring.BuildConfig;
import cx.ring.R;
......@@ -54,6 +56,14 @@ public class CallActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setTurnScreenOn(true);
setShowWhenLocked(true);
} else {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
setContentView(R.layout.activity_call_layout);
mMainView = findViewById(R.id.main_call_layout);
......
......@@ -758,14 +758,14 @@ public class DRingService extends Service implements Observer<ServiceEvent> {
case INCOMING_CALL:
SipCall call = arg.getEventInput(ServiceEvent.EventInput.CALL, SipCall.class);
if (call != null && isTv()) {
if (call != null) {
Log.d(TAG, "call id : " + call.getCallId());
Bundle extras = new Bundle();
extras.putString("account", mAccountService.getCurrentAccount().getAccountID());
extras.putString("callId", call.getCallId());
startActivity(new Intent(Intent.ACTION_VIEW)
.putExtras(extras)
.setClass(getApplicationContext(), TVCallActivity.class)
.setClass(getApplicationContext(), isTv() ? TVCallActivity.class : CallActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
}
break;
......
......@@ -21,10 +21,12 @@ package cx.ring.tv.call;
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.WindowManager;
import cx.ring.R;
import cx.ring.application.RingApplication;
......@@ -39,6 +41,14 @@ public class TVCallActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setTurnScreenOn(true);
setShowWhenLocked(true);
} else {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}
setContentView(R.layout.tv_activity_call);
// dependency injection
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment