From f17d6eff0b78c9936f4d47caf58ccee2c6e1737d Mon Sep 17 00:00:00 2001 From: Ankit Gupta Date: Mon, 27 Jun 2016 17:00:51 -0700 Subject: Timer: Do not rotate Alert timer Rotation of alert time on allows pop up of lock screen in between. Keeping the configuration to default prevents this happening. Same issue has been fixed for AlarmActivity here: ab0d28c68a77bea2a4a2ee50378da3670a1dd939 Issue-id: FEIJ-1413 Change-Id: I0eb4d7879745267e91d38626df1abf1db09bb604 --- res/values/config.xml | 1 + src/com/android/deskclock/timer/TimerAlertFullScreen.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/res/values/config.xml b/res/values/config.xml index 9187cc5a0..b7ef0fda1 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -23,6 +23,7 @@ true true false + false diff --git a/src/com/android/deskclock/timer/TimerAlertFullScreen.java b/src/com/android/deskclock/timer/TimerAlertFullScreen.java index db6edfca3..13025e5a6 100644 --- a/src/com/android/deskclock/timer/TimerAlertFullScreen.java +++ b/src/com/android/deskclock/timer/TimerAlertFullScreen.java @@ -23,6 +23,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; +import android.content.pm.ActivityInfo; import com.android.deskclock.BaseActivity; import com.android.deskclock.R; @@ -71,6 +72,16 @@ public class TimerAlertFullScreen extends BaseActivity implements OnEmptyListLis getFragmentManager().beginTransaction() .add(R.id.fragment_container, timerFragment, FRAGMENT).commit(); } + // Following issue was found on Alarm and same can be applied on timer: + // In order to allow tablets to freely rotate and phones to stick + // with "nosensor" (use default device orientation) we have to have + // the manifest start with an orientation of unspecified" and only limit + // to "nosensor" for phones. Otherwise we get behavior like in b/8728671 + // where tablets start off in their default orientation and then are + // able to freely rotate. + if (!getResources().getBoolean(R.bool.config_rotateTimerAlert)) { + setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); + } } @Override -- cgit v1.2.3