Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/upstream' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Jun 8, 2024
2 parents 1738f42 + c64e205 commit 04133d9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}

Expand All @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,11 @@ public void stopListening() {
return;
}

sWidgetHost.setAppWidgetHidden();
try {
sWidgetHost.setAppWidgetHidden();
} catch (Throwable t) {
// Ignore
}
setListeningFlag(false);
}

Expand Down
6 changes: 5 additions & 1 deletion src/com/android/launcher3/widget/LauncherWidgetHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,11 @@ public void stopListening() {
}
}
}
mWidgetHost.stopListening();
try {
mWidgetHost.stopListening();
} catch (Throwable t) {
// Ignore
}
setListeningFlag(false);
}

Expand Down

0 comments on commit 04133d9

Please sign in to comment.