diff options
Diffstat (limited to 'packages/SystemUI/src/com')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java | 7 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java | 33 |
2 files changed, 17 insertions, 23 deletions
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; } |