diff --git a/lawnchair/src/app/lawnchair/search/algorithms/LawnchairAppSearchAlgorithm.kt b/lawnchair/src/app/lawnchair/search/algorithms/LawnchairAppSearchAlgorithm.kt index c4cfd6960c5..2bf0e3ef2ee 100644 --- a/lawnchair/src/app/lawnchair/search/algorithms/LawnchairAppSearchAlgorithm.kt +++ b/lawnchair/src/app/lawnchair/search/algorithms/LawnchairAppSearchAlgorithm.kt @@ -98,12 +98,14 @@ class LawnchairAppSearchAlgorithm(context: Context) : LawnchairSearchAlgorithm(c } if (appResults.size == 1 && context.isDefaultLauncher()) { - val singleAppResult = appResults.first() - val shortcuts = getShortcuts(singleAppResult) - if (shortcuts.isNotEmpty()) { - searchTargets.add(generateSearchTarget.getHeaderTarget(SPACE)) - searchTargets.add(createSearchTarget(singleAppResult, true)) - searchTargets.addAll(shortcuts.map(::createSearchTarget)) + val singleAppResult = appResults.firstOrNull() + val shortcuts = singleAppResult?.let { getShortcuts(it) } + if (shortcuts != null) { + if (shortcuts.isNotEmpty()) { + searchTargets.add(generateSearchTarget.getHeaderTarget(SPACE)) + searchTargets.add(createSearchTarget(singleAppResult, true)) + searchTargets.addAll(shortcuts.map(::createSearchTarget)) + } } } diff --git a/lawnchair/src/app/lawnchair/search/algorithms/LawnchairLocalSearchAlgorithm.kt b/lawnchair/src/app/lawnchair/search/algorithms/LawnchairLocalSearchAlgorithm.kt index 87b21cabcfc..2cce6cf8e1a 100644 --- a/lawnchair/src/app/lawnchair/search/algorithms/LawnchairLocalSearchAlgorithm.kt +++ b/lawnchair/src/app/lawnchair/search/algorithms/LawnchairLocalSearchAlgorithm.kt @@ -160,12 +160,14 @@ class LawnchairLocalSearchAlgorithm(context: Context) : LawnchairSearchAlgorithm } if (appResults.size == 1 && searchApps && context.isDefaultLauncher()) { - val singleAppResult = appResults.first() - val shortcuts = getShortcuts(singleAppResult) - if (shortcuts.isNotEmpty()) { - searchTargets.add(generateSearchTarget.getHeaderTarget(SPACE)) - searchTargets.add(createSearchTarget(singleAppResult, true)) - searchTargets.addAll(shortcuts.map(::createSearchTarget)) + val singleAppResult = appResults.firstOrNull() + val shortcuts = singleAppResult?.let { getShortcuts(it) } + if (shortcuts != null) { + if (shortcuts.isNotEmpty()) { + searchTargets.add(generateSearchTarget.getHeaderTarget(SPACE)) + searchTargets.add(createSearchTarget(singleAppResult, true)) + searchTargets.addAll(shortcuts.map(::createSearchTarget)) + } } } @@ -176,9 +178,9 @@ class LawnchairLocalSearchAlgorithm(context: Context) : LawnchairSearchAlgorithm searchTargets.addAll(suggestions.map { generateSearchTarget.getSuggestionTarget(it.resultData as String) }) } - val calculator = filterByType(localSearchResults, CALCULATOR).first() - val calcData = calculator.resultData as Calculation - if (calcData.isValid) { + val calculator = filterByType(localSearchResults, CALCULATOR).firstOrNull() + val calcData = calculator?.resultData as? Calculation + if (calcData != null && calcData.isValid) { val calculatorHeader = generateSearchTarget.getHeaderTarget(context.getString(R.string.all_apps_search_result_calculator)) searchTargets.add(calculatorHeader) searchTargets.add( @@ -321,8 +323,12 @@ class LawnchairLocalSearchAlgorithm(context: Context) : LawnchairSearchAlgorithm } val settingsDeferred = async { - findSettingsByNameAndAction(query, maxSettingsEntryCount) - .map { SearchResult(SETTINGS, it) } + if (prefs.searchResultSettingsEntry.get()) { + findSettingsByNameAndAction(query, maxSettingsEntryCount) + .map { SearchResult(SETTINGS, it) } + } else { + emptyList() + } } val startPageSuggestionsDeferred = async { diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 1baf7925e9a..526922e8409 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -1154,7 +1154,7 @@ public void registerRemoteTransitions() { if (ENABLE_SHELL_TRANSITIONS && LawnchairQuickstepCompat.ATLEAST_U) SystemUiProxy.INSTANCE.get(mLauncher).shareTransactionQueue(); - if (hasControlRemoteAppTransitionPermission()) { + if (hasControlRemoteAppTransitionPermission() && LawnchairQuickstepCompat.ATLEAST_Q) { mWallpaperOpenTransitionRunner = createWallpaperOpenRunner(false /* fromUnlock */); mLauncherOpenTransition = LawnchairQuickstepCompat.getRemoteTransitionCompat().getRemoteTransition( new LauncherAnimationRunner(mHandler, mWallpaperOpenTransitionRunner, diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepWidgetHolder.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepWidgetHolder.java index 9dbca581fb8..ac0164a5f04 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepWidgetHolder.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepWidgetHolder.java @@ -222,7 +222,11 @@ public void stopListening() { return; } - sWidgetHost.setAppWidgetHidden(); + try { + sWidgetHost.setAppWidgetHidden(); + } catch (Throwable t) { + // Ignore + } setListeningFlag(false); } diff --git a/src/com/android/launcher3/widget/LauncherWidgetHolder.java b/src/com/android/launcher3/widget/LauncherWidgetHolder.java index ad7f7c3e7fc..8c15294bd61 100644 --- a/src/com/android/launcher3/widget/LauncherWidgetHolder.java +++ b/src/com/android/launcher3/widget/LauncherWidgetHolder.java @@ -342,7 +342,11 @@ public void stopListening() { } } } - mWidgetHost.stopListening(); + try { + mWidgetHost.stopListening(); + } catch (Throwable t) { + // Ignore + } setListeningFlag(false); }