Snap for 6437181 from 52614d9226 to mainline-release

Change-Id: I97e4a66b584081c4c78414524c64b47874249bb8
This commit is contained in:
android-build-team Robot
2020-04-28 07:06:27 +00:00
31 changed files with 245 additions and 50 deletions

View File

@@ -5188,7 +5188,8 @@
<!-- Summary for autoclick seekbar settings preference when user selected custom item. [CHAR LIMIT=35] -->
<plurals name="accessibilty_autoclick_delay_unit_second">
<item quantity="one"><xliff:g id="click_delay_label" example="1">%1$s</xliff:g> second</item>
<item quantity="other"><xliff:g id="click_delay_label" example="0.6">%1$s</xliff:g> seconds</item>
<item quantity="few"><xliff:g id="click_delay_label" example="0.6">%1$s</xliff:g> seconds</item>
<item quantity="other"><xliff:g id="click_delay_label">%1$s</xliff:g> seconds</item>
</plurals>
<!-- Summary for vibration settings preference when notification vibration and haptic feedback intensity are set. [CHAR LIMIT=50] -->
@@ -7998,7 +7999,7 @@
<!-- Do not disturb settings, main screen, field, schedules [CHAR LIMIT=100]-->
<string name="zen_category_schedule">Schedules</string>
<!-- Do not disturb settings, main screen, field, duration setting where user can specify how
long dnd will last when toggling dnd on from qs or settings) [CHAR LIMIT=100] -->
long dnd will last when toggling dnd on from qs) [CHAR LIMIT=100] -->
<string name="zen_category_duration">Duration for Quick Settings</string>
<!-- Do not disturb settings, sound and vibrations screen footer [CHAR LIMIT=NONE]-->
@@ -8989,8 +8990,11 @@
<!-- [CHAR LIMIT=NONE] Zen mode custom rule settings: Messages screen footer -->
<string name="zen_mode_custom_messages_footer">For \u2018<xliff:g id="schedule_name" example="Schedule 1">%1$s</xliff:g>\u2019 incoming messages are blocked. You can adjust settings to allow your friends, family, or other contacts to reach you.</string>
<!-- Zen mode settings: All senders can bypass DND summary [CHAR LIMIT=NONE -->
<string name="zen_mode_all_senders_summary">All <xliff:g id="sender_category" example="messages">%s</xliff:g> can reach you</string>
<!-- Zen mode settings: All messages can bypass DND summary [CHAR LIMIT=NONE -->
<string name="zen_mode_all_messages_summary">All messages can reach you</string>
<!-- Zen mode settings: All calls can bypass DND summary [CHAR LIMIT=NONE -->
<string name="zen_mode_all_calls_summary">All calls can reach you</string>
<!-- Zen mode settings: Senders in contacts can bypass DND summary summary [CHAR LIMIT=NONE -->
<string name="zen_mode_contacts_senders_summary"><xliff:g id="num_contacts" example="120">%d</xliff:g> contacts</string>
@@ -9019,8 +9023,10 @@
<string name="zen_mode_alarms">Alarms</string>
<!-- [CHAR LIMIT=NONE] Zen mode settings: Allow alarms summary -->
<string name="zen_mode_alarms_summary">From timers, alarms, security systems, and other apps</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Alarms option (ie: sound from alarm clock) -->
<!-- [CHAR LIMIT=50] Zen mode settings: Alarms list option (ie: sound from alarm clock) -->
<string name="zen_mode_alarms_list">alarms</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Alarms (ie: sound from alarm clock) category in a list of sounds that can bypass DND when alarms is the first or only element in the list. For example "Alarms can interrupt" or "Alarms and media can interrupt" -->
<string name="zen_mode_alarms_list_first">Alarms</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Allow media (sound from video) to bypass dnd -->
<string name="zen_mode_media">Media sounds</string>
@@ -9028,6 +9034,8 @@
<string name="zen_mode_media_summary">Sounds from videos, games, and other media</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Media (ie: sound from video) -->
<string name="zen_mode_media_list">media</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Media (ie: sound from video) category in a list of sounds when media is the first or only element in the list. For example "Media can interrupt" or "Media and touch sounds can interrupt" -->
<string name="zen_mode_media_list_first">Media</string>
<!-- [CHAR LIMIT=80] Zen mode settings: allow touch sounds to bypass DND -->
<string name="zen_mode_system">Touch sounds</string>
@@ -9035,6 +9043,8 @@
<string name="zen_mode_system_summary">Sounds from the keyboard and other buttons</string>
<!-- [CHAR LIMIT=50] Zen mode settings: System sounds (ie: touch sounds) -->
<string name="zen_mode_system_list">touch sounds</string>
<!-- [CHAR LIMIT=50] Zen mode settings: System sounds (ie: touch sounds) category in a list of sounds that can bypass DND when touch sounds is the first or only element in the list. For example "Touch sounds can interrupt" or "Touch sounds and events can interrupt" -->
<string name="zen_mode_system_list_first">Touch sounds</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Allow reminder notifications/sounds to bypass DND -->
<string name="zen_mode_reminders">Reminders</string>
@@ -9042,6 +9052,8 @@
<string name="zen_mode_reminders_summary">From tasks and reminders</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Reminders (ie: calendar reminders are allowed to bypass dnd) -->
<string name="zen_mode_reminders_list">reminders</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Reminders (ie: calendar reminders) category in a list of elements that can bypass DND where reminders is the first or only element in the list. For example, "Reminds can interrupt” or "Reminders and events can interrupt” -->
<string name="zen_mode_reminders_list_first">Reminders</string>
<!-- [CHAR LIMIT=80] Zen mode settings: Allow event notifications/sounds to bypass DND -->
<string name="zen_mode_events">Calendar events</string>
@@ -9049,6 +9061,8 @@
<string name="zen_mode_events_summary">From upcoming calendar events</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Events (ie: calendar events) -->
<string name="zen_mode_events_list">events</string>
<!-- [CHAR LIMIT=50] Zen mode settings: Events (ie: calendar events) category in a list of sounds when events is the first or only element in the list. For example “Events can interrupt" or “Events and touch sounds can interrupt" -->
<string name="zen_mode_events_list_first">Events</string>
<!-- [CHAR LIMIT=100] Zen mode settings: Allow apps to bypass DND -->
<string name="zen_mode_bypassing_apps">Allow apps to override</string>

View File

@@ -52,11 +52,12 @@ public class LegacyAccessibilityServicePreferenceFragment extends
@Override
int getUserShortcutTypes() {
int shortcutTypes = super.getUserShortcutTypes();
final boolean isServiceOn =
getArguments().getBoolean(AccessibilitySettings.EXTRA_CHECKED);
final AccessibilityServiceInfo info = getAccessibilityServiceInfo();
final boolean hasRequestAccessibilityButtonFlag =
(info.flags & AccessibilityServiceInfo.FLAG_REQUEST_ACCESSIBILITY_BUTTON) != 0;
if (hasRequestAccessibilityButtonFlag) {
if (hasRequestAccessibilityButtonFlag && isServiceOn) {
shortcutTypes |= UserShortcutType.SOFTWARE;
} else {
shortcutTypes &= (~UserShortcutType.SOFTWARE);

View File

@@ -205,7 +205,7 @@ public class ToggleAutoclickCustomSeekbarController extends BasePreferenceContro
}
private CharSequence delayTimeToString(int delayMillis) {
final int quantity = (delayMillis == 1000) ? Quantity.ONE : Quantity.OTHER;
final int quantity = (delayMillis == 1000) ? Quantity.ONE : Quantity.FEW;
final float delaySecond = (float) delayMillis / 1000;
// Only show integer when delay time is 1.
final String decimalFormat = (delaySecond == 1) ? "%.0f" : "%.1f";

View File

@@ -53,11 +53,13 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
@Retention(SOURCE)
@IntDef({
Quantity.OTHER,
Quantity.ONE
Quantity.ONE,
Quantity.FEW
})
@interface Quantity {
int OTHER = 0;
int ONE = 1;
int FEW = 3;
}
/**
@@ -79,7 +81,7 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
*/
static CharSequence getAutoclickPreferenceSummary(Resources resources, int delayMillis) {
final int summaryIndex = getAutoclickPreferenceSummaryIndex(delayMillis);
final int quantity = (delayMillis == 1000) ? Quantity.ONE : Quantity.OTHER;
final int quantity = (delayMillis == 1000) ? Quantity.ONE : Quantity.FEW;
final float delaySecond = (float) delayMillis / 1000;
// Only show integer when delay time is 1.
final String decimalFormat = (delaySecond == 1) ? "%.0f" : "%.1f";

View File

@@ -114,25 +114,30 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
*/
public void init(int subscriptionId) {
mSubId = subscriptionId;
mDataUsageController = null;
}
mDefaultTemplate = DataUsageUtils.getDefaultTemplate(mContext, mSubId);
private void updateConfiguration(Context context,
int subscriptionId, SubscriptionInfo subInfo) {
final NetworkPolicyManager policyManager =
mContext.getSystemService(NetworkPolicyManager.class);
context.getSystemService(NetworkPolicyManager.class);
mPolicyEditor = new NetworkPolicyEditor(policyManager);
mHasMobileData = DataUsageUtils.hasMobileData(mContext);
mHasMobileData = DataUsageUtils.hasMobileData(context);
mDataUsageController = new DataUsageController(mContext);
mDataUsageController.setSubscriptionId(mSubId);
mDataUsageController = new DataUsageController(context);
mDataUsageController.setSubscriptionId(subscriptionId);
mDataInfoController = new DataUsageInfoController();
final SubscriptionInfo subInfo = getSubscriptionInfo(mSubId);
if (subInfo != null) {
mDataUsageTemplate = R.string.cell_data_template;
} else if (DataUsageUtils.hasWifiRadio(mContext)) {
mDefaultTemplate = DataUsageUtils.getMobileTemplate(context, subscriptionId);
} else if (DataUsageUtils.hasWifiRadio(context)) {
mDataUsageTemplate = R.string.wifi_data_template;
mDefaultTemplate = NetworkTemplate.buildTemplateWifiWildcard();
} else {
mDataUsageTemplate = R.string.ethernet_data_template;
mDefaultTemplate = DataUsageUtils.getDefaultTemplate(context, subscriptionId);
}
}
@@ -198,8 +203,8 @@ public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenc
DataUsageSummaryPreference summaryPreference = (DataUsageSummaryPreference) preference;
final SubscriptionInfo subInfo = getSubscriptionInfo(mSubId);
if (subInfo == null) {
mDefaultTemplate = NetworkTemplate.buildTemplateWifiWildcard();
if (mDataUsageController == null) {
updateConfiguration(mContext, mSubId, subInfo);
}
final DataUsageController.DataUsageInfo info =

View File

@@ -83,6 +83,9 @@ public class MediaOutputGroupSlice implements CustomSliceable {
final IconCompat titleIcon = IconCompat.createWithResource(mContext,
R.drawable.ic_speaker_group_black_24dp);
final Bitmap emptyBitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
if (getWorker() == null) {
return listBuilder.build();
}
final int maxVolume = getWorker().getSessionVolumeMax();
final String title = mContext.getString(R.string.media_output_group);
final SliceAction primaryAction = SliceAction.createDeeplink(

View File

@@ -120,14 +120,17 @@ public class MediaOutputIndicatorSlice implements CustomSliceable {
return mWorker;
}
private boolean isVisible() {
@VisibleForTesting
boolean isVisible() {
// To decide Slice's visibility.
// Return true if
// 1. AudioMode is not in on-going call
// 2. worker is not null
// 3. Available devices are more than 0
// 4. The local media session is active and the state is playing.
return getWorker() != null
&& !com.android.settingslib.Utils.isAudioModeOngoingCall(mContext)
&& getWorker().getMediaDevices().size() > 0;
&& getWorker().getMediaDevices().size() > 0
&& getWorker().getActiveLocalMediaController() != null;
}
}

View File

@@ -19,10 +19,21 @@ package com.android.settings.network.telephony;
import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
import android.content.ComponentName;
import android.content.Context;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.network.SubscriptionUtil;
@@ -31,13 +42,6 @@ import com.android.settings.network.SubscriptionsChangeListener;
import java.util.ArrayList;
import java.util.List;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
/**
* This implements common controller functionality for a Preference letting the user see/change
* what mobile network subscription is used by default for some service controlled by the
@@ -51,10 +55,17 @@ public abstract class DefaultSubscriptionController extends BasePreferenceContro
protected SubscriptionsChangeListener mChangeListener;
protected ListPreference mPreference;
protected SubscriptionManager mManager;
protected TelecomManager mTelecomManager;
private static final String EMERGENCY_ACCOUNT_HANDLE_ID = "E";
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
new ComponentName("com.android.phone",
"com.android.services.telephony.TelephonyConnectionService");
public DefaultSubscriptionController(Context context, String preferenceKey) {
super(context, preferenceKey);
mManager = context.getSystemService(SubscriptionManager.class);
mTelecomManager = mContext.getSystemService(TelecomManager.class);
mChangeListener = new SubscriptionsChangeListener(context, this);
}
@@ -103,8 +114,14 @@ public abstract class DefaultSubscriptionController extends BasePreferenceContro
@Override
public CharSequence getSummary() {
final PhoneAccountHandle handle = getDefaultCallingAccountHandle();
if ((handle != null) && (!isCallingAccountBindToSubscription(handle))) {
// display VoIP account in summary when configured through settings within dialer
return getLabelFromCallingAccount(handle);
}
final SubscriptionInfo info = getDefaultSubscriptionInfo();
if (info != null) {
// display subscription based account
return info.getDisplayName();
} else {
return mContext.getString(R.string.calls_and_sms_ask_every_time);
@@ -161,6 +178,56 @@ public abstract class DefaultSubscriptionController extends BasePreferenceContro
}
}
/**
* Get default calling account
*
* @return current calling account {@link PhoneAccountHandle}
*/
public PhoneAccountHandle getDefaultCallingAccountHandle() {
final PhoneAccountHandle currentSelectPhoneAccount =
mTelecomManager.getUserSelectedOutgoingPhoneAccount();
if (currentSelectPhoneAccount == null) {
return null;
}
final List<PhoneAccountHandle> accountHandles =
mTelecomManager.getCallCapablePhoneAccounts(false);
final PhoneAccountHandle emergencyAccountHandle = new PhoneAccountHandle(
PSTN_CONNECTION_SERVICE_COMPONENT, EMERGENCY_ACCOUNT_HANDLE_ID);
if (currentSelectPhoneAccount.equals(emergencyAccountHandle)) {
return null;
}
for (PhoneAccountHandle handle : accountHandles) {
if (currentSelectPhoneAccount.equals(handle)) {
return currentSelectPhoneAccount;
}
}
return null;
}
/**
* Check if calling account bind to subscription
*
* @param handle {@link PhoneAccountHandle} for specific calling account
*/
public boolean isCallingAccountBindToSubscription(PhoneAccountHandle handle) {
return mTelecomManager.getPhoneAccount(handle)
.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION);
}
/**
* Get label from calling account
*
* @param handle to get label from {@link PhoneAccountHandle}
* @return label of calling account
*/
public CharSequence getLabelFromCallingAccount(PhoneAccountHandle handle) {
CharSequence label = mTelecomManager.getPhoneAccount(handle).getLabel();
if (label != null) {
label = mContext.getPackageManager().getUserBadgedLabel(label, handle.getUserHandle());
}
return (label != null) ? label : "";
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final int subscriptionId = Integer.parseInt((String) newValue);

View File

@@ -129,6 +129,7 @@ public class MobileNetworkSettings extends RestrictedDashboardFragment {
public void onAttach(Context context) {
super.onAttach(context);
use(DataUsageSummaryPreferenceController.class).init(mSubId);
use(CallsDefaultSubscriptionController.class).init(getLifecycle());
use(SmsDefaultSubscriptionController.class).init(getLifecycle());
use(MobileNetworkSwitchController.class).init(getLifecycle(), mSubId);

View File

@@ -17,6 +17,7 @@
package com.android.settings.network.telephony;
import android.content.Context;
import android.telecom.PhoneAccountHandle;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -40,4 +41,10 @@ public class SmsDefaultSubscriptionController extends DefaultSubscriptionControl
protected void setDefaultSubscription(int subscriptionId) {
mManager.setDefaultSmsSubId(subscriptionId);
}
@Override
public PhoneAccountHandle getDefaultCallingAccountHandle() {
// Not supporting calling account override by VoIP
return null;
}
}

View File

@@ -30,17 +30,19 @@ public class ZenDurationDialogPreference extends CustomDialogPreferenceCompat {
public ZenDurationDialogPreference(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setSingleLineTitle(false);
}
public ZenDurationDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setSingleLineTitle(false);
}
public ZenDurationDialogPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setSingleLineTitle(false);
}
@Override
protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
DialogInterface.OnClickListener listener) {

View File

@@ -150,10 +150,9 @@ public class ZenModePrioritySendersPreferenceController
case KEY_CONTACTS:
return mBackend.getContactsNumberSummary(mContext);
case KEY_ANY:
return mContext.getResources().getString(R.string.zen_mode_all_senders_summary,
mContext.getResources().getString(mIsMessages
? R.string.zen_mode_messages_list
: R.string.zen_mode_calls_list));
return mContext.getResources().getString(mIsMessages
? R.string.zen_mode_all_messages_summary
: R.string.zen_mode_all_calls_summary);
case KEY_NONE:
default:
return null;

View File

@@ -265,19 +265,19 @@ public class ZenModeSettings extends ZenModeSettingsBase {
private String getCategory(int category, Policy policy, boolean isFirst) {
if (category == PRIORITY_CATEGORY_ALARMS) {
if (isFirst) {
return mContext.getString(R.string.zen_mode_alarms);
return mContext.getString(R.string.zen_mode_alarms_list_first);
} else {
return mContext.getString(R.string.zen_mode_alarms_list);
}
} else if (category == PRIORITY_CATEGORY_MEDIA) {
if (isFirst) {
return mContext.getString(R.string.zen_mode_media);
return mContext.getString(R.string.zen_mode_media_list_first);
} else {
return mContext.getString(R.string.zen_mode_media_list);
}
} else if (category == PRIORITY_CATEGORY_SYSTEM) {
if (isFirst) {
return mContext.getString(R.string.zen_mode_system);
return mContext.getString(R.string.zen_mode_system_list_first);
} else {
return mContext.getString(R.string.zen_mode_system_list);
}
@@ -291,13 +291,13 @@ public class ZenModeSettings extends ZenModeSettingsBase {
}
} else if (category == Policy.PRIORITY_CATEGORY_EVENTS) {
if (isFirst) {
return mContext.getString(R.string.zen_mode_events);
return mContext.getString(R.string.zen_mode_events_list_first);
} else {
return mContext.getString(R.string.zen_mode_events_list);
}
} else if (category == Policy.PRIORITY_CATEGORY_REMINDERS) {
if (isFirst) {
return mContext.getString(R.string.zen_mode_reminders);
return mContext.getString(R.string.zen_mode_reminders_list_first);
} else {
return mContext.getString(R.string.zen_mode_reminders_list);
}

View File

@@ -38,6 +38,9 @@ import com.android.settingslib.wifi.AccessPoint;
*
* The AccessPoint should be saved to the argument when launching this class in order to properly
* render this page.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in {@link ConfigureWifiEntryFragment}.
*/
public class ConfigureAccessPointFragment extends InstrumentedFragment implements WifiConfigUiBase {

View File

@@ -27,7 +27,10 @@ import com.android.settings.R;
import com.android.settingslib.wifi.AccessPoint;
/**
* An AP preference for the currently connected AP
* An AP preference for the currently connected AP.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in {@link ConnectedWifiEntryPreference}.
*/
public class ConnectedAccessPointPreference extends LongPressAccessPointPreference implements
View.OnClickListener {

View File

@@ -23,6 +23,12 @@ import androidx.preference.PreferenceViewHolder;
import com.android.settingslib.wifi.AccessPoint;
import com.android.settingslib.wifi.AccessPointPreference;
/**
* An AP preference for the currently connected AP.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in {@link com.android.settingslib.wifi.LongPressWifiEntryPreference}.
*/
public class LongPressAccessPointPreference extends AccessPointPreference {
private final Fragment mFragment;

View File

@@ -86,6 +86,9 @@ import java.util.stream.Collectors;
/**
* The class for allowing UIs like {@link WifiDialog} and {@link WifiConfigUiBase} to
* share the logic for controlling buttons, text fields, etc.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in {@link WifiConfigController2}.
*/
public class WifiConfigController implements TextWatcher,
AdapterView.OnItemSelectedListener, OnCheckedChangeListener,

View File

@@ -22,6 +22,9 @@ import android.widget.Button;
/**
* Foundation interface glues between Activities and UIs like {@link WifiDialog}.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in {@link WifiConfigUiBase2}.
*/
public interface WifiConfigUiBase {
@@ -56,4 +59,4 @@ public interface WifiConfigUiBase {
public Button getSubmitButton();
public Button getForgetButton();
public Button getCancelButton();
}
}

View File

@@ -19,7 +19,6 @@ package com.android.settings.wifi;
import android.annotation.StyleRes;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
@@ -33,6 +32,12 @@ import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedLockUtilsInternal;
import com.android.settingslib.wifi.AccessPoint;
/**
* Dialog for users to edit a Wi-Fi network.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in {@link WifiDialog2}.
*/
public class WifiDialog extends AlertDialog implements WifiConfigUiBase,
DialogInterface.OnClickListener {

View File

@@ -90,6 +90,9 @@ import java.util.List;
*
* The second is for Setup Wizard, with a simplified interface that hides the action bar
* and menus.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in {@link WifiSettings2}.
*/
@SearchIndexable
public class WifiSettings extends RestrictedSettingsFragment

View File

@@ -25,11 +25,14 @@ import androidx.preference.Preference;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.wifi.dpp.WifiDppUtils;
import com.android.settingslib.wifi.AccessPoint;
/**
* {@link BasePreferenceController} that launches Wi-Fi Easy Connect configurator flow
* {@link BasePreferenceController} that launches Wi-Fi Easy Connect configurator flow.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in
* {@link com.android.settings.wifi.details2.AddDevicePreferenceController2}.
*/
public class AddDevicePreferenceController extends BasePreferenceController {

View File

@@ -99,6 +99,10 @@ import java.util.stream.Collectors;
/**
* Controller for logic pertaining to displaying Wifi information for the
* {@link WifiNetworkDetailsFragment}.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in
* {@link com.android.settings.wifi.details2.WifiDetailPreferenceController2}.
*/
public class WifiDetailPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin, WifiDialogListener, LifecycleObserver, OnPause,

View File

@@ -31,7 +31,11 @@ import com.android.settings.wifi.WifiDialog;
import com.android.settingslib.core.AbstractPreferenceController;
/**
* {@link AbstractPreferenceController} that controls whether the wifi network is metered or not
* {@link AbstractPreferenceController} that controls whether the wifi network is metered or not.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in
* {@link com.android.settings.wifi.details2.WifiMeteredPreferenceControlle2}.
*/
public class WifiMeteredPreferenceController extends BasePreferenceController implements
Preference.OnPreferenceChangeListener, WifiDialog.WifiDialogListener {

View File

@@ -46,6 +46,10 @@ import java.util.List;
*
* <p>The AccessPoint should be saved to the intent Extras when launching this class via
* {@link AccessPoint#saveWifiState(Bundle)} in order to properly render this page.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in
* {@link com.android.settings.wifi.details2.WifiNetworkDetailsFragment2}.
*/
public class WifiNetworkDetailsFragment extends DashboardFragment implements
WifiDialog.WifiDialogListener {

View File

@@ -33,7 +33,11 @@ import com.android.settingslib.core.AbstractPreferenceController;
/**
* {@link AbstractPreferenceController} that controls whether the wifi network is mac randomized
* or not
* or not.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in
* {@link com.android.settings.wifi.details2.WifiPrivacyPreferenceController2}.
*/
public class WifiPrivacyPreferenceController extends BasePreferenceController implements
Preference.OnPreferenceChangeListener, WifiDialog.WifiDialogListener {

View File

@@ -35,6 +35,10 @@ import java.util.stream.Collectors;
/**
* Controller that manages a PreferenceGroup, which contains a list of saved access points.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in
* {@link com.android.settings.wifi.savedaccesspoints2.SavedAccessPointsPreferenceController2}.
*/
public class SavedAccessPointsPreferenceController extends BasePreferenceController implements
Preference.OnPreferenceClickListener {

View File

@@ -34,6 +34,10 @@ import com.android.settingslib.wifi.AccessPointPreference;
/**
* UI to manage saved networks/access points.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in
* {@link com.android.settings.wifi.savedaccesspoints2.SavedAccessPointsWifiSettings2}.
*/
public class SavedAccessPointsWifiSettings extends DashboardFragment {

View File

@@ -24,6 +24,10 @@ import java.util.stream.Collectors;
/**
* Controller that manages a PreferenceGroup, which contains a list of subscribed access points.
*
* Migrating from Wi-Fi SettingsLib to to WifiTrackerLib, this object will be removed in the near
* future, please develop in
* {@link com.android.settings.wifi.savedaccesspoints2.SubscribedAccessPointsPreferenceController2}.
*/
public class SubscribedAccessPointsPreferenceController extends
SavedAccessPointsPreferenceController {

View File

@@ -156,6 +156,12 @@ public class MediaOutputGroupSliceTest {
assertThat(rows).isEqualTo(3);
}
@Test
public void getSlice_nullWorker_noException() {
sMediaDeviceUpdateWorker = null;
mMediaOutputGroupSlice.getSlice();
}
@Test
public void getSlice_withOneSelectableDevice_checkTitle() {
mSelectableDevices.add(mDevice1);

View File

@@ -120,6 +120,8 @@ public class MediaOutputIndicatorSliceTest {
public void getSlice_withConnectedDevice_verifyMetadata() {
mDevices.add(mDevice1);
when(sMediaOutputIndicatorWorker.getMediaDevices()).thenReturn(mDevices);
doReturn(mMediaController).when(sMediaOutputIndicatorWorker)
.getActiveLocalMediaController();
doReturn(mDevice1).when(sMediaOutputIndicatorWorker).getCurrentConnectedMediaDevice();
mAudioManager.setMode(AudioManager.MODE_NORMAL);
@@ -215,6 +217,30 @@ public class MediaOutputIndicatorSliceTest {
MediaOutputSliceConstants.KEY_MEDIA_SESSION_TOKEN) == null).isTrue();
}
@Test
public void isVisible_allConditionMatched_returnTrue() {
mAudioManager.setMode(AudioManager.MODE_NORMAL);
mDevices.add(mDevice1);
when(sMediaOutputIndicatorWorker.getMediaDevices()).thenReturn(mDevices);
doReturn(mMediaController).when(sMediaOutputIndicatorWorker)
.getActiveLocalMediaController();
assertThat(mMediaOutputIndicatorSlice.isVisible()).isTrue();
}
@Test
public void isVisible_noActiveSession_returnFalse() {
mAudioManager.setMode(AudioManager.MODE_NORMAL);
mDevices.add(mDevice1);
when(sMediaOutputIndicatorWorker.getMediaDevices()).thenReturn(mDevices);
doReturn(null).when(sMediaOutputIndicatorWorker)
.getActiveLocalMediaController();
assertThat(mMediaOutputIndicatorSlice.isVisible()).isFalse();
}
@Implements(SliceBackgroundWorker.class)
public static class ShadowSliceBackgroundWorker {

View File

@@ -11,6 +11,7 @@ import static org.robolectric.Robolectric.buildActivity;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -25,7 +26,6 @@ import com.android.settings.testutils.shadow.ShadowUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -103,12 +103,13 @@ public class RedactionInterstitialTest {
}
@Test
@Ignore
public void managedProfileNoRestrictionsTest() {
setupSettings(1 /* show */, 1 /* showUnredacted */);
final ShadowUserManager sum =
Shadow.extract(RuntimeEnvironment.application.getSystemService(UserManager.class));
sum.setManagedProfile(true);
sum.addProfile(
UserHandle.myUserId(), UserHandle.myUserId(),
"work-profile"/* profileName */, UserInfo.FLAG_MANAGED_PROFILE);
setupActivity();
assertHideAllVisible(false);
@@ -117,12 +118,13 @@ public class RedactionInterstitialTest {
}
@Test
@Ignore
public void managedProfileUnredactedRestrictionTest() {
setupSettings(1 /* show */, 1 /* showUnredacted */);
final ShadowUserManager sum =
Shadow.extract(RuntimeEnvironment.application.getSystemService(UserManager.class));
sum.setManagedProfile(true);
sum.addProfile(
UserHandle.myUserId(), UserHandle.myUserId(),
"work-profile"/* profileName */, UserInfo.FLAG_MANAGED_PROFILE);
ShadowRestrictedLockUtilsInternal.setKeyguardDisabledFeatures(
KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS);
setupActivity();