Merge "[Audiosharing] Show/hide audio sharing settings based on BT state." into main
diff --git a/Android.bp b/Android.bp
index 2699c38..045a963 100644
--- a/Android.bp
+++ b/Android.bp
@@ -94,6 +94,7 @@
"battery-event-protos-lite",
"battery-usage-slot-protos-lite",
"contextualcards",
+ "development_settings_flag_lib",
"factory_reset_flags_lib",
"fuelgauge-log-protos-lite",
"fuelgauge-usage-state-protos-lite",
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 26386c5..095452c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -16,11 +16,6 @@
android:name="com.android.settings.USE_BIOMETRIC_PROVIDER"
android:protectionLevel="signature|privileged"/>
- <!-- Permissions for acting as the factory reset preparation application. -->
- <permission
- android:name="com.android.settings.permissions.PREPARE_FACTORY_RESET"
- android:protectionLevel="signature|privileged"/>
-
<uses-permission android:name="android.permission.REQUEST_NETWORK_SCORES" />
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
@@ -2864,11 +2859,10 @@
</activity>
<activity
- android:name="Settings$DevelopmentSettingsDashboardActivity"
+ android:name="Settings$DevelopmentSettingsActivity"
android:label="@string/development_settings_title"
android:icon="@drawable/ic_settings_development"
- android:exported="true"
- android:enabled="false">
+ android:exported="true">
<intent-filter android:priority="1">
<action android:name="android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
<action android:name="com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
@@ -2879,35 +2873,8 @@
<action android:name="com.android.settings.action.SETTINGS" />
<action android:name="com.android.intent.action.SHOW_CONTRAST_DIALOG" />
</intent-filter>
- <meta-data android:name="com.android.settings.order" android:value="-40"/>
- <meta-data android:name="com.android.settings.category"
- android:value="com.android.settings.category.ia.system" />
- <meta-data android:name="com.android.settings.summary"
- android:resource="@string/summary_empty"/>
- <meta-data android:name="com.android.settings.icon"
- android:resource="@drawable/ic_settings_development" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.development.DevelopmentSettingsDashboardFragment" />
- <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
- android:value="@string/menu_key_system"/>
- <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
- android:value="true" />
- </activity>
-
- <!-- The opposite of DevelopmentSettingsActivity, it's no-op and only enabled when the real
- activity is disabled to be CTS compliant. -->
- <activity
- android:name=".development.DevelopmentSettingsDisabledActivity"
- android:icon="@drawable/ic_settings_development"
- android:label="@string/development_settings_title"
- android:excludeFromRecents="true"
- android:exported="true"
- android:theme="@style/Transparent">
- <intent-filter android:priority="-1">
- <action android:name="android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
- <action android:name="com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
</activity>
<activity
@@ -4231,11 +4198,6 @@
android:value="@string/menu_key_system"/>
</activity-alias>
- <provider
- android:name=".dashboard.SummaryProvider"
- android:authorities="${applicationId}.dashboard.SummaryProvider">
- </provider>
-
<activity android:name=".backup.UserBackupSettingsActivity"
android:label="@string/privacy_settings_title"
android:exported="true"
@@ -4323,6 +4285,15 @@
android:value="true" />
</activity>
+ <!-- Access to the Credential Manager list. -->
+ <activity android:name=".applications.credentials.CredentialsPickerActivity"
+ android:excludeFromRecents="true"
+ android:launchMode="singleInstance"
+ android:exported="false">
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.applications.credentials.DefaultCombinedPicker" />
+ </activity>
+
<activity
android:name=".Settings$SystemDashboardActivity"
android:label="@string/header_category_system"
diff --git a/aconfig/Android.bp b/aconfig/Android.bp
index de6d0af..d14cc6f 100644
--- a/aconfig/Android.bp
+++ b/aconfig/Android.bp
@@ -47,3 +47,16 @@
name: "accessibility_settings_flags_lib",
aconfig_declarations: "accessibility_flags",
}
+
+aconfig_declarations {
+ name: "development_settings_flags",
+ package: "com.android.settings.development",
+ srcs: [
+ "development/**/*.aconfig"
+ ],
+}
+
+java_aconfig_library {
+ name: "development_settings_flag_lib",
+ aconfig_declarations: "development_settings_flags",
+}
diff --git a/aconfig/development/settings_core_flag_declarations.aconfig b/aconfig/development/settings_core_flag_declarations.aconfig
new file mode 100644
index 0000000..c012263
--- /dev/null
+++ b/aconfig/development/settings_core_flag_declarations.aconfig
@@ -0,0 +1,8 @@
+package: "com.android.settings.development"
+
+flag {
+ name: "deprecate_list_activity"
+ namespace: "android_settings"
+ description: "Feature flag for deprecating ListActivity in Settings"
+ bug: "299195099"
+}
diff --git a/res/drawable/ic_wifi_off.xml b/res/drawable/ic_wifi_off.xml
deleted file mode 100644
index 1480a59..0000000
--- a/res/drawable/ic_wifi_off.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- ~ Copyright (C) 2020 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.
- -->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="@android:color/white"
- android:pathData="M23,9c-4.11,-4.11 -9.93,-5.43 -15.15,-3.98l9.57,9.57L23,9zM5.76,5.76L2.81,2.81 1.39,4.22l2.52,2.52C2.88,7.37 1.89,8.11 1,9l11,11 2.59,-2.59 5.19,5.19 1.41,-1.41L16,16 5.76,5.76z"/>
-</vector>
\ No newline at end of file
diff --git a/res/values/config.xml b/res/values/config.xml
index 73ee108..c30a047 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -349,9 +349,6 @@
Fetch resource from overlay package directly if this is set. -->
<string name="config_regulatory_info_overlay_package_name" translatable="false" />
- <!-- Whether to show a preference item for mobile plan -->
- <bool name="config_show_mobile_plan">true</bool>
-
<!-- Whether none security option is hide or not (country specific). -->
<bool name="config_hide_none_security_option">false</bool>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6739a71..8dca8d0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2167,12 +2167,8 @@
<!-- Button label to connect to a Wi-Fi network -->
<string name="wifi_connect">Connect</string>
- <!-- Turned on notification for Wi-Fi [CHAR LIMIT=40] -->
- <string name="wifi_turned_on_message">Wi\u2011Fi turned on</string>
<!-- A notification for connected to a Wi-Fi network [CHAR LIMIT=NONE] -->
<string name="wifi_connected_to_message">Connected to <xliff:g id="network_name" example="MyNetwork">%1$s</xliff:g></string>
- <!-- A notification for connecting to a Wi-Fi network [CHAR LIMIT=NONE] -->
- <string name="wifi_connecting_to_message">Connecting to <xliff:g id="network_name" example="MyNetwork">%1$s</xliff:g></string>
<!-- Button label to connecting progress to a Wi-Fi network [CHAR LIMIT=20] -->
<string name="wifi_connecting">Connecting\u2026</string>
<!-- Failured notification for connect -->
@@ -2656,6 +2652,8 @@
<string name="adaptive_sleep_contextual_slice_title">Turn on screen attention</string>
<!-- Description about the contextual adaptive sleep card [CHAR LIMIT=NONE]-->
<string name="adaptive_sleep_contextual_slice_summary">Keep screen on when looking at it</string>
+ <!-- Description about the power consumption implication in screen timeout footer [CHAR LIMIT=NONE]-->
+ <string name="power_consumption_footer_summary">Longer screen timeout will use more battery.</string>
<!-- auto_rotate settings screen, title about the camera privacy lock enabled [CHAR LIMIT=NONE]-->
<string name="auto_rotate_camera_lock_title">Camera is locked</string>
<!-- Description feature's privacy sensitive details to make sure users understand what feature users, what it saves/sends etc [CHAR LIMIT=NONE]-->
@@ -3455,9 +3453,6 @@
<!-- Wireless controls, item title to go into the network settings -->
<string name="network_settings_title">Mobile network</string>
- <!-- Mobile plan [CHAR LIMIT=35]-->
- <string name="manage_mobile_plan_title" translatable="true">Mobile plan</string>
-
<!-- SMS Application [CHAR LIMIT=35]-->
<string name="sms_application_title" translatable="true">SMS app</string>
<string name="sms_change_default_dialog_title" translatable="true">Change SMS app?</string>
@@ -3471,18 +3466,6 @@
<!-- Wifi Assistant request message. This message asks the user if it is okay for an app to become the Wifi Assistant. [CHAR LIMIT=100] -->
<string name="network_scorer_change_active_no_previous_dialog_text">Use <xliff:g id="new_app">%s</xliff:g> to manage your network connections?</string>
- <!-- The SIM operator is not known [CHAR_ LIMIT=50]-->
- <string name="mobile_unknown_sim_operator" translatable="true">Unknown SIM operator</string>
-
- <!-- There is no mobile provisiong website for the operator which is the firat parameter [CHAR_ LIMIT=50]-->
- <string name="mobile_no_provisioning_url"><xliff:g id="operator">%1$s</xliff:g> has no known provisioning website</string>
-
- <!-- Ask user to insert a SIM card [CHAR_ LIMIT=50]-->
- <string name="mobile_insert_sim_card" translatable="true">Please insert SIM card and restart</string>
-
- <!-- Ask user to connect to the internet [CHAR_ LIMIT=50]-->
- <string name="mobile_connect_to_internet" translatable="true">Please connect to the internet</string>
-
<!-- Location settings screen, sub category for recent location requests [CHAR LIMIT=42] -->
<string name="location_category_recent_location_requests">Recent location requests</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 0786458..2c928ff 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -950,7 +950,7 @@
</style>
<style name="ScreenLockPasswordHintTextFontStyle">
- <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textColor">?android:attr/colorError</item>
<item name="android:fontFamily">google-sans-text</item>
</style>
diff --git a/res/xml/development_app_picker.xml b/res/xml/development_app_picker.xml
new file mode 100644
index 0000000..15e4ce0
--- /dev/null
+++ b/res/xml/development_app_picker.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2023 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.
+ -->
+
+<PreferenceScreen/>
diff --git a/res/xml/network_provider_internet.xml b/res/xml/network_provider_internet.xml
index b055ea3..8e9d45d 100644
--- a/res/xml/network_provider_internet.xml
+++ b/res/xml/network_provider_internet.xml
@@ -59,15 +59,6 @@
settings:userRestriction="no_airplane_mode"/>
<com.android.settingslib.RestrictedPreference
- android:key="manage_mobile_plan"
- android:title="@string/manage_mobile_plan_title"
- android:persistent="false"
- android:order="19"
- settings:userRestriction="no_config_mobile_networks"
- settings:isPreferenceVisible="@bool/config_show_sim_info"
- settings:useAdminDisabledSummary="true" />
-
- <com.android.settingslib.RestrictedPreference
android:fragment="com.android.settings.network.tether.TetherSettings"
android:key="tether_settings"
android:title="@string/tether_settings_title_all"
diff --git a/res/xml/system_dashboard_fragment.xml b/res/xml/system_dashboard_fragment.xml
index 54dc195..a2cb8fa 100644
--- a/res/xml/system_dashboard_fragment.xml
+++ b/res/xml/system_dashboard_fragment.xml
@@ -100,6 +100,11 @@
android:fragment="com.android.settings.users.UserSettings"
settings:controller="com.android.settings.users.MultiUserPreferenceController"/>
+ <com.android.settings.spa.preference.ComposePreference
+ android:key="developer_options"
+ android:order="-40"
+ settings:controller="com.android.settings.system.DeveloperOptionsController"/>
+
<Preference
android:key="reset_dashboard"
android:title="@string/reset_dashboard_title"
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 49b2174..64e3244 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -134,7 +134,7 @@
public static class HighPowerApplicationsActivity extends SettingsActivity { /* empty */ }
public static class BackgroundCheckSummaryActivity extends SettingsActivity { /* empty */ }
public static class StorageUseActivity extends SettingsActivity { /* empty */ }
- public static class DevelopmentSettingsDashboardActivity extends SettingsActivity { /* empty */ }
+ public static class DevelopmentSettingsActivity extends SettingsActivity { /* empty */ }
public static class AccessibilitySettingsActivity extends SettingsActivity { /* empty */ }
public static class AccessibilityDetailsSettingsActivity extends SettingsActivity { /* empty */ }
public static class CaptioningSettingsActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 3b0dd40..27a87f3 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -48,7 +48,6 @@
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
@@ -70,7 +69,6 @@
import com.android.settings.widget.SettingsMainSwitchBar;
import com.android.settingslib.core.instrumentation.Instrumentable;
import com.android.settingslib.core.instrumentation.SharedPreferencesLogger;
-import com.android.settingslib.development.DevelopmentSettingsEnabler;
import com.android.settingslib.drawer.DashboardCategory;
import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -174,8 +172,6 @@
private CharSequence mInitialTitle;
private int mInitialTitleResId;
- private BroadcastReceiver mDevelopmentSettingsListener;
-
private boolean mBatteryPresent = true;
private BroadcastReceiver mBatteryInfoReceiver = new BroadcastReceiver() {
@Override
@@ -614,15 +610,6 @@
super.onResume();
setActionBarStatus();
- mDevelopmentSettingsListener = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- updateTilesList();
- }
- };
- LocalBroadcastManager.getInstance(this).registerReceiver(mDevelopmentSettingsListener,
- new IntentFilter(DevelopmentSettingsEnabler.DEVELOPMENT_SETTINGS_CHANGED_ACTION));
-
registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
updateTilesList();
@@ -631,8 +618,6 @@
@Override
protected void onPause() {
super.onPause();
- LocalBroadcastManager.getInstance(this).unregisterReceiver(mDevelopmentSettingsListener);
- mDevelopmentSettingsListener = null;
unregisterReceiver(mBatteryInfoReceiver);
}
@@ -781,13 +766,6 @@
Utils.isBandwidthControlEnabled(), isAdmin)
|| somethingChanged;
- final boolean showDev = DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(this)
- && !Utils.isMonkeyRunning();
- somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
- Settings.DevelopmentSettingsDashboardActivity.class.getName()),
- showDev, isAdmin)
- || somethingChanged;
-
somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
Settings.WifiDisplaySettingsActivity.class.getName()),
WifiDisplaySettings.isAvailable(this), isAdmin)
diff --git a/src/com/android/settings/applications/credentials/CombinedProviderInfo.java b/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
index 074fb7b..e8541389 100644
--- a/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
+++ b/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
@@ -82,6 +82,37 @@
return mAutofillServiceInfo.getServiceInfo().applicationInfo;
}
+ /** Returns the package name. */
+ public @Nullable String getPackageName() {
+ ApplicationInfo ai = getApplicationInfo();
+ if (ai != null) {
+ return ai.packageName;
+ }
+
+ return null;
+ }
+
+ /** Returns the settings activity. */
+ public @Nullable String getSettingsActivity() {
+ // This logic is not used by the top entry but rather what activity should
+ // be launched from the settings screen.
+ for (CredentialProviderInfo cpi : mCredentialProviderInfos) {
+ final CharSequence settingsActivity = cpi.getSettingsActivity();
+ if (!TextUtils.isEmpty(settingsActivity)) {
+ return String.valueOf(settingsActivity);
+ }
+ }
+
+ if (mAutofillServiceInfo != null) {
+ final String settingsActivity = mAutofillServiceInfo.getSettingsActivity();
+ if (!TextUtils.isEmpty(settingsActivity)) {
+ return settingsActivity;
+ }
+ }
+
+ return null;
+ }
+
/** Returns the app icon. */
@Nullable
public Drawable getAppIcon(@NonNull Context context, int userId) {
diff --git a/src/com/android/settings/applications/credentials/CredentialsPickerActivity.java b/src/com/android/settings/applications/credentials/CredentialsPickerActivity.java
new file mode 100644
index 0000000..495c104
--- /dev/null
+++ b/src/com/android/settings/applications/credentials/CredentialsPickerActivity.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2023 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.applications.credentials;
+
+
+import com.android.settings.SettingsActivity;
+
+/** Standalone activity used to launch a {@link DefaultCombinedPicker} fragment. */
+public class CredentialsPickerActivity extends SettingsActivity {
+
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return super.isValidFragment(fragmentName)
+ || DefaultCombinedPicker.class.getName().equals(fragmentName);
+ }
+}
diff --git a/src/com/android/settings/applications/credentials/DefaultCombinedPreferenceController.java b/src/com/android/settings/applications/credentials/DefaultCombinedPreferenceController.java
index 59c33b2..47a89ec 100644
--- a/src/com/android/settings/applications/credentials/DefaultCombinedPreferenceController.java
+++ b/src/com/android/settings/applications/credentials/DefaultCombinedPreferenceController.java
@@ -16,11 +16,10 @@
package com.android.settings.applications.credentials;
+import android.annotation.Nullable;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.credentials.CredentialManager;
import android.credentials.CredentialProviderInfo;
@@ -29,16 +28,19 @@
import android.service.autofill.AutofillService;
import android.service.autofill.AutofillServiceInfo;
import android.text.TextUtils;
-import android.util.Log;
import android.view.autofill.AutofillManager;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
import com.android.settings.applications.defaultapps.DefaultAppPreferenceController;
import com.android.settingslib.applications.DefaultAppInfo;
import java.util.ArrayList;
import java.util.List;
-public class DefaultCombinedPreferenceController extends DefaultAppPreferenceController {
+public class DefaultCombinedPreferenceController extends DefaultAppPreferenceController
+ implements Preference.OnPreferenceClickListener {
private static final Intent AUTOFILL_PROBE = new Intent(AutofillService.SERVICE_INTERFACE);
private static final String TAG = "DefaultCombinedPreferenceController";
@@ -73,18 +75,55 @@
@Override
protected Intent getSettingIntent(DefaultAppInfo info) {
- if (info == null) {
- return null;
+ // Despite this method being called getSettingIntent this intent actually
+ // opens the primary picker. This is so that we can swap the cog and the left
+ // hand side presses to align the UX.
+ return new Intent(mContext, CredentialsPickerActivity.class);
+ }
+
+ @Override
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+
+ final String prefKey = getPreferenceKey();
+ final Preference preference = screen.findPreference(prefKey);
+ if (preference != null) {
+ preference.setOnPreferenceClickListener((Preference.OnPreferenceClickListener) this);
}
- final AutofillSettingIntentProvider intentProvider =
- new AutofillSettingIntentProvider(mContext, getUser(), info.getKey());
- return intentProvider.getIntent();
+ }
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ // Get the selected provider.
+ final CombinedProviderInfo topProvider = getTopProvider();
+ if (topProvider == null) {
+ return false;
+ }
+
+ // If the top provider has a defined Credential Manager settings
+ // provider then we should open that up.
+ final String settingsActivity = topProvider.getSettingsActivity();
+ if (!TextUtils.isEmpty(settingsActivity)) {
+ final Intent intent =
+ new Intent(Intent.ACTION_MAIN)
+ .setComponent(
+ new ComponentName(
+ topProvider.getPackageName(), settingsActivity));
+ startActivity(intent);
+ return true;
+ }
+
+ return false;
+ }
+
+ private @Nullable CombinedProviderInfo getTopProvider() {
+ List<CombinedProviderInfo> providers = getAllProviders(getUser());
+ return CombinedProviderInfo.getTopProvider(providers);
}
@Override
protected DefaultAppInfo getDefaultAppInfo() {
- List<CombinedProviderInfo> providers = getAllProviders(getUser());
- CombinedProviderInfo topProvider = CombinedProviderInfo.getTopProvider(providers);
+ CombinedProviderInfo topProvider = getTopProvider();
if (topProvider != null) {
ServiceInfo brandingService = topProvider.getBrandingService();
if (brandingService == null) {
@@ -138,53 +177,6 @@
return true;
}
- /** Provides Intent to setting activity for the specified autofill service. */
- static final class AutofillSettingIntentProvider {
-
- private final String mKey;
- private final Context mContext;
- private final int mUserId;
-
- public AutofillSettingIntentProvider(Context context, int userId, String key) {
- mKey = key;
- mContext = context;
- mUserId = userId;
- }
-
- public Intent getIntent() {
- final List<ResolveInfo> resolveInfos =
- mContext.getPackageManager()
- .queryIntentServicesAsUser(
- AUTOFILL_PROBE, PackageManager.GET_META_DATA, mUserId);
-
- for (ResolveInfo resolveInfo : resolveInfos) {
- final ServiceInfo serviceInfo = resolveInfo.serviceInfo;
-
- // If there are multiple autofill services then pick the first one.
- if (mKey != null && mKey.startsWith(serviceInfo.packageName)) {
- final String settingsActivity;
- try {
- settingsActivity =
- new AutofillServiceInfo(mContext, serviceInfo)
- .getSettingsActivity();
- } catch (SecurityException e) {
- // Service does not declare the proper permission, ignore it.
- Log.e(TAG, "Error getting info for " + serviceInfo + ": " + e);
- return null;
- }
- if (TextUtils.isEmpty(settingsActivity)) {
- return null;
- }
- return new Intent(Intent.ACTION_MAIN)
- .setComponent(
- new ComponentName(serviceInfo.packageName, settingsActivity));
- }
- }
-
- return null;
- }
- }
-
protected int getUser() {
return UserHandle.myUserId();
}
diff --git a/src/com/android/settings/applications/credentials/DefaultPrivateCombinedPreferenceController.kt b/src/com/android/settings/applications/credentials/DefaultPrivateCombinedPreferenceController.kt
index d606f3c..990e221 100644
--- a/src/com/android/settings/applications/credentials/DefaultPrivateCombinedPreferenceController.kt
+++ b/src/com/android/settings/applications/credentials/DefaultPrivateCombinedPreferenceController.kt
@@ -36,15 +36,6 @@
return "default_credman_autofill_private"
}
- override fun getSettingIntent(info: DefaultAppInfo ?): Intent ? {
- if (info == null) {
- return null
- }
- return userHandle?.let { handle ->
- AutofillSettingIntentProvider(mContext, handle.identifier, info.key).intent
- } ?: null
- }
-
override fun startActivity(intent: Intent) {
userHandle?.let { handle ->
mContext.startActivityAsUser(intent, handle)
diff --git a/src/com/android/settings/applications/credentials/DefaultWorkCombinedPreferenceController.java b/src/com/android/settings/applications/credentials/DefaultWorkCombinedPreferenceController.java
index eb0aa7a..f7ca204 100644
--- a/src/com/android/settings/applications/credentials/DefaultWorkCombinedPreferenceController.java
+++ b/src/com/android/settings/applications/credentials/DefaultWorkCombinedPreferenceController.java
@@ -21,7 +21,6 @@
import android.os.UserHandle;
import com.android.settings.Utils;
-import com.android.settingslib.applications.DefaultAppInfo;
public class DefaultWorkCombinedPreferenceController extends DefaultCombinedPreferenceController {
private final UserHandle mUserHandle;
@@ -45,17 +44,6 @@
}
@Override
- protected Intent getSettingIntent(DefaultAppInfo info) {
- if (info == null) {
- return null;
- }
- final AutofillSettingIntentProvider intentProvider =
- new AutofillSettingIntentProvider(
- mContext, mUserHandle.getIdentifier(), info.getKey());
- return intentProvider.getIntent();
- }
-
- @Override
protected void startActivity(Intent intent) {
mContext.startActivityAsUser(intent, mUserHandle);
}
diff --git a/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollHelper.java b/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollHelper.java
index 0bfb87d..d3bc977 100644
--- a/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollHelper.java
+++ b/src/com/android/settings/biometrics/fingerprint/UdfpsEnrollHelper.java
@@ -182,7 +182,7 @@
* Called when a fingerprint image has been acquired, but wasn't processed yet.
*/
public void onAcquired(boolean isAcquiredGood) {
- if (mListener != null && mTotalSteps != -1) {
+ if (mListener != null) {
mListener.onAcquired(isAcquiredGood && animateIfLastStep());
}
}
diff --git a/src/com/android/settings/dashboard/SummaryProvider.java b/src/com/android/settings/dashboard/SummaryProvider.java
deleted file mode 100644
index cd388b9..0000000
--- a/src/com/android/settings/dashboard/SummaryProvider.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2019 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.dashboard;
-
-import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY;
-
-import android.content.ContentProvider;
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Bundle;
-
-import com.android.settings.backup.BackupSettingsHelper;
-
-/** Provide preference summary for injected items. */
-public class SummaryProvider extends ContentProvider {
- private static final String BACKUP = "backup";
- private static final String USER = "user";
-
- @Override
- public Bundle call(String method, String uri, Bundle extras) {
- final Bundle bundle = new Bundle();
- switch (method) {
- case BACKUP:
- bundle.putString(META_DATA_PREFERENCE_SUMMARY,
- new BackupSettingsHelper(getContext()).getSummary());
- break;
- default:
- throw new IllegalArgumentException("Unknown Uri format: " + uri);
- }
- return bundle;
- }
-
- @Override
- public boolean onCreate() {
- return true;
- }
-
- @Override
- public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
- String sortOrder) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getType(Uri uri) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Uri insert(Uri uri, ContentValues values) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int delete(Uri uri, String selection, String[] selectionArgs) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java
index eaad7f3..4df1fdd 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java
@@ -27,7 +27,6 @@
import android.content.pm.UserInfo;
import android.content.pm.UserProperties;
import android.os.Bundle;
-import android.os.Flags;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
@@ -187,8 +186,7 @@
UserInfo userInfo = userManager.getUserInfo(userHandles.get(i).getIdentifier());
if (userInfo == null
|| userInfo.isCloneProfile()
- || (Flags.allowPrivateProfile()
- && shouldHideUserInQuietMode(userHandles.get(i), userManager))) {
+ || shouldHideUserInQuietMode(userHandles.get(i), userManager)) {
if (DEBUG) {
Log.d(TAG, "Delete the user: " + userHandles.get(i).getIdentifier());
}
@@ -221,8 +219,7 @@
UserInfo userInfo = userManager.getUserInfo(userHandle.getIdentifier());
if (userInfo == null
|| userInfo.isCloneProfile()
- || (Flags.allowPrivateProfile()
- && shouldHideUserInQuietMode(userHandle, userManager))) {
+ || shouldHideUserInQuietMode(userHandle, userManager)) {
if (DEBUG) {
Log.d(TAG, "Delete the user: " + userHandle.getIdentifier());
}
diff --git a/src/com/android/settings/development/DevelopmentAppPicker.java b/src/com/android/settings/development/DevelopmentAppPicker.java
new file mode 100644
index 0000000..7ef0869
--- /dev/null
+++ b/src/com/android/settings/development/DevelopmentAppPicker.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2023 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.development;
+
+import static android.app.Activity.RESULT_OK;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Process;
+import android.os.UserHandle;
+
+import com.android.settings.R;
+import com.android.settings.applications.defaultapps.DefaultAppPickerFragment;
+import com.android.settingslib.applications.DefaultAppInfo;
+
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+public class DevelopmentAppPicker extends DefaultAppPickerFragment {
+ public static final String EXTRA_REQUESTING_PERMISSION = "REQUESTING_PERMISSION";
+ public static final String EXTRA_DEBUGGABLE = "DEBUGGABLE";
+ public static final String EXTRA_SELECTING_APP = "SELECTING_APP";
+
+ private String mPermissionName;
+ private boolean mDebuggableOnly;
+ private String mSelectingApp;
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ Bundle arguments = getArguments();
+ if (arguments == null) {
+ return;
+ }
+ mPermissionName = arguments.getString(EXTRA_REQUESTING_PERMISSION);
+ mDebuggableOnly = arguments.getBoolean(EXTRA_DEBUGGABLE);
+ mSelectingApp = arguments.getString(EXTRA_SELECTING_APP);
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return SettingsEnums.DEVELOPMENT_APP_PICKER;
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.development_app_picker;
+ }
+
+ @Override
+ protected boolean shouldShowItemNone() {
+ return true;
+ }
+
+ @Override
+ protected List<DefaultAppInfo> getCandidates() {
+ List<DefaultAppInfo> packageInfoList = new ArrayList<DefaultAppInfo>();
+ Context context = getContext();
+ List<ApplicationInfo> installedApps = mPm.getInstalledApplications(0);
+ for (ApplicationInfo ai : installedApps) {
+ if (ai.uid == Process.SYSTEM_UID) {
+ continue;
+ }
+ // Filter out apps that are not debuggable if required.
+ if (mDebuggableOnly) {
+ // On a user build, we only allow debugging of apps that
+ // are marked as debuggable, otherwise (for platform development)
+ // we allow all apps.
+ if ((ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) == 0
+ && "user".equals(Build.TYPE)) {
+ continue;
+ }
+ }
+
+ // Filter out apps that do not request the permission if required.
+ if (mPermissionName != null) {
+ boolean requestsPermission = false;
+ try {
+ PackageInfo pi = mPm.getPackageInfo(ai.packageName,
+ PackageManager.GET_PERMISSIONS);
+ if (pi.requestedPermissions == null) {
+ continue;
+ }
+ for (String requestedPermission : pi.requestedPermissions) {
+ if (requestedPermission.equals(mPermissionName)) {
+ requestsPermission = true;
+ break;
+ }
+ }
+ if (!requestsPermission) {
+ continue;
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ continue;
+ }
+ }
+ DefaultAppInfo appInfo = new DefaultAppInfo(context, mPm, UserHandle.myUserId(), ai);
+ packageInfoList.add(appInfo);
+ }
+ Collections.sort(packageInfoList, sLabelComparator);
+ return packageInfoList;
+ }
+
+ @Override
+ protected String getDefaultKey() {
+ return mSelectingApp;
+ }
+
+ @Override
+ protected boolean setDefaultKey(String key) {
+ DefaultAppInfo appInfo = (DefaultAppInfo) getCandidate(key);
+ Intent intent = new Intent();
+ if (appInfo != null && appInfo.packageItemInfo != null) {
+ intent.setAction(appInfo.packageItemInfo.packageName);
+ }
+ setResult(RESULT_OK, intent);
+ finish();
+ return true;
+ }
+
+ private static final Comparator<DefaultAppInfo> sLabelComparator =
+ new Comparator<DefaultAppInfo>() {
+ public int compare(DefaultAppInfo a, DefaultAppInfo b) {
+ return Collator.getInstance().compare(a.loadLabel(), b.loadLabel());
+ }
+ };
+}
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 9c8c186..4c8b2dc 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -47,6 +47,7 @@
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.Toast;
import androidx.annotation.VisibleForTesting;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -230,6 +231,12 @@
getActivity().finish();
return;
}
+ Context context = requireContext();
+ if (!DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context)) {
+ Toast.makeText(context, R.string.dev_settings_disabled_warning, Toast.LENGTH_SHORT)
+ .show();
+ finish();
+ }
}
@Override
diff --git a/src/com/android/settings/development/DevelopmentSettingsDisabledActivity.java b/src/com/android/settings/development/DevelopmentSettingsDisabledActivity.java
deleted file mode 100644
index 9ea24da..0000000
--- a/src/com/android/settings/development/DevelopmentSettingsDisabledActivity.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2017 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.development;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.widget.Toast;
-
-import com.android.settings.R;
-
-public class DevelopmentSettingsDisabledActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Toast.makeText(this, R.string.dev_settings_disabled_warning, Toast.LENGTH_SHORT).show();
- finish();
- }
-}
diff --git a/src/com/android/settings/development/MockLocationAppPreferenceController.java b/src/com/android/settings/development/MockLocationAppPreferenceController.java
index b20ef02..d927c31 100644
--- a/src/com/android/settings/development/MockLocationAppPreferenceController.java
+++ b/src/com/android/settings/development/MockLocationAppPreferenceController.java
@@ -21,16 +21,20 @@
import android.Manifest;
import android.app.Activity;
import android.app.AppOpsManager;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.provider.Settings;
import android.text.TextUtils;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.core.SubSettingLauncher;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
import java.util.List;
@@ -64,10 +68,26 @@
if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
return false;
}
- final Intent intent = new Intent(mContext, AppPicker.class);
- intent.putExtra(AppPicker.EXTRA_REQUESTIING_PERMISSION,
- Manifest.permission.ACCESS_MOCK_LOCATION);
- mFragment.startActivityForResult(intent, REQUEST_MOCK_LOCATION_APP);
+ if (Flags.deprecateListActivity()) {
+ final Bundle args = new Bundle();
+ args.putString(DevelopmentAppPicker.EXTRA_REQUESTING_PERMISSION,
+ Manifest.permission.ACCESS_MOCK_LOCATION);
+ final String debugApp = Settings.Global.getString(
+ mContext.getContentResolver(), Settings.Global.DEBUG_APP);
+ args.putString(DevelopmentAppPicker.EXTRA_SELECTING_APP, debugApp);
+ new SubSettingLauncher(mContext)
+ .setDestination(DevelopmentAppPicker.class.getName())
+ .setSourceMetricsCategory(SettingsEnums.DEVELOPMENT)
+ .setArguments(args)
+ .setTitleRes(com.android.settingslib.R.string.select_application)
+ .setResultListener(mFragment, REQUEST_MOCK_LOCATION_APP)
+ .launch();
+ } else {
+ final Intent intent = new Intent(mContext, AppPicker.class);
+ intent.putExtra(AppPicker.EXTRA_REQUESTIING_PERMISSION,
+ Manifest.permission.ACCESS_MOCK_LOCATION);
+ mFragment.startActivityForResult(intent, REQUEST_MOCK_LOCATION_APP);
+ }
return true;
}
diff --git a/src/com/android/settings/development/SelectDebugAppPreferenceController.java b/src/com/android/settings/development/SelectDebugAppPreferenceController.java
index f0b0b27..d691149 100644
--- a/src/com/android/settings/development/SelectDebugAppPreferenceController.java
+++ b/src/com/android/settings/development/SelectDebugAppPreferenceController.java
@@ -19,16 +19,20 @@
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_DEBUG_APP;
import android.app.Activity;
+import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
+import android.os.Bundle;
import android.provider.Settings;
+import android.text.TextUtils;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.core.SubSettingLauncher;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
public class SelectDebugAppPreferenceController extends DeveloperOptionsPreferenceController
@@ -53,13 +57,29 @@
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
- if (DEBUG_APP_KEY.equals(preference.getKey())) {
+ if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
+ return false;
+ }
+
+ if (Flags.deprecateListActivity()) {
+ final Bundle args = new Bundle();
+ args.putBoolean(DevelopmentAppPicker.EXTRA_DEBUGGABLE, true /* value */);
+ final String debugApp = Settings.Global.getString(
+ mContext.getContentResolver(), Settings.Global.DEBUG_APP);
+ args.putString(DevelopmentAppPicker.EXTRA_SELECTING_APP, debugApp);
+ new SubSettingLauncher(mContext)
+ .setDestination(DevelopmentAppPicker.class.getName())
+ .setSourceMetricsCategory(SettingsEnums.DEVELOPMENT)
+ .setArguments(args)
+ .setTitleRes(com.android.settingslib.R.string.select_application)
+ .setResultListener(mFragment, REQUEST_CODE_DEBUG_APP)
+ .launch();
+ } else {
final Intent intent = getActivityStartIntent();
intent.putExtra(AppPicker.EXTRA_DEBUGGABLE, true /* value */);
mFragment.startActivityForResult(intent, REQUEST_CODE_DEBUG_APP);
- return true;
}
- return false;
+ return true;
}
@Override
diff --git a/src/com/android/settings/deviceinfo/batteryinfo/BatteryInfoFragment.java b/src/com/android/settings/deviceinfo/batteryinfo/BatteryInfoFragment.java
index 1731212..c017022 100644
--- a/src/com/android/settings/deviceinfo/batteryinfo/BatteryInfoFragment.java
+++ b/src/com/android/settings/deviceinfo/batteryinfo/BatteryInfoFragment.java
@@ -17,15 +17,15 @@
package com.android.settings.deviceinfo.batteryinfo;
import android.app.settings.SettingsEnums;
+import android.content.Context;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
-/**
- * A fragment that shows battery hardware information.
- */
+/** A fragment that shows battery hardware information. */
@SearchIndexable
public class BatteryInfoFragment extends DashboardFragment {
@@ -47,5 +47,12 @@
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider(R.xml.battery_info);
+ new BaseSearchIndexProvider(R.xml.battery_info) {
+ @Override
+ protected boolean isPageSearchEnabled(Context context) {
+ return FeatureFactory.getFeatureFactory()
+ .getBatterySettingsFeatureProvider()
+ .isBatteryInfoEnabled(context);
+ }
+ };
}
diff --git a/src/com/android/settings/display/ScreenTimeoutSettings.java b/src/com/android/settings/display/ScreenTimeoutSettings.java
index 43dd31c..f7be319 100644
--- a/src/com/android/settings/display/ScreenTimeoutSettings.java
+++ b/src/com/android/settings/display/ScreenTimeoutSettings.java
@@ -93,6 +93,9 @@
FooterPreference mDisableOptionsPreference;
@VisibleForTesting
+ FooterPreference mPowerConsumptionPreference;
+
+ @VisibleForTesting
AdaptiveSleepPermissionPreferenceController mAdaptiveSleepPermissionController;
@VisibleForTesting
@@ -216,6 +219,9 @@
if (mAdmin != null) {
setupDisabledFooterPreference();
screen.addPreference(mDisableOptionsPreference);
+ } else {
+ setupPowerConsumptionFooterPreference();
+ screen.addPreference(mPowerConsumptionPreference);
}
}
@@ -236,8 +242,20 @@
mDisableOptionsPreference.setIcon(R.drawable.ic_info_outline_24dp);
// The 'disabled by admin' preference should always be at the end of the setting page.
- mDisableOptionsPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
mPrivacyPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE - 1);
+ mDisableOptionsPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
+ }
+
+ @VisibleForTesting
+ void setupPowerConsumptionFooterPreference() {
+ mPowerConsumptionPreference = new FooterPreference(getContext());
+ mPowerConsumptionPreference.setTitle(R.string.power_consumption_footer_summary);
+ mPowerConsumptionPreference.setSelectable(false);
+ mPowerConsumptionPreference.setIcon(R.drawable.ic_info_outline_24dp);
+
+ // The 'Longer screen timeout' preference should always be at the end of the setting page.
+ mPrivacyPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE - 1);
+ mPowerConsumptionPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
}
@Override
diff --git a/src/com/android/settings/fuelgauge/BatterySettingsMigrateChecker.java b/src/com/android/settings/fuelgauge/BatterySettingsMigrateChecker.java
index dd49c8b..066e0fc 100644
--- a/src/com/android/settings/fuelgauge/BatterySettingsMigrateChecker.java
+++ b/src/com/android/settings/fuelgauge/BatterySettingsMigrateChecker.java
@@ -51,8 +51,7 @@
context = context.getApplicationContext();
verifySaverConfiguration(context);
verifyBatteryOptimizeModes(context);
- // Initialize and sync settings into SharedPreferences for migration.
- DynamicDenylistManager.getInstance(context);
+ DynamicDenylistManager.getInstance(context).onBootComplete();
}
/** Avoid users set important apps into the unexpected battery optimize modes */
diff --git a/src/com/android/settings/fuelgauge/datasaver/DynamicDenylistManager.java b/src/com/android/settings/fuelgauge/datasaver/DynamicDenylistManager.java
index 3ac9987..4a25238 100644
--- a/src/com/android/settings/fuelgauge/datasaver/DynamicDenylistManager.java
+++ b/src/com/android/settings/fuelgauge/datasaver/DynamicDenylistManager.java
@@ -139,16 +139,25 @@
return;
}
synchronized (mLock) {
- for (int uid : mNetworkPolicyManager
- .getUidsWithPolicy(POLICY_REJECT_METERED_BACKGROUND)) {
- if (!getDenylistAllUids(getManualDenylistPref()).contains(uid)) {
- mNetworkPolicyManager.setUidPolicy(uid, POLICY_NONE);
+ final int[] uids = mNetworkPolicyManager
+ .getUidsWithPolicy(POLICY_REJECT_METERED_BACKGROUND);
+ if (uids != null && uids.length != 0) {
+ for (int uid : uids) {
+ if (!getDenylistAllUids(getManualDenylistPref()).contains(uid)) {
+ mNetworkPolicyManager.setUidPolicy(uid, POLICY_NONE);
+ }
}
}
}
clearSharedPreferences();
}
+ /** Reset the POLICY_REJECT_METERED uids when device is boot completed. */
+ public void onBootComplete() {
+ resetDenylistIfNeeded(/* packageName= */ null, /* force= */ true);
+ syncPolicyIfNeeded();
+ }
+
/** Dump the data stored in the {@link SharedPreferences}. */
public void dump(PrintWriter writer) {
writer.println("Dump of DynamicDenylistManager:");
diff --git a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
index 0cda62d..ebafbaf 100644
--- a/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
+++ b/src/com/android/settings/homepage/contextualcards/ContextualCardLoader.java
@@ -18,7 +18,6 @@
import static com.android.settings.intelligence.ContextualCardProto.ContextualCard.Category.STICKY_VALUE;
import static com.android.settings.slices.CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI;
-import static com.android.settings.slices.CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI;
import android.app.settings.SettingsEnums;
import android.content.Context;
@@ -225,8 +224,7 @@
}
private boolean isLargeCard(ContextualCard card) {
- return card.getSliceUri().equals(CONTEXTUAL_WIFI_SLICE_URI)
- || card.getSliceUri().equals(BLUETOOTH_DEVICES_SLICE_URI);
+ return card.getSliceUri().equals(BLUETOOTH_DEVICES_SLICE_URI);
}
public interface CardContentLoaderListener {
diff --git a/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java b/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
index 81142c2..3e6659f 100644
--- a/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
+++ b/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProvider.java
@@ -32,12 +32,6 @@
@Override
@Nullable
public ContextualCardList getContextualCards() {
- final ContextualCard wifiCard =
- ContextualCard.newBuilder()
- .setSliceUri(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI.toString())
- .setCardName(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI.toString())
- .setCardCategory(ContextualCard.Category.IMPORTANT)
- .build();
final ContextualCard connectedDeviceCard =
ContextualCard.newBuilder()
.setSliceUri(CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI.toString())
@@ -71,7 +65,6 @@
.setCardCategory(ContextualCard.Category.IMPORTANT)
.build();
final ContextualCardList cards = ContextualCardList.newBuilder()
- .addCard(wifiCard)
.addCard(connectedDeviceCard)
.addCard(lowStorageCard)
.addCard(contextualAdaptiveSleepCard)
diff --git a/src/com/android/settings/network/InternetPreferenceController.java b/src/com/android/settings/network/InternetPreferenceController.java
index 71acd4b..1f5042f 100644
--- a/src/com/android/settings/network/InternetPreferenceController.java
+++ b/src/com/android/settings/network/InternetPreferenceController.java
@@ -43,6 +43,7 @@
import com.android.settings.widget.SummaryUpdater;
import com.android.settings.wifi.WifiPickerTrackerHelper;
import com.android.settings.wifi.WifiSummaryUpdater;
+import com.android.settings.wifi.repository.SharedConnectivityRepository;
import com.android.settingslib.Utils;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
@@ -77,6 +78,7 @@
private List<SubscriptionInfoEntity> mSubInfoEntityList = new ArrayList<>();
private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
private DefaultSubscriptionReceiver mDataSubscriptionChangedReceiver;
+ private boolean mIsHotspotNetworkEnabled = SharedConnectivityRepository.isDeviceConfigEnabled();
@VisibleForTesting
WifiPickerTrackerHelper mWifiPickerTrackerHelper;
@@ -111,7 +113,9 @@
mLifecycleOwner = lifecycleOwner;
mMobileNetworkRepository = MobileNetworkRepository.getInstance(context);
mDataSubscriptionChangedReceiver = new DefaultSubscriptionReceiver(context, this);
- mWifiPickerTrackerHelper = new WifiPickerTrackerHelper(lifecycle, context, this);
+ if (mIsHotspotNetworkEnabled) {
+ mWifiPickerTrackerHelper = new WifiPickerTrackerHelper(lifecycle, context, this);
+ }
lifecycle.addObserver(this);
}
@@ -162,6 +166,9 @@
@VisibleForTesting
boolean updateHotspotNetwork() {
+ if (mWifiPickerTrackerHelper == null) {
+ return false;
+ }
WifiEntry entry = mWifiPickerTrackerHelper.getWifiPickerTracker().getConnectedWifiEntry();
if (!(entry instanceof HotspotNetworkEntry)) {
return false;
diff --git a/src/com/android/settings/network/MobilePlanPreferenceController.java b/src/com/android/settings/network/MobilePlanPreferenceController.java
deleted file mode 100644
index fcca5e6..0000000
--- a/src/com/android/settings/network/MobilePlanPreferenceController.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2016 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 static android.content.Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT;
-import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-import static android.os.UserHandle.myUserId;
-import static android.os.UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS;
-
-import static com.android.settingslib.RestrictedLockUtilsInternal.hasBaseUserRestriction;
-
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.UserManager;
-import android.telephony.TelephonyManager;
-import android.text.TextUtils;
-import android.util.Log;
-
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.Utils;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnCreate;
-import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState;
-
-import java.util.List;
-
-public class MobilePlanPreferenceController extends AbstractPreferenceController
- implements PreferenceControllerMixin, LifecycleObserver, OnCreate, OnSaveInstanceState {
-
- public interface MobilePlanPreferenceHost {
- void showMobilePlanMessageDialog();
- }
-
- public static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1;
-
- private static final String TAG = "MobilePlanPrefContr";
- static final String KEY_MANAGE_MOBILE_PLAN = "manage_mobile_plan";
- private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage";
-
- private final UserManager mUserManager;
- private final boolean mIsSecondaryUser;
- private final MobilePlanPreferenceHost mHost;
-
- private ConnectivityManager mCm;
- private TelephonyManager mTm;
-
- private String mMobilePlanDialogMessage;
-
- public MobilePlanPreferenceController(Context context,
- MobilePlanPreferenceHost host) {
- super(context);
- mHost = host;
- mCm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- mTm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
- mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
- mIsSecondaryUser = !mUserManager.isAdminUser();
- }
-
- @Override
- public boolean handlePreferenceTreeClick(Preference preference) {
- if (mHost != null && KEY_MANAGE_MOBILE_PLAN.equals(preference.getKey())) {
- mMobilePlanDialogMessage = null;
- onManageMobilePlanClick();
- return true;
- }
- return false;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- if (savedInstanceState != null) {
- mMobilePlanDialogMessage = savedInstanceState.getString(SAVED_MANAGE_MOBILE_PLAN_MSG);
- }
- Log.d(TAG, "onCreate: mMobilePlanDialogMessage=" + mMobilePlanDialogMessage);
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) {
- if (!TextUtils.isEmpty(mMobilePlanDialogMessage)) {
- outState.putString(SAVED_MANAGE_MOBILE_PLAN_MSG, mMobilePlanDialogMessage);
- }
- }
-
- public String getMobilePlanDialogMessage() {
- return mMobilePlanDialogMessage;
- }
-
- public void setMobilePlanDialogMessage(String messasge) {
- mMobilePlanDialogMessage = messasge;
- }
-
- @Override
- public boolean isAvailable() {
- final boolean isPrefAllowedOnDevice = mContext.getResources().getBoolean(
- com.android.settings.R.bool.config_show_mobile_plan);
- final boolean isPrefAllowedForUser = !mIsSecondaryUser
- && !Utils.isWifiOnly(mContext)
- && !hasBaseUserRestriction(mContext, DISALLOW_CONFIG_MOBILE_NETWORKS, myUserId());
- return isPrefAllowedForUser && isPrefAllowedOnDevice;
- }
- @Override
- public String getPreferenceKey() {
- return KEY_MANAGE_MOBILE_PLAN;
- }
-
- private void onManageMobilePlanClick() {
- Resources resources = mContext.getResources();
- NetworkInfo ni = mCm.getActiveNetworkInfo();
- if (mTm.hasIccCard() && (ni != null)) {
- // Check for carrier apps that can handle provisioning first
- Intent provisioningIntent = new Intent(Intent.ACTION_CARRIER_SETUP);
- List<String> carrierPackages =
- mTm.getCarrierPackageNamesForIntent(provisioningIntent);
- if (carrierPackages != null && !carrierPackages.isEmpty()) {
- if (carrierPackages.size() != 1) {
- Log.w(TAG, "Multiple matching carrier apps found, launching the first.");
- }
- provisioningIntent.setPackage(carrierPackages.get(0));
- mContext.startActivity(provisioningIntent);
- return;
- }
-
- // Get provisioning URL
- String url = mTm.getMobileProvisioningUrl();
- if (!TextUtils.isEmpty(url)) {
- Intent intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
- Intent.CATEGORY_APP_BROWSER);
- intent.setData(Uri.parse(url));
- intent.setFlags(FLAG_ACTIVITY_BROUGHT_TO_FRONT | FLAG_ACTIVITY_NEW_TASK);
- try {
- mContext.startActivity(intent);
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "onManageMobilePlanClick: startActivity failed" + e);
- }
- } else {
- // No provisioning URL
- String operatorName = mTm.getSimOperatorName();
- if (TextUtils.isEmpty(operatorName)) {
- // Use NetworkOperatorName as second choice in case there is no
- // SPN (Service Provider Name on the SIM). Such as with T-mobile.
- operatorName = mTm.getNetworkOperatorName();
- if (TextUtils.isEmpty(operatorName)) {
- mMobilePlanDialogMessage =
- resources.getString(R.string.mobile_unknown_sim_operator);
- } else {
- mMobilePlanDialogMessage = resources.getString(
- R.string.mobile_no_provisioning_url, operatorName);
- }
- } else {
- mMobilePlanDialogMessage =
- resources.getString(R.string.mobile_no_provisioning_url, operatorName);
- }
- }
- } else if (mTm.hasIccCard() == false) {
- // No sim card
- mMobilePlanDialogMessage = resources.getString(R.string.mobile_insert_sim_card);
- } else {
- // NetworkInfo is null, there is no connection
- mMobilePlanDialogMessage = resources.getString(R.string.mobile_connect_to_internet);
- }
- if (!TextUtils.isEmpty(mMobilePlanDialogMessage)) {
- Log.d(TAG, "onManageMobilePlanClick: message=" + mMobilePlanDialogMessage);
- if (mHost != null) {
- mHost.showMobilePlanMessageDialog();
- } else {
- Log.d(TAG, "Missing host fragment, cannot show message dialog.");
- }
- }
- }
-}
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 4790c65..10fdc98 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -15,27 +15,19 @@
*/
package com.android.settings.network;
-import static com.android.settings.network.MobilePlanPreferenceController.MANAGE_MOBILE_PLAN_DIALOG_ID;
-
-import android.app.Dialog;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.util.Log;
-import androidx.appcompat.app.AlertDialog;
-import androidx.fragment.app.Fragment;
import androidx.lifecycle.LifecycleOwner;
import com.android.settings.R;
import com.android.settings.SettingsDumpService;
import com.android.settings.core.OnActivityResultListener;
import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.network.MobilePlanPreferenceController.MobilePlanPreferenceHost;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.search.SearchIndexable;
@@ -44,7 +36,7 @@
@SearchIndexable
public class NetworkDashboardFragment extends DashboardFragment implements
- MobilePlanPreferenceHost, OnActivityResultListener {
+ OnActivityResultListener {
private static final String TAG = "NetworkDashboardFrag";
@@ -84,15 +76,12 @@
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
- return buildPreferenceControllers(context, getSettingsLifecycle(), mMetricsFeatureProvider,
- this /* fragment */, this /* mobilePlanHost */, this /* LifecycleOwner */);
+ return buildPreferenceControllers(context, getSettingsLifecycle(),
+ this /* LifecycleOwner */);
}
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
- Lifecycle lifecycle, MetricsFeatureProvider metricsFeatureProvider, Fragment fragment,
- MobilePlanPreferenceHost mobilePlanHost, LifecycleOwner lifecycleOwner) {
- final MobilePlanPreferenceController mobilePlanPreferenceController =
- new MobilePlanPreferenceController(context, mobilePlanHost);
+ Lifecycle lifecycle, LifecycleOwner lifecycleOwner) {
final InternetPreferenceController internetPreferenceController =
new InternetPreferenceController(context, lifecycle, lifecycleOwner);
@@ -102,7 +91,6 @@
new PrivateDnsPreferenceController(context);
if (lifecycle != null) {
- lifecycle.addObserver(mobilePlanPreferenceController);
lifecycle.addObserver(vpnPreferenceController);
lifecycle.addObserver(privateDnsPreferenceController);
}
@@ -112,8 +100,6 @@
controllers.add(new MobileNetworkSummaryController(context, lifecycle, lifecycleOwner));
controllers.add(new TetherPreferenceController(context, lifecycle));
controllers.add(vpnPreferenceController);
- controllers.add(new ProxyPreferenceController(context));
- controllers.add(mobilePlanPreferenceController);
if (internetPreferenceController != null) {
controllers.add(internetPreferenceController);
}
@@ -126,36 +112,6 @@
return controllers;
}
- @Override
- public void showMobilePlanMessageDialog() {
- showDialog(MANAGE_MOBILE_PLAN_DIALOG_ID);
- }
-
- @Override
- public Dialog onCreateDialog(int dialogId) {
- Log.d(TAG, "onCreateDialog: dialogId=" + dialogId);
- switch (dialogId) {
- case MANAGE_MOBILE_PLAN_DIALOG_ID:
- final MobilePlanPreferenceController controller =
- use(MobilePlanPreferenceController.class);
- return new AlertDialog.Builder(getActivity())
- .setMessage(controller.getMobilePlanDialogMessage())
- .setCancelable(false)
- .setPositiveButton(com.android.internal.R.string.ok,
- (dialog, id) -> controller.setMobilePlanDialogMessage(null))
- .create();
- }
- return super.onCreateDialog(dialogId);
- }
-
- @Override
- public int getDialogMetricsCategory(int dialogId) {
- if (MANAGE_MOBILE_PLAN_DIALOG_ID == dialogId) {
- return SettingsEnums.DIALOG_MANAGE_MOBILE_PLAN;
- }
- return 0;
- }
-
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@@ -173,20 +129,7 @@
public List<AbstractPreferenceController> createPreferenceControllers(Context
context) {
return buildPreferenceControllers(context, null /* lifecycle */,
- null /* metricsFeatureProvider */, null /* fragment */,
- null /* mobilePlanHost */, null /* LifecycleOwner */);
- }
-
- @Override
- public List<String> getNonIndexableKeys(Context context) {
- final List<String> keys = super.getNonIndexableKeys(context);
-
- MobilePlanPreferenceController mppc =
- new MobilePlanPreferenceController(context, null);
- if (!mppc.isAvailable()) {
- keys.add(MobilePlanPreferenceController.KEY_MANAGE_MOBILE_PLAN);
- }
- return keys;
+ null /* LifecycleOwner */);
}
};
}
diff --git a/src/com/android/settings/network/ProxyPreferenceController.java b/src/com/android/settings/network/ProxyPreferenceController.java
deleted file mode 100644
index 8f26bfb..0000000
--- a/src/com/android/settings/network/ProxyPreferenceController.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2016 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.app.admin.DevicePolicyManager;
-import android.content.Context;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.core.AbstractPreferenceController;
-
-public class ProxyPreferenceController extends AbstractPreferenceController
- implements PreferenceControllerMixin {
-
- private static final String KEY_PROXY_SETTINGS = "proxy_settings";
-
- public ProxyPreferenceController(Context context) {
- super(context);
- }
-
- @Override
- public boolean isAvailable() {
- // proxy UI disabled until we have better app support
- return false;
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
- // Enable Proxy selector settings if allowed.
- final Preference pref = screen.findPreference(KEY_PROXY_SETTINGS);
- if (pref != null) {
- final DevicePolicyManager dpm = (DevicePolicyManager)
- mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
- pref.setEnabled(dpm.getGlobalProxyAdmin() == null);
- }
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_PROXY_SETTINGS;
- }
-}
diff --git a/src/com/android/settings/network/apn/ApnEditPageProvider.kt b/src/com/android/settings/network/apn/ApnEditPageProvider.kt
index 86d7456..5026958 100644
--- a/src/com/android/settings/network/apn/ApnEditPageProvider.kt
+++ b/src/com/android/settings/network/apn/ApnEditPageProvider.kt
@@ -39,6 +39,7 @@
import com.android.settings.network.apn.ApnNetworkTypes.getNetworkTypeSelectedOptionsState
import com.android.settingslib.spa.framework.common.SettingsPageProvider
import com.android.settingslib.spa.framework.compose.LocalNavController
+import com.android.settingslib.spa.framework.compose.OnBackEffect
import com.android.settingslib.spa.widget.editor.SettingsExposedDropdownMenuBox
import com.android.settingslib.spa.widget.editor.SettingsExposedDropdownMenuCheckBox
import com.android.settingslib.spa.widget.editor.SettingsOutlinedTextField
@@ -97,21 +98,20 @@
val networkTypeSelectedOptionsState = remember {
getNetworkTypeSelectedOptionsState(apnData.networkType)
}
+ OnBackEffect{
+ validateAndSaveApnData(
+ apnDataInit,
+ apnData,
+ context,
+ uriInit,
+ networkTypeSelectedOptionsState
+ )
+ }
+ val navController = LocalNavController.current
RegularScaffold(
title = if(apnDataInit.newApn) stringResource(id = R.string.apn_add) else stringResource(id = R.string.apn_edit),
- actions = {
- IconButton(onClick = {
- validateAndSaveApnData(
- apnDataInit,
- apnData,
- context,
- uriInit,
- networkTypeSelectedOptionsState
- )
- }) { Icon(imageVector = Icons.Outlined.Done, contentDescription = "Save APN") }
- }
) {
- Column() {
+ Column {
SettingsOutlinedTextField(
value = apnData.name,
label = stringResource(R.string.apn_name),
@@ -203,12 +203,12 @@
enabled = apnData.networkTypeEnabled
) {}
if (!apnData.newApn) {
- val navController = LocalNavController.current
Preference(
object : PreferenceModel {
override val title = stringResource(R.string.menu_delete)
override val onClick = {
deleteApn(uriInit, context)
+ apnData = apnData.copy(saveEnabled = false)
navController.navigateBack()
}
}
diff --git a/src/com/android/settings/network/apn/ApnStatus.kt b/src/com/android/settings/network/apn/ApnStatus.kt
index a479868..d81a8e3 100644
--- a/src/com/android/settings/network/apn/ApnStatus.kt
+++ b/src/com/android/settings/network/apn/ApnStatus.kt
@@ -69,6 +69,7 @@
val networkTypeEnabled: Boolean = true,
val newApn: Boolean = false,
val subId: Int = -1,
+ val saveEnabled: Boolean = true,
val customizedConfig: CustomizedConfig = CustomizedConfig()
) {
fun getContentValues(context: Context): ContentValues {
@@ -230,6 +231,10 @@
uriInit: Uri,
networkTypeSelectedOptionsState: SnapshotStateList<Int>
): Boolean {
+ // Can not be saved
+ if (!apnData.saveEnabled) {
+ return false
+ }
// Nothing to do if it's a read only APN
if (apnData.customizedConfig.readOnlyApn) {
return true
diff --git a/src/com/android/settings/privatespace/AutoAdvanceSetupFragment.java b/src/com/android/settings/privatespace/AutoAdvanceSetupFragment.java
index 1061498..036a13a 100644
--- a/src/com/android/settings/privatespace/AutoAdvanceSetupFragment.java
+++ b/src/com/android/settings/privatespace/AutoAdvanceSetupFragment.java
@@ -93,6 +93,13 @@
};
@Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ if (android.os.Flags.allowPrivateProfile()) {
+ super.onCreate(savedInstanceState);
+ }
+ }
+
+ @Override
public View onCreateView(
LayoutInflater inflater,
@Nullable ViewGroup container,
diff --git a/src/com/android/settings/privatespace/DeletePrivateSpaceController.java b/src/com/android/settings/privatespace/DeletePrivateSpaceController.java
index c94f63a..98bf827 100644
--- a/src/com/android/settings/privatespace/DeletePrivateSpaceController.java
+++ b/src/com/android/settings/privatespace/DeletePrivateSpaceController.java
@@ -53,7 +53,7 @@
@Override
public int getAvailabilityStatus() {
- return AVAILABLE;
+ return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/privatespace/HidePrivateSpaceController.java b/src/com/android/settings/privatespace/HidePrivateSpaceController.java
index 8a0f167..a53055c 100644
--- a/src/com/android/settings/privatespace/HidePrivateSpaceController.java
+++ b/src/com/android/settings/privatespace/HidePrivateSpaceController.java
@@ -38,7 +38,7 @@
@Override
@AvailabilityStatus
public int getAvailabilityStatus() {
- return AVAILABLE;
+ return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/privatespace/HidePrivateSpaceSettings.java b/src/com/android/settings/privatespace/HidePrivateSpaceSettings.java
index d7a9cf5..8c73364 100644
--- a/src/com/android/settings/privatespace/HidePrivateSpaceSettings.java
+++ b/src/com/android/settings/privatespace/HidePrivateSpaceSettings.java
@@ -17,6 +17,7 @@
package com.android.settings.privatespace;
import android.app.settings.SettingsEnums;
+import android.os.Bundle;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
@@ -25,6 +26,13 @@
private static final String TAG = "HidePrivateSpaceSettings";
@Override
+ public void onCreate(Bundle icicle) {
+ if (android.os.Flags.allowPrivateProfile()) {
+ super.onCreate(icicle);
+ }
+ }
+
+ @Override
public int getMetricsCategory() {
return SettingsEnums.PRIVATE_SPACE_SETTINGS;
}
diff --git a/src/com/android/settings/privatespace/HidePrivateSpaceSummaryController.java b/src/com/android/settings/privatespace/HidePrivateSpaceSummaryController.java
index 73b3960..42627af 100644
--- a/src/com/android/settings/privatespace/HidePrivateSpaceSummaryController.java
+++ b/src/com/android/settings/privatespace/HidePrivateSpaceSummaryController.java
@@ -36,7 +36,7 @@
@Override
public int getAvailabilityStatus() {
- return AVAILABLE;
+ return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java b/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java
index 0539f60..31d4be9 100644
--- a/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java
+++ b/src/com/android/settings/privatespace/PrivateProfileContextHelperActivity.java
@@ -52,6 +52,9 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
+ if (!android.os.Flags.allowPrivateProfile()) {
+ return;
+ }
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
ThemeHelper.trySetDynamicColor(this);
super.onCreate(savedInstanceState);
diff --git a/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java b/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java
index 3f212b1..1efd445 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceAuthenticationActivity.java
@@ -66,9 +66,8 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
if (Flags.allowPrivateProfile()) {
+ super.onCreate(savedInstanceState);
ThemeHelper.trySetDynamicColor(this);
mPrivateSpaceMaintainer = new Injector().injectPrivateSpaceMaintainer(
getApplicationContext());
@@ -87,7 +86,6 @@
promptToSetDeviceLock();
}
} else {
- Log.w(TAG, "allowPrivateProfile flag is Off!");
finish();
}
}
diff --git a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
index 5d00329..1e27ec1 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
@@ -17,6 +17,7 @@
package com.android.settings.privatespace;
import android.app.settings.SettingsEnums;
+import android.os.Bundle;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
@@ -26,6 +27,13 @@
private static final String TAG = "PrivateSpaceDashboardFragment";
@Override
+ public void onCreate(Bundle icicle) {
+ if (android.os.Flags.allowPrivateProfile()) {
+ super.onCreate(icicle);
+ }
+ }
+
+ @Override
protected int getPreferenceScreenResId() {
return R.xml.private_space_settings;
}
diff --git a/src/com/android/settings/privatespace/PrivateSpaceEducation.java b/src/com/android/settings/privatespace/PrivateSpaceEducation.java
index 5dd0cfa..0c87b2b 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceEducation.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceEducation.java
@@ -39,6 +39,9 @@
LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
+ if (!android.os.Flags.allowPrivateProfile()) {
+ return null;
+ }
GlifLayout rootView =
(GlifLayout)
inflater.inflate(R.layout.privatespace_education_screen, container, false);
diff --git a/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java b/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java
index 341110b..3ec7c92 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceMaintainer.java
@@ -25,6 +25,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.pm.UserInfo;
+import android.os.Flags;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
@@ -68,6 +69,9 @@
* <p> This method should be used by the Private Space Setup Flow ONLY.
*/
final synchronized boolean createPrivateSpace() {
+ if (!Flags.allowPrivateProfile()) {
+ return false;
+ }
// Check if Private space already exists
if (doesPrivateSpaceExist()) {
return true;
@@ -130,6 +134,9 @@
/** Returns true if the Private space exists. */
public synchronized boolean doesPrivateSpaceExist() {
+ if (!Flags.allowPrivateProfile()) {
+ return false;
+ }
if (mUserHandle != null) {
return true;
}
diff --git a/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java b/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java
index 93dc43b..dd60dc4 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceSetLockFragment.java
@@ -47,6 +47,9 @@
LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
+ if (!android.os.Flags.allowPrivateProfile()) {
+ return null;
+ }
GlifLayout rootView =
(GlifLayout) inflater.inflate(
R.layout.privatespace_setlock_screen, container, false);
diff --git a/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java b/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java
index a5628c8..4eb61e5 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceSetupActivity.java
@@ -36,6 +36,9 @@
private NavHostFragment mNavHostFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
+ if (!android.os.Flags.allowPrivateProfile()) {
+ return;
+ }
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
ThemeHelper.trySetDynamicColor(this);
super.onCreate(savedInstanceState);
diff --git a/src/com/android/settings/privatespace/SetupSuccessFragment.java b/src/com/android/settings/privatespace/SetupSuccessFragment.java
index 1868f65..f6796be 100644
--- a/src/com/android/settings/privatespace/SetupSuccessFragment.java
+++ b/src/com/android/settings/privatespace/SetupSuccessFragment.java
@@ -45,6 +45,9 @@
LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
+ if (!android.os.Flags.allowPrivateProfile()) {
+ return null;
+ }
GlifLayout rootView =
(GlifLayout)
inflater.inflate(R.layout.privatespace_setup_success, container, false);
diff --git a/src/com/android/settings/privatespace/onelock/FaceFingerprintUnlockController.java b/src/com/android/settings/privatespace/onelock/FaceFingerprintUnlockController.java
index e976261..e130e4d 100644
--- a/src/com/android/settings/privatespace/onelock/FaceFingerprintUnlockController.java
+++ b/src/com/android/settings/privatespace/onelock/FaceFingerprintUnlockController.java
@@ -35,7 +35,7 @@
@Override
public boolean isAvailable() {
- return false;
+ return android.os.Flags.allowPrivateProfile();
}
@Override
diff --git a/src/com/android/settings/privatespace/onelock/PrivateSpaceLockController.java b/src/com/android/settings/privatespace/onelock/PrivateSpaceLockController.java
index 2783c1c..20298a1 100644
--- a/src/com/android/settings/privatespace/onelock/PrivateSpaceLockController.java
+++ b/src/com/android/settings/privatespace/onelock/PrivateSpaceLockController.java
@@ -73,7 +73,7 @@
@Override
public boolean isAvailable() {
- return true;
+ return android.os.Flags.allowPrivateProfile();
}
@Override
diff --git a/src/com/android/settings/privatespace/onelock/UseOneLockController.java b/src/com/android/settings/privatespace/onelock/UseOneLockController.java
index 5c461e0..31634b9 100644
--- a/src/com/android/settings/privatespace/onelock/UseOneLockController.java
+++ b/src/com/android/settings/privatespace/onelock/UseOneLockController.java
@@ -45,7 +45,7 @@
}
@Override
public int getAvailabilityStatus() {
- return AVAILABLE;
+ return android.os.Flags.allowPrivateProfile() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
diff --git a/src/com/android/settings/privatespace/onelock/UseOneLockControllerSwitch.java b/src/com/android/settings/privatespace/onelock/UseOneLockControllerSwitch.java
index 218b870..04101b2 100644
--- a/src/com/android/settings/privatespace/onelock/UseOneLockControllerSwitch.java
+++ b/src/com/android/settings/privatespace/onelock/UseOneLockControllerSwitch.java
@@ -94,7 +94,7 @@
@Override
public boolean isAvailable() {
- return true;
+ return android.os.Flags.allowPrivateProfile();
}
@Override
diff --git a/src/com/android/settings/privatespace/onelock/UseOneLockSettingsFragment.java b/src/com/android/settings/privatespace/onelock/UseOneLockSettingsFragment.java
index 36f8448..459116a 100644
--- a/src/com/android/settings/privatespace/onelock/UseOneLockSettingsFragment.java
+++ b/src/com/android/settings/privatespace/onelock/UseOneLockSettingsFragment.java
@@ -19,6 +19,7 @@
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
+import android.os.Bundle;
import androidx.annotation.Nullable;
@@ -35,6 +36,13 @@
public static final int UNUNIFY_PRIVATE_LOCK_FROM_DEVICE_REQUEST = 2;
@Override
+ public void onCreate(Bundle icicle) {
+ if (android.os.Flags.allowPrivateProfile()) {
+ super.onCreate(icicle);
+ }
+ }
+
+ @Override
public int getMetricsCategory() {
return SettingsEnums.PRIVATE_SPACE_SETTINGS;
}
diff --git a/src/com/android/settings/slices/CustomSliceRegistry.java b/src/com/android/settings/slices/CustomSliceRegistry.java
index 08d2be6..8f30106 100644
--- a/src/com/android/settings/slices/CustomSliceRegistry.java
+++ b/src/com/android/settings/slices/CustomSliceRegistry.java
@@ -41,7 +41,6 @@
import com.android.settings.network.telephony.MobileDataSlice;
import com.android.settings.notification.zen.ZenModeButtonPreferenceController;
import com.android.settings.wifi.calling.WifiCallingSliceHelper;
-import com.android.settings.wifi.slice.ContextualWifiSlice;
import com.android.settings.wifi.slice.WifiSlice;
import com.android.settingslib.media.MediaOutputConstants;
@@ -83,15 +82,6 @@
.build();
/**
- * Backing Uri for the Wifi Slice.
- */
- public static final Uri CONTEXTUAL_WIFI_SLICE_URI = new Uri.Builder()
- .scheme(ContentResolver.SCHEME_CONTENT)
- .authority(SettingsSlicesContract.AUTHORITY)
- .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
- .appendPath("contextual_wifi")
- .build();
- /**
* Slice Uri for Enhanced 4G slice
*/
public static final Uri ENHANCED_4G_SLICE_URI = new Uri.Builder()
@@ -321,7 +311,6 @@
// Slices for contextual card.
sUriToSlice.put(FACE_ENROLL_SLICE_URI, FaceSetupSlice.class);
sUriToSlice.put(CONTEXTUAL_ADAPTIVE_SLEEP_URI, ContextualAdaptiveSleepSlice.class);
- sUriToSlice.put(CONTEXTUAL_WIFI_SLICE_URI, ContextualWifiSlice.class);
sUriToSlice.put(LOW_STORAGE_SLICE_URI, LowStorageSlice.class);
sUriToSlice.put(BLUETOOTH_DEVICES_SLICE_URI, BluetoothDevicesSlice.class);
}
diff --git a/src/com/android/settings/system/DeveloperOptionsController.kt b/src/com/android/settings/system/DeveloperOptionsController.kt
new file mode 100644
index 0000000..fe7fb4d
--- /dev/null
+++ b/src/com/android/settings/system/DeveloperOptionsController.kt
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2023 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.system
+
+import android.app.settings.SettingsEnums
+import android.content.Context
+import android.os.Build
+import android.os.UserManager
+import android.provider.Settings
+import androidx.annotation.VisibleForTesting
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.res.vectorResource
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
+import com.android.settings.R
+import com.android.settings.core.SubSettingLauncher
+import com.android.settings.development.DevelopmentSettingsDashboardFragment
+import com.android.settings.spa.preference.ComposePreferenceController
+import com.android.settingslib.spa.widget.preference.PreferenceModel
+import com.android.settingslib.spa.widget.ui.SettingsIcon
+import com.android.settingslib.spaprivileged.model.enterprise.Restrictions
+import com.android.settingslib.spaprivileged.settingsprovider.settingsGlobalBooleanFlow
+import com.android.settingslib.spaprivileged.template.preference.RestrictedPreference
+
+class DeveloperOptionsController(context: Context, preferenceKey: String) :
+ ComposePreferenceController(context, preferenceKey) {
+
+ override fun getAvailabilityStatus() = AVAILABLE
+
+ private val isDevelopmentSettingsEnabledFlow = context.settingsGlobalBooleanFlow(
+ name = Settings.Global.DEVELOPMENT_SETTINGS_ENABLED,
+ defaultValue = Build.IS_ENG,
+ )
+
+ @Composable
+ override fun Content() {
+ val isDevelopmentSettingsEnabled by isDevelopmentSettingsEnabledFlow
+ .collectAsStateWithLifecycle(initialValue = false)
+ if (isDevelopmentSettingsEnabled) {
+ DeveloperOptionsPreference()
+ }
+ }
+
+ @VisibleForTesting
+ @Composable
+ fun DeveloperOptionsPreference() {
+ RestrictedPreference(
+ model = object : PreferenceModel {
+ override val title =
+ stringResource(com.android.settingslib.R.string.development_settings_title)
+ override val icon = @Composable {
+ SettingsIcon(ImageVector.vectorResource(R.drawable.ic_settings_development))
+ }
+ override val onClick = {
+ SubSettingLauncher(mContext).apply {
+ setDestination(DevelopmentSettingsDashboardFragment::class.qualifiedName)
+ setSourceMetricsCategory(SettingsEnums.SETTINGS_SYSTEM_CATEGORY)
+ }.launch()
+ }
+ },
+ restrictions = Restrictions(keys = listOf(UserManager.DISALLOW_DEBUGGING_FEATURES)),
+ )
+ }
+}
diff --git a/src/com/android/settings/system/FactoryResetPreferenceController.java b/src/com/android/settings/system/FactoryResetPreferenceController.java
index 739a0a7..e62e548 100644
--- a/src/com/android/settings/system/FactoryResetPreferenceController.java
+++ b/src/com/android/settings/system/FactoryResetPreferenceController.java
@@ -15,6 +15,7 @@
*/
package com.android.settings.system;
+import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
@@ -38,9 +39,6 @@
private static final String ACTION_PREPARE_FACTORY_RESET =
"com.android.settings.ACTION_PREPARE_FACTORY_RESET";
- private static final String PREPARE_FACTORY_RESET_PERMISSION =
- "com.android.settings.permissions.PREPARE_FACTORY_RESET";
-
private final UserManager mUm;
private ActivityResultLauncher<Intent> mFactoryResetPreparationLauncher;
@@ -103,7 +101,7 @@
boolean isGranted =
(factoryResetWizardPackageInfo.requestedPermissionsFlags[i]
& PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0;
- if (permission.equals(PREPARE_FACTORY_RESET_PERMISSION) && isGranted) {
+ if (permission.equals(Manifest.permission.PREPARE_FACTORY_RESET) && isGranted) {
return prepareFactoryResetWizardRequest;
}
}
diff --git a/src/com/android/settings/wifi/slice/ContextualWifiScanWorker.java b/src/com/android/settings/wifi/slice/ContextualWifiScanWorker.java
deleted file mode 100644
index ae45251..0000000
--- a/src/com/android/settings/wifi/slice/ContextualWifiScanWorker.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2019 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.wifi.slice;
-
-import android.content.Context;
-import android.net.Uri;
-
-/**
- * {@link SliceBackgroundWorker} for Wi-Fi, used by {@link ContextualWifiSlice}.
- */
-public class ContextualWifiScanWorker extends WifiScanWorker {
-
- public ContextualWifiScanWorker(Context context, Uri uri) {
- super(context, uri);
- }
-
- @Override
- protected int getApRowCount() {
- return ContextualWifiSlice.getApRowCount();
- }
-}
diff --git a/src/com/android/settings/wifi/slice/ContextualWifiSlice.java b/src/com/android/settings/wifi/slice/ContextualWifiSlice.java
deleted file mode 100644
index 6b83f74..0000000
--- a/src/com/android/settings/wifi/slice/ContextualWifiSlice.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2018 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.wifi.slice;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.net.ConnectivityManager;
-import android.net.NetworkCapabilities;
-import android.net.Uri;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
-import android.text.TextUtils;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.core.graphics.drawable.IconCompat;
-import androidx.slice.Slice;
-import androidx.slice.builders.ListBuilder;
-
-import com.android.settings.R;
-import com.android.settings.Utils;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.slices.CustomSliceRegistry;
-import com.android.settings.slices.CustomSliceable;
-import com.android.wifitrackerlib.WifiEntry;
-
-/**
- * {@link CustomSliceable} for Wi-Fi, used by contextual homepage.
- */
-public class ContextualWifiSlice extends WifiSlice {
-
- @VisibleForTesting
- static final int COLLAPSED_ROW_COUNT = 0;
-
- @VisibleForTesting
- static long sActiveUiSession = -1000;
- @VisibleForTesting
- static boolean sApRowCollapsed;
-
- private final ConnectivityManager mConnectivityManager;
-
- public ContextualWifiSlice(Context context) {
- super(context);
-
- mConnectivityManager = mContext.getSystemService(ConnectivityManager.class);
- }
-
- @Override
- public Uri getUri() {
- return CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI;
- }
-
- @Override
- public Slice getSlice() {
- final long currentUiSession = FeatureFactory.getFeatureFactory()
- .getSlicesFeatureProvider().getUiSessionToken();
- if (currentUiSession != sActiveUiSession) {
- sActiveUiSession = currentUiSession;
- sApRowCollapsed = hasWorkingNetwork();
- } else if (!mWifiManager.isWifiEnabled()) {
- sApRowCollapsed = false;
- }
- return super.getSlice();
- }
-
- static int getApRowCount() {
- return sApRowCollapsed ? COLLAPSED_ROW_COUNT : DEFAULT_EXPANDED_ROW_COUNT;
- }
-
- @Override
- protected boolean isApRowCollapsed() {
- return sApRowCollapsed;
- }
-
- @Override
- protected ListBuilder.RowBuilder getHeaderRow(boolean isWifiEnabled,
- WifiSliceItem wifiSliceItem) {
- final ListBuilder.RowBuilder builder = super.getHeaderRow(isWifiEnabled, wifiSliceItem);
- builder.setTitleItem(getHeaderIcon(isWifiEnabled, wifiSliceItem), ListBuilder.ICON_IMAGE);
- if (sApRowCollapsed) {
- builder.setSubtitle(getHeaderSubtitle(wifiSliceItem));
- }
- return builder;
- }
-
- private IconCompat getHeaderIcon(boolean isWifiEnabled, WifiSliceItem wifiSliceItem) {
- final Drawable drawable;
- final int tint;
- if (!isWifiEnabled) {
- drawable = mContext.getDrawable(R.drawable.ic_wifi_off);
- tint = Utils.getDisabled(mContext, Utils.getColorAttrDefaultColor(mContext,
- android.R.attr.colorControlNormal));
- } else {
- // get icon of medium signal strength
- drawable = mContext.getDrawable(com.android.settingslib.Utils.getWifiIconResource(2));
- if (wifiSliceItem != null
- && wifiSliceItem.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED) {
- tint = Utils.getColorAccentDefaultColor(mContext);
- } else {
- tint = Utils.getColorAttrDefaultColor(mContext, android.R.attr.colorControlNormal);
- }
- }
- drawable.setTint(tint);
- return Utils.createIconWithDrawable(drawable);
- }
-
- private CharSequence getHeaderSubtitle(WifiSliceItem wifiSliceItem) {
- if (wifiSliceItem == null
- || wifiSliceItem.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED) {
- return mContext.getText(R.string.disconnected);
- }
- if (wifiSliceItem.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTING) {
- return mContext.getString(R.string.wifi_connecting_to_message,
- wifiSliceItem.getTitle());
- }
- return mContext.getString(R.string.wifi_connected_to_message, wifiSliceItem.getTitle());
- }
-
- private boolean hasWorkingNetwork() {
- return !TextUtils.equals(getActiveSSID(), WifiManager.UNKNOWN_SSID) && hasInternetAccess();
- }
-
- private String getActiveSSID() {
- if (mWifiManager.getWifiState() != WifiManager.WIFI_STATE_ENABLED) {
- return WifiManager.UNKNOWN_SSID;
- }
- return WifiInfo.sanitizeSsid(mWifiManager.getConnectionInfo().getSSID());
- }
-
- private boolean hasInternetAccess() {
- final NetworkCapabilities nc = mConnectivityManager.getNetworkCapabilities(
- mWifiManager.getCurrentNetwork());
- return nc != null
- && !nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_CAPTIVE_PORTAL)
- && !nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_PARTIAL_CONNECTIVITY)
- && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED);
- }
-
- @Override
- public Class getBackgroundWorkerClass() {
- return ContextualWifiScanWorker.class;
- }
-}
diff --git a/tests/robotests/src/com/android/settings/MainClearTest.java b/tests/robotests/src/com/android/settings/MainClearTest.java
index dc17dda..e84d4eb 100644
--- a/tests/robotests/src/com/android/settings/MainClearTest.java
+++ b/tests/robotests/src/com/android/settings/MainClearTest.java
@@ -56,6 +56,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -233,6 +234,7 @@
assertThat(mMainClear.showWipeEuicc()).isTrue();
}
+ @Ignore("b/313566998")
@Test
public void testShowWipeEuicc_developerMode_unprovisioned() {
prepareEuiccState(
diff --git a/tests/robotests/src/com/android/settings/accounts/ManagedProfileQuietModeEnablerTest.java b/tests/robotests/src/com/android/settings/accounts/ManagedProfileQuietModeEnablerTest.java
index 305b03a..c003de2 100644
--- a/tests/robotests/src/com/android/settings/accounts/ManagedProfileQuietModeEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/ManagedProfileQuietModeEnablerTest.java
@@ -42,6 +42,7 @@
import androidx.test.core.app.ApplicationProvider;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -111,6 +112,7 @@
verify(mUserManager).requestQuietModeEnabled(mEnable, mManagedUser);
}
+ @Ignore("b/313573729")
@Test
@RequiresFlagsEnabled(Flags.FLAG_QUIET_MODE_CREDENTIAL_BUG_FIX)
public void onSetQuietMode_ifQuietModeAlreadyInDesiredState_shouldNotRequestQuietModeEnabled() {
diff --git a/tests/robotests/src/com/android/settings/applications/AppDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/applications/AppDashboardFragmentTest.java
index 5137516..5e58f15 100644
--- a/tests/robotests/src/com/android/settings/applications/AppDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppDashboardFragmentTest.java
@@ -38,6 +38,7 @@
import com.android.settingslib.drawer.CategoryKey;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -80,6 +81,7 @@
assertThat(preferenceScreenKeys).containsAtLeastElementsIn(preferenceKeys);
}
+ @Ignore("b/313578776")
@Test
@Config(shadows = ShadowUserManager.class)
public void testAdvancedAppsCategory() {
diff --git a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
index 8740662..d27601e 100644
--- a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
@@ -40,6 +40,7 @@
import android.os.UserManager;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -157,11 +158,13 @@
mDevicePolicyManager, mPackageManager, mPackageManagerService, mApp5)).isFalse();
}
+ @Ignore("b/313578776")
@Test
public void testCountInstalledAppsSync() throws Exception {
verifyCountInstalledApps(false /* async */);
}
+ @Ignore("b/313578776")
@Test
public void testCountInstalledAppsAync() throws Exception {
verifyCountInstalledApps(true /* async */);
diff --git a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
index 4eb623d..6bed1bc 100644
--- a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
@@ -43,6 +43,7 @@
import com.android.settingslib.testutils.shadow.ShadowSmsApplication;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -140,11 +141,13 @@
assertThat(mAppList.get(0).appInfo.packageName).isEqualTo(APP_2);
}
+ @Ignore("b/313578776")
@Test
public void testCalculateNumberOfInstalledAppsSync() {
verifyCalculateNumberOfPolicyInstalledApps(false /* async */);
}
+ @Ignore("b/313578776")
@Test
public void testCalculateNumberOfInstalledAppsAsync() {
verifyCalculateNumberOfPolicyInstalledApps(true /* async */);
@@ -176,11 +179,13 @@
assertThat(mAppCount).isEqualTo(2);
}
+ @Ignore("b/313578776")
@Test
public void testCalculateNumberOfAppsWithAdminGrantedPermissionsSync() throws Exception {
verifyCalculateNumberOfAppsWithAdminGrantedPermissions(false /* async */);
}
+ @Ignore("b/313578776")
@Test
public void testCalculateNumberOfAppsWithAdminGrantedPermissionsAsync() throws Exception {
verifyCalculateNumberOfAppsWithAdminGrantedPermissions(true /* async */);
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/AppMemoryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/AppMemoryPreferenceControllerTest.java
index cc789c6..8e1fd3d 100644
--- a/tests/robotests/src/com/android/settings/applications/appinfo/AppMemoryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/AppMemoryPreferenceControllerTest.java
@@ -37,6 +37,7 @@
import com.android.settings.testutils.shadow.ShadowUserManager;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -79,6 +80,7 @@
when(mFragment.getActivity()).thenReturn(mActivity);
}
+ @Ignore("b/313582035")
@Test
@Config(qualifiers = "mcc999")
public void getAvailabilityStatus_developmentSettingsEnabled_shouldReturnAvailable() {
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index d3ae4e3..196f206 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -63,6 +63,7 @@
import com.android.settingslib.testutils.shadow.ShadowInteractionJankMonitor;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -313,6 +314,7 @@
verify(adapter).filterSearch(query);
}
+ @Ignore("b/313583754")
@Test
public void notifyItemChange_recyclerViewIdle_shouldNotify() {
final RecyclerView recyclerView = mock(RecyclerView.class);
@@ -327,6 +329,7 @@
verify(adapter).notifyItemChanged(0);
}
+ @Ignore("b/313583754")
@Test
public void notifyItemChange_recyclerViewScrolling_shouldNotifyWhenIdle() {
final RecyclerView recyclerView = mock(RecyclerView.class);
@@ -423,6 +426,7 @@
assertThat(adapter.getItemCount()).isEqualTo(5);
}
+ @Ignore("b/313583754")
@Test
public void applicationsAdapter_filterSearch_noMatch_shouldShowEmptyList() {
final ManageApplications.ApplicationsAdapter adapter =
diff --git a/tests/robotests/src/com/android/settings/biometrics/BiometricSettingsProviderTest.kt b/tests/robotests/src/com/android/settings/biometrics/BiometricSettingsProviderTest.kt
index edb1230..cdad338 100644
--- a/tests/robotests/src/com/android/settings/biometrics/BiometricSettingsProviderTest.kt
+++ b/tests/robotests/src/com/android/settings/biometrics/BiometricSettingsProviderTest.kt
@@ -26,6 +26,7 @@
import com.android.settings.flags.Flags
import com.google.common.truth.Truth.assertThat
import org.junit.Before
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -73,6 +74,7 @@
provider.update(Uri.EMPTY, null, null, null)
}
+ @Ignore("b/313342682")
@Test
@RequiresFlagsEnabled(Flags.FLAG_BIOMETRIC_SETTINGS_PROVIDER)
fun getSuggestionState_shouldQueryFeatureProvider() {
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsFragmentTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsFragmentTest.java
index 8b70550..5e90e55 100644
--- a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsFragmentTest.java
@@ -72,6 +72,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -201,6 +202,7 @@
assertThat(mFingerprintAuthenticateSidecar.isCancelled()).isTrue();
}
+ @Ignore("b/313342682")
@Test
public void testGuestUserRequireScreenOnToAuth() {
Settings.Secure.putIntForUser(
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
index 2c9fb99..49777bc 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
@@ -59,6 +59,7 @@
import java.util.HashSet;
import java.util.Set;
+@Ignore("b/313014781")
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {ShadowEntityHeaderController.class, ShadowDeviceConfig.class})
public class AdvancedBluetoothDetailsHeaderControllerTest {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
index 8ac56dc..1904cb5 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
@@ -50,6 +50,7 @@
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -62,6 +63,7 @@
import org.robolectric.annotation.Config;
import org.robolectric.fakes.RoboMenu;
+@Ignore("b/313014781")
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {
com.android.settings.testutils.shadow.ShadowUserManager.class,
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPermissionActivityTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPermissionActivityTest.java
index 6f02753..4c58cd2 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPermissionActivityTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPermissionActivityTest.java
@@ -24,6 +24,7 @@
import android.content.Intent;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -32,6 +33,7 @@
import org.robolectric.RuntimeEnvironment;
import org.robolectric.util.ReflectionHelpers;
+@Ignore("b/313014781")
@RunWith(RobolectricTestRunner.class)
public class BluetoothPermissionActivityTest {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceControllerTest.java
index 50c82d3..88ace91 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSwitchPreferenceControllerTest.java
@@ -33,6 +33,7 @@
import com.android.settingslib.widget.FooterPreference;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -82,6 +83,7 @@
assertThat(TextUtils.equals(mFooterPreference.getTitle(), text)).isTrue();
}
+ @Ignore("b/313014781")
@Test
public void updateText_bluetoothOffScanningOff() {
Settings.Global.putInt(mContext.getContentResolver(),
@@ -91,6 +93,7 @@
assertThat(mFooterPreference.getTitle()).isEqualTo(BLUETOOTH_INFO_STRING);
}
+ @Ignore("b/313014781")
@Test
public void updateText_bluetoothOnScanningOff() {
Settings.Global.putInt(mContext.getContentResolver(),
@@ -100,6 +103,7 @@
assertThat(mFooterPreference.getTitle()).isEqualTo(BLUETOOTH_INFO_STRING);
}
+ @Ignore("b/313014781")
@Test
public void updateText_bluetoothOnScanningOn() {
Settings.Global.putInt(mContext.getContentResolver(),
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java
index 1d1f2f8..a3348ca 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java
@@ -25,17 +25,23 @@
import android.content.Context;
import android.content.pm.PackageManager;
+import android.platform.test.annotations.RequiresFlagsDisabled;
+import android.platform.test.annotations.RequiresFlagsEnabled;
+import android.platform.test.flag.junit.CheckFlagsRule;
+import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.provider.SearchIndexableResource;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerListHelper;
+import com.android.settings.flags.Flags;
import com.android.settings.slices.SlicePreferenceController;
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
import com.android.settings.testutils.shadow.ShadowUserManager;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -50,11 +56,13 @@
@Config(shadows = {ShadowUserManager.class,
ShadowConnectivityManager.class, ShadowBluetoothAdapter.class})
public class ConnectedDeviceDashboardFragmentTest {
+ @Rule
+ public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
+
private static final String KEY_NEARBY_DEVICES = "bt_nearby_slice";
private static final String KEY_DISCOVERABLE_FOOTER = "discoverable_footer";
private static final String KEY_SAVED_DEVICE_SEE_ALL = "previously_connected_devices_see_all";
private static final String KEY_FAST_PAIR_DEVICE_SEE_ALL = "fast_pair_devices_see_all";
- private static final String KEY_FAST_PAIR_DEVICE_LIST = "fast_pair_devices";
private static final String KEY_ADD_BT_DEVICES = "add_bt_devices";
private static final String KEY_AUDIO_SHARING_DEVICE_LIST = "audio_sharing_device_list";
private static final String KEY_AUDIO_SHARING_SETTINGS =
@@ -65,9 +73,7 @@
private static final String TEST_APP_NAME = "com.testapp.settings";
private static final String TEST_ACTION = "com.testapp.settings.ACTION_START";
-
- @Mock
- private PackageManager mPackageManager;
+ @Mock private PackageManager mPackageManager;
private Context mContext;
private ConnectedDeviceDashboardFragment mFragment;
@@ -84,17 +90,19 @@
@Test
public void searchIndexProvider_shouldIndexResource() {
final List<SearchIndexableResource> indexRes =
- ConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
- .getXmlResourcesToIndex(mContext, true /* enabled */);
+ ConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
+ mContext, true /* enabled */);
assertThat(indexRes).isNotNull();
assertThat(indexRes.get(0).xmlResId).isEqualTo(R.xml.connected_devices);
}
@Test
+ @RequiresFlagsEnabled(Flags.FLAG_ENABLE_LE_AUDIO_SHARING)
public void nonIndexableKeys_existInXmlLayout() {
- final List<String> niks = ConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
- .getNonIndexableKeys(mContext);
+ final List<String> niks =
+ ConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
+ mContext);
assertThat(niks)
.containsExactly(
@@ -104,7 +112,24 @@
KEY_DISCOVERABLE_FOOTER,
KEY_SAVED_DEVICE_SEE_ALL,
KEY_FAST_PAIR_DEVICE_SEE_ALL,
- KEY_FAST_PAIR_DEVICE_LIST,
+ KEY_AUDIO_SHARING_SETTINGS);
+ }
+
+ @Test
+ @RequiresFlagsDisabled(Flags.FLAG_ENABLE_LE_AUDIO_SHARING)
+ public void nonIndexableKeys_existInXmlLayout_flagOff() {
+ final List<String> niks =
+ ConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(
+ mContext);
+
+ assertThat(niks)
+ .containsExactly(
+ KEY_CONNECTED_DEVICES,
+ KEY_AVAILABLE_DEVICES,
+ KEY_NEARBY_DEVICES,
+ KEY_DISCOVERABLE_FOOTER,
+ KEY_SAVED_DEVICE_SEE_ALL,
+ KEY_FAST_PAIR_DEVICE_SEE_ALL,
KEY_AUDIO_SHARING_DEVICE_LIST,
KEY_AUDIO_SHARING_SETTINGS);
}
@@ -132,8 +157,8 @@
@Test
public void getPreferenceControllers_containSlicePrefController() {
final List<BasePreferenceController> controllers =
- PreferenceControllerListHelper.getPreferenceControllersFromXml(mContext,
- R.xml.connected_devices);
+ PreferenceControllerListHelper.getPreferenceControllersFromXml(
+ mContext, R.xml.connected_devices);
assertThat(controllers
.stream()
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsControllerTest.java
index 8257b43..091abde 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsFunctionsControllerTest.java
@@ -44,6 +44,7 @@
import com.android.settingslib.widget.SelectorWithWidgetPreference;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -222,6 +223,7 @@
assertThat(prefs.get(3).isChecked()).isFalse();
}
+ @Ignore("b/313362757")
@Test
public void onClickNone_mtpEnabled_shouldDisableMtp() {
when(mUsbBackend.areFunctionsSupported(anyLong())).thenReturn(true);
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsPowerRoleControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsPowerRoleControllerTest.java
index e793336..6be1bd5 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsPowerRoleControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsPowerRoleControllerTest.java
@@ -45,6 +45,7 @@
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -100,6 +101,7 @@
mDetailsPowerRoleController.mHandler = mHandler;
}
+ @Ignore("b/313362757")
@Test
public void displayRefresh_sink_shouldUncheck() {
mDetailsPowerRoleController.displayPreference(mScreen);
@@ -112,6 +114,7 @@
assertThat(pref.isChecked()).isFalse();
}
+ @Ignore("b/313362757")
@Test
public void displayRefresh_source_shouldCheck() {
mDetailsPowerRoleController.displayPreference(mScreen);
@@ -149,6 +152,7 @@
mDetailsPowerRoleController.getPreferenceKey())).isNull();
}
+ @Ignore("b/313362757")
@Test
public void onClick_sink_shouldSetSource() {
mDetailsPowerRoleController.displayPreference(mScreen);
@@ -162,6 +166,7 @@
.isEqualTo(mContext.getString(R.string.usb_switching));
}
+ @Ignore("b/313362757")
@Test
public void onClickTwice_sink_shouldSetSourceOnce() {
mDetailsPowerRoleController.displayPreference(mScreen);
@@ -176,6 +181,7 @@
verify(mUsbBackend, times(1)).setPowerRole(POWER_ROLE_SOURCE);
}
+ @Ignore("b/313362757")
@Test
public void onClickDeviceAndRefresh_success_shouldClearSubtext() {
mDetailsPowerRoleController.displayPreference(mScreen);
@@ -194,6 +200,7 @@
assertThat(pref.getSummary()).isEqualTo("");
}
+ @Ignore("b/313362757")
@Test
public void onClickDeviceAndRefresh_failed_shouldShowFailureText() {
mDetailsPowerRoleController.displayPreference(mScreen);
@@ -213,6 +220,7 @@
.isEqualTo(mContext.getString(R.string.usb_switching_failed));
}
+ @Ignore("b/313362757")
@Test
public void onClickDevice_timedOut_shouldShowFailureText() {
mDetailsPowerRoleController.displayPreference(mScreen);
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsTranscodeMtpControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsTranscodeMtpControllerTest.java
index 7cf3ecc..51d2c16 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsTranscodeMtpControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/usb/UsbDetailsTranscodeMtpControllerTest.java
@@ -36,6 +36,7 @@
import com.android.settings.testutils.shadow.ShadowUtils;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -118,6 +119,7 @@
assertThat(mPreference.isEnabled()).isFalse();
}
+ @Ignore("b/313362757")
@Test
public void displayRefresh_fileTransfer_withAbsentProp_shouldCheck() {
mUnderTest.displayPreference(mScreen);
@@ -129,6 +131,7 @@
assertThat(getSwitchPreference().isChecked()).isFalse();
}
+ @Ignore("b/313362757")
@Test
public void displayRefresh_fileTransfer_withUnsetProp_shouldUncheck() {
mUnderTest.displayPreference(mScreen);
@@ -141,6 +144,7 @@
assertThat(getSwitchPreference().isChecked()).isFalse();
}
+ @Ignore("b/313362757")
@Test
public void displayRefresh_fileTransfer_withSetProp_shouldCheck() {
mUnderTest.displayPreference(mScreen);
@@ -153,6 +157,7 @@
assertThat(getSwitchPreference().isChecked()).isTrue();
}
+ @Ignore("b/313362757")
@Test
public void click_checked_shouldSetSystemProperty() {
mUnderTest.displayPreference(mScreen);
@@ -160,6 +165,7 @@
assertThat(SystemProperties.getBoolean(TRANSCODE_MTP_SYS_PROP_KEY, false)).isTrue();
}
+ @Ignore("b/313362757")
@Test
public void click_unChecked_shouldUnsetSystemProperty() {
mUnderTest.displayPreference(mScreen);
diff --git a/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java b/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java
index 7f3ef9a..009f13a 100644
--- a/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java
+++ b/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java
@@ -52,6 +52,7 @@
new InstrumentableFragmentCodeInspector(mClasses).run();
}
+ @Ignore("b/313612087")
@Test
public void runSliceControllerInXmlInspection() throws Exception {
new SliceControllerInXmlCodeInspector(mClasses).run();
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
index f7a940f..5317ce0 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
@@ -83,6 +83,7 @@
import com.android.settingslib.drawer.TileUtils;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -236,6 +237,7 @@
assertThat(preference.getOrder()).isEqualTo(tile.getOrder());
}
+ @Ignore("b/313569889")
@Test
public void bindPreference_noFragmentMetadata_shouldBindToProfileSelector() {
final Preference preference = new Preference(RuntimeEnvironment.application);
@@ -702,6 +704,7 @@
assertThat(nextStartedActivity).isNull();
}
+ @Ignore("b/313569889")
@Test
public void openTileIntent_profileSelectionDialog_shouldShow() {
ShadowUserManager.getShadow().addUser(10, "Someone", 0);
@@ -718,6 +721,7 @@
verify(mActivity).getSupportFragmentManager();
}
+ @Ignore("b/313569889")
@Test
public void openTileIntent_profileSelectionDialog_explicitMetadataShouldShow() {
ShadowUserManager.getShadow().addUser(10, "Someone", 0);
@@ -735,6 +739,7 @@
verify(mActivity).getSupportFragmentManager();
}
+ @Ignore("b/313569889")
@Test
public void openTileIntent_profileSelectionDialog_shouldNotShow() {
ShadowUserManager.getShadow().addUser(10, "Someone", 0);
@@ -752,6 +757,7 @@
verify(mActivity, never()).getSupportFragmentManager();
}
+ @Ignore("b/313569889")
@Test
public void openTileIntent_profileSelectionDialog_validUserHandleShouldNotShow() {
final int userId = 10;
@@ -774,6 +780,7 @@
verify(mActivity, never()).getSupportFragmentManager();
}
+ @Ignore("b/313569889")
@Test
public void openTileIntent_profileSelectionDialog_invalidUserHandleShouldShow() {
ShadowUserManager.getShadow().addUser(10, "Someone", 0);
@@ -792,6 +799,7 @@
verify(mActivity).getSupportFragmentManager();
}
+ @Ignore("b/313569889")
@Test
public void openTileIntent_profileSelectionDialog_unresolvableWorkProfileIntentShouldNotShow() {
final int userId = 10;
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
index cfbdd75..449958c 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
@@ -66,6 +66,7 @@
import com.android.settingslib.drawer.Tile;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -386,6 +387,7 @@
assertThat(mTestFragment.mBlockerController).isNull();
}
+ @Ignore("b/313569889")
@Test
public void createPreference_isProviderTile_returnSwitchPreference() {
final Preference pref = mTestFragment.createPreference(mProviderTile);
diff --git a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java
index e7e37d7..1eb2ea4 100644
--- a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java
@@ -42,6 +42,7 @@
import com.google.android.collect.Lists;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -88,6 +89,7 @@
verify(mUserManager, never()).getUserInfo(NORMAL_USER.getIdentifier());
}
+ @Ignore("b/313569889")
@Test
public void updateUserHandlesIfNeeded_Remove() {
final Tile tile = new ActivityTile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE);
@@ -103,6 +105,7 @@
verify(mUserManager, times(2)).getUserInfo(REMOVED_USER.getIdentifier());
}
+ @Ignore("b/313569889")
@Test
public void updateUserHandlesIfNeeded_removesCloneProfile() {
final UserInfo userInfo = new UserInfo(CLONE_USER.getIdentifier(), "clone_user", null,
@@ -119,6 +122,7 @@
verify(mUserManager, times(1)).getUserInfo(CLONE_USER.getIdentifier());
}
+ @Ignore("b/313569889")
@Test
public void updatePendingIntentsIfNeeded_removesUsersWithNoPendingIntentsAndCloneProfile() {
final UserInfo userInfo = new UserInfo(CLONE_USER.getIdentifier(), "clone_user", null,
diff --git a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationFragmentTest.java b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationFragmentTest.java
index fa2782f..e30759a 100644
--- a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationFragmentTest.java
@@ -21,11 +21,13 @@
import static com.google.common.truth.Truth.assertThat;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
+@Ignore("b/313569889")
@RunWith(RobolectricTestRunner.class)
public class ProfileSelectLocationFragmentTest {
diff --git a/tests/robotests/src/com/android/settings/datausage/ChartDataUsagePreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/ChartDataUsagePreferenceTest.java
index 9c93606..205a600 100644
--- a/tests/robotests/src/com/android/settings/datausage/ChartDataUsagePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/ChartDataUsagePreferenceTest.java
@@ -36,6 +36,7 @@
import com.android.settings.widget.UsageView;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -92,6 +93,7 @@
assertThat(points.valueAt(1)).isNotEqualTo(-1);
}
+ @Ignore("b/313568482")
@Test
public void calcPoints_dataNotAvailableAtCycleStart_shouldIndicateStartOfData() {
final UsageView usageView = mock(UsageView.class);
@@ -112,6 +114,7 @@
assertThat(points.valueAt(1)).isEqualTo(-1);
}
+ @Ignore("b/313568482")
@Test
public void calcPoints_shouldNotDrawPointForFutureDate() {
final UsageView usageView = mock(UsageView.class);
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceControllerTest.java
index 36c9231..50cb8d2 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceControllerTest.java
@@ -37,6 +37,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -95,6 +96,7 @@
assertThat(isEnabled).isFalse();
}
+ @Ignore("b/313589946")
@Test
public void updateState_settingEnabled_preferenceShouldBeChecked() {
mController.sLeAudioSupportedStateCache = BluetoothStatusCodes.FEATURE_SUPPORTED;
@@ -103,6 +105,7 @@
verify(mPreference).setChecked(true);
}
+ @Ignore("b/313589946")
@Test
public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
mController.sLeAudioSupportedStateCache = BluetoothStatusCodes.FEATURE_SUPPORTED;
diff --git a/tests/robotests/src/com/android/settings/development/DevelopmentMemtagPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/DevelopmentMemtagPreferenceControllerTest.java
index d4af470..229f2fa 100644
--- a/tests/robotests/src/com/android/settings/development/DevelopmentMemtagPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/DevelopmentMemtagPreferenceControllerTest.java
@@ -38,6 +38,7 @@
import com.android.settingslib.testutils.shadow.ShadowInteractionJankMonitor;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,13 +47,14 @@
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowSystemProperties;
+@Ignore("b/313564061")
@RunWith(RobolectricTestRunner.class)
@Config(
shadows = {
- ZygoteShadow.class,
- ShadowDeviceConfig.class,
- ShadowInteractionJankMonitor.class,
- ShadowRestrictedLockUtilsInternal.class
+ ZygoteShadow.class,
+ ShadowDeviceConfig.class,
+ ShadowInteractionJankMonitor.class,
+ ShadowRestrictedLockUtilsInternal.class
})
public class DevelopmentMemtagPreferenceControllerTest {
private final String mMemtagSupportedProperty = "ro.arm64.memtag.bootctl_supported";
diff --git a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDisabledActivityTest.java b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDisabledActivityTest.java
deleted file mode 100644
index 6b4068d..0000000
--- a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDisabledActivityTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2017 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.development;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import com.android.settings.R;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.Robolectric;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.shadows.ShadowToast;
-
-@RunWith(RobolectricTestRunner.class)
-public class DevelopmentSettingsDisabledActivityTest {
-
- @Test
- public void launchActivity_shouldShowToast() {
- Robolectric.setupActivity(DevelopmentSettingsDisabledActivity.class);
-
- final Context context = RuntimeEnvironment.application;
- assertThat(ShadowToast.getTextOfLatestToast())
- .isEqualTo(context.getString(R.string.dev_settings_disabled_warning));
- }
-}
diff --git a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
index dffd7fb..5a679ad 100644
--- a/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
+++ b/tests/robotests/src/com/android/settings/development/compat/PlatformCompatDashboardTest.java
@@ -51,6 +51,7 @@
import com.android.settings.R;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -140,6 +141,7 @@
R.string.platform_compat_selected_app_summary, APP_NAME, 1));
}
+ @Ignore("b/313591873")
@Test
public void createPreferenceForChange_defaultEnabledChange_createCheckedEntry() {
CompatibilityChangeInfo enabledChange = mChanges[0];
@@ -158,6 +160,7 @@
assertThat(enabledSwitchPreference.isEnabled()).isTrue();
}
+ @Ignore("b/313591873")
@Test
public void createPreferenceForChange_defaultDisabledChange_createUncheckedEntry() {
CompatibilityChangeInfo disabledChange = mChanges[1];
@@ -174,6 +177,7 @@
assertThat(disabledSwitchPreference.isEnabled()).isTrue();
}
+ @Ignore("b/313591873")
@Test
public void createPreferenceForChange_cannotOverride_createDisabledEntry()
throws RemoteException {
@@ -195,6 +199,7 @@
assertThat(switchPreference.isEnabled()).isFalse();
}
+ @Ignore("b/313591873")
@Test
public void createChangeCategoryPreference_enabledAndDisabled_hasTitleAndEntries() {
Set<Long> enabledChanges = new HashSet<>();
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryInfoFragmentTest.java b/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryInfoFragmentTest.java
new file mode 100644
index 0000000..d0dda84
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/deviceinfo/batteryinfo/BatteryInfoFragmentTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2023 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.deviceinfo.batteryinfo;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settings.testutils.FakeFeatureFactory;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.util.ReflectionHelpers;
+
+@RunWith(org.robolectric.RobolectricTestRunner.class)
+public class BatteryInfoFragmentTest {
+ private Context mContext;
+ private FakeFeatureFactory mFactory;
+ private BatteryInfoFragment mFragment;
+
+ @Before
+ public void setUp() {
+ mContext = ApplicationProvider.getApplicationContext();
+ mFactory = FakeFeatureFactory.setupForTest();
+ mFragment = new BatteryInfoFragment();
+ }
+
+ @Test
+ public void isPageSearchEnabled_batteryInfoEnabled_returnTrue() {
+ when(mFactory.batterySettingsFeatureProvider.isBatteryInfoEnabled(mContext))
+ .thenReturn(true);
+
+ final BaseSearchIndexProvider provider =
+ (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
+
+ final Object obj =
+ org.robolectric.util.ReflectionHelpers.callInstanceMethod(
+ provider, /*methodName=*/ "isPageSearchEnabled",
+ ReflectionHelpers.ClassParameter.from(Context.class, mContext));
+ final boolean isEnabled = (Boolean) obj;
+ assertThat(isEnabled).isTrue();
+ }
+
+ @Test
+ public void isPageSearchEnabled_batteryInfoDisabled_returnFalse() {
+ when(mFactory.batterySettingsFeatureProvider.isBatteryInfoEnabled(mContext))
+ .thenReturn(false);
+
+ final BaseSearchIndexProvider provider =
+ (BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
+
+ final Object obj =
+ org.robolectric.util.ReflectionHelpers.callInstanceMethod(
+ provider, /*methodName=*/ "isPageSearchEnabled",
+ ReflectionHelpers.ClassParameter.from(Context.class, mContext));
+ final boolean isEnabled = (Boolean) obj;
+ assertThat(isEnabled).isFalse();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
index a326061..a70753a 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java
@@ -40,6 +40,7 @@
import androidx.preference.Preference;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -114,6 +115,7 @@
assertThat(controller.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
+ @Ignore("b/313567396")
@Test
public void updateState_canHandleV2Intent_setIntentToPreference() throws Exception {
setupModulePackage("test version 123");
@@ -127,6 +129,7 @@
assertThat(mPreference.getIntent()).isEqualTo(MODULE_UPDATE_V2_INTENT);
}
+ @Ignore("b/313567396")
@Test
public void updateState_canHandleV2Intent_preferenceShouldBeSelectable() throws Exception {
setupModulePackage("test version 123");
@@ -140,6 +143,7 @@
assertThat(mPreference.isSelectable()).isTrue();
}
+ @Ignore("b/313567396")
@RequiresFlagsEnabled(com.android.settings.flags.Flags.FLAG_MAINLINE_MODULE_EXPLICIT_INTENT)
@Test
public void updateState_canHandleIntent_setIntentToPreference() throws Exception {
@@ -155,6 +159,7 @@
assertThat(mPreference.getIntent()).isEqualTo(MODULE_UPDATE_INTENT);
}
+ @Ignore("b/313567396")
@RequiresFlagsEnabled(com.android.settings.flags.Flags.FLAG_MAINLINE_MODULE_EXPLICIT_INTENT)
@Test
public void updateState_canHandleIntent_preferenceShouldBeSelectable() throws Exception {
diff --git a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
index c33bd21..9e193ff 100644
--- a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
@@ -93,6 +93,9 @@
FooterPreference mDisableOptionsPreference;
@Mock
+ FooterPreference mPowerConsumptionPreference;
+
+ @Mock
private PackageManager mPackageManager;
@Before
@@ -182,11 +185,28 @@
public void updateCandidates_enforcedAdmin_showDisabledByAdminPreference() {
mSettings.mAdmin = new RestrictedLockUtils.EnforcedAdmin();
mSettings.mDisableOptionsPreference = mDisableOptionsPreference;
+ mSettings.mPowerConsumptionPreference = mPowerConsumptionPreference;
doNothing().when(mSettings).setupDisabledFooterPreference();
+ doNothing().when(mSettings).setupPowerConsumptionFooterPreference();
mSettings.updateCandidates();
verify(mPreferenceScreen, atLeast(1)).addPreference(mDisableOptionsPreference);
+ verify(mPreferenceScreen, never()).addPreference(mPowerConsumptionPreference);
+ }
+
+ @Test
+ public void updateCandidates_withoutAdmin_showPowerConsumptionPreference() {
+ mSettings.mAdmin = null;
+ mSettings.mDisableOptionsPreference = mDisableOptionsPreference;
+ mSettings.mPowerConsumptionPreference = mPowerConsumptionPreference;
+ doNothing().when(mSettings).setupDisabledFooterPreference();
+ doNothing().when(mSettings).setupPowerConsumptionFooterPreference();
+
+ mSettings.updateCandidates();
+
+ verify(mPreferenceScreen, never()).addPreference(mDisableOptionsPreference);
+ verify(mPreferenceScreen, atLeast(1)).addPreference(mPowerConsumptionPreference);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryTipsCardPreferenceTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryTipsCardPreferenceTest.java
index 91d8c7d..bdf81e4 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryTipsCardPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batteryusage/BatteryTipsCardPreferenceTest.java
@@ -40,6 +40,7 @@
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -155,6 +156,7 @@
"ScreenTimeoutAnomaly");
}
+ @Ignore("b/313582999")
@Test
public void onClick_mainBtnOfAppsAnomaly_selectHighlightSlot() {
final PowerAnomalyEvent appsAnomaly = BatteryTestUtils.createAppAnomalyEvent();
@@ -176,6 +178,7 @@
.action(mContext, SettingsEnums.ACTION_BATTERY_TIPS_CARD_ACCEPT, "AppAnomaly");
}
+ @Ignore("b/313582999")
@Test
public void onClick_dismissBtnOfAppsAnomaly_keepHighlightSlotIndex() {
final PowerAnomalyEvent appsAnomaly = BatteryTestUtils.createAppAnomalyEvent();
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/datasaver/DynamicDenylistManagerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/datasaver/DynamicDenylistManagerTest.java
index 06790bf..c29541c 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/datasaver/DynamicDenylistManagerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/datasaver/DynamicDenylistManagerTest.java
@@ -393,6 +393,27 @@
assertThat(dumpResults.contains("DynamicDenylist: null")).isTrue();
}
+ @Test
+ public void onBootComplete_resetIntoManualMode() {
+ initDynamicDenylistManager(new int[] {FAKE_UID_1_INT});
+ setDenylist(new ArraySet<>(List.of(FAKE_UID_2_INT)));
+ // Ensure the testing environment for manual denylist.
+ assertThat(mManualDenyListPref.getAll()).hasSize(2);
+ assertTrue(mManualDenyListPref.contains(PREF_KEY_MANUAL_DENYLIST_SYNCED));
+ assertTrue(mManualDenyListPref.contains(FAKE_UID_1));
+ // Ensure the testing environment for dynamic denylist.
+ assertThat(mDynamicDenyListPref.getAll()).hasSize(1);
+
+ mDynamicDenylistManager.onBootComplete();
+
+ // Keep the users set uids in the manual denylist.
+ assertThat(mManualDenyListPref.getAll()).hasSize(2);
+ assertTrue(mManualDenyListPref.contains(PREF_KEY_MANUAL_DENYLIST_SYNCED));
+ assertTrue(mManualDenyListPref.contains(FAKE_UID_1));
+ // Clear the uids in the dynamic denylist.
+ assertThat(mDynamicDenyListPref.getAll()).isEmpty();
+ }
+
private void initDynamicDenylistManager(int[] preload) {
initDynamicDenylistManager(preload, preload);
}
diff --git a/tests/robotests/src/com/android/settings/gestures/LabeledSeekBarPreferenceTest.java b/tests/robotests/src/com/android/settings/gestures/LabeledSeekBarPreferenceTest.java
index 6302f80..5262a16 100644
--- a/tests/robotests/src/com/android/settings/gestures/LabeledSeekBarPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/LabeledSeekBarPreferenceTest.java
@@ -42,6 +42,7 @@
import com.android.settings.widget.LabeledSeekBarPreference;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -150,6 +151,7 @@
assertThat(mLabelFrame.getVisibility()).isEqualTo(View.GONE);
}
+ @Ignore("b/313594999")
@Test
public void setIconAttributes_iconVisible() {
final AttributeSet attributeSet = Robolectric.buildAttributeSet()
@@ -204,6 +206,7 @@
new LabeledSeekBarPreference(mContext, attributeSet);
}
+ @Ignore("b/313594999")
@Test
public void setContentDescriptionWithIcon_success() {
final String startDescription =
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
index e6b0343..de07fe0 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedActionPullDownPrefControllerTest.java
@@ -26,6 +26,7 @@
import com.android.settingslib.widget.SelectorWithWidgetPreference;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -76,6 +77,7 @@
.isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
}
+ @Ignore("b/313541907")
@Test
public void getAvailabilityStatus_setNavi3ButtonMode_shouldDisabled() {
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
index da27191..6d13056 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedActionShowNotificationPrefControllerTest.java
@@ -26,6 +26,7 @@
import com.android.settingslib.widget.SelectorWithWidgetPreference;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -85,6 +86,7 @@
.isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
}
+ @Ignore("b/313541907")
@Test
public void getAvailabilityStatus_setNavi3ButtonMode_shouldDisabled() {
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedMainSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedMainSwitchPreferenceControllerTest.java
index 599d4e0..118c58a 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedMainSwitchPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedMainSwitchPreferenceControllerTest.java
@@ -25,6 +25,7 @@
import com.android.settings.core.BasePreferenceController;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -83,6 +84,7 @@
.isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING);
}
+ @Ignore("b/313541907")
@Test
public void getAvailabilityStatus_set3ButtonMode_shouldDisabled() {
SystemProperties.set(OneHandedSettingsUtils.SUPPORT_ONE_HANDED_MODE, "true");
diff --git a/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java b/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java
index 112e04a..b3d4934 100644
--- a/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/OneHandedPreferenceCategoryControllerTest.java
@@ -30,6 +30,7 @@
import com.android.settings.R;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -61,6 +62,7 @@
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
}
+ @Ignore("b/313541907")
@Test
public void getTitle_set3ButtonMode_shouldReturnSetShortcutTo() {
mUtils.setNavigationBarMode(mContext, "0" /* 3 button */);
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
index 0909675..1967aef 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardLoaderTest.java
@@ -168,6 +168,7 @@
.setName("test_dark_theme")
.setCardType(ContextualCard.CardType.SLICE)
.setSliceUri(CustomSliceRegistry.DARK_THEME_SLICE_URI)
+ .setCategory(STICKY_VALUE)
.build());
cards.add(new ContextualCard.Builder()
.setName("test_gesture")
@@ -176,12 +177,6 @@
"content://com.android.settings.test.slices/action/gesture_pick_up"))
.build());
cards.add(new ContextualCard.Builder()
- .setName("test_wifi")
- .setCardType(ContextualCard.CardType.SLICE)
- .setSliceUri(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI)
- .setCategory(STICKY_VALUE)
- .build());
- cards.add(new ContextualCard.Builder()
.setName("test_connected")
.setCardType(ContextualCard.CardType.SLICE)
.setSliceUri(CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI)
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
index f18d94f..b53f760 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardManagerTest.java
@@ -234,7 +234,7 @@
@Test
public void sortCards_hasStickyCards_stickyShouldAlwaysBeTheLast() {
final List<ContextualCard> cards = new ArrayList<>();
- cards.add(buildContextualCard(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI,
+ cards.add(buildContextualCard(CustomSliceRegistry.FACE_ENROLL_SLICE_URI,
ContextualCardProto.ContextualCard.Category.STICKY_VALUE, 1.02f));
cards.add(buildContextualCard(CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI,
ContextualCardProto.ContextualCard.Category.STICKY_VALUE, 1.01f));
@@ -246,7 +246,7 @@
assertThat(sortedCards.get(cards.size() - 1).getSliceUri())
.isEqualTo(CustomSliceRegistry.BLUETOOTH_DEVICES_SLICE_URI);
assertThat(sortedCards.get(cards.size() - 2).getSliceUri())
- .isEqualTo(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI);
+ .isEqualTo(CustomSliceRegistry.FACE_ENROLL_SLICE_URI);
}
@Test
@@ -611,7 +611,7 @@
@Test
public void getCardsWithViewType_hasOneStickySlice_shouldHaveOneStickyCard() {
final List<ContextualCard> cards = new ArrayList<>();
- cards.add(buildContextualCard(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI.toString()));
+ cards.add(buildContextualCard(CustomSliceRegistry.FACE_ENROLL_SLICE_URI.toString()));
cards.add(buildContextualCard(CustomSliceRegistry.LOW_STORAGE_SLICE_URI.toString()));
final List<Integer> categories = Arrays.asList(
ContextualCardProto.ContextualCard.Category.STICKY_VALUE,
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProviderTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProviderTest.java
index d4b67f5..dcf3387 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProviderTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/SettingsContextualCardProviderTest.java
@@ -70,16 +70,16 @@
}
@Test
- public void getContextualCards_wifiSlice_shouldGetImportantCategory() {
+ public void getContextualCards_darkThemeSlice_shouldGetImportantCategory() {
final ContextualCardList cards = mProvider.getContextualCards();
- ContextualCard wifiCard = null;
+ ContextualCard darkThemeCard = null;
for (ContextualCard card : cards.getCardList()) {
if (card.getSliceUri().equals(
- CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI.toString())) {
- wifiCard = card;
+ CustomSliceRegistry.DARK_THEME_SLICE_URI.toString())) {
+ darkThemeCard = card;
}
}
- assertThat(wifiCard.getCardCategory()).isEqualTo(ContextualCard.Category.IMPORTANT);
+ assertThat(darkThemeCard.getCardCategory()).isEqualTo(ContextualCard.Category.IMPORTANT);
}
}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionControllerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionControllerTest.java
index 58a8d5b..9e83641 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionControllerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/GrayscaleConditionControllerTest.java
@@ -29,6 +29,7 @@
import android.os.UserHandle;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -56,6 +57,7 @@
mController = new GrayscaleConditionController(mContext, mConditionManager);
}
+ @Ignore("b/313597163")
@Test
public void isDisplayable_noIntent_shouldReturnFalse() {
assertThat(mController.isDisplayable()).isFalse();
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/DarkThemeSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/DarkThemeSliceTest.java
index f5f3d59..4377ec0 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/DarkThemeSliceTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/DarkThemeSliceTest.java
@@ -42,6 +42,7 @@
import com.android.settings.testutils.FakeFeatureFactory;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -129,6 +130,7 @@
assertThat(mDarkThemeSlice.isAvailable(mContext)).isTrue();
}
+ @Ignore("b/313598030")
@Test
public void getSlice_batterySaver_returnErrorSlice() {
when(mPowerManager.isPowerSaveMode()).thenReturn(true);
@@ -138,6 +140,7 @@
assertThat(metadata.isErrorSlice()).isTrue();
}
+ @Ignore("b/313598030")
@Test
public void getSlice_notAvailable_returnErrorSlice() {
mContext.getResources().getConfiguration().uiMode = UI_MODE_NIGHT_YES;
@@ -147,6 +150,7 @@
assertThat(metadata.isErrorSlice()).isTrue();
}
+ @Ignore("b/313598030")
@Test
public void getSlice_newSession_notAvailable_returnErrorSlice() {
// previous displayed: yes
@@ -173,6 +177,7 @@
assertThat(mDarkThemeSlice.getSlice()).isNotNull();
}
+ @Ignore("b/313598030")
@Test
public void getSlice_sliceNotClicked_notAvailable_returnErrorSlice() {
mDarkThemeSlice.sSliceClicked = false;
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRendererTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRendererTest.java
index cf8d361..71c839d 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRendererTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRendererTest.java
@@ -38,20 +38,19 @@
import androidx.lifecycle.LiveData;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
-import androidx.slice.builders.ListBuilder;
-import androidx.slice.builders.SliceAction;
import androidx.slice.Slice;
import androidx.slice.SliceProvider;
+import androidx.slice.builders.ListBuilder;
+import androidx.slice.builders.SliceAction;
import androidx.slice.widget.SliceLiveData;
-
import com.android.settings.R;
import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.homepage.contextualcards.ContextualCardsFragment;
import com.android.settings.homepage.contextualcards.ControllerRendererPool;
-import com.android.settings.wifi.slice.ContextualWifiSlice;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -102,6 +101,7 @@
.isNull();
}
+ @Ignore("b/313598030")
@Test
public void bindView_viewTypeFullWidth_shouldSetCachedSlice() {
final RecyclerView.ViewHolder viewHolder = getSliceViewHolder();
@@ -113,6 +113,7 @@
.isNotNull();
}
+ @Ignore("b/313598030")
@Test
public void bindView_viewTypeSticky_shouldSetCachedSlice() {
final RecyclerView.ViewHolder viewHolder = spy(getStickyViewHolder());
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SwipeDismissalDelegateTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SwipeDismissalDelegateTest.java
index 3e5934b..89a9ca8 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SwipeDismissalDelegateTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SwipeDismissalDelegateTest.java
@@ -36,6 +36,7 @@
import com.android.settings.homepage.contextualcards.slices.SliceFullCardRendererHelper.SliceViewHolder;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -67,12 +68,14 @@
mDismissalDelegate = new SwipeDismissalDelegate(mDismissalDelegateListener);
}
+ @Ignore("b/313598030")
@Test
public void getMovementFlags_conditionalViewHolder_shouldDisableSwipe() {
assertThat(mDismissalDelegate.getMovementFlags(mRecyclerView, getConditionalViewHolder()))
.isEqualTo(0);
}
+ @Ignore("b/313598030")
@Test
public void getMovementFlags_dismissalView_shouldDisableSwipe() {
final RecyclerView.ViewHolder holder = getSliceViewHolder();
@@ -81,6 +84,7 @@
assertThat(mDismissalDelegate.getMovementFlags(mRecyclerView, holder)).isEqualTo(0);
}
+ @Ignore("b/313598030")
@Test
public void getMovementFlags_SliceViewHolder_shouldEnableSwipe() {
final RecyclerView.ViewHolder holder = getSliceViewHolder();
@@ -90,6 +94,7 @@
.isNotEqualTo(0);
}
+ @Ignore("b/313598030")
@Test
public void onSwipe_shouldNotifyListener() {
mDismissalDelegate.onSwiped(getSliceViewHolder(), 1);
diff --git a/tests/robotests/src/com/android/settings/localepicker/AppLocalePickerActivityTest.java b/tests/robotests/src/com/android/settings/localepicker/AppLocalePickerActivityTest.java
index 817df4c..2ad24f2 100644
--- a/tests/robotests/src/com/android/settings/localepicker/AppLocalePickerActivityTest.java
+++ b/tests/robotests/src/com/android/settings/localepicker/AppLocalePickerActivityTest.java
@@ -58,6 +58,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -202,6 +203,7 @@
assertThat(controller.get().isFinishing()).isTrue();
}
+ @Ignore("b/313604701")
@Test
public void onLocaleSelected_getLocaleNotNull_getLanguageTag() {
ActivityController<TestAppLocalePickerActivity> controller =
diff --git a/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
index bed3346..8726fc3 100644
--- a/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
@@ -44,6 +44,7 @@
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -114,6 +115,7 @@
verify(mContext).unregisterReceiver(mController.mInjectedSettingsReceiver);
}
+ @Ignore("b/313540388")
@Test
public void workProfileDisallowShareLocationOn_getParentUserLocationServicesOnly() {
final int fakeWorkProfileId = 123;
@@ -166,6 +168,7 @@
verify(mSettingsInjector).reloadStatusMessages();
}
+ @Ignore("b/313540388")
@Test
public void withUserRestriction_shouldDisableLocationAccuracy() {
final List<Preference> preferences = new ArrayList<>();
diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
index 7248ff6..a91f627 100644
--- a/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
@@ -54,6 +54,7 @@
import com.android.settingslib.media.MediaOutputConstants;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -151,6 +152,7 @@
assertThat(metadata.isErrorSlice()).isFalse();
}
+ @Ignore("b/313605377")
@Test
public void getSlice_noConnectedDevice_returnErrorSlice() {
mDevices.clear();
@@ -163,6 +165,7 @@
assertThat(metadata.isErrorSlice()).isTrue();
}
+ @Ignore("b/313605377")
@Test
public void getSlice_audioModeIsInCommunication_returnErrorSlice() {
mDevices.add(mDevice1);
@@ -177,6 +180,7 @@
assertThat(metadata.isErrorSlice()).isTrue();
}
+ @Ignore("b/313605377")
@Test
public void getSlice_audioModeIsRingtone_returnErrorSlice() {
mDevices.add(mDevice1);
@@ -191,6 +195,7 @@
assertThat(metadata.isErrorSlice()).isTrue();
}
+ @Ignore("b/313605377")
@Test
public void getSlice_audioModeIsInCall_returnErrorSlice() {
mDevices.add(mDevice1);
diff --git a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
index b1bd41d..fb29e05 100644
--- a/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/network/NetworkProviderSettingsTest.java
@@ -82,6 +82,7 @@
import com.android.wifitrackerlib.WifiPickerTracker;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -397,6 +398,7 @@
verify(mContextMenu, never()).add(anyInt(), eq(MENU_ID_SHARE), anyInt(), anyInt());
}
+ @Ignore("b/313585353")
@Test
public void onWifiEntriesChanged_shouldChangeNextButtonState() {
mNetworkProviderSettings.onWifiEntriesChanged();
diff --git a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
index e1687a0..090bcfb 100644
--- a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
@@ -42,6 +42,7 @@
import com.android.settings.testutils.FakeFeatureFactory;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -54,6 +55,7 @@
import java.util.Objects;
+@Ignore("b/313576125")
@RunWith(RobolectricTestRunner.class)
@LooperMode(LooperMode.Mode.LEGACY)
@Config(shadows = {
diff --git a/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java b/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java
index 9322317..f177c19 100644
--- a/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java
@@ -50,6 +50,7 @@
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -125,6 +126,7 @@
/**
* ViewHolder should load and set the action label correctly.
*/
+ @Ignore("b/313576125")
@Test
public void setActionLabel_loadsActionLabel() {
addTestLiveData(VOLUME_NOTIFICATION_URI);
@@ -165,6 +167,7 @@
return foundLabel;
}
+ @Ignore("b/313576125")
@Test
public void sizeOfAdapter_shouldNotExceedMaxNum() {
for (int i = 0; i < MAX_NUM_OF_SLICES + 2; i++) {
@@ -183,6 +186,7 @@
assertThat(adapter.getData().size()).isEqualTo(MAX_NUM_OF_SLICES);
}
+ @Ignore("b/313576125")
@Test
public void mediaOutputIndicatorSlice_notSliderPanel_noSliderLayout() {
addTestLiveData(MEDIA_OUTPUT_INDICATOR_SLICE_URI);
@@ -199,6 +203,7 @@
assertThat(viewHolder.mSliceSliderLayout).isNull();
}
+ @Ignore("b/313576125")
@Test
public void onBindViewHolder_viewTypeSlider_verifyActionLabelSet() {
addTestLiveData(VOLUME_NOTIFICATION_URI);
diff --git a/tests/robotests/src/com/android/settings/panel/SettingsPanelActivityTest.java b/tests/robotests/src/com/android/settings/panel/SettingsPanelActivityTest.java
index 46c61e4..e550284 100644
--- a/tests/robotests/src/com/android/settings/panel/SettingsPanelActivityTest.java
+++ b/tests/robotests/src/com/android/settings/panel/SettingsPanelActivityTest.java
@@ -47,6 +47,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -101,6 +102,7 @@
mSettingsPanelActivity.getResources().getConfiguration().uiMode = mOriginalUiMode;
}
+ @Ignore("b/313576125")
@Test
public void onStart_isNotDebuggable_shouldHideSystemOverlay() {
ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", false);
@@ -117,6 +119,7 @@
verify(window).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
}
+ @Ignore("b/313576125")
@Test
public void onStop_isNotDebuggable_shouldRemoveHideSystemOverlay() {
ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", false);
@@ -144,6 +147,7 @@
& SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS).isEqualTo(0);
}
+ @Ignore("b/313576125")
@Test
public void onStop_panelIsNotCreating_shouldForceUpdate() {
mSettingsPanelActivity.mForceCreation = false;
@@ -155,6 +159,7 @@
assertThat(mSettingsPanelActivity.mForceCreation).isTrue();
}
+ @Ignore("b/313576125")
@Test
public void onStop_panelIsCreating_shouldNotForceUpdate() {
mSettingsPanelActivity.mForceCreation = false;
diff --git a/tests/robotests/src/com/android/settings/security/MemtagPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/MemtagPreferenceControllerTest.java
index 7d2c6dd..cca88dd 100644
--- a/tests/robotests/src/com/android/settings/security/MemtagPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/MemtagPreferenceControllerTest.java
@@ -43,6 +43,7 @@
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowSystemProperties;
+@Ignore("b/313564061")
@RunWith(RobolectricTestRunner.class)
@Config(
shadows = {
@@ -134,7 +135,6 @@
}
@Test
- @Ignore
public void setChecked_isChecked_doesNotShowDialog() {
ZygoteShadow.setSupportsMemoryTagging(false);
mController.setChecked(false);
@@ -142,7 +142,6 @@
}
@Test
- @Ignore
public void setChecked_isUnchecked_doesNotShowDialog() {
ZygoteShadow.setSupportsMemoryTagging(true);
mController.setChecked(true);
diff --git a/tests/robotests/src/com/android/settings/security/screenlock/PinPrivacyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/screenlock/PinPrivacyPreferenceControllerTest.java
index 171fb44..4ee3b55 100644
--- a/tests/robotests/src/com/android/settings/security/screenlock/PinPrivacyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/screenlock/PinPrivacyPreferenceControllerTest.java
@@ -32,6 +32,7 @@
import com.android.internal.widget.LockPatternUtils;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -66,6 +67,7 @@
assertThat(mController.isAvailable()).isTrue();
}
+ @Ignore("b/313612259")
@Test
public void isAvailable_lockSetToPinOrPw_shouldReturnTrue() {
when(mLockPatternUtils.getCredentialTypeForUser(TEST_USER_ID)).thenReturn(
diff --git a/tests/robotests/src/com/android/settings/security/trustagent/TrustAgentsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/trustagent/TrustAgentsPreferenceControllerTest.java
index d7aa42c..8339798 100644
--- a/tests/robotests/src/com/android/settings/security/trustagent/TrustAgentsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/trustagent/TrustAgentsPreferenceControllerTest.java
@@ -40,6 +40,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -105,6 +106,7 @@
assertThat(mPreferenceScreen.getPreferenceCount()).isEqualTo(0);
}
+ @Ignore("b/313612480")
@Test
public void
onStart_hasAUninstalledTrustAgent_shouldRemoveOnePreferenceAndLeaveTwoPreferences() {
@@ -125,6 +127,7 @@
assertThat(mPreferenceScreen.getPreferenceCount()).isEqualTo(2);
}
+ @Ignore("b/313612480")
@Test
public void onStart_hasANewTrustAgent_shouldAddOnePreferenceAndHaveFourPreferences() {
final List<ResolveInfo> availableAgents = createFakeAvailableAgents();
@@ -145,6 +148,7 @@
assertThat(mPreferenceScreen.getPreferenceCount()).isEqualTo(4);
}
+ @Ignore("b/313612480")
@Test
public void onStart_hasUnrestrictedTrustAgent_shouldAddThreeChangeablePreferences() {
ShadowRestrictedLockUtilsInternal.setKeyguardDisabledFeatures(0);
@@ -165,6 +169,7 @@
}
}
+ @Ignore("b/313612480")
@Test
public void onStart_hasRestrictedTructAgent_shouldAddThreeUnchangeablePreferences() {
final List<ResolveInfo> availableAgents = createFakeAvailableAgents();
diff --git a/tests/robotests/src/com/android/settings/shortcut/CreateShortcutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/shortcut/CreateShortcutPreferenceControllerTest.java
index 4aba895..3705ba8 100644
--- a/tests/robotests/src/com/android/settings/shortcut/CreateShortcutPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/shortcut/CreateShortcutPreferenceControllerTest.java
@@ -45,6 +45,7 @@
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -200,6 +201,7 @@
}
@Test
+ @Ignore
public void queryShortcuts_configShowDataUsage_ShouldEnableShortcuts() {
doReturn(true).when(mController).canShowDataUsage();
setupActivityInfo(Settings.DataUsageSummaryActivity.class.getSimpleName());
@@ -208,6 +210,7 @@
}
@Test
+ @Ignore
public void queryShortcuts_configNotShowDataUsage_ShouldDisableShortcuts() {
doReturn(false).when(mController).canShowDataUsage();
setupActivityInfo(Settings.DataUsageSummaryActivity.class.getSimpleName());
diff --git a/tests/robotests/src/com/android/settings/theme/ContrastPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/theme/ContrastPreferenceControllerTest.java
index dbd3372..d74b6df 100644
--- a/tests/robotests/src/com/android/settings/theme/ContrastPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/theme/ContrastPreferenceControllerTest.java
@@ -38,6 +38,7 @@
import androidx.test.core.app.ApplicationProvider;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -73,6 +74,7 @@
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
}
+ @Ignore("b/313614100")
@Test
public void testHandlePreferenceTreeClick() {
Preference preference = new Preference(mContext);
diff --git a/tests/robotests/src/com/android/settings/users/TimeoutToDockUserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/users/TimeoutToDockUserPreferenceControllerTest.java
index 3d8e893..df098b2 100644
--- a/tests/robotests/src/com/android/settings/users/TimeoutToDockUserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/users/TimeoutToDockUserPreferenceControllerTest.java
@@ -40,6 +40,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -126,6 +127,7 @@
BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
}
+ @Ignore("b/313530297")
@Test
public void getAvailabilityStatus_isCurrentlyMainUser_returnDisabledForUser() {
when(Utils.canCurrentUserDream(mContext)).thenReturn(true);
@@ -134,6 +136,7 @@
BasePreferenceController.DISABLED_FOR_USER);
}
+ @Ignore("b/313530297")
@Test
public void getAvailabilityStatus_featureAndMultiUserEnabledAndNonMainUser_returnAvailable() {
when(Utils.canCurrentUserDream(mContext)).thenReturn(false);
diff --git a/tests/robotests/src/com/android/settings/users/UserDetailsSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserDetailsSettingsTest.java
index b339052..874b978 100644
--- a/tests/robotests/src/com/android/settings/users/UserDetailsSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserDetailsSettingsTest.java
@@ -63,6 +63,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -264,6 +265,7 @@
verify(mSwitchUserPref).setEnabled(false);
}
+ @Ignore("b/313530297")
@Test
public void initialize_adminWithTelephony_shouldShowPhonePreference() {
setupSelectedUser();
@@ -309,6 +311,7 @@
verify(mFragment).removePreference(KEY_APP_AND_CONTENT_ACCESS);
}
+ @Ignore("b/313530297")
@Test
public void initialize_adminSelectsSecondaryUser_shouldShowRemovePreference() {
setupSelectedUser();
@@ -321,6 +324,7 @@
verify(mFragment, never()).removePreference(KEY_REMOVE_USER);
}
+ @Ignore("b/313530297")
@Test
public void initialize_adminSelectsNewRestrictedUser_shouldOpenAppContentScreen() {
setupSelectedRestrictedUser();
@@ -343,6 +347,7 @@
.isEqualTo(true);
}
+ @Ignore("b/313530297")
@Test
public void initialize_adminSelectsRestrictedUser_shouldSetupPreferences() {
setupSelectedRestrictedUser();
@@ -372,6 +377,7 @@
verify(mActivity, never()).startActivity(any(Intent.class));
}
+ @Ignore("b/313530297")
@Test
public void initialize_adminSelectsGuest_shouldShowRemovePreference() {
setupSelectedGuest();
@@ -415,6 +421,7 @@
verify(mFragment).removePreference(KEY_REMOVE_USER);
}
+ @Ignore("b/313530297")
@Test
public void initialize_userHasCallRestriction_shouldSetPhoneSwitchUnChecked() {
setupSelectedUser();
@@ -427,6 +434,7 @@
verify(mPhonePref).setChecked(false);
}
+ @Ignore("b/313530297")
@Test
public void initialize_noCallRestriction_shouldSetPhoneSwitchChecked() {
setupSelectedUser();
@@ -525,6 +533,7 @@
verify(mFragment, never()).switchUser();
}
+ @Ignore("b/313530297")
@Test
public void onPreferenceClick_removeGuestClicked_canDelete_shouldShowDialog() {
setupSelectedGuest();
@@ -542,6 +551,7 @@
verify(mFragment).showDialog(DIALOG_CONFIRM_RESET_GUEST);
}
+ @Ignore("b/313530297")
@Test
public void onPreferenceClick_removeRestrictedClicked_canDelete_shouldShowDialog() {
setupSelectedRestrictedUser();
@@ -560,6 +570,7 @@
verify(mFragment).showDialog(DIALOG_CONFIRM_REMOVE);
}
+ @Ignore("b/313530297")
@Test
public void onPreferenceClick_removeClicked_canDelete_shouldShowDialog() {
setupSelectedUser();
@@ -651,6 +662,7 @@
assertThat(result).isFalse();
}
+ @Ignore("b/313530297")
@Test
public void canDeleteUser_adminSelectsUser_noRestrictions_shouldReturnTrue() {
setupSelectedUser();
@@ -684,6 +696,7 @@
assertThat(result).isFalse();
}
+ @Ignore("b/313530297")
@Test
public void initialize_userSelected_shouldShowGrantAdminPref_MultipleAdminEnabled() {
setupSelectedUser();
@@ -693,6 +706,7 @@
verify(mFragment, never()).removePreference(KEY_GRANT_ADMIN);
}
+ @Ignore("b/313530297")
@Test
public void initialize_userSelected_shouldNotShowGrantAdminPref() {
setupSelectedUser();
@@ -700,6 +714,7 @@
verify(mFragment).removePreference(KEY_GRANT_ADMIN);
}
+ @Ignore("b/313530297")
@Test
public void initialize_restrictUserSelected_shouldNotShowGrantAdminPref_MultipleAdminEnabled() {
setupSelectedUser();
@@ -710,6 +725,7 @@
verify(mFragment).removePreference(KEY_GRANT_ADMIN);
}
+ @Ignore("b/313530297")
@Test
public void initialize_mainUserSelected_shouldShowGrantAdminPref_MultipleAdminEnabled() {
setupSelectedMainUser();
@@ -718,6 +734,7 @@
verify(mFragment).removePreference(KEY_GRANT_ADMIN);
}
+ @Ignore("b/313530297")
@Test
public void initialize_guestSelected_shouldNotShowGrantAdminPref_MultipleAdminEnabled() {
setupSelectedGuest();
diff --git a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
index 36eeac8..47c382f 100644
--- a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
@@ -73,6 +73,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.AdditionalMatchers;
@@ -207,6 +208,7 @@
assertThat(UserSettings.assignDefaultPhoto(null, ACTIVE_USER_ID)).isFalse();
}
+ @Ignore("b/313530297")
@Test
public void testGetRawDataToIndex_returnAllIndexablePreferences() {
String[] expectedKeys = {KEY_ALLOW_MULTIPLE_USERS};
@@ -708,6 +710,7 @@
verify(mUserManager).getAliveUsers();
}
+ @Ignore("b/313530297")
@Test
public void updateUserList_userIconMissing_shouldLoadIcon() {
UserInfo currentUser = getAdminUser(true);
diff --git a/tests/robotests/src/com/android/settings/webview/WebViewAppPickerTest.java b/tests/robotests/src/com/android/settings/webview/WebViewAppPickerTest.java
index c693938..d35b608 100644
--- a/tests/robotests/src/com/android/settings/webview/WebViewAppPickerTest.java
+++ b/tests/robotests/src/com/android/settings/webview/WebViewAppPickerTest.java
@@ -48,6 +48,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -207,6 +208,7 @@
verify(mActivity, times(1)).finish();
}
+ @Ignore("b/313615637")
@Test
public void testNotFinishedIfAdmin() {
mUserManager.setIsAdminUser(true);
diff --git a/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java b/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
index 9ed6de3..c87aeea 100644
--- a/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/widget/EntityHeaderControllerTest.java
@@ -45,6 +45,7 @@
import com.android.settingslib.widget.LayoutPreference;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -207,6 +208,7 @@
verify(activity, never()).startActivity(any(Intent.class));
}
+ @Ignore("b/313616350")
@Test
public void bindButton_hasAppInfo_shouldAttachClickListener() {
final View appLinks = mLayoutInflater.inflate(
diff --git a/tests/robotests/src/com/android/settings/widget/LinkifySummaryPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/LinkifySummaryPreferenceTest.java
index e5ae840..f060588 100644
--- a/tests/robotests/src/com/android/settings/widget/LinkifySummaryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/LinkifySummaryPreferenceTest.java
@@ -34,6 +34,7 @@
import androidx.preference.PreferenceViewHolder;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -42,6 +43,7 @@
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
+@Ignore("b/313563183")
@RunWith(RobolectricTestRunner.class)
public class LinkifySummaryPreferenceTest {
@Spy
diff --git a/tests/robotests/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2Test.java b/tests/robotests/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2Test.java
index 11d421c..3923cf8 100644
--- a/tests/robotests/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2Test.java
+++ b/tests/robotests/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2Test.java
@@ -94,6 +94,7 @@
import com.android.wifitrackerlib.WifiEntry.ConnectCallback;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
@@ -735,6 +736,7 @@
verify(mMockRxLinkSpeedPref).setSummary("100 Mbps");
}
+ @Ignore("b/313536962")
@Test
public void ssidPref_isSubscription_show() {
setUpForConnectedNetwork();
@@ -934,6 +936,7 @@
verify(mMockActivity, never()).finish();
}
+ @Ignore("b/313536962")
@Test
public void noLinkProperties_allIpDetailsHidden() {
setUpForConnectedNetwork();
@@ -956,6 +959,7 @@
verify(mMockDnsPref, never()).setVisible(true);
}
+ @Ignore("b/313536962")
@Test
public void disconnectedNetwork_allIpDetailsHidden() {
setUpForDisconnectedNetwork();
@@ -1005,6 +1009,7 @@
inOrder.verify(mMockIpv6AddressesPref).setSummary(text);
}
+ @Ignore("b/313536962")
@Test
public void onLinkPropertiesChanged_updatesFields() {
setUpForConnectedNetwork();
diff --git a/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java b/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java
deleted file mode 100644
index d9c726a..0000000
--- a/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright (C) 2018 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.wifi.slice;
-
-import static com.android.settings.wifi.slice.ContextualWifiSlice.COLLAPSED_ROW_COUNT;
-import static com.android.settings.wifi.slice.WifiSlice.DEFAULT_EXPANDED_ROW_COUNT;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
-
-import androidx.core.graphics.drawable.IconCompat;
-import androidx.slice.Slice;
-import androidx.slice.SliceMetadata;
-import androidx.slice.SliceProvider;
-import androidx.slice.core.SliceAction;
-import androidx.slice.widget.SliceLiveData;
-
-import com.android.settings.R;
-import com.android.settings.slices.CustomSliceRegistry;
-import com.android.settings.slices.SlicesFeatureProviderImpl;
-import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settings.testutils.shadow.ShadowConnectivityManager;
-import com.android.settings.testutils.shadow.ShadowWifiSlice;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-import org.robolectric.shadows.ShadowBinder;
-
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-@Config(shadows = {ShadowConnectivityManager.class, ShadowWifiSlice.class})
-public class ContextualWifiSliceTest {
- private static final String SSID = "123";
-
- @Mock
- private WifiManager mWifiManager;
- @Mock
- private PackageManager mPackageManager;
- @Mock
- private WifiInfo mWifiInfo;
- @Mock
- private Network mNetwork;
-
- private Context mContext;
- private ContentResolver mResolver;
- private ContextualWifiSlice mWifiSlice;
- private FakeFeatureFactory mFeatureFactory;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = spy(RuntimeEnvironment.application);
- mResolver = mock(ContentResolver.class);
- mFeatureFactory = FakeFeatureFactory.setupForTest();
- mFeatureFactory.slicesFeatureProvider = new SlicesFeatureProviderImpl();
- mFeatureFactory.slicesFeatureProvider.newUiSession();
- doReturn(mResolver).when(mContext).getContentResolver();
- doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class);
- doReturn(true).when(mWifiManager).isWifiEnabled();
- doReturn(WifiManager.WIFI_STATE_ENABLED).when(mWifiManager).getWifiState();
- doReturn(mWifiInfo).when(mWifiManager).getConnectionInfo();
- doReturn(SSID).when(mWifiInfo).getSSID();
- doReturn(mNetwork).when(mWifiManager).getCurrentNetwork();
- when(mContext.getPackageManager()).thenReturn(mPackageManager);
-
- // Set-up specs for SliceMetadata.
- SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
-
- final String siPackageName =
- mContext.getString(R.string.config_settingsintelligence_package_name);
- ShadowBinder.setCallingUid(1);
- when(mPackageManager.getPackagesForUid(1)).thenReturn(new String[]{siPackageName});
- when(mPackageManager.getNameForUid(1)).thenReturn(siPackageName);
- ShadowWifiSlice.setWifiPermissible(true);
- mWifiSlice = new ContextualWifiSlice(mContext);
- }
-
- @Test
- public void getWifiSlice_newSession_hasActiveConnection_shouldCollapseSlice() {
- mWifiSlice.sActiveUiSession = ~mFeatureFactory.slicesFeatureProvider.getUiSessionToken();
- connectToWifi(makeValidatedNetworkCapabilities());
-
- final Slice wifiSlice = mWifiSlice.getSlice();
-
- assertWifiHeader(wifiSlice);
- assertThat(ContextualWifiSlice.getApRowCount()).isEqualTo(COLLAPSED_ROW_COUNT);
- }
-
- @Test
- public void getWifiSlice_newSession_noConnection_shouldExpandSlice() {
- mWifiSlice.sActiveUiSession = ~mFeatureFactory.slicesFeatureProvider.getUiSessionToken();
-
- final Slice wifiSlice = mWifiSlice.getSlice();
-
- assertWifiHeader(wifiSlice);
- assertThat(ContextualWifiSlice.getApRowCount()).isEqualTo(DEFAULT_EXPANDED_ROW_COUNT);
- }
-
- @Test
- public void getWifiSlice_previousExpanded_hasActiveConnection_shouldExpandSlice() {
- mWifiSlice.sActiveUiSession = mFeatureFactory.slicesFeatureProvider.getUiSessionToken();
- mWifiSlice.sApRowCollapsed = false;
- connectToWifi(makeValidatedNetworkCapabilities());
-
- final Slice wifiSlice = mWifiSlice.getSlice();
-
- assertWifiHeader(wifiSlice);
- assertThat(ContextualWifiSlice.getApRowCount()).isEqualTo(DEFAULT_EXPANDED_ROW_COUNT);
- }
-
- @Test
- public void getWifiSlice_previousCollapsed_connectionLoss_shouldCollapseSlice() {
- mWifiSlice.sActiveUiSession = mFeatureFactory.slicesFeatureProvider.getUiSessionToken();
- mWifiSlice.sApRowCollapsed = true;
- connectToWifi(makeValidatedNetworkCapabilities());
-
- doReturn(null).when(mWifiManager).getCurrentNetwork();
- final Slice wifiSlice = mWifiSlice.getSlice();
-
- assertWifiHeader(wifiSlice);
- assertThat(ContextualWifiSlice.getApRowCount()).isEqualTo(COLLAPSED_ROW_COUNT);
- }
-
- @Test
- public void getWifiSlice_contextualWifiSlice_shouldReturnContextualWifiSliceUri() {
- mWifiSlice.sActiveUiSession = mFeatureFactory.slicesFeatureProvider.getUiSessionToken();
-
- final Slice wifiSlice = mWifiSlice.getSlice();
-
- assertThat(wifiSlice.getUri()).isEqualTo(CustomSliceRegistry.CONTEXTUAL_WIFI_SLICE_URI);
- }
-
- private void connectToWifi(NetworkCapabilities nc) {
- ShadowConnectivityManager.getShadow().setNetworkCapabilities(mNetwork, nc);
- }
-
- private NetworkCapabilities makeValidatedNetworkCapabilities() {
- final NetworkCapabilities nc = NetworkCapabilities.Builder.withoutDefaultCapabilities()
- .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
- .addCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED)
- .build();
- return nc;
- }
-
- private void assertWifiHeader(Slice slice) {
- final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
- assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.wifi_settings));
-
- final SliceAction primaryAction = metadata.getPrimaryAction();
- final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext,
- R.drawable.ic_settings_wireless);
- assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
-
- final List<SliceAction> toggles = metadata.getToggles();
- assertThat(toggles).hasSize(1);
- }
-}
diff --git a/tests/spa_unit/src/com/android/settings/system/DeveloperOptionsControllerTest.kt b/tests/spa_unit/src/com/android/settings/system/DeveloperOptionsControllerTest.kt
new file mode 100644
index 0000000..8707065
--- /dev/null
+++ b/tests/spa_unit/src/com/android/settings/system/DeveloperOptionsControllerTest.kt
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2023 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.system
+
+import android.content.Context
+import android.content.Intent
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithText
+import androidx.compose.ui.test.performClick
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.SettingsActivity
+import com.android.settings.development.DevelopmentSettingsDashboardFragment
+import com.google.common.truth.Truth.assertThat
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.kotlin.any
+import org.mockito.kotlin.argumentCaptor
+import org.mockito.kotlin.doNothing
+import org.mockito.kotlin.spy
+import org.mockito.kotlin.verify
+import org.mockito.kotlin.whenever
+
+@RunWith(AndroidJUnit4::class)
+class DeveloperOptionsControllerTest {
+ @get:Rule
+ val composeTestRule = createComposeRule()
+
+ private val context: Context = spy(ApplicationProvider.getApplicationContext()) {
+ doNothing().whenever(mock).startActivity(any())
+ }
+
+ private val controller = DeveloperOptionsController(context, TEST_KEY)
+
+ @Test
+ fun title_isDisplayed() {
+ composeTestRule.setContent {
+ controller.DeveloperOptionsPreference()
+ }
+
+ composeTestRule.onNodeWithText(
+ context.getString(com.android.settingslib.R.string.development_settings_title)
+ ).assertIsDisplayed()
+ }
+
+ @Test
+ fun onClick_launchDevelopmentSettingsDashboardFragment() {
+ composeTestRule.setContent {
+ controller.DeveloperOptionsPreference()
+ }
+
+ composeTestRule.onNodeWithText(
+ context.getString(com.android.settingslib.R.string.development_settings_title)
+ ).performClick()
+
+ val intent = argumentCaptor<Intent> {
+ verify(context).startActivity(capture())
+ }.firstValue
+ assertThat(intent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT))
+ .isEqualTo(DevelopmentSettingsDashboardFragment::class.qualifiedName)
+ }
+
+ private companion object {
+ const val TEST_KEY = "test_key"
+ }
+}
diff --git a/tests/unit/src/com/android/settings/network/InternetPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/InternetPreferenceControllerTest.java
index 5af2da0..4ba12cb 100644
--- a/tests/unit/src/com/android/settings/network/InternetPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/InternetPreferenceControllerTest.java
@@ -298,4 +298,11 @@
assertThat(mPreference.getSummary().toString()).isEqualTo(TEST_SUMMARY);
}
+
+ @Test
+ public void updateHotspotNetwork_hotspotNetworkNotEnabled_returnFalse() {
+ mController.mWifiPickerTrackerHelper = null;
+
+ assertThat(mController.updateHotspotNetwork()).isFalse();
+ }
}
diff --git a/tests/unit/src/com/android/settings/network/MobilePlanPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/MobilePlanPreferenceControllerTest.java
deleted file mode 100644
index 9b38e5b..0000000
--- a/tests/unit/src/com/android/settings/network/MobilePlanPreferenceControllerTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2020 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 static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.settings.testutils.ResourcesUtils;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-public class MobilePlanPreferenceControllerTest {
-
- private Context mContext;
-
- @Before
- public void setUp() {
- mContext = ApplicationProvider.getApplicationContext();
- }
-
- @Test
- public void testNoProvisionStringFormattedCorrectly() {
- final String operator = "test_operator";
-
- assertThat(
- ResourcesUtils.getResourcesString(mContext, "mobile_no_provisioning_url", operator))
- .contains(operator);
- }
-}