diff options
author | Jon Miranda <jonmiranda@google.com> | 2017-09-19 14:43:17 -0700 |
---|---|---|
committer | Jon Miranda <jonmiranda@google.com> | 2017-09-19 14:43:17 -0700 |
commit | 6bed350b75ad407ba85ae15d62551194dd0a69d4 (patch) | |
tree | 363c2c2169a60199342422f1848bab283c41c2d0 /src/com/android/launcher3/Launcher.java | |
parent | d926a9316f61a7540b00ecd42acba8013e715f92 (diff) | |
download | android_packages_apps_Trebuchet-6bed350b75ad407ba85ae15d62551194dd0a69d4.tar.gz android_packages_apps_Trebuchet-6bed350b75ad407ba85ae15d62551194dd0a69d4.tar.bz2 android_packages_apps_Trebuchet-6bed350b75ad407ba85ae15d62551194dd0a69d4.zip |
Fix bug where widgets are inflated in the wrong orientation.
The bug is that in onResume, the context may tell us the wrong
orientation.
As a workaround, we store the orientation that the Launcher
is created with, and we use that orientation to check whether
we actually need to reinflate the widgets.
Bug: 64916689
Change-Id: I5194debbd217a573d1f177c31d8c0abdf9da51b5
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 1e12b423f..522e96a12 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -251,6 +251,10 @@ public class Launcher extends BaseActivity // Main container view and the model for the widget tray screen. @Thunk WidgetsContainerView mWidgetsView; + // We need to store the orientation Launcher was created with, due to a bug (b/64916689) + // that results in widgets being inflated in the wrong orientation. + private int mOrientation; + // We set the state in both onCreate and then onNewIntent in some cases, which causes both // scroll issues (because the workspace may not have been measured yet) and extra work. // Instead, just save the state that we need to restore Launcher to, and commit it in onResume. @@ -383,6 +387,7 @@ public class Launcher extends BaseActivity mDeviceProfile = mDeviceProfile.getMultiWindowProfile(this, mwSize); } + mOrientation = getResources().getConfiguration().orientation; mSharedPrefs = Utilities.getPrefs(this); mIsSafeModeEnabled = getPackageManager().isSafeMode(); mModel = app.setLauncher(this); @@ -1669,6 +1674,8 @@ public class Launcher extends BaseActivity return mSharedPrefs; } + public int getOrientation() { return mOrientation; } + @Override protected void onNewIntent(Intent intent) { long startTime = 0; |