Add support for testing in portrait mode

Bug: 110103162
Test: TaplTests
Change-Id: I7f633405c04984ea8f04acdc6dd4ad21019d3409
This commit is contained in:
Vadim Tryshev committed 2018-09-21 14:53:11 -07:00
1 parent e583a064fa
commit 802a28946c
4 files changed
+40 -25

No files matched your search

-11
View File
@@ -867,17 +867,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
}
}
public boolean hasSettings() {
if (mLauncherCallbacks != null) {
return mLauncherCallbacks.hasSettings();
} else {
// On O and above we there is always some setting present settings (add icon to
// home screen or icon badging). On earlier APIs we will have the allow rotation
// setting, on devices with a locked orientation,
return Utilities.ATLEAST_OREO || !getResources().getBoolean(R.bool.allow_rotation);
}
}
public boolean isInState(LauncherState state) {
return mStateManager.getState() == state;
}
@@ -56,7 +56,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
private final Activity mActivity;
private final SharedPreferences mPrefs;
private final boolean mIgnoreAutoRotateSettings;
private boolean mIgnoreAutoRotateSettings;
private boolean mAutoRotateEnabled;
/**
@@ -110,6 +110,13 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
}
}
// Used by tests only.
public void forceAllowRotationForTesting(boolean allowRotation) {
mIgnoreAutoRotateSettings =
allowRotation || mActivity.getResources().getBoolean(R.bool.allow_rotation);
notifyChange();
}
public void initialize() {
if (!mInitialized) {
mInitialized = true;