Skip to content

Commit 32ff1c8

Browse files
muhomorrthestinger
authored andcommitted
fixup! infrastructure for AppSwitch UIs
1 parent 12e22b0 commit 32ff1c8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/com/android/settings/applications/AswAdapter.kt

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ abstract class AswAdapter<T : AppSwitch> {
6666

6767
fun getAppListPageProviderName() = this::class.simpleName!!
6868

69+
open fun shouldIncludeInAppListPage(app: ApplicationInfo, gosPs: GosPackageState) = true
70+
6971
fun openAppListPage(ctx: Context) {
7072
ctx.startSpaActivity(getAppListPageProviderName())
7173
}

src/com/android/settings/spa/app/appinfo/AswAppList.kt

+7-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ class AswAppListModel(val ctx: Context, val adapter: AswAdapter<*>) : AppListMod
6262
): Flow<List<AppRecordImpl>> {
6363
return userIdFlow.combine(appListFlow) { userId, appList ->
6464
appList.asyncMap { app ->
65-
AppRecordImpl(app, GosPackageState.get(app.packageName, userId))
66-
}
65+
val gosPs = GosPackageState.get(app.packageName, userId)
66+
if (adapter.shouldIncludeInAppListPage(app, gosPs)) {
67+
AppRecordImpl(app, GosPackageState.get(app.packageName, userId))
68+
} else {
69+
null
70+
}
71+
}.filterNotNull()
6772
}
6873
}
6974

0 commit comments

Comments
 (0)