Snap for 5348557 from ee59c6e596 to qt-release
Change-Id: Ie6b722ae216eae5d9f06982ef459858fd2d35d07
This commit is contained in:
@@ -2058,7 +2058,7 @@
|
||||
<activity
|
||||
android:name="Settings$PowerUsageSummaryActivity"
|
||||
android:label="@string/power_usage_summary_title"
|
||||
android:icon="@drawable/ic_homepage_battery"
|
||||
android:icon="@drawable/ic_settings_battery"
|
||||
android:parentActivityName="Settings">
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.intent.action.POWER_USAGE_SUMMARY" />
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/panel_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="24dp"
|
||||
android:paddingTop="18dp"
|
||||
android:textColor="?android:attr/colorPrimary"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
<include layout="@layout/horizontal_divider"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/panel_parent_layout"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<include layout="@layout/panel_buttons"/>
|
||||
</LinearLayout>
|
||||
24
res/layout-land/panel_slice_list.xml
Normal file
24
res/layout-land/panel_slice_list.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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
|
||||
-->
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/panel_parent_layout"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingBottom="14dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/see_more"
|
||||
style="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:text="@string/see_more"/>
|
||||
|
||||
<Space
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/done"
|
||||
style="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/done"/>
|
||||
</LinearLayout>
|
||||
@@ -33,11 +33,34 @@
|
||||
|
||||
<include layout="@layout/horizontal_divider"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/panel_parent_layout"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<include layout="@layout/panel_slice_list"/>
|
||||
|
||||
<include layout="@layout/panel_buttons"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/see_more"
|
||||
style="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:text="@string/see_more"/>
|
||||
|
||||
<Space
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/done"
|
||||
style="@android:style/Widget.DeviceDefault.Button.Borderless.Colored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:text="@string/done"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
24
res/layout/panel_slice_list.xml
Normal file
24
res/layout/panel_slice_list.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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
|
||||
-->
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/panel_parent_layout"
|
||||
android:scrollbars="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:overScrollMode="never"/>
|
||||
@@ -25,7 +25,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp" />
|
||||
android:paddingEnd="20dp"/>
|
||||
|
||||
<include layout="@layout/horizontal_divider"/>
|
||||
</LinearLayout>
|
||||
@@ -4745,7 +4745,7 @@
|
||||
<!-- Title for accessibility preference to accessibility timeout. [CHAR LIMIT=35] -->
|
||||
<string name="accessibility_control_timeout_preference_title">Time to take action</string>
|
||||
<!-- Descriptive text for accessibility preference to accessibility content timeout. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_content_timeout_preference_summary">Choose how much time you want to read and take action on messages that automatically go away.\n\nSupport for this setting is up to each app.</string>
|
||||
<string name="accessibility_content_timeout_preference_summary">Choose how long to show messages that you need to read, but are visible only temporarily.\n\nNot all apps support this setting.</string>
|
||||
<!-- Descriptive text for accessibility preference to accessibility control timeout. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_control_timeout_preference_summary">Choose how long to show messages that ask you to take action, but are visible only temporarily.\n\nNot all apps support this setting.</string>
|
||||
|
||||
@@ -10710,4 +10710,7 @@
|
||||
<string name="media_output_panel_title">Switch output</string>
|
||||
<!-- Summary for represent which device is playing media [CHAR LIMIT=NONE] -->
|
||||
<string name="media_output_panel_summary_of_playing_device">Currently playing on <xliff:g id="device_name" example="Bose headphone">%1$s</xliff:g></string>
|
||||
|
||||
<!-- Message for forget passpoint dialog [CHAR LIMIT=none] -->
|
||||
<string name="forget_passpoint_dialog_message">Your subscription with this provider may be cancelled. Recurring subscriptions will not be cancelled. For more information, check with your provider.</string>
|
||||
</resources>
|
||||
|
||||
@@ -238,7 +238,10 @@
|
||||
|
||||
<style name="TextAppearance.CategoryTitle"
|
||||
parent="@*android:style/TextAppearance.DeviceDefault.Body2">
|
||||
<item name="android:textColor">?android:attr/textColorSecondary</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:textSize">11sp</item>
|
||||
<!-- 0.8 Spacing, 0.8/11 = 0.072727273 -->
|
||||
<item name="android:letterSpacing">0.072727273</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.TileTitle" parent="@*android:style/TextAppearance.DeviceDefault.Subhead"/>
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
<item name="slicePreferenceStyle">@style/SlicePreference</item>
|
||||
<item name="seekBarPreferenceStyle">@style/SettingsSeekBarPreference</item>
|
||||
<item name="twoStateButtonPreferenceStyle">@style/TwoStateButtonPreference</item>
|
||||
<item name="preferenceCategoryTitleTextAppearance">@style/TextAppearance.CategoryTitle
|
||||
</item>
|
||||
</style>
|
||||
|
||||
<style name="PreferenceTheme.SetupWizard">
|
||||
|
||||
@@ -18,7 +18,6 @@ import android.app.role.RoleManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.permission.PermissionControllerManager;
|
||||
import android.text.TextUtils;
|
||||
@@ -28,10 +27,7 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.util.CollectionUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.applications.DefaultAppSettings;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
|
||||
/*
|
||||
* Abstract base controller for the default app shortcut preferences that launches the default app
|
||||
@@ -58,22 +54,13 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
|
||||
mRoleManager = context.getSystemService(RoleManager.class);
|
||||
|
||||
// TODO: STOPSHIP(b/110557011): Remove this check once we have all default apps migrated.
|
||||
if (mRoleName != null) {
|
||||
final PermissionControllerManager permissionControllerManager =
|
||||
mContext.getSystemService(PermissionControllerManager.class);
|
||||
permissionControllerManager.isApplicationQualifiedForRole(mRoleName, mPackageName,
|
||||
mContext.getMainExecutor(), qualified -> {
|
||||
mAppQualified = qualified;
|
||||
refreshAvailability();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: STOPSHIP(b/110557011): Remove this once we have all default apps migrated.
|
||||
public DefaultAppShortcutPreferenceControllerBase(Context context, String preferenceKey,
|
||||
String packageName) {
|
||||
this(context, preferenceKey, null /* roleName */, packageName);
|
||||
final PermissionControllerManager permissionControllerManager =
|
||||
mContext.getSystemService(PermissionControllerManager.class);
|
||||
permissionControllerManager.isApplicationQualifiedForRole(mRoleName, mPackageName,
|
||||
mContext.getMainExecutor(), qualified -> {
|
||||
mAppQualified = qualified;
|
||||
refreshAvailability();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +85,7 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
if (mContext.getSystemService(UserManager.class).isManagedProfile()) {
|
||||
return DISABLED_FOR_USER;
|
||||
}
|
||||
return hasAppCapability() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
return mAppQualified ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,49 +99,20 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
if (!TextUtils.equals(mPreferenceKey, preference.getKey())) {
|
||||
return false;
|
||||
}
|
||||
// TODO: STOPSHIP(b/110557011): Remove this check once we have all default apps migrated.
|
||||
if (mRoleName != null) {
|
||||
final Intent intent = new Intent(Intent.ACTION_MANAGE_DEFAULT_APP)
|
||||
.putExtra(Intent.EXTRA_ROLE_NAME, mRoleName);
|
||||
mContext.startActivity(intent);
|
||||
} else {
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, mPreferenceKey);
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(DefaultAppSettings.class.getName())
|
||||
.setArguments(bundle)
|
||||
.setTitleRes(R.string.configure_apps)
|
||||
.setSourceMetricsCategory(SettingsEnums.PAGE_UNKNOWN)
|
||||
.launch();
|
||||
}
|
||||
final Intent intent = new Intent(Intent.ACTION_MANAGE_DEFAULT_APP)
|
||||
.putExtra(Intent.EXTRA_ROLE_NAME, mRoleName);
|
||||
mContext.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the app has the default app capability
|
||||
*
|
||||
* @return true if the app has the default app capability
|
||||
*/
|
||||
protected boolean hasAppCapability() {
|
||||
// TODO: STOPSHIP(b/110557011): Remove this check once we have all default apps migrated.
|
||||
if (mRoleName != null) {
|
||||
return mAppQualified;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the app is the default app
|
||||
*
|
||||
* @return true if the app is the default app
|
||||
*/
|
||||
protected boolean isDefaultApp() {
|
||||
// TODO: STOPSHIP(b/110557011): Remove this check once we have all default apps migrated.
|
||||
if (mRoleName != null) {
|
||||
final String packageName = CollectionUtils.firstOrNull(mRoleManager.getRoleHolders(
|
||||
mRoleName));
|
||||
return TextUtils.equals(mPackageName, packageName);
|
||||
}
|
||||
return false;
|
||||
private boolean isDefaultApp() {
|
||||
final String packageName = CollectionUtils.firstOrNull(mRoleManager.getRoleHolders(
|
||||
mRoleName));
|
||||
return TextUtils.equals(mPackageName, packageName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,8 @@
|
||||
|
||||
package com.android.settings.applications.appinfo;
|
||||
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import com.android.settings.applications.defaultapps.DefaultBrowserPreferenceController;
|
||||
|
||||
public class DefaultBrowserShortcutPreferenceController
|
||||
extends DefaultAppShortcutPreferenceControllerBase {
|
||||
@@ -25,19 +23,6 @@ public class DefaultBrowserShortcutPreferenceController
|
||||
private static final String KEY = "default_browser";
|
||||
|
||||
public DefaultBrowserShortcutPreferenceController(Context context, String packageName) {
|
||||
super(context, KEY, packageName);
|
||||
super(context, KEY, RoleManager.ROLE_BROWSER, packageName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasAppCapability() {
|
||||
return DefaultBrowserPreferenceController
|
||||
.hasBrowserPreference(mPackageName, mContext, UserHandle.myUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDefaultApp() {
|
||||
return new DefaultBrowserPreferenceController(mContext)
|
||||
.isBrowserDefault(mPackageName, UserHandle.myUserId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,27 +14,15 @@
|
||||
|
||||
package com.android.settings.applications.appinfo;
|
||||
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.applications.defaultapps.DefaultEmergencyPreferenceController;
|
||||
|
||||
public class DefaultEmergencyShortcutPreferenceController
|
||||
extends DefaultAppShortcutPreferenceControllerBase {
|
||||
|
||||
private static final String KEY = "default_emergency_app";
|
||||
|
||||
public DefaultEmergencyShortcutPreferenceController(Context context, String packageName) {
|
||||
super(context, KEY, packageName);
|
||||
super(context, KEY, RoleManager.ROLE_EMERGENCY, packageName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasAppCapability() {
|
||||
return DefaultEmergencyPreferenceController.hasEmergencyPreference(mPackageName, mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDefaultApp() {
|
||||
return DefaultEmergencyPreferenceController.isEmergencyDefault(mPackageName, mContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,28 +14,15 @@
|
||||
|
||||
package com.android.settings.applications.appinfo;
|
||||
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.settings.applications.defaultapps.DefaultHomePreferenceController;
|
||||
|
||||
public class DefaultHomeShortcutPreferenceController
|
||||
extends DefaultAppShortcutPreferenceControllerBase {
|
||||
|
||||
private static final String KEY = "default_home";
|
||||
|
||||
public DefaultHomeShortcutPreferenceController(Context context, String packageName) {
|
||||
super(context, KEY, packageName);
|
||||
super(context, KEY, RoleManager.ROLE_HOME, packageName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasAppCapability() {
|
||||
return DefaultHomePreferenceController.hasHomePreference(mPackageName, mContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDefaultApp() {
|
||||
return DefaultHomePreferenceController.isHomeDefault(mPackageName,
|
||||
mContext.getPackageManager());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -381,7 +381,11 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
|
||||
}
|
||||
|
||||
private void updateEid() {
|
||||
mDialog.setText(EID_INFO_VALUE_ID, mEuiccManager.getEid());
|
||||
if (mEuiccManager.isEnabled()) {
|
||||
mDialog.setText(EID_INFO_VALUE_ID, mEuiccManager.getEid());
|
||||
} else {
|
||||
mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateImsRegistrationState() {
|
||||
|
||||
@@ -1509,7 +1509,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
// Populate the Wi-Fi security spinner with the various supported key management types
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_none));
|
||||
mSecurityInPosition[idx++] = AccessPoint.SECURITY_NONE;
|
||||
if (mWifiManager.isOweSupported()) {
|
||||
if (mWifiManager.isEnhancedOpenSupported()) {
|
||||
spinnerAdapter.add(mContext.getString(R.string.wifi_security_owe));
|
||||
mSecurityInPosition[idx++] = AccessPoint.SECURITY_OWE;
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,12 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
return;
|
||||
}
|
||||
} else if (mSelectedAccessPoint.getConfig().isPasspoint()) {
|
||||
mWifiManager.removePasspointConfiguration(mSelectedAccessPoint.getConfig().FQDN);
|
||||
try {
|
||||
mWifiManager.removePasspointConfiguration(mSelectedAccessPoint.getConfig().FQDN);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(TAG, "Failed to remove Passpoint configuration with error: " + e);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
mWifiManager.forget(mSelectedAccessPoint.getConfig().networkId, mForgetListener);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
|
||||
import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -45,7 +46,6 @@ import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.FeatureFlagUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
@@ -61,6 +61,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.development.featureflags.FeatureFlagPersistent;
|
||||
import com.android.settings.widget.EntityHeaderController;
|
||||
import com.android.settings.wifi.WifiDialog;
|
||||
import com.android.settings.wifi.WifiDialog.WifiDialogListener;
|
||||
@@ -568,6 +569,12 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
||||
mWifiManager.disableEphemeralNetwork(mWifiInfo.getSSID());
|
||||
} else if (mWifiConfig != null) {
|
||||
if (mWifiConfig.isPasspoint()) {
|
||||
// Post a dialog to confirm if user really want to forget the passpoint network.
|
||||
if (FeatureFlagPersistent.isEnabled(mContext, FeatureFlags.NETWORK_INTERNET_V2)) {
|
||||
showConfirmForgetDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
mWifiManager.removePasspointConfiguration(mWifiConfig.FQDN);
|
||||
} else {
|
||||
mWifiManager.forget(mWifiConfig.networkId, null /* action listener */);
|
||||
@@ -578,6 +585,22 @@ public class WifiDetailPreferenceController extends AbstractPreferenceController
|
||||
mFragment.getActivity().finish();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected void showConfirmForgetDialog() {
|
||||
final AlertDialog dialog = new AlertDialog.Builder(mContext)
|
||||
.setPositiveButton(R.string.forget, ((dialog1, which) -> {
|
||||
mWifiManager.removePasspointConfiguration(mWifiConfig.FQDN);
|
||||
mMetricsFeatureProvider.action(
|
||||
mFragment.getActivity(), SettingsEnums.ACTION_WIFI_FORGET);
|
||||
mFragment.getActivity().finish();
|
||||
}))
|
||||
.setNegativeButton(R.string.cancel, null /* listener */)
|
||||
.setTitle(R.string.wifi_forget_dialog_title)
|
||||
.setMessage(R.string.forget_passpoint_dialog_message)
|
||||
.create();
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show QR code to share the network represented by this preference.
|
||||
*/
|
||||
|
||||
@@ -34,8 +34,6 @@ import android.permission.PermissionControllerManager;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.applications.DefaultAppSettings;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -73,7 +71,6 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
|
||||
private ShadowUserManager mShadowUserManager;
|
||||
|
||||
private TestRolePreferenceController mController;
|
||||
private TestLegacyPreferenceController mLegacyController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@@ -86,7 +83,6 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
|
||||
mShadowUserManager = shadowOf(mActivity.getSystemService(UserManager.class));
|
||||
mController = new TestRolePreferenceController(mActivity);
|
||||
when(mPreference.getKey()).thenReturn(mController.getPreferenceKey());
|
||||
mLegacyController = new TestLegacyPreferenceController(mActivity);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -141,8 +137,8 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
|
||||
when(mRoleManager.getRoleHolders(eq(TEST_ROLE_NAME))).thenReturn(Collections.singletonList(
|
||||
TEST_PACKAGE_NAME));
|
||||
final CharSequence yesText = mActivity.getText(R.string.yes);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setSummary(yesText);
|
||||
}
|
||||
|
||||
@@ -150,17 +146,17 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
|
||||
public void updateState_notRoleHoler_shouldSetSummaryToNo() {
|
||||
when(mRoleManager.getRoleHolders(eq(TEST_ROLE_NAME))).thenReturn(Collections.emptyList());
|
||||
final CharSequence noText = mActivity.getText(R.string.no);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setSummary(noText);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeClick_shouldStartManageDefaultAppIntent() {
|
||||
final ShadowActivity shadowActivity = shadowOf(mActivity);
|
||||
|
||||
mController.handlePreferenceTreeClick(mPreference);
|
||||
final Intent intent = shadowActivity.getNextStartedActivity();
|
||||
|
||||
assertThat(intent).isNotNull();
|
||||
assertThat(intent.getAction()).isEqualTo(Intent.ACTION_MANAGE_DEFAULT_APP);
|
||||
assertThat(intent.getStringExtra(Intent.EXTRA_ROLE_NAME)).isEqualTo(TEST_ROLE_NAME);
|
||||
@@ -172,76 +168,4 @@ public class DefaultAppShortcutPreferenceControllerBaseTest {
|
||||
super(context, TEST_PREFERENCE_KEY, TEST_ROLE_NAME, TEST_PACKAGE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: STOPSHIP(b/110557011): Remove following tests once we have all default apps migrated.
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_hasAppCapability_shouldReturnAvailable() {
|
||||
mShadowUserManager.setManagedProfile(false);
|
||||
mLegacyController.mHasAppCapability = true;
|
||||
|
||||
assertThat(mLegacyController.getAvailabilityStatus()).isEqualTo(
|
||||
DefaultAppShortcutPreferenceControllerBase.AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_noAppCapability_shouldReturnDisabled() {
|
||||
mShadowUserManager.setManagedProfile(false);
|
||||
mLegacyController.mHasAppCapability = false;
|
||||
|
||||
assertThat(mLegacyController.getAvailabilityStatus()).isEqualTo(
|
||||
DefaultAppShortcutPreferenceControllerBase.UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_isDefaultApp_shouldSetSummaryToYes() {
|
||||
mLegacyController.mIsDefaultApp = true;
|
||||
final CharSequence yesText = mActivity.getText(R.string.yes);
|
||||
|
||||
mLegacyController.updateState(mPreference);
|
||||
verify(mPreference).setSummary(yesText);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_notDefaultApp_shouldSetSummaryToNo() {
|
||||
mLegacyController.mIsDefaultApp = false;
|
||||
final CharSequence noText = mActivity.getText(R.string.no);
|
||||
|
||||
mLegacyController.updateState(mPreference);
|
||||
verify(mPreference).setSummary(noText);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeClick_shouldStartDefaultAppSettings() {
|
||||
final ShadowActivity shadowActivity = shadowOf(mActivity);
|
||||
|
||||
mLegacyController.handlePreferenceTreeClick(mPreference);
|
||||
final Intent intent = shadowActivity.getNextStartedActivity();
|
||||
assertThat(intent).isNotNull();
|
||||
assertThat(intent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT)).isEqualTo(
|
||||
DefaultAppSettings.class.getName());
|
||||
assertThat(intent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS).getString(
|
||||
SettingsActivity.EXTRA_FRAGMENT_ARG_KEY)).isEqualTo(TEST_PREFERENCE_KEY);
|
||||
}
|
||||
|
||||
private class TestLegacyPreferenceController
|
||||
extends DefaultAppShortcutPreferenceControllerBase {
|
||||
|
||||
private boolean mIsDefaultApp;
|
||||
private boolean mHasAppCapability;
|
||||
|
||||
private TestLegacyPreferenceController(Context context) {
|
||||
super(context, TEST_PREFERENCE_KEY, TEST_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasAppCapability() {
|
||||
return mHasAppCapability;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isDefaultApp() {
|
||||
return mIsDefaultApp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,15 +18,8 @@ package com.android.settings.applications.appinfo;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.permission.PermissionControllerManager;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -35,57 +28,27 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class DefaultBrowserShortcutPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
private PermissionControllerManager mPermissionControllerManager;
|
||||
|
||||
private Context mContext;
|
||||
private DefaultBrowserShortcutPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
||||
mController = new DefaultBrowserShortcutPreferenceController(mContext, "Package1");
|
||||
ShadowApplication.getInstance().setSystemService(Context.PERMISSION_CONTROLLER_SERVICE,
|
||||
mPermissionControllerManager);
|
||||
mController = new DefaultBrowserShortcutPreferenceController(RuntimeEnvironment.application,
|
||||
"Package1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPreferenceKey_shouldReturnDefaultBrowser() {
|
||||
assertThat(mController.getPreferenceKey()).isEqualTo("default_browser");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasAppCapability_hasBrowserCapability_shouldReturnTrue() {
|
||||
List<ResolveInfo> resolveInfos = new ArrayList<>();
|
||||
resolveInfos.add(new ResolveInfo());
|
||||
when(mPackageManager.queryIntentActivitiesAsUser(argThat(intent-> intent != null
|
||||
&& intent.getCategories().contains(Intent.CATEGORY_BROWSABLE)), anyInt(), anyInt()))
|
||||
.thenReturn(resolveInfos);
|
||||
|
||||
assertThat(mController.hasAppCapability()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasAppCapability_noBrowserCapability_shouldReturnFalse() {
|
||||
assertThat(mController.hasAppCapability()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isDefaultApp_isDefaultBrowser_shouldReturnTrue() {
|
||||
when(mPackageManager.getDefaultBrowserPackageNameAsUser(anyInt())).thenReturn("Package1");
|
||||
|
||||
assertThat(mController.isDefaultApp()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isDefaultApp_notDefaultBrowser_shouldReturnFalse() {
|
||||
assertThat(mController.isDefaultApp()).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,17 +18,8 @@ package com.android.settings.applications.appinfo;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.role.RoleManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.permission.PermissionControllerManager;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -37,62 +28,27 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class DefaultEmergencyShortcutPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private RoleManager mRoleManager;
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
private PermissionControllerManager mPermissionControllerManager;
|
||||
|
||||
private Context mContext;
|
||||
private DefaultEmergencyShortcutPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
||||
when(mContext.getSystemService(RoleManager.class)).thenReturn(mRoleManager);
|
||||
mController = new DefaultEmergencyShortcutPreferenceController(mContext, "Package1");
|
||||
ShadowApplication.getInstance().setSystemService(Context.PERMISSION_CONTROLLER_SERVICE,
|
||||
mPermissionControllerManager);
|
||||
mController = new DefaultEmergencyShortcutPreferenceController(
|
||||
RuntimeEnvironment.application, "Package1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPreferenceKey_shouldReturnDefaultEmergency() {
|
||||
assertThat(mController.getPreferenceKey()).isEqualTo("default_emergency_app");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasAppCapability_hasEmergencyCapability_shouldReturnTrue() {
|
||||
List<ResolveInfo> resolveInfos = new ArrayList<>();
|
||||
resolveInfos.add(new ResolveInfo());
|
||||
when(mPackageManager.queryIntentActivities(argThat(intent-> intent != null
|
||||
&& intent.getAction().equals(TelephonyManager.ACTION_EMERGENCY_ASSISTANCE)),
|
||||
anyInt())).thenReturn(resolveInfos);
|
||||
|
||||
assertThat(mController.hasAppCapability()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasAppCapability_noEmergencyCapability_shouldReturnFalse() {
|
||||
assertThat(mController.hasAppCapability()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isDefaultApp_isDefaultEmergency_shouldReturnTrue() {
|
||||
when(mRoleManager.getRoleHolders(RoleManager.ROLE_EMERGENCY))
|
||||
.thenReturn(Collections.singletonList("Package1"));
|
||||
|
||||
assertThat(mController.isDefaultApp()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isDefaultApp_notDefaultEmergency_shouldReturnFalse() {
|
||||
assertThat(mController.isDefaultApp()).isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,15 +18,8 @@ package com.android.settings.applications.appinfo;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyList;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import com.android.settings.applications.defaultapps.DefaultHomePreferenceController;
|
||||
import android.permission.PermissionControllerManager;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -35,62 +28,27 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.annotation.Implementation;
|
||||
import org.robolectric.annotation.Implements;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class DefaultHomeShortcutPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private PackageManager mPackageManager;
|
||||
private PermissionControllerManager mPermissionControllerManager;
|
||||
|
||||
private Context mContext;
|
||||
private DefaultHomeShortcutPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
when(mContext.getPackageManager()).thenReturn(mPackageManager);
|
||||
mController = new DefaultHomeShortcutPreferenceController(mContext, "Package1");
|
||||
ShadowApplication.getInstance().setSystemService(Context.PERMISSION_CONTROLLER_SERVICE,
|
||||
mPermissionControllerManager);
|
||||
mController = new DefaultHomeShortcutPreferenceController(RuntimeEnvironment.application,
|
||||
"Package1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPreferenceKey_shouldReturnDefaultHome() {
|
||||
assertThat(mController.getPreferenceKey()).isEqualTo("default_home");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowDefaultHomePreferenceController.class)
|
||||
public void hasAppCapability_hasHomeCapability_shouldReturnTrue() {
|
||||
assertThat(mController.hasAppCapability()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hasAppCapability_noHomeCapability_shouldReturnFalse() {
|
||||
assertThat(mController.hasAppCapability()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isDefaultApp_isDefaultHome_shouldReturnTrue() {
|
||||
when(mPackageManager.getHomeActivities(anyList()))
|
||||
.thenReturn(new ComponentName("Package1", "cls1"));
|
||||
assertThat(mController.isDefaultApp()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isDefaultApp_notDefaultHome_shouldReturnFalse() {
|
||||
when(mPackageManager.getHomeActivities(anyList()))
|
||||
.thenReturn(new ComponentName("pkg2", "cls1"));
|
||||
assertThat(mController.isDefaultApp()).isFalse();
|
||||
}
|
||||
|
||||
@Implements(DefaultHomePreferenceController.class)
|
||||
public static class ShadowDefaultHomePreferenceController {
|
||||
@Implementation
|
||||
protected static boolean hasHomePreference(String pkg, Context context) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +124,7 @@ public class SimStatusDialogControllerTest {
|
||||
doReturn("").when(mController).getPhoneNumber();
|
||||
doReturn(mSignalStrength).when(mController).getSignalStrength();
|
||||
|
||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
||||
when(mEuiccManager.getEid()).thenReturn("");
|
||||
ReflectionHelpers.setField(mController, "mTelephonyManager", mTelephonyManager);
|
||||
ReflectionHelpers.setField(mController, "mCarrierConfigManager", mCarrierConfigManager);
|
||||
@@ -352,6 +353,17 @@ public class SimStatusDialogControllerTest {
|
||||
mController.initialize();
|
||||
|
||||
verify(mDialog).setText(EID_INFO_VALUE_ID, eid);
|
||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initialize_showEid_euiccManagerIsNotEnabled() {
|
||||
when(mEuiccManager.isEnabled()).thenReturn(false);
|
||||
|
||||
mController.initialize();
|
||||
|
||||
verify(mDialog, never()).setText(eq(EID_INFO_VALUE_ID), any());
|
||||
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -324,7 +324,7 @@ public class WifiConfigControllerTest {
|
||||
WifiManager wifiManager = mock(WifiManager.class);
|
||||
when(wifiManager.isWpa3SaeSupported()).thenReturn(saeVisible);
|
||||
when(wifiManager.isWpa3SuiteBSupported()).thenReturn(suitebVisible);
|
||||
when(wifiManager.isOweSupported()).thenReturn(oweVisible);
|
||||
when(wifiManager.isEnhancedOpenSupported()).thenReturn(oweVisible);
|
||||
|
||||
mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
|
||||
WifiConfigUiBase.MODE_MODIFY, wifiManager);
|
||||
|
||||
@@ -65,6 +65,8 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.development.featureflags.FeatureFlagPersistent;
|
||||
import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
|
||||
import com.android.settings.testutils.shadow.ShadowEntityHeaderController;
|
||||
import com.android.settings.widget.EntityHeaderController;
|
||||
@@ -755,6 +757,36 @@ public class WifiDetailPreferenceControllerTest {
|
||||
.action(mockActivity, MetricsProto.MetricsEvent.ACTION_WIFI_FORGET);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forgetNetwork_Passpoint() {
|
||||
mockWifiConfig.networkId = 5;
|
||||
when(mockWifiConfig.isPasspoint()).thenReturn(true);
|
||||
|
||||
mController.displayPreference(mockScreen);
|
||||
mForgetClickListener.getValue().onClick(null);
|
||||
|
||||
verify(mockWifiManager).removePasspointConfiguration(mockWifiConfig.FQDN);
|
||||
verify(mockMetricsFeatureProvider)
|
||||
.action(mockActivity, MetricsProto.MetricsEvent.ACTION_WIFI_FORGET);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forgetNetwork_PasspointV2_shouldShowDialog() {
|
||||
final WifiDetailPreferenceController spyController = spy(mController);
|
||||
|
||||
mockWifiConfig.networkId = 5;
|
||||
when(mockWifiConfig.isPasspoint()).thenReturn(true);
|
||||
FeatureFlagPersistent.setEnabled(mContext, FeatureFlags.NETWORK_INTERNET_V2, true);
|
||||
|
||||
spyController.displayPreference(mockScreen);
|
||||
mForgetClickListener.getValue().onClick(null);
|
||||
|
||||
verify(mockWifiManager, times(0)).removePasspointConfiguration(mockWifiConfig.FQDN);
|
||||
verify(mockMetricsFeatureProvider, times(0))
|
||||
.action(mockActivity, MetricsProto.MetricsEvent.ACTION_WIFI_FORGET);
|
||||
verify(spyController).showConfirmForgetDialog();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void networkStateChangedIntent_shouldRefetchInfo() {
|
||||
displayAndResume();
|
||||
|
||||
Reference in New Issue
Block a user