diff --git a/api/current.xml b/api/current.xml
index cbe47ff7af6ae..64a7d7a29632d 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -23917,6 +23917,17 @@
visibility="public"
>
+
+
path = uri.getPathSegments();
+ if (path == null || path.size() != 3) return null;
+ String pkg = path.get(1);
+ String cls = path.get(2);
+ if (TextUtils.isEmpty(pkg) || TextUtils.isEmpty(cls)) return null;
+ return new ComponentName(pkg, cls);
+ }
+
+ public void onClick(View v) {
+ trigger();
+ }
+
+ private void trigger() {
+ try {
+ Intent intent = createIntent(mSource, mQuery, mAppSearchData);
+ intent.setSourceBounds(getOnScreenRect(mIconView));
+ mIconView.getContext().startActivity(intent);
+ } catch (ActivityNotFoundException ex) {
+ Log.e(TAG, "No source selector activity found", ex);
+ }
+ }
+
+ // TODO: This code is replicated in lots of places:
+ // - android.provider.ContactsContract.QuickContact.showQuickContact()
+ // - android.widget.RemoteViews.setOnClickPendingIntent()
+ // - com.android.launcher2.Launcher.onClick()
+ // - com.android.launcher.Launcher.onClick()
+ // - com.android.server.status.StatusBarService.Launcher.onClick()
+ private static Rect getOnScreenRect(View v) {
+ final float appScale = v.getResources().getCompatibilityInfo().applicationScale;
+ final int[] pos = new int[2];
+ v.getLocationOnScreen(pos);
+ final Rect rect = new Rect();
+ rect.left = (int) (pos[0] * appScale + 0.5f);
+ rect.top = (int) (pos[1] * appScale + 0.5f);
+ rect.right = (int) ((pos[0] + v.getWidth()) * appScale + 0.5f);
+ rect.bottom = (int) ((pos[1] + v.getHeight()) * appScale + 0.5f);
+ return rect;
+ }
+
+}
diff --git a/core/res/res/drawable-hdpi/search_source_selector_indicator.png b/core/res/res/drawable-hdpi/search_source_selector_indicator.png
new file mode 100644
index 0000000000000..b93a0c0bbfb33
Binary files /dev/null and b/core/res/res/drawable-hdpi/search_source_selector_indicator.png differ
diff --git a/core/res/res/drawable-mdpi/search_source_selector_indicator.png b/core/res/res/drawable-mdpi/search_source_selector_indicator.png
new file mode 100644
index 0000000000000..26bf18a68870f
Binary files /dev/null and b/core/res/res/drawable-mdpi/search_source_selector_indicator.png differ
diff --git a/core/res/res/drawable/search_source_selector_background.xml b/core/res/res/drawable/search_source_selector_background.xml
new file mode 100644
index 0000000000000..fcacd892f3b70
--- /dev/null
+++ b/core/res/res/drawable/search_source_selector_background.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
diff --git a/core/res/res/layout/search_bar.xml b/core/res/res/layout/search_bar.xml
index cf246ba3906a4..12285fde6cee6 100644
--- a/core/res/res/layout/search_bar.xml
+++ b/core/res/res/layout/search_bar.xml
@@ -55,14 +55,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
-
-
+ android:layout_gravity="center_vertical" />
+
+
+
+
+
+
+