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:launchMode="singleTop"
|
||||
android:noHistory="true"
|
||||
android:showWhenLocked="true"
|
||||
android:turnScreenOn="true"
|
||||
android:theme="@style/LinphoneStyleLight">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
@ -152,6 +154,7 @@
|
|||
android:name=".call.CallActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:noHistory="true"
|
||||
android:showWhenLocked="true"
|
||||
android:theme="@style/LinphoneStyleLight">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.call;
|
|||
|
||||
/*
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
getWindow()
|
||||
.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
|
||||
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
setContentView(R.layout.call);
|
||||
|
||||
// Earset Connectivity Broadcast Processing
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.call;
|
|||
|
||||
/*
|
||||
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
|
||||
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.view.KeyEvent;
|
||||
import android.view.TextureView;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -37,6 +36,7 @@ import java.util.ArrayList;
|
|||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.contacts.ContactsManager;
|
||||
import org.linphone.contacts.LinphoneContact;
|
||||
import org.linphone.core.Address;
|
||||
|
@ -82,10 +82,9 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
|
||||
getWindow()
|
||||
.addFlags(
|
||||
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
|
||||
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
||||
Compatibility.setShowWhenLocked(this, true);
|
||||
Compatibility.setTurnScreenOn(this, true);
|
||||
|
||||
setContentView(R.layout.call_incoming);
|
||||
|
||||
mName = findViewById(R.id.contact_name);
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.linphone.call;
|
|||
|
||||
/*
|
||||
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
|
||||
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.app.Activity;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ContentProviderClient;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.WindowManager;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import org.linphone.R;
|
||||
|
||||
|
@ -198,4 +200,16 @@ class ApiTwentyOnePlus {
|
|||
public static void closeContentProviderClient(ContentProviderClient client) {
|
||||
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.
|
||||
*/
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
|
@ -224,4 +225,16 @@ public class Compatibility {
|
|||
}
|
||||
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