Do not use window flags for turn_screen_on and show_when_locked for Android 8.1+, fixes incoming call not shown on screensaver
This commit is contained in:
parent
19d05da222
commit
df6f346111
6 changed files with 39 additions and 12 deletions
|
@ -134,6 +134,8 @@
|
||||||
android:name=".call.CallIncomingActivity"
|
android:name=".call.CallIncomingActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
|
android:showWhenLocked="true"
|
||||||
|
android:turnScreenOn="true"
|
||||||
android:theme="@style/LinphoneStyleLight">
|
android:theme="@style/LinphoneStyleLight">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -152,6 +154,7 @@
|
||||||
android:name=".call.CallActivity"
|
android:name=".call.CallActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:noHistory="true"
|
android:noHistory="true"
|
||||||
|
android:showWhenLocked="true"
|
||||||
android:theme="@style/LinphoneStyleLight">
|
android:theme="@style/LinphoneStyleLight">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.call;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CallActivity.java
|
CallActivity.java
|
||||||
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -174,10 +174,8 @@ public class CallActivity extends LinphoneGenericActivity
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWindow()
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
.addFlags(
|
|
||||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
|
|
||||||
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
|
|
||||||
setContentView(R.layout.call);
|
setContentView(R.layout.call);
|
||||||
|
|
||||||
// Earset Connectivity Broadcast Processing
|
// Earset Connectivity Broadcast Processing
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.call;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CallIncomingActivity.java
|
CallIncomingActivity.java
|
||||||
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -28,7 +28,6 @@ import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.TextureView;
|
import android.view.TextureView;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -37,6 +36,7 @@ import java.util.ArrayList;
|
||||||
import org.linphone.LinphoneActivity;
|
import org.linphone.LinphoneActivity;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
|
import org.linphone.compatibility.Compatibility;
|
||||||
import org.linphone.contacts.ContactsManager;
|
import org.linphone.contacts.ContactsManager;
|
||||||
import org.linphone.contacts.LinphoneContact;
|
import org.linphone.contacts.LinphoneContact;
|
||||||
import org.linphone.core.Address;
|
import org.linphone.core.Address;
|
||||||
|
@ -82,10 +82,9 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWindow()
|
Compatibility.setShowWhenLocked(this, true);
|
||||||
.addFlags(
|
Compatibility.setTurnScreenOn(this, true);
|
||||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
|
||||||
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
|
||||||
setContentView(R.layout.call_incoming);
|
setContentView(R.layout.call_incoming);
|
||||||
|
|
||||||
mName = findViewById(R.id.contact_name);
|
mName = findViewById(R.id.contact_name);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.call;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CallOutgoingActivity.java
|
CallOutgoingActivity.java
|
||||||
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -20,11 +20,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.ContentProviderClient;
|
import android.content.ContentProviderClient;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.view.WindowManager;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
|
|
||||||
|
@ -198,4 +200,16 @@ class ApiTwentyOnePlus {
|
||||||
public static void closeContentProviderClient(ContentProviderClient client) {
|
public static void closeContentProviderClient(ContentProviderClient client) {
|
||||||
client.release();
|
client.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setShowWhenLocked(Activity activity, boolean enable) {
|
||||||
|
if (enable) {
|
||||||
|
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTurnScreenOn(Activity activity, boolean enable) {
|
||||||
|
if (enable) {
|
||||||
|
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ 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 android.app.Activity;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
@ -224,4 +225,16 @@ public class Compatibility {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setShowWhenLocked(Activity activity, boolean enable) {
|
||||||
|
if (Version.sdkStrictlyBelow(Version.API27_OREO_81)) {
|
||||||
|
ApiTwentyOnePlus.setShowWhenLocked(activity, enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTurnScreenOn(Activity activity, boolean enable) {
|
||||||
|
if (Version.sdkStrictlyBelow(Version.API27_OREO_81)) {
|
||||||
|
ApiTwentyOnePlus.setTurnScreenOn(activity, enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue