diff options
author | twyen <twyen@google.com> | 2017-08-02 13:34:44 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-03 08:29:48 -0700 |
commit | 286a785c6f0ec653b1876e7532c79e15785c99ff (patch) | |
tree | 81878c40a3ed87ad4b1a625c77362305c952ace7 /java/com | |
parent | b9fd26e9c61745126ea19f5067406a5d26ea7133 (diff) |
Reapply Screen timeout when in call activity is recreated
Previously the keep screen on flag is only applied the the activity once when the video call is created. The flag will be lost when the activity is recreated, such as rotating the screen.
In this CL, the keep screen on state is persisted in the InCallPresenter, and will be reapplied every time the activity is created. The flag will be cleared when the call is finished or when the video call has ened
Bug: 64101648,63917358
Test: InCallPresenterTest
PiperOrigin-RevId: 164030247
Change-Id: Ie90f8dd0dfc9b542d691296c729dc3342a8bc2ad
Diffstat (limited to 'java/com')
-rw-r--r-- | java/com/android/incallui/InCallPresenter.java | 13 | ||||
-rw-r--r-- | java/com/android/incallui/VideoCallPresenter.java | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index 3a4862233..6c08c497b 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -191,6 +191,8 @@ public class InCallPresenter implements CallList.Listener { /** Determines if the InCall UI is in fullscreen mode or not. */ private boolean mIsFullScreen = false; + private boolean mScreenTimeoutEnabled = true; + private PhoneStateListener mPhoneStateListener = new PhoneStateListener() { @Override @@ -400,6 +402,7 @@ public class InCallPresenter implements CallList.Listener { } private void attemptFinishActivity() { + mScreenTimeoutEnabled = true; final boolean doFinish = (mInCallActivity != null && isActivityStarted()); LogUtil.i("InCallPresenter.attemptFinishActivity", "Hide in call UI: " + doFinish); if (doFinish) { @@ -1077,6 +1080,7 @@ public class InCallPresenter implements CallList.Listener { // TODO(maxwelb) - b/36649622: Investigate this redundant call mStatusBarNotifier.updateNotification(mCallList); } + applyScreenTimeout(); } /*package*/ @@ -1590,13 +1594,18 @@ public class InCallPresenter implements CallList.Listener { public void enableScreenTimeout(boolean enable) { LogUtil.v("InCallPresenter.enableScreenTimeout", "enableScreenTimeout: value=" + enable); + mScreenTimeoutEnabled = enable; + applyScreenTimeout(); + } + + private void applyScreenTimeout() { if (mInCallActivity == null) { - LogUtil.e("InCallPresenter.enableScreenTimeout", "InCallActivity is null."); + LogUtil.e("InCallPresenter.applyScreenTimeout", "InCallActivity is null."); return; } final Window window = mInCallActivity.getWindow(); - if (enable) { + if (mScreenTimeoutEnabled) { window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else { window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); diff --git a/java/com/android/incallui/VideoCallPresenter.java b/java/com/android/incallui/VideoCallPresenter.java index 233b2b569..89cddb9c4 100644 --- a/java/com/android/incallui/VideoCallPresenter.java +++ b/java/com/android/incallui/VideoCallPresenter.java @@ -867,7 +867,7 @@ public class VideoCallPresenter false /* isRemotelyHeld */); enableCamera(mVideoCall, false); InCallPresenter.getInstance().setFullScreen(false); - + InCallPresenter.getInstance().enableScreenTimeout(false); mIsVideoMode = false; } |