Ensuring setQsbSearchBar is called whenever the QSB is created
> On launcher3 when the QSB is created for the first time after a
widget drop, it is not set in searchDropTarget and as a result
the "Remove" and "App Info" drop targets are not visible until
Launcher3 restarts and rebinds QSB
Change-Id: I599a9a18cc5d46af790b3145dae2eb385b32b20e
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1ad8b27..e3a2d7c 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -116,7 +116,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
-import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;
@@ -147,7 +146,6 @@
private static final int REQUEST_CREATE_SHORTCUT = 1;
private static final int REQUEST_CREATE_APPWIDGET = 5;
- private static final int REQUEST_PICK_SHORTCUT = 7;
private static final int REQUEST_PICK_APPWIDGET = 9;
private static final int REQUEST_PICK_WALLPAPER = 10;
@@ -1444,7 +1442,10 @@
dragController.addDropTarget(mWorkspace);
if (mSearchDropTargetBar != null) {
mSearchDropTargetBar.setup(this, dragController);
- mSearchDropTargetBar.setQsbSearchBar(getQsbBar());
+ if (getOrCreateQsbBar() == null) {
+ // Explicitly set it to null during initialization.
+ mSearchDropTargetBar.setQsbSearchBar(null);
+ }
}
if (getResources().getBoolean(R.bool.debug_memory_enabled)) {
@@ -3952,7 +3953,7 @@
// NO-OP
}
- public View getQsbBar() {
+ public View getOrCreateQsbBar() {
if (mLauncherCallbacks != null && mLauncherCallbacks.providesSearch()) {
return mLauncherCallbacks.getQsbBar();
}
@@ -4001,6 +4002,7 @@
mQsb.updateAppWidgetOptions(opts);
mQsb.setPadding(0, 0, 0, 0);
mSearchDropTargetBar.addView(mQsb);
+ mSearchDropTargetBar.setQsbSearchBar(mQsb);
}
}
return mQsb;
@@ -4602,7 +4604,7 @@
mSearchDropTargetBar.removeView(mQsb);
mQsb = null;
}
- mSearchDropTargetBar.setQsbSearchBar(getQsbBar());
+ getOrCreateQsbBar();
}
/**