diff options
author | Jun Mukai <mukai@google.com> | 2015-06-17 10:58:59 -0700 |
---|---|---|
committer | Jun Mukai <mukai@google.com> | 2015-06-17 11:26:54 -0700 |
commit | e9819e6d5df372323582cf9ae7567062ffc6fca8 (patch) | |
tree | bbb942273425056c7bad7e0b432d46786ca57ff4 | |
parent | 4919827990b16ae22595d0b7cb123a875961d9be (diff) | |
download | packages_apps_Trebuchet-e9819e6d5df372323582cf9ae7567062ffc6fca8.tar.gz packages_apps_Trebuchet-e9819e6d5df372323582cf9ae7567062ffc6fca8.tar.bz2 packages_apps_Trebuchet-e9819e6d5df372323582cf9ae7567062ffc6fca8.zip |
Add null-check for workspace/hotseat.
I assumed that they are non-null, but reportedly it was wrong.
This method can be invoked before the views are fully initialized.
Also hotseat can be null as far as I see setupViews(), therefore
null-check and 'importance stored' flag check should be done
separately.
Bug: 21779078
Change-Id: I3f17226f887c38adf2b1fb7ee2a016e00ffc0eb4
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 9989abb6d..3596b71d2 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -554,32 +554,44 @@ public class Launcher extends Activity public boolean setLauncherCallbacks(LauncherCallbacks callbacks) { mLauncherCallbacks = callbacks; mLauncherCallbacks.setLauncherSearchCallback(new Launcher.LauncherSearchCallbacks() { - private boolean mImportanceStored = false; + private boolean mWorkspaceImportanceStored = false; + private boolean mHotseatImportanceStored = false; private int mWorkspaceImportanceForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_AUTO; private int mHotseatImportanceForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_AUTO; @Override public void onSearchOverlayOpened() { - if (mImportanceStored) { + if (mWorkspaceImportanceStored || mHotseatImportanceStored) { return; } // The underlying workspace and hotseat are temporarily suppressed by the search // overlay. So they sholudn't be accessible. - mWorkspaceImportanceForAccessibility = mWorkspace.getImportantForAccessibility(); - mHotseatImportanceForAccessibility = mHotseat.getImportantForAccessibility(); - mWorkspace.setImportantForAccessibility( - View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); - mHotseat.setImportantForAccessibility( - View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); - mImportanceStored = true; + if (mWorkspace != null) { + mWorkspaceImportanceForAccessibility = + mWorkspace.getImportantForAccessibility(); + mWorkspace.setImportantForAccessibility( + View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); + mWorkspaceImportanceStored = true; + } + if (mHotseat != null) { + mHotseatImportanceForAccessibility = mHotseat.getImportantForAccessibility(); + mHotseat.setImportantForAccessibility( + View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); + mHotseatImportanceStored = true; + } } @Override public void onSearchOverlayClosed() { - mWorkspace.setImportantForAccessibility(mWorkspaceImportanceForAccessibility); - mHotseat.setImportantForAccessibility(mHotseatImportanceForAccessibility); - mImportanceStored = false; + if (mWorkspaceImportanceStored && mWorkspace != null) { + mWorkspace.setImportantForAccessibility(mWorkspaceImportanceForAccessibility); + } + if (mHotseatImportanceStored && mHotseat != null) { + mHotseat.setImportantForAccessibility(mHotseatImportanceForAccessibility); + } + mWorkspaceImportanceStored = false; + mHotseatImportanceStored = false; } }); return true; |