Loading AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -5173,6 +5173,15 @@ <activity android:name=".spa.SpaBridgeActivity" android:exported="false"/> <activity android:name=".spa.SpaAppBridgeActivity" android:exported="false"/> <activity android:name=".spa.search.SpaSearchLandingActivity" android:exported="true"> <intent-filter android:priority="1"> <action android:name="android.settings.SPA_SEARCH_LANDING" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name=".Settings$FingerprintSettingsActivityV2" android:label="@string/security_settings_fingerprint_preference_title" android:exported="false" Loading src/com/android/settings/search/SearchFeatureProviderImpl.kt +8 −1 Original line number Diff line number Diff line Loading @@ -22,11 +22,18 @@ import android.content.Intent import android.net.Uri import android.provider.Settings import com.android.settings.search.SearchIndexableResourcesFactory.createSearchIndexableResources import com.android.settings.spa.search.SpaSearchRepository import com.android.settingslib.search.SearchIndexableResources /** FeatureProvider for the refactored search code. */ open class SearchFeatureProviderImpl : SearchFeatureProvider { private val lazySearchIndexableResources by lazy { createSearchIndexableResources() } private val lazySearchIndexableResources by lazy { createSearchIndexableResources().apply { for (searchIndexableData in SpaSearchRepository().getSearchIndexableDataList()) { addIndex(searchIndexableData) } } } override fun verifyLaunchSearchResultPageCaller(context: Context, callerPackage: String) { require(callerPackage.isNotEmpty()) { Loading src/com/android/settings/spa/network/NetworkCellularGroupProvider.kt +22 −1 Original line number Diff line number Diff line Loading @@ -46,10 +46,14 @@ import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel import com.android.settings.R import com.android.settings.flags.Flags import com.android.settings.network.SubscriptionInfoListViewModel import com.android.settings.network.SubscriptionUtil import com.android.settings.network.telephony.DataSubscriptionRepository import com.android.settings.network.telephony.MobileDataRepository import com.android.settings.network.telephony.requireSubscriptionManager import com.android.settings.spa.network.PrimarySimRepository.PrimarySimInfo import com.android.settings.spa.search.SearchablePage import com.android.settings.wifi.WifiPickerTrackerHelper import com.android.settingslib.spa.framework.common.SettingsEntryBuilder import com.android.settingslib.spa.framework.common.SettingsPageProvider Loading @@ -62,6 +66,7 @@ import com.android.settingslib.spa.widget.preference.PreferenceModel import com.android.settingslib.spa.widget.scaffold.RegularScaffold import com.android.settingslib.spa.widget.ui.Category import com.android.settingslib.spaprivileged.framework.common.broadcastReceiverFlow import com.android.settingslib.spaprivileged.framework.common.userManager import com.android.settingslib.spaprivileged.settingsprovider.settingsGlobalBooleanFlow import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers Loading @@ -78,7 +83,7 @@ import kotlinx.coroutines.withContext /** * Showing the sim onboarding which is the process flow of sim switching on. */ open class NetworkCellularGroupProvider : SettingsPageProvider { open class NetworkCellularGroupProvider : SettingsPageProvider, SearchablePage { override val name = fileName override val metricsCategory = SettingsEnums.MOBILE_NETWORK_LIST private val owner = createSettingsPage() Loading Loading @@ -191,8 +196,24 @@ open class NetworkCellularGroupProvider : SettingsPageProvider { open fun OtherSection(){ // Do nothing } override fun getSearchableTitles(context: Context): List<String> { if (!isPageSearchable(context)) return emptyList() return buildList { if (context.requireSubscriptionManager().activeSubscriptionInfoCount > 0) { add(context.getString(R.string.mobile_data_settings_title)) } } } companion object { const val fileName = "NetworkCellularGroupProvider" private fun isPageSearchable(context: Context) = Flags.isDualSimOnboardingEnabled() && SubscriptionUtil.isSimHardwareVisible(context) && !com.android.settingslib.Utils.isWifiOnly(context) && context.userManager.isAdminUser } } Loading src/com/android/settings/spa/search/SearchablePage.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.spa.search import android.content.Context interface SearchablePage { /** Gets the searchable titles at the current moment. */ fun getSearchableTitles(context: Context): List<String> } src/com/android/settings/spa/search/SpaSearchLandingActivity.kt 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.spa.search import android.app.Activity import android.os.Bundle import com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY import com.android.settings.overlay.FeatureFactory.Companion.featureFactory import com.android.settings.password.PasswordUtils import com.android.settings.spa.SpaDestination class SpaSearchLandingActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (!isValidCall()) return val destination = intent.getStringExtra(EXTRA_FRAGMENT_ARG_KEY) if (destination.isNullOrBlank()) return SpaDestination(destination = destination, highlightMenuKey = null) .startFromExportedActivity(this) finish() } private fun isValidCall() = PasswordUtils.getCallingAppPackageName(activityToken) == featureFactory.searchFeatureProvider.getSettingsIntelligencePkgName(this) } Loading
AndroidManifest.xml +9 −0 Original line number Diff line number Diff line Loading @@ -5173,6 +5173,15 @@ <activity android:name=".spa.SpaBridgeActivity" android:exported="false"/> <activity android:name=".spa.SpaAppBridgeActivity" android:exported="false"/> <activity android:name=".spa.search.SpaSearchLandingActivity" android:exported="true"> <intent-filter android:priority="1"> <action android:name="android.settings.SPA_SEARCH_LANDING" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name=".Settings$FingerprintSettingsActivityV2" android:label="@string/security_settings_fingerprint_preference_title" android:exported="false" Loading
src/com/android/settings/search/SearchFeatureProviderImpl.kt +8 −1 Original line number Diff line number Diff line Loading @@ -22,11 +22,18 @@ import android.content.Intent import android.net.Uri import android.provider.Settings import com.android.settings.search.SearchIndexableResourcesFactory.createSearchIndexableResources import com.android.settings.spa.search.SpaSearchRepository import com.android.settingslib.search.SearchIndexableResources /** FeatureProvider for the refactored search code. */ open class SearchFeatureProviderImpl : SearchFeatureProvider { private val lazySearchIndexableResources by lazy { createSearchIndexableResources() } private val lazySearchIndexableResources by lazy { createSearchIndexableResources().apply { for (searchIndexableData in SpaSearchRepository().getSearchIndexableDataList()) { addIndex(searchIndexableData) } } } override fun verifyLaunchSearchResultPageCaller(context: Context, callerPackage: String) { require(callerPackage.isNotEmpty()) { Loading
src/com/android/settings/spa/network/NetworkCellularGroupProvider.kt +22 −1 Original line number Diff line number Diff line Loading @@ -46,10 +46,14 @@ import androidx.lifecycle.compose.LocalLifecycleOwner import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.viewmodel.compose.viewModel import com.android.settings.R import com.android.settings.flags.Flags import com.android.settings.network.SubscriptionInfoListViewModel import com.android.settings.network.SubscriptionUtil import com.android.settings.network.telephony.DataSubscriptionRepository import com.android.settings.network.telephony.MobileDataRepository import com.android.settings.network.telephony.requireSubscriptionManager import com.android.settings.spa.network.PrimarySimRepository.PrimarySimInfo import com.android.settings.spa.search.SearchablePage import com.android.settings.wifi.WifiPickerTrackerHelper import com.android.settingslib.spa.framework.common.SettingsEntryBuilder import com.android.settingslib.spa.framework.common.SettingsPageProvider Loading @@ -62,6 +66,7 @@ import com.android.settingslib.spa.widget.preference.PreferenceModel import com.android.settingslib.spa.widget.scaffold.RegularScaffold import com.android.settingslib.spa.widget.ui.Category import com.android.settingslib.spaprivileged.framework.common.broadcastReceiverFlow import com.android.settingslib.spaprivileged.framework.common.userManager import com.android.settingslib.spaprivileged.settingsprovider.settingsGlobalBooleanFlow import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers Loading @@ -78,7 +83,7 @@ import kotlinx.coroutines.withContext /** * Showing the sim onboarding which is the process flow of sim switching on. */ open class NetworkCellularGroupProvider : SettingsPageProvider { open class NetworkCellularGroupProvider : SettingsPageProvider, SearchablePage { override val name = fileName override val metricsCategory = SettingsEnums.MOBILE_NETWORK_LIST private val owner = createSettingsPage() Loading Loading @@ -191,8 +196,24 @@ open class NetworkCellularGroupProvider : SettingsPageProvider { open fun OtherSection(){ // Do nothing } override fun getSearchableTitles(context: Context): List<String> { if (!isPageSearchable(context)) return emptyList() return buildList { if (context.requireSubscriptionManager().activeSubscriptionInfoCount > 0) { add(context.getString(R.string.mobile_data_settings_title)) } } } companion object { const val fileName = "NetworkCellularGroupProvider" private fun isPageSearchable(context: Context) = Flags.isDualSimOnboardingEnabled() && SubscriptionUtil.isSimHardwareVisible(context) && !com.android.settingslib.Utils.isWifiOnly(context) && context.userManager.isAdminUser } } Loading
src/com/android/settings/spa/search/SearchablePage.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.spa.search import android.content.Context interface SearchablePage { /** Gets the searchable titles at the current moment. */ fun getSearchableTitles(context: Context): List<String> }
src/com/android/settings/spa/search/SpaSearchLandingActivity.kt 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.spa.search import android.app.Activity import android.os.Bundle import com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY import com.android.settings.overlay.FeatureFactory.Companion.featureFactory import com.android.settings.password.PasswordUtils import com.android.settings.spa.SpaDestination class SpaSearchLandingActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (!isValidCall()) return val destination = intent.getStringExtra(EXTRA_FRAGMENT_ARG_KEY) if (destination.isNullOrBlank()) return SpaDestination(destination = destination, highlightMenuKey = null) .startFromExportedActivity(this) finish() } private fun isValidCall() = PasswordUtils.getCallingAppPackageName(activityToken) == featureFactory.searchFeatureProvider.getSettingsIntelligencePkgName(this) }