mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-18 02:05:01 +01:00
dismiss keyguard for CallNotificationActivity (WIP, see TODO)
Whenever i click the button to accept the call, CallActivity is started by intent. CallActivity itself has the same logic to dismiss the keyguard. The problem is: When switching from CallNotificationActivity to CallActivity the lockscreen is shown indeed! So i guess Android recognizes "oh, CallNotificationActivity is gone. Let's show the lockscreen" before it recognizes that the new activity also dismiss the lockscreen ?! I fear for this scenario it was not the best idea to have 2 different activies.. (before it was only 1 activity and 2 condcutor controllers..) Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
e05334cb9a
commit
57804c8d62
@ -129,7 +129,8 @@
|
|||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:taskAffinity=".call"
|
android:taskAffinity=".call"
|
||||||
android:excludeFromRecents="true" />
|
android:excludeFromRecents="true"
|
||||||
|
android:showOnLockScreen="true"/>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.CallNotificationActivity"
|
android:name=".activities.CallNotificationActivity"
|
||||||
@ -138,7 +139,8 @@
|
|||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:taskAffinity=".call"
|
android:taskAffinity=".call"
|
||||||
android:excludeFromRecents="true" />
|
android:excludeFromRecents="true"
|
||||||
|
android:showOnLockScreen="true" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.FullScreenImageActivity"
|
android:name=".activities.FullScreenImageActivity"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
package com.nextcloud.talk.activities;
|
package com.nextcloud.talk.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.KeyguardManager;
|
||||||
import android.app.PictureInPictureParams;
|
import android.app.PictureInPictureParams;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -39,6 +40,7 @@ import android.text.TextUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Rational;
|
import android.util.Rational;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
import com.bluelinelabs.logansquare.LoganSquare;
|
||||||
import com.facebook.common.executors.UiThreadImmediateExecutorService;
|
import com.facebook.common.executors.UiThreadImmediateExecutorService;
|
||||||
@ -130,6 +132,10 @@ public class CallNotificationActivity extends BaseActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
||||||
|
|
||||||
|
dismissKeyguard();
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
|
|
||||||
eventBus.post(new CallNotificationClick());
|
eventBus.post(new CallNotificationClick());
|
||||||
|
|
||||||
binding = CallNotificationActivityBinding.inflate(getLayoutInflater());
|
binding = CallNotificationActivityBinding.inflate(getLayoutInflater());
|
||||||
@ -489,7 +495,6 @@ public class CallNotificationActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void enterPipMode() {
|
void enterPipMode() {
|
||||||
// enableKeyguard();
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
enterPictureInPictureMode(getPipParams());
|
enterPictureInPictureMode(getPipParams());
|
||||||
} else {
|
} else {
|
||||||
@ -526,4 +531,19 @@ public class CallNotificationActivity extends BaseActivity {
|
|||||||
binding.callAnswerButtons.setVisibility(View.VISIBLE);
|
binding.callAnswerButtons.setVisibility(View.VISIBLE);
|
||||||
binding.incomingCallRelativeLayout.setVisibility(View.VISIBLE);
|
binding.incomingCallRelativeLayout.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: dismiss keyguard works, but whenever accepting the call and switch to CallActivity by intent, the
|
||||||
|
// lockscreen is shown (although CallActivity also dismisses the keyguard in the same way.)
|
||||||
|
private void dismissKeyguard() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||||
|
setShowWhenLocked(true);
|
||||||
|
setTurnScreenOn(true);
|
||||||
|
KeyguardManager keyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
|
||||||
|
keyguardManager.requestDismissKeyguard(this, null);
|
||||||
|
} else {
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
|
||||||
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user