Merge "Redirect to new APN edit page" into main
diff --git a/aconfig/catalyst/accessibility.aconfig b/aconfig/catalyst/accessibility.aconfig
index 80a9d62..7837067 100644
--- a/aconfig/catalyst/accessibility.aconfig
+++ b/aconfig/catalyst/accessibility.aconfig
@@ -2,8 +2,15 @@
container: "system"
flag {
+ name: "catalyst_accessibility_color_and_motion"
+ namespace: "android_settings"
+ description: "Migrate Color and motion screen to the Catalyst infrastructure"
+ bug: "323791114"
+}
+
+flag {
name: "catalyst_text_reading_screen"
namespace: "android_settings"
description: "Flag for Display size and text"
bug: "323791114"
-}
\ No newline at end of file
+}
diff --git a/aconfig/catalyst/battery.aconfig b/aconfig/catalyst/battery.aconfig
index ce5c5c5..cec40f3 100644
--- a/aconfig/catalyst/battery.aconfig
+++ b/aconfig/catalyst/battery.aconfig
@@ -2,8 +2,15 @@
container: "system"
flag {
+ name: "catalyst_power_usage_summary_screen"
+ namespace: "android_settings"
+ description: "Flag for Battery screen"
+ bug: "323791114"
+}
+
+flag {
name: "catalyst_battery_saver_screen"
namespace: "android_settings"
description: "Flag for Battery Saver"
bug: "323791114"
-}
+}
\ No newline at end of file
diff --git a/aconfig/catalyst/connected_devices.aconfig b/aconfig/catalyst/connected_devices.aconfig
new file mode 100644
index 0000000..7a335fa
--- /dev/null
+++ b/aconfig/catalyst/connected_devices.aconfig
@@ -0,0 +1,9 @@
+package: "com.android.settings.flags"
+container: "system"
+
+flag {
+ name: "catalyst_bluetooth_switchbar_screen"
+ namespace: "android_settings"
+ description: "Flag for Bluetooth"
+ bug: "323791114"
+}
diff --git a/aconfig/catalyst/location.aconfig b/aconfig/catalyst/location.aconfig
new file mode 100644
index 0000000..c656bf3
--- /dev/null
+++ b/aconfig/catalyst/location.aconfig
@@ -0,0 +1,9 @@
+package: "com.android.settings.flags"
+container: "system"
+
+flag {
+ name: "catalyst_location_settings"
+ namespace: "android_settings"
+ description: "Flag for Location"
+ bug: "323791114"
+}
diff --git a/aconfig/catalyst/network_and_internet.aconfig b/aconfig/catalyst/network_and_internet.aconfig
index a3e1784..a5183f3 100644
--- a/aconfig/catalyst/network_and_internet.aconfig
+++ b/aconfig/catalyst/network_and_internet.aconfig
@@ -7,3 +7,10 @@
description: "Flag for Network & Internet"
bug: "323791114"
}
+
+flag {
+ name: "catalyst_mobile_network_list"
+ namespace: "android_settings"
+ description: "Flag for SIMs"
+ bug: "323791114"
+}
diff --git a/src/com/android/settings/accessibility/ColorAndMotionFragment.java b/src/com/android/settings/accessibility/ColorAndMotionFragment.java
index 4ea2226..7a7c21d 100644
--- a/src/com/android/settings/accessibility/ColorAndMotionFragment.java
+++ b/src/com/android/settings/accessibility/ColorAndMotionFragment.java
@@ -17,12 +17,15 @@
package com.android.settings.accessibility;
import android.app.settings.SettingsEnums;
+import android.content.Context;
import android.hardware.display.ColorDisplayManager;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.view.accessibility.Flags;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.TwoStatePreference;
@@ -148,6 +151,12 @@
}
}
+ @Nullable
+ @Override
+ public String getPreferenceScreenBindingKey(@NonNull Context context) {
+ return ColorAndMotionScreen.KEY;
+ }
+
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.accessibility_color_and_motion);
}
diff --git a/src/com/android/settings/accessibility/ColorAndMotionScreen.kt b/src/com/android/settings/accessibility/ColorAndMotionScreen.kt
new file mode 100644
index 0000000..20a71e3
--- /dev/null
+++ b/src/com/android/settings/accessibility/ColorAndMotionScreen.kt
@@ -0,0 +1,43 @@
+/*
+ * 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.accessibility
+
+import android.content.Context
+import com.android.settings.flags.Flags
+import com.android.settings.R
+import com.android.settingslib.metadata.ProvidePreferenceScreen
+import com.android.settingslib.metadata.preferenceHierarchy
+import com.android.settingslib.preference.PreferenceScreenCreator
+
+@ProvidePreferenceScreen
+class ColorAndMotionScreen : PreferenceScreenCreator {
+ override val key: String = KEY
+ override val title: Int = R.string.accessibility_color_and_motion_title
+
+ override fun isFlagEnabled(context: Context) = Flags.catalystAccessibilityColorAndMotion()
+
+ override fun hasCompleteHierarchy(): Boolean = false
+
+ override fun fragmentClass() = ColorAndMotionFragment::class.java
+
+ override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(this) {}
+
+
+ companion object {
+ const val KEY = "accessibility_color_and_motion"
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragment.java b/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragment.java
index d04b34a..f05b157 100644
--- a/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragment.java
@@ -61,6 +61,7 @@
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.accessibility.AccessibilitySetupWizardUtils;
+import com.android.settings.accessibility.Flags;
import com.android.settings.accessibility.PreferredShortcuts;
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.dashboard.DashboardFragment;
@@ -201,9 +202,14 @@
super.onCreatePreferences(savedInstanceState, rootKey);
Activity activity = getActivity();
+ final Preference descriptionPref = findPreference(getString(
+ R.string.accessibility_shortcut_description_pref));
if (!activity.getIntent().getAction().equals(
Settings.ACTION_ACCESSIBILITY_SHORTCUT_SETTINGS)) {
+ if (Flags.toggleFeatureFragmentCollectionInfo()) {
+ descriptionPref.setVisible(false);
+ }
return;
}
@@ -219,10 +225,11 @@
);
activity.setTitle(titles.first);
-
- String screenDescriptionPrefKey = getString(
- R.string.accessibility_shortcut_description_pref);
- findPreference(screenDescriptionPrefKey).setSummary(titles.second);
+ if (titles.second != null || !Flags.toggleFeatureFragmentCollectionInfo()) {
+ descriptionPref.setSummary(titles.second);
+ } else {
+ descriptionPref.setVisible(false);
+ }
}
@NonNull
diff --git a/src/com/android/settings/biometrics/fingerprint2/BiometricsEnvironment.kt b/src/com/android/settings/biometrics/fingerprint2/BiometricsEnvironment.kt
index 761a9c3..50ac3cd 100644
--- a/src/com/android/settings/biometrics/fingerprint2/BiometricsEnvironment.kt
+++ b/src/com/android/settings/biometrics/fingerprint2/BiometricsEnvironment.kt
@@ -133,11 +133,8 @@
fun createRenameFingerprintInteractor(): RenameFingerprintInteractor =
RenameFingerprintsInteractorImpl(fingerprintManager, context.userId, backgroundDispatcher)
- val accessibilityInteractor: AccessibilityInteractor by lazy {
- AccessibilityInteractorImpl(
- context.getSystemService(AccessibilityManager::class.java)!!,
- applicationScope,
- )
+ fun createAccessibilityInteractor(): AccessibilityInteractor {
+ return AccessibilityInteractorImpl(context.getSystemService(AccessibilityManager::class.java)!!)
}
val foldStateInteractor: FoldStateInteractor by lazy { FoldStateInteractorImpl(context) }
@@ -157,7 +154,7 @@
val enrollStageInteractor: EnrollStageInteractor by lazy { EnrollStageInteractorImpl() }
val udfpsEnrollInteractor: UdfpsEnrollInteractor by lazy {
- UdfpsEnrollInteractorImpl(context, accessibilityInteractor)
+ UdfpsEnrollInteractorImpl(context, createAccessibilityInteractor())
}
val sensorInteractor: FingerprintSensorInteractor by lazy {
diff --git a/src/com/android/settings/biometrics/fingerprint2/domain/interactor/AccessibilityInteractor.kt b/src/com/android/settings/biometrics/fingerprint2/domain/interactor/AccessibilityInteractor.kt
index e1a08e6..9f62ed0 100644
--- a/src/com/android/settings/biometrics/fingerprint2/domain/interactor/AccessibilityInteractor.kt
+++ b/src/com/android/settings/biometrics/fingerprint2/domain/interactor/AccessibilityInteractor.kt
@@ -16,6 +16,8 @@
package com.android.settings.biometrics.fingerprint2.domain.interactor
+import android.view.accessibility.AccessibilityEvent
+import android.view.accessibility.AccessibilityEvent.TYPE_ANNOUNCEMENT
import android.view.accessibility.AccessibilityManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.awaitClose
@@ -27,26 +29,38 @@
/** Represents all of the information on accessibility state. */
interface AccessibilityInteractor {
/** A flow that contains whether or not accessibility is enabled */
- val isAccessibilityEnabled: Flow<Boolean>
+ fun isEnabledFlow(scope: CoroutineScope): Flow<Boolean>
+ val isEnabled: Boolean
+ fun announce(clazz: Class<*>, announcement: CharSequence?)
}
class AccessibilityInteractorImpl(
- accessibilityManager: AccessibilityManager,
- applicationScope: CoroutineScope,
+ private val accessibilityManager: AccessibilityManager,
) : AccessibilityInteractor {
/** A flow that contains whether or not accessibility is enabled */
- override val isAccessibilityEnabled: Flow<Boolean> =
+ override fun isEnabledFlow(scope: CoroutineScope): Flow<Boolean> =
callbackFlow {
- val listener =
- AccessibilityManager.AccessibilityStateChangeListener { enabled -> trySend(enabled) }
- accessibilityManager.addAccessibilityStateChangeListener(listener)
+ val listener =
+ AccessibilityManager.AccessibilityStateChangeListener { enabled -> trySend(enabled) }
+ accessibilityManager.addAccessibilityStateChangeListener(listener)
- // This clause will be called when no one is listening to the flow
- awaitClose { accessibilityManager.removeAccessibilityStateChangeListener(listener) }
- }
+ // This clause will be called when no one is listening to the flow
+ awaitClose { accessibilityManager.removeAccessibilityStateChangeListener(listener) }
+ }
.stateIn(
- applicationScope, // This is going to tied to the activity scope
+ scope,
SharingStarted.WhileSubscribed(), // When no longer subscribed, we removeTheListener
false,
)
+
+ override val isEnabled: Boolean
+ get() = accessibilityManager.isEnabled
+
+ override fun announce(clazz: Class<*>, announcement: CharSequence?) {
+ val event = AccessibilityEvent(TYPE_ANNOUNCEMENT)
+ event.className = clazz.javaClass.name
+ event.packageName = clazz.packageName
+ event.text.add(announcement)
+ accessibilityManager.sendAccessibilityEvent(event)
+ }
}
diff --git a/src/com/android/settings/biometrics/fingerprint2/domain/interactor/UdfpsEnrollInteractor.kt b/src/com/android/settings/biometrics/fingerprint2/domain/interactor/UdfpsEnrollInteractor.kt
index 006060a..62c51ae 100644
--- a/src/com/android/settings/biometrics/fingerprint2/domain/interactor/UdfpsEnrollInteractor.kt
+++ b/src/com/android/settings/biometrics/fingerprint2/domain/interactor/UdfpsEnrollInteractor.kt
@@ -19,6 +19,7 @@
import android.content.Context
import android.graphics.PointF
import android.util.TypedValue
+import kotlinx.coroutines.MainScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.combine
@@ -87,7 +88,7 @@
override val guidedEnrollmentOffset: Flow<PointF> =
combine(
_guidedEnrollment,
- accessibilityInteractor.isAccessibilityEnabled,
+ accessibilityInteractor.isEnabledFlow(MainScope()),
isGuidedEnrollment,
) { point, accessibilityEnabled, guidedEnrollmentEnabled ->
if (accessibilityEnabled || !guidedEnrollmentEnabled) {
diff --git a/src/com/android/settings/biometrics/fingerprint2/ui/enrollment/modules/enrolling/udfps/ui/viewmodel/UdfpsViewModel.kt b/src/com/android/settings/biometrics/fingerprint2/ui/enrollment/modules/enrolling/udfps/ui/viewmodel/UdfpsViewModel.kt
index 658c6c7..df46aa4 100644
--- a/src/com/android/settings/biometrics/fingerprint2/ui/enrollment/modules/enrolling/udfps/ui/viewmodel/UdfpsViewModel.kt
+++ b/src/com/android/settings/biometrics/fingerprint2/ui/enrollment/modules/enrolling/udfps/ui/viewmodel/UdfpsViewModel.kt
@@ -179,7 +179,7 @@
/** Indicates if accessibility is enabled */
val accessibilityEnabled =
- accessibilityInteractor.isAccessibilityEnabled.shareIn(
+ accessibilityInteractor.isEnabledFlow(viewModelScope).shareIn(
this.viewModelScope,
SharingStarted.Eagerly,
replay = 1,
@@ -425,7 +425,7 @@
biometricEnvironment.enrollStageInteractor,
biometricEnvironment.orientationInteractor,
biometricEnvironment.udfpsEnrollInteractor,
- biometricEnvironment.accessibilityInteractor,
+ biometricEnvironment.createAccessibilityInteractor(),
biometricEnvironment.sensorInteractor,
biometricEnvironment.touchEventInteractor,
biometricEnvironment.createSensorPropertiesInteractor(),
diff --git a/src/com/android/settings/biometrics/fingerprint2/ui/enrollment/viewmodel/FingerprintEnrollFindSensorViewModel.kt b/src/com/android/settings/biometrics/fingerprint2/ui/enrollment/viewmodel/FingerprintEnrollFindSensorViewModel.kt
index 9b2cdde..b27cfdd 100644
--- a/src/com/android/settings/biometrics/fingerprint2/ui/enrollment/viewmodel/FingerprintEnrollFindSensorViewModel.kt
+++ b/src/com/android/settings/biometrics/fingerprint2/ui/enrollment/viewmodel/FingerprintEnrollFindSensorViewModel.kt
@@ -84,7 +84,7 @@
/** Represents the stream of showing udfps lottie and whether accessibility is enabled. */
val udfpsLottieInfo: Flow<Boolean> =
- _showUdfpsLottie.combine(accessibilityInteractor.isAccessibilityEnabled) {
+ _showUdfpsLottie.combine(accessibilityInteractor.isEnabledFlow(viewModelScope)) {
_,
isAccessibilityEnabled ->
isAccessibilityEnabled
@@ -213,7 +213,7 @@
provider[FingerprintGatekeeperViewModel::class],
provider[BackgroundViewModel::class],
provider[FingerprintFlowViewModel::class],
- biometricEnvironment.accessibilityInteractor,
+ biometricEnvironment.createAccessibilityInteractor(),
biometricEnvironment.foldStateInteractor,
biometricEnvironment.orientationInteractor,
biometricEnvironment.createSensorPropertiesInteractor(),
diff --git a/src/com/android/settings/connecteddevice/BluetoothDashboardFragment.java b/src/com/android/settings/connecteddevice/BluetoothDashboardFragment.java
index 66f2f1b..90ef5b9 100644
--- a/src/com/android/settings/connecteddevice/BluetoothDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/BluetoothDashboardFragment.java
@@ -21,6 +21,8 @@
import android.text.TextUtils;
import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.android.settings.R;
@@ -120,4 +122,9 @@
*/
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.bluetooth_screen);
+
+ @Override
+ public @Nullable String getPreferenceScreenBindingKey(@NonNull Context context) {
+ return BluetoothDashboardScreen.KEY;
+ }
}
diff --git a/src/com/android/settings/connecteddevice/BluetoothDashboardScreen.kt b/src/com/android/settings/connecteddevice/BluetoothDashboardScreen.kt
new file mode 100644
index 0000000..66fd8b1
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/BluetoothDashboardScreen.kt
@@ -0,0 +1,47 @@
+/*
+ * 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.connecteddevice
+
+import android.content.Context
+import com.android.settings.R
+import com.android.settings.flags.Flags
+import com.android.settingslib.metadata.ProvidePreferenceScreen
+import com.android.settingslib.metadata.preferenceHierarchy
+import com.android.settingslib.preference.PreferenceScreenCreator
+
+@ProvidePreferenceScreen
+class BluetoothDashboardScreen : PreferenceScreenCreator {
+ override val key: String
+ get() = KEY
+
+ override val title: Int
+ get() = R.string.bluetooth_settings_title
+
+ override val icon: Int
+ get() = R.drawable.ic_settings_bluetooth
+
+ override fun isFlagEnabled(context: Context) = Flags.catalystBluetoothSwitchbarScreen()
+
+ override fun hasCompleteHierarchy() = false
+
+ override fun fragmentClass() = BluetoothDashboardFragment::class.java
+
+ override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(this) {}
+
+ companion object {
+ const val KEY = "bluetooth_switchbar_screen"
+ }
+}
diff --git a/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummary.java
index 4c700d2..b5581d0 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummary.java
@@ -27,6 +27,8 @@
import android.os.Handler;
import android.provider.Settings.Global;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
@@ -270,4 +272,9 @@
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.power_usage_summary);
+
+ @Override
+ public @Nullable String getPreferenceScreenBindingKey(@NonNull Context context) {
+ return PowerUsageSummaryScreen.KEY;
+ }
}
diff --git a/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryScreen.kt b/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryScreen.kt
new file mode 100644
index 0000000..229e308
--- /dev/null
+++ b/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryScreen.kt
@@ -0,0 +1,62 @@
+/*
+ * 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.fuelgauge.batteryusage
+
+import android.content.Context
+import com.android.settings.R
+import com.android.settings.flags.Flags
+import com.android.settingslib.metadata.PreferenceAvailabilityProvider
+import com.android.settingslib.metadata.PreferenceIconProvider
+import com.android.settingslib.metadata.ProvidePreferenceScreen
+import com.android.settingslib.metadata.preferenceHierarchy
+import com.android.settingslib.preference.PreferenceScreenCreator
+
+@ProvidePreferenceScreen
+class PowerUsageSummaryScreen : PreferenceScreenCreator,
+ PreferenceAvailabilityProvider,
+ PreferenceIconProvider {
+ override val key: String
+ get() = KEY
+
+ override val title: Int
+ get() = R.string.power_usage_summary_title
+
+ override val keywords: Int
+ get() = R.string.keywords_battery
+
+ override fun isFlagEnabled(context: Context) = Flags.catalystPowerUsageSummaryScreen()
+
+ override fun hasCompleteHierarchy() = false
+
+ override fun fragmentClass() = PowerUsageSummary::class.java
+
+ override fun isAvailable(context: Context) =
+ context.resources.getBoolean(R.bool.config_show_top_level_battery)
+
+ override fun getIcon(context: Context): Int =
+ if (Flags.homepageRevamp()) {
+ R.drawable.ic_settings_battery_filled
+ } else {
+ R.drawable.ic_settings_battery_white
+ }
+
+
+ override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(this) {}
+
+ companion object {
+ const val KEY = "power_usage_summary_screen"
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/location/LocationScreen.kt b/src/com/android/settings/location/LocationScreen.kt
new file mode 100644
index 0000000..d45b762
--- /dev/null
+++ b/src/com/android/settings/location/LocationScreen.kt
@@ -0,0 +1,65 @@
+/*
+ * 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.location
+
+import android.content.Context
+import android.location.LocationManager
+import com.android.settings.R
+import com.android.settings.flags.Flags
+import com.android.settingslib.metadata.PreferenceIconProvider
+import com.android.settingslib.metadata.PreferenceSummaryProvider
+import com.android.settingslib.metadata.ProvidePreferenceScreen
+import com.android.settingslib.metadata.preferenceHierarchy
+import com.android.settingslib.preference.PreferenceScreenCreator
+
+@ProvidePreferenceScreen
+class LocationScreen : PreferenceScreenCreator, PreferenceSummaryProvider, PreferenceIconProvider {
+ override val key: String
+ get() = KEY
+
+ override val title: Int
+ get() = R.string.location_settings_title
+
+ override val keywords: Int
+ get() = R.string.keywords_location
+
+ override fun getSummary(context: Context): CharSequence? {
+ var locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
+ return if (locationManager.isLocationEnabled) {
+ context.getString(R.string.location_settings_loading_app_permission_stats)
+ } else {
+ context.getString(R.string.location_settings_summary_location_off)
+ }
+ }
+
+ override fun getIcon(context: Context) =
+ when {
+ Flags.homepageRevamp() -> R.drawable.ic_settings_location_filled
+ else -> R.drawable.ic_settings_location
+ }
+
+ override fun isFlagEnabled(context: Context) = Flags.catalystLocationSettings()
+
+ override fun hasCompleteHierarchy() = false
+
+ override fun fragmentClass() = LocationSettings::class.java
+
+ override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(this) {}
+
+ companion object {
+ const val KEY = "location_settings"
+ }
+}
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 87e8817..6a1d3d2 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -29,6 +29,8 @@
import android.provider.Settings;
import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;
@@ -185,4 +187,9 @@
R.string.location_settings_tooltip_text_for_chrome));
}
}
+
+ @Override
+ public @Nullable String getPreferenceScreenBindingKey(@NonNull Context context) {
+ return LocationScreen.KEY;
+ }
}
diff --git a/src/com/android/settings/network/MobileNetworkListFragment.kt b/src/com/android/settings/network/MobileNetworkListFragment.kt
index 3118088..a0da636 100644
--- a/src/com/android/settings/network/MobileNetworkListFragment.kt
+++ b/src/com/android/settings/network/MobileNetworkListFragment.kt
@@ -92,4 +92,6 @@
simRepositoryFactory(context).canEnterMobileNetworkPage()
}
}
+
+ override fun getPreferenceScreenBindingKey(context: Context) = MobileNetworkListScreen.KEY
}
diff --git a/src/com/android/settings/network/MobileNetworkListScreen.kt b/src/com/android/settings/network/MobileNetworkListScreen.kt
new file mode 100644
index 0000000..93d8ee6
--- /dev/null
+++ b/src/com/android/settings/network/MobileNetworkListScreen.kt
@@ -0,0 +1,50 @@
+/*
+ * 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.network
+
+import android.content.Context
+import com.android.settings.R
+import com.android.settings.flags.Flags
+import com.android.settingslib.metadata.ProvidePreferenceScreen
+import com.android.settingslib.metadata.preferenceHierarchy
+import com.android.settingslib.preference.PreferenceScreenCreator
+
+@ProvidePreferenceScreen
+class MobileNetworkListScreen : PreferenceScreenCreator {
+ override val key: String
+ get() = KEY
+
+ override val title: Int
+ get() = R.string.provider_network_settings_title
+
+ override val icon: Int
+ get() = R.drawable.ic_sim_card
+
+ override val keywords: Int
+ get() = R.string.keywords_more_mobile_networks
+
+ override fun isFlagEnabled(context: Context) = Flags.catalystMobileNetworkList()
+
+ override fun hasCompleteHierarchy() = false
+
+ override fun fragmentClass() = MobileNetworkListFragment::class.java
+
+ override fun getPreferenceHierarchy(context: Context) = preferenceHierarchy(this) {}
+
+ companion object {
+ const val KEY = "mobile_network_list"
+ }
+}
diff --git a/tests/robotests/OWNERS b/tests/robotests/OWNERS
index 8a7a27e..e15af1c 100644
--- a/tests/robotests/OWNERS
+++ b/tests/robotests/OWNERS
@@ -1,2 +1,3 @@
# We do not guard tests - everyone is welcomed to contribute to tests.
-per-file *.java=*
\ No newline at end of file
+per-file *.java=*
+per-file *.kt=*
diff --git a/tests/robotests/src/com/android/settings/accessibility/ColorAndMotionScreenTest.kt b/tests/robotests/src/com/android/settings/accessibility/ColorAndMotionScreenTest.kt
new file mode 100644
index 0000000..6d7164e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/ColorAndMotionScreenTest.kt
@@ -0,0 +1,38 @@
+/*
+ * 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.accessibility
+
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.flags.Flags
+import com.android.settingslib.preference.CatalystScreenTestCase
+import com.android.settingslib.preference.PreferenceScreenCreator
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class ColorAndMotionScreenTest : CatalystScreenTestCase() {
+ override val preferenceScreenCreator: PreferenceScreenCreator = ColorAndMotionScreen()
+ override val flagName: String = Flags.FLAG_CATALYST_ACCESSIBILITY_COLOR_AND_MOTION
+
+ override fun migration() {}
+
+ @Test
+ fun key() {
+ assertThat(preferenceScreenCreator.key).isEqualTo(ColorAndMotionScreen.KEY)
+ }
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java
index 414fe63..b3270e9 100644
--- a/tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/shortcuts/EditShortcutsPreferenceFragmentTest.java
@@ -16,6 +16,9 @@
package com.android.settings.accessibility.shortcuts;
+import static android.provider.Settings.ACTION_ACCESSIBILITY_SHORTCUT_SETTINGS;
+
+import static com.android.internal.accessibility.AccessibilityShortcutController.DALTONIZER_COMPONENT_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_COMPONENT_NAME;
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE;
@@ -45,6 +48,7 @@
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.Flags;
+import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.testing.FragmentScenario;
import androidx.lifecycle.Lifecycle;
@@ -160,7 +164,7 @@
public void showEditShortcutScreen_inSuw_launchSubSettingWithSuw() {
EditShortcutsPreferenceFragment.showEditShortcutScreen(
mActivity, METRICS_CATEGORY, SCREEN_TITLE,
- TARGET_FAKE_COMPONENT, createSuwIntent(new Intent(), /* isInSuw= */ true));
+ TARGET_FAKE_COMPONENT, setIntentInSuw(new Intent(), /* isInSuw= */ true));
assertLaunchSubSettingWithCurrentTargetComponents(
TARGET_FAKE_COMPONENT.flattenToString(), /* isInSuw= */ true);
@@ -199,6 +203,53 @@
}
@Test
+ @EnableFlags(
+ com.android.settings.accessibility.Flags.FLAG_TOGGLE_FEATURE_FRAGMENT_COLLECTION_INFO)
+ public void shortcutDescriptionPref_defaultLaunch_notVisible() {
+ mFragmentScenario = createFragScenario(/* isInSuw= */ false, TARGET);
+ mFragmentScenario.moveToState(Lifecycle.State.CREATED);
+
+ mFragmentScenario.onFragment(fragment -> {
+ Preference preference = fragment.findPreference(
+ mContext.getString(R.string.accessibility_shortcut_description_pref));
+ assertThat(preference.isVisible()).isFalse();
+ });
+ }
+
+ @Test
+ @EnableFlags(
+ com.android.settings.accessibility.Flags.FLAG_TOGGLE_FEATURE_FRAGMENT_COLLECTION_INFO)
+ public void shortcutDescriptionPref_launchFromAction_singleTarget_notVisible() {
+ mFragmentScenario = createFragScenario(/* isInSuw= */ false, List.of(TARGET),
+ ACTION_ACCESSIBILITY_SHORTCUT_SETTINGS);
+ mFragmentScenario.moveToState(Lifecycle.State.CREATED);
+
+ mFragmentScenario.onFragment(fragment -> {
+ Preference preference = fragment.findPreference(
+ mContext.getString(R.string.accessibility_shortcut_description_pref));
+ assertThat(preference.isVisible()).isFalse();
+ });
+ }
+
+ @Test
+ @EnableFlags(
+ com.android.settings.accessibility.Flags.FLAG_TOGGLE_FEATURE_FRAGMENT_COLLECTION_INFO)
+ public void shortcutDescriptionPref_launchFromAction_multipleTargets_isVisible() {
+ mFragmentScenario = createFragScenario(/* isInSuw= */ false,
+ // Both of these components are system components with known labels, so we don't
+ // need to mock AccessibilityManager with fake labels.
+ List.of(TARGET, DALTONIZER_COMPONENT_NAME.flattenToString()),
+ ACTION_ACCESSIBILITY_SHORTCUT_SETTINGS);
+ mFragmentScenario.moveToState(Lifecycle.State.CREATED);
+
+ mFragmentScenario.onFragment(fragment -> {
+ Preference preference = fragment.findPreference(
+ mContext.getString(R.string.accessibility_shortcut_description_pref));
+ assertThat(preference.isVisible()).isTrue();
+ });
+ }
+
+ @Test
public void fragmentCreated_settingsObserversAreRegistered() {
ShadowContentResolver contentResolver = shadowOf(mContext.getContentResolver());
for (Uri uri : SHORTCUT_SETTINGS) {
@@ -654,9 +705,14 @@
private FragmentScenario<EditShortcutsPreferenceFragment> createFragScenario(
boolean isInSuw, String target) {
+ return createFragScenario(isInSuw, List.of(target), null);
+ }
+ private FragmentScenario<EditShortcutsPreferenceFragment> createFragScenario(
+ boolean isInSuw, List<String> targets, @Nullable String intentAction) {
Bundle args = new Bundle();
args.putStringArray(
- EditShortcutsPreferenceFragment.ARG_KEY_SHORTCUT_TARGETS, new String[]{target});
+ EditShortcutsPreferenceFragment.ARG_KEY_SHORTCUT_TARGETS,
+ targets.toArray(new String[0]));
FragmentScenario<EditShortcutsPreferenceFragment> scenario =
FragmentScenario.launch(
EditShortcutsPreferenceFragment.class, args,
@@ -664,7 +720,11 @@
scenario.onFragment(fragment -> {
Intent intent = fragment.requireActivity().getIntent();
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE, SCREEN_TITLE);
- fragment.requireActivity().setIntent(createSuwIntent(intent, isInSuw));
+ setIntentInSuw(intent, isInSuw);
+ if (intentAction != null) {
+ intent.setAction(intentAction);
+ }
+ fragment.requireActivity().setIntent(intent);
// Since the fragment is attached before we have a chance
// to modify the activity's intent; initialize controllers again
fragment.initializePreferenceControllerArguments();
@@ -672,11 +732,7 @@
return scenario;
}
- private Intent createSuwIntent(Intent intent, boolean isInSuw) {
-
- if (intent == null) {
- intent = new Intent();
- }
+ private Intent setIntentInSuw(Intent intent, boolean isInSuw) {
intent.putExtra(EXTRA_IS_SETUP_FLOW, isInSuw);
intent.putExtra(EXTRA_IS_FIRST_RUN, isInSuw);
intent.putExtra(EXTRA_IS_PRE_DEFERRED_SETUP, isInSuw);
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/BluetoothDashboardScreenTest.kt b/tests/robotests/src/com/android/settings/connecteddevice/BluetoothDashboardScreenTest.kt
new file mode 100644
index 0000000..39c0294
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/connecteddevice/BluetoothDashboardScreenTest.kt
@@ -0,0 +1,39 @@
+/*
+ * 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.connecteddevice
+
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.flags.Flags
+import com.android.settingslib.preference.CatalystScreenTestCase
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class BluetoothDashboardScreenTest : CatalystScreenTestCase() {
+ override val preferenceScreenCreator = BluetoothDashboardScreen()
+
+ override val flagName: String
+ get() = Flags.FLAG_CATALYST_BLUETOOTH_SWITCHBAR_SCREEN
+
+ @Test
+ fun key() {
+ assertThat(preferenceScreenCreator.key).isEqualTo(BluetoothDashboardScreen.KEY)
+ }
+
+ override fun migration() {
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryScreenTest.kt b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryScreenTest.kt
new file mode 100644
index 0000000..80a6b2e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/PowerUsageSummaryScreenTest.kt
@@ -0,0 +1,101 @@
+/*
+ * 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.fuelgauge.batteryusage
+
+import android.content.ContextWrapper
+import android.content.res.Resources
+import android.platform.test.annotations.DisableFlags
+import android.platform.test.annotations.EnableFlags
+import androidx.fragment.app.testing.FragmentScenario
+import androidx.preference.PreferenceFragmentCompat
+import com.android.settings.R
+import com.android.settings.flags.Flags
+import com.android.settings.testutils.shadow.ShadowUtils
+import com.android.settingslib.preference.CatalystScreenTestCase
+import com.google.common.truth.Truth.assertThat
+import org.junit.After
+import org.junit.Test
+import org.mockito.ArgumentMatchers.anyInt
+import org.mockito.kotlin.doReturn
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.stub
+import org.robolectric.annotation.Config
+
+@Config(shadows = [ShadowUtils::class])
+class PowerUsageSummaryScreenTest : CatalystScreenTestCase() {
+
+ override val preferenceScreenCreator = PowerUsageSummaryScreen()
+
+ override val flagName: String
+ get() = Flags.FLAG_CATALYST_POWER_USAGE_SUMMARY_SCREEN
+
+ private val mockResources = mock<Resources>()
+
+ private val context =
+ object : ContextWrapper(appContext) {
+ override fun getResources(): Resources = mockResources
+ }
+
+ @After
+ fun tearDown() {
+ ShadowUtils.reset()
+ }
+
+ @Test
+ fun key() {
+ assertThat(preferenceScreenCreator.key).isEqualTo(PowerUsageSummaryScreen.KEY)
+ }
+
+ @Test
+ fun isAvailable_configTrue_shouldReturnTrue() {
+ mockResources.stub { on { getBoolean(anyInt()) } doReturn true }
+
+ assertThat(preferenceScreenCreator.isAvailable(context)).isTrue()
+ }
+
+ @Test
+ fun isAvailable_configFalse_shouldReturnFalse() {
+ mockResources.stub { on { getBoolean(anyInt()) } doReturn false }
+
+ assertThat(preferenceScreenCreator.isAvailable(context)).isFalse()
+ }
+
+ @Test
+ @EnableFlags(Flags.FLAG_HOMEPAGE_REVAMP)
+ fun getIcon_whenHomePageRevampFlagOn() {
+ assertThat(preferenceScreenCreator.getIcon(context))
+ .isEqualTo(R.drawable.ic_settings_battery_filled)
+ }
+
+ @Test
+ @DisableFlags(Flags.FLAG_HOMEPAGE_REVAMP)
+ fun getIcon_whenHomePageRevampFlagOff() {
+ assertThat(preferenceScreenCreator.getIcon(context))
+ .isEqualTo(R.drawable.ic_settings_battery_white)
+ }
+
+ override fun migration() {
+ ShadowUtils.setIsBatteryPresent(false)
+
+ super.migration()
+ }
+
+ override fun launchFragmentScenario(fragmentClass: Class<PreferenceFragmentCompat>) =
+ FragmentScenario.launch(
+ fragmentClass,
+ themeResId = R.style.Theme_CollapsingToolbar_Settings,
+ )
+}
diff --git a/tests/robotests/src/com/android/settings/location/LocationScreenTest.kt b/tests/robotests/src/com/android/settings/location/LocationScreenTest.kt
new file mode 100644
index 0000000..1d1696d
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/location/LocationScreenTest.kt
@@ -0,0 +1,73 @@
+/*
+ * 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.location
+
+import android.content.Context
+import android.content.ContextWrapper
+import android.location.LocationManager
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.R
+import com.android.settings.flags.Flags
+import com.android.settingslib.preference.CatalystScreenTestCase
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.kotlin.doReturn
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.stub
+
+@RunWith(AndroidJUnit4::class)
+class LocationScreenTest : CatalystScreenTestCase() {
+ override val preferenceScreenCreator = LocationScreen()
+
+ override val flagName: String
+ get() = Flags.FLAG_CATALYST_LOCATION_SETTINGS
+
+ private val mockLocationManager = mock<LocationManager>()
+
+ private val context =
+ object : ContextWrapper(appContext) {
+ override fun getSystemService(name: String): Any =
+ when (name) {
+ Context.LOCATION_SERVICE -> mockLocationManager
+ else -> super.getSystemService(name)
+ }
+ }
+
+ @Test
+ fun key() {
+ assertThat(preferenceScreenCreator.key).isEqualTo(LocationScreen.KEY)
+ }
+
+ @Test
+ fun getSummary_enableLocation_shouldReturnLoading() {
+ mockLocationManager.stub { on { isLocationEnabled } doReturn true }
+
+ assertThat(preferenceScreenCreator.getSummary(context)).isEqualTo(
+ context.getString(R.string.location_settings_loading_app_permission_stats))
+ }
+
+ @Test
+ fun getSummary_disableLocation_shouldReturnLocationOff() {
+ mockLocationManager.stub { on { isLocationEnabled } doReturn false }
+
+ assertThat(preferenceScreenCreator.getSummary(context)).isEqualTo(
+ context.getString(R.string.location_settings_summary_location_off))
+ }
+
+ override fun migration() {
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/network/MobileNetworkListScreenTest.kt b/tests/robotests/src/com/android/settings/network/MobileNetworkListScreenTest.kt
new file mode 100644
index 0000000..1d7a1d9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/MobileNetworkListScreenTest.kt
@@ -0,0 +1,36 @@
+/*
+ * 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.network
+
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.flags.Flags
+import com.android.settingslib.preference.CatalystScreenTestCase
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class MobileNetworkListScreenTest : CatalystScreenTestCase() {
+ override val preferenceScreenCreator = MobileNetworkListScreen()
+
+ override val flagName: String
+ get() = Flags.FLAG_CATALYST_MOBILE_NETWORK_LIST
+
+ @Test
+ fun key() {
+ assertThat(preferenceScreenCreator.key).isEqualTo(MobileNetworkListScreen.KEY)
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityManager.java
index fcd1e42..7de69a7 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityManager.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityManager.java
@@ -24,6 +24,8 @@
import android.util.ArrayMap;
import android.view.accessibility.AccessibilityManager;
+import com.android.internal.accessibility.common.ShortcutConstants;
+
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
@@ -71,4 +73,14 @@
@NonNull List<AccessibilityShortcutInfo> installedAccessibilityShortcutList) {
mInstalledAccessibilityShortcutList = installedAccessibilityShortcutList;
}
+
+ /**
+ * Implements the hidden method
+ * {@link AccessibilityManager#getAccessibilityShortcutTargets}.
+ */
+ @Implementation
+ public List<String> getAccessibilityShortcutTargets(
+ @ShortcutConstants.UserShortcutType int shortcutType) {
+ return List.of();
+ }
}
diff --git a/tests/screenshot/src/com/android/settings/tests/screenshot/biometrics/fingerprint/Injector.kt b/tests/screenshot/src/com/android/settings/tests/screenshot/biometrics/fingerprint/Injector.kt
index e7fc3ed..a5d0461 100644
--- a/tests/screenshot/src/com/android/settings/tests/screenshot/biometrics/fingerprint/Injector.kt
+++ b/tests/screenshot/src/com/android/settings/tests/screenshot/biometrics/fingerprint/Injector.kt
@@ -44,6 +44,7 @@
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintScrollViewModel
import com.android.settings.testutils2.FakeFingerprintManagerInteractor
import com.android.systemui.biometrics.shared.model.toFingerprintSensor
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
@@ -73,7 +74,10 @@
var accessibilityInteractor =
object : AccessibilityInteractor {
- override val isAccessibilityEnabled: Flow<Boolean> = flowOf(true)
+ override fun isEnabledFlow(scope: CoroutineScope): Flow<Boolean> = flowOf(true)
+ override val isEnabled: Boolean
+ get() = true
+ override fun announce(clazz: Class<*>, announcement: CharSequence?) {}
}
var foldStateInteractor =
diff --git a/tests/unit/src/com/android/settings/fingerprint2/enrollment/viewmodel/FingerprintEnrollFindSensorViewModelV2Test.kt b/tests/unit/src/com/android/settings/fingerprint2/enrollment/viewmodel/FingerprintEnrollFindSensorViewModelV2Test.kt
index 04cece8..a8c5e68 100644
--- a/tests/unit/src/com/android/settings/fingerprint2/enrollment/viewmodel/FingerprintEnrollFindSensorViewModelV2Test.kt
+++ b/tests/unit/src/com/android/settings/fingerprint2/enrollment/viewmodel/FingerprintEnrollFindSensorViewModelV2Test.kt
@@ -39,6 +39,7 @@
import com.android.settings.testutils2.FakeFingerprintManagerInteractor
import com.android.systemui.biometrics.shared.model.toFingerprintSensor
import com.google.common.truth.Truth.assertThat
+import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
@@ -106,7 +107,10 @@
)
accessibilityInteractor =
object : AccessibilityInteractor {
- override val isAccessibilityEnabled: Flow<Boolean> = flowOf(false)
+ override fun isEnabledFlow(scope: CoroutineScope): Flow<Boolean> = flowOf(true)
+ override val isEnabled: Boolean
+ get() = true
+ override fun announce(clazz: Class<*>, announcement: CharSequence?) {}
}
foldStateInteractor =
object : FoldStateInteractor {