summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-05-06 00:03:21 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-06 00:03:21 +0000
commit258ea87d45f39e7bef97301333670c4704ace60e (patch)
tree94fcb29cdf2e1087bdb536135df55fc877ceef9e /packages
parent13a62a45e704aa6f1a4ef96427c5aa0937135b7c (diff)
parent98596c92a323444ebeebf5cfe6be328f76d4a0a0 (diff)
downloadframeworks_base-258ea87d45f39e7bef97301333670c4704ace60e.zip
frameworks_base-258ea87d45f39e7bef97301333670c4704ace60e.tar.gz
frameworks_base-258ea87d45f39e7bef97301333670c4704ace60e.tar.bz2
am 0a730c24: Merge "Exposing the API to support widgets in Recents."
* commit '0a730c24b0af03bea4afa5b6da5ae576b0ef2f99': Exposing the API to support widgets in Recents.
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/values-sw720dp/config.xml3
-rw-r--r--packages/SystemUI/res/values/config.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java33
4 files changed, 22 insertions, 23 deletions
diff --git a/packages/SystemUI/res/values-sw720dp/config.xml b/packages/SystemUI/res/values-sw720dp/config.xml
index bf01a8d..7cf711a 100644
--- a/packages/SystemUI/res/values-sw720dp/config.xml
+++ b/packages/SystemUI/res/values-sw720dp/config.xml
@@ -32,5 +32,8 @@
<!-- Min alpha % that recent items will fade to while being dismissed -->
<integer name="config_recent_item_min_alpha">0</integer>
+
+ <!-- Transposes the search bar layout in landscape -->
+ <bool name="recents_transpose_search_layout_with_orientation">false</bool>
</resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 024f1eb..c3ccb59 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -123,6 +123,8 @@
<integer name="recents_animate_task_view_info_pane_duration">150</integer>
<!-- The minimum alpha for the dim applied to cards that go deeper into the stack. -->
<integer name="recents_max_task_stack_view_dim">96</integer>
+ <!-- Transposes the search bar layout in landscape -->
+ <bool name="recents_transpose_search_layout_with_orientation">true</bool>
<!-- Whether to enable KeyguardService or not -->
<bool name="config_enableKeyguardService">true</bool>
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index 5a1dc8d..23a0179 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -37,6 +37,7 @@ public class RecentsConfiguration {
public Rect displayRect = new Rect();
boolean isLandscape;
+ boolean transposeSearchLayoutWithOrientation;
int searchBarAppWidgetId = -1;
public float animationPxMovementPerSecond;
@@ -83,6 +84,8 @@ public class RecentsConfiguration {
isLandscape = res.getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE;
+ transposeSearchLayoutWithOrientation =
+ res.getBoolean(R.bool.recents_transpose_search_layout_with_orientation);
Console.log(Constants.DebugFlags.UI.MeasureAndLayout,
"[RecentsConfiguration|orientation]", isLandscape ? "Landscape" : "Portrait",
Console.AnsiGreen);
@@ -148,7 +151,7 @@ public class RecentsConfiguration {
if (hasSearchBarAppWidget()) {
Rect searchBarBounds = new Rect();
getSearchBarBounds(width, height, searchBarBounds);
- if (isLandscape) {
+ if (isLandscape && transposeSearchLayoutWithOrientation) {
// In landscape, the search bar appears on the left, so shift the task rect right
taskStackBounds.set(searchBarBounds.width(), 0, width, height);
} else {
@@ -171,7 +174,7 @@ public class RecentsConfiguration {
return;
}
- if (isLandscape) {
+ if (isLandscape && transposeSearchLayoutWithOrientation) {
// In landscape, the search bar appears on the left
searchBarSpaceBounds.set(0, 0, searchBarSpaceHeightPx, height);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
index 68af663..c3b8a20 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
@@ -55,6 +55,7 @@ public class SystemServicesProxy {
UserManager mUm;
SearchManager mSm;
String mPackage;
+ ComponentName mAssistComponent;
Bitmap mDummyIcon;
@@ -68,6 +69,12 @@ public class SystemServicesProxy {
mSm = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
mPackage = context.getPackageName();
+ // Resolve the assist intent
+ Intent assist = mSm.getAssistIntent(context, false);
+ if (assist != null) {
+ mAssistComponent = assist.getComponent();
+ }
+
if (Constants.DebugFlags.App.EnableSystemServicesProxy) {
// Create a dummy icon
mDummyIcon = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
@@ -236,30 +243,14 @@ public class SystemServicesProxy {
*/
public Pair<Integer, AppWidgetProviderInfo> bindSearchAppWidget(AppWidgetHost host) {
if (mAwm == null) return null;
+ if (mAssistComponent == null) return null;
- // Ensure we have a global search activity
- ComponentName globalSearchActivity = mSm.getGlobalSearchActivity();
- if (globalSearchActivity == null) return null;
-
- // Resolve the search widget provider from the search activity
- ActivityInfo searchActivityInfo = getActivityInfo(globalSearchActivity);
- if (searchActivityInfo == null) return null;
-
- String key = "com.android.recents.search_widget_provider";
- ComponentName searchWidgetCn = null;
- Bundle searchMetaData = searchActivityInfo.metaData;
- String searchWidgetProvider = searchMetaData.getString(key, "");
- if (searchWidgetProvider.length() != 0) {
- searchWidgetCn = ComponentName.unflattenFromString(searchWidgetProvider);
- } else {
- return null;
- }
-
- // Find the first Recents widget from the same package as the global search activity
- List<AppWidgetProviderInfo> widgets = mAwm.getInstalledProviders();
+ // Find the first Recents widget from the same package as the global assist activity
+ List<AppWidgetProviderInfo> widgets = mAwm.getInstalledProviders(
+ AppWidgetProviderInfo.WIDGET_CATEGORY_RECENTS);
AppWidgetProviderInfo searchWidgetInfo = null;
for (AppWidgetProviderInfo info : widgets) {
- if (info.provider.equals(searchWidgetCn)) {
+ if (info.provider.getPackageName().equals(mAssistComponent.getPackageName())) {
searchWidgetInfo = info;
break;
}