Snap for 10296703 from 2e9e7dc954
to udc-qpr1-release
Change-Id: I576f919c3937384ca6f3db6fc95c8b7df6ead057
This commit is contained in:
@@ -720,7 +720,7 @@
|
|||||||
<!-- Description for using device controls feature with a locked phone [CHAR LIMIT=NONE] -->
|
<!-- Description for using device controls feature with a locked phone [CHAR LIMIT=NONE] -->
|
||||||
<string name="lockscreen_trivial_controls_summary" product="default">Without unlocking your phone</string>
|
<string name="lockscreen_trivial_controls_summary" product="default">Without unlocking your phone</string>
|
||||||
<!-- Description for using device controls feature with a locked tablet [CHAR LIMIT=NONE] -->
|
<!-- Description for using device controls feature with a locked tablet [CHAR LIMIT=NONE] -->
|
||||||
<string name="lockscreen_trivial_controls_summary" product="tabled">Without unlocking your tablet</string>
|
<string name="lockscreen_trivial_controls_summary" product="tablet">Without unlocking your tablet</string>
|
||||||
|
|
||||||
<!-- Accessibility summary text for auto rotate [CHAR LIMIT=NONE] -->
|
<!-- Accessibility summary text for auto rotate [CHAR LIMIT=NONE] -->
|
||||||
<string name="auto_rotate_summary_a11y" product="default">When you move your phone between portrait and landscape</string>
|
<string name="auto_rotate_summary_a11y" product="default">When you move your phone between portrait and landscape</string>
|
||||||
|
@@ -18,9 +18,9 @@
|
|||||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid
|
<solid
|
||||||
android:color="?androidprv:attr/materialColorPrimaryContainer" />
|
android:color="?androidprv:attr/materialColorSecondaryContainer" />
|
||||||
<stroke
|
<stroke
|
||||||
android:width="1dp"
|
android:width="1dp"
|
||||||
android:color="?androidprv:attr/materialColorOnPrimaryContainer"/>
|
android:color="?androidprv:attr/materialColorOnSecondaryContainer"/>
|
||||||
<corners android:radius="@dimen/rect_button_radius" />
|
<corners android:radius="@dimen/rect_button_radius" />
|
||||||
</shape>
|
</shape>
|
||||||
|
@@ -29,8 +29,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:paddingBottom="24dp">
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/cancelButton"
|
android:id="@+id/cancelButton"
|
||||||
@@ -87,6 +86,7 @@
|
|||||||
android:paddingStart="?attr/sudMarginStart"
|
android:paddingStart="?attr/sudMarginStart"
|
||||||
android:paddingEnd="?attr/sudMarginEnd"
|
android:paddingEnd="?attr/sudMarginEnd"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
android:gravity="center_vertical"/>
|
android:gravity="center_vertical"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -96,8 +96,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="?attr/sudMarginStart"
|
android:layout_marginStart="?attr/sudMarginStart"
|
||||||
android:layout_marginEnd="?attr/sudMarginEnd"
|
android:layout_marginEnd="?attr/sudMarginEnd"
|
||||||
android:layout_marginTop="60dp"
|
|
||||||
android:layout_marginBottom="14dp"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:text="@string/work_challenge_emergency_button_text"/>
|
android:text="@string/work_challenge_emergency_button_text"/>
|
||||||
|
@@ -61,6 +61,7 @@
|
|||||||
android:layout_marginStart="?attr/sudMarginStart"
|
android:layout_marginStart="?attr/sudMarginStart"
|
||||||
android:layout_marginEnd="?attr/sudMarginEnd"
|
android:layout_marginEnd="?attr/sudMarginEnd"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
android:gravity="center_vertical"/>
|
android:gravity="center_vertical"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
|
@@ -27,11 +27,11 @@
|
|||||||
android:clipChildren="true"
|
android:clipChildren="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.android.settings.localepicker.LocaleRecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/dragList"
|
android:id="@+id/dragList"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:scrollbars="vertical"/>
|
android:scrollbars="none"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/add_language"
|
android:id="@+id/add_language"
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
android:title="@string/language_settings">
|
android:title="@string/language_picker_title">
|
||||||
|
|
||||||
<com.android.settingslib.widget.TopIntroPreference
|
<com.android.settingslib.widget.TopIntroPreference
|
||||||
android:title="@string/desc_introduction_of_language_picker"
|
android:title="@string/desc_introduction_of_language_picker"
|
||||||
|
@@ -145,8 +145,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
profilePref.setEnabled(!mCachedDevice.isBusy());
|
profilePref.setEnabled(!mCachedDevice.isBusy());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile instanceof LeAudioProfile && !mIsLeAudioToggleEnabled) {
|
if (profile instanceof LeAudioProfile) {
|
||||||
profilePref.setVisible(false);
|
profilePref.setVisible(mIsLeAudioToggleEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile instanceof MapProfile) {
|
if (profile instanceof MapProfile) {
|
||||||
|
@@ -172,7 +172,6 @@ public class BatteryEntry {
|
|||||||
mName = mDefaultPackageName;
|
mName = mDefaultPackageName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getQuickNameIconForUid(uid, packages, loadDataInBackground);
|
|
||||||
mTimeInForegroundMs =
|
mTimeInForegroundMs =
|
||||||
uidBatteryConsumer.getTimeInStateMs(UidBatteryConsumer.STATE_FOREGROUND);
|
uidBatteryConsumer.getTimeInStateMs(UidBatteryConsumer.STATE_FOREGROUND);
|
||||||
mTimeInBackgroundMs =
|
mTimeInBackgroundMs =
|
||||||
|
@@ -104,7 +104,6 @@ public class LocaleListEditor extends RestrictedSettingsFragment implements View
|
|||||||
|
|
||||||
addPreferencesFromResource(R.xml.languages);
|
addPreferencesFromResource(R.xml.languages);
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
activity.setTitle(R.string.language_picker_title);
|
|
||||||
mLocaleHelperPreferenceController = new LocaleHelperPreferenceController(activity);
|
mLocaleHelperPreferenceController = new LocaleHelperPreferenceController(activity);
|
||||||
final PreferenceScreen screen = getPreferenceScreen();
|
final PreferenceScreen screen = getPreferenceScreen();
|
||||||
mLocalePickerPreference = screen.findPreference(KEY_LANGUAGES_PICKER);
|
mLocalePickerPreference = screen.findPreference(KEY_LANGUAGES_PICKER);
|
||||||
@@ -358,12 +357,12 @@ public class LocaleListEditor extends RestrictedSettingsFragment implements View
|
|||||||
final LocaleLinearLayoutManager llm = new LocaleLinearLayoutManager(getContext(), mAdapter);
|
final LocaleLinearLayoutManager llm = new LocaleLinearLayoutManager(getContext(), mAdapter);
|
||||||
llm.setAutoMeasureEnabled(true);
|
llm.setAutoMeasureEnabled(true);
|
||||||
list.setLayoutManager(llm);
|
list.setLayoutManager(llm);
|
||||||
|
|
||||||
list.setHasFixedSize(true);
|
list.setHasFixedSize(true);
|
||||||
list.setNestedScrollingEnabled(false);
|
list.setNestedScrollingEnabled(false);
|
||||||
mAdapter.setRecyclerView(list);
|
mAdapter.setRecyclerView(list);
|
||||||
list.setAdapter(mAdapter);
|
list.setAdapter(mAdapter);
|
||||||
list.setOnTouchListener(this);
|
list.setOnTouchListener(this);
|
||||||
|
list.requestFocus();
|
||||||
|
|
||||||
mAddLanguage = layout.findViewById(R.id.add_language);
|
mAddLanguage = layout.findViewById(R.id.add_language);
|
||||||
mAddLanguage.setOnClickListener(new View.OnClickListener() {
|
mAddLanguage.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@@ -1,37 +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.localepicker;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
|
|
||||||
class LocaleRecyclerView extends RecyclerView {
|
|
||||||
public LocaleRecyclerView(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocaleRecyclerView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocaleRecyclerView(Context context, AttributeSet attrs, int defStyle) {
|
|
||||||
super(context, attrs, defStyle);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -168,7 +168,7 @@ public class BubblePreference extends Preference implements View.OnClickListener
|
|||||||
mView.setSelected(selected);
|
mView.setSelected(selected);
|
||||||
|
|
||||||
int colorResId = selected
|
int colorResId = selected
|
||||||
? com.android.internal.R.attr.materialColorOnPrimaryContainer
|
? com.android.internal.R.attr.materialColorOnSecondaryContainer
|
||||||
: com.android.internal.R.attr.materialColorOnSurfaceVariant;
|
: com.android.internal.R.attr.materialColorOnSurfaceVariant;
|
||||||
ColorStateList stateList = Utils.getColorAttr(context, colorResId);
|
ColorStateList stateList = Utils.getColorAttr(context, colorResId);
|
||||||
mImageView.setImageTintList(stateList);
|
mImageView.setImageTintList(stateList);
|
||||||
|
@@ -17,9 +17,7 @@
|
|||||||
package com.android.settings.password;
|
package com.android.settings.password;
|
||||||
|
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PATTERN_HEADER;
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.CONFIRM_WORK_PROFILE_PATTERN_HEADER;
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_CONFIRM_PATTERN;
|
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_LAST_PATTERN_ATTEMPT_BEFORE_WIPE;
|
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_LAST_PATTERN_ATTEMPT_BEFORE_WIPE;
|
||||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_PATTERN_REQUIRED;
|
|
||||||
import static android.app.admin.DevicePolicyResources.UNDEFINED;
|
import static android.app.admin.DevicePolicyResources.UNDEFINED;
|
||||||
|
|
||||||
import static com.android.settings.biometrics.GatekeeperPasswordProvider.containsGatekeeperPasswordHandle;
|
import static com.android.settings.biometrics.GatekeeperPasswordProvider.containsGatekeeperPasswordHandle;
|
||||||
@@ -315,23 +313,12 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
R.string.lockpassword_remote_validation_pattern_details);
|
R.string.lockpassword_remote_validation_pattern_details);
|
||||||
}
|
}
|
||||||
final boolean isStrongAuthRequired = isStrongAuthRequired();
|
final boolean isStrongAuthRequired = isStrongAuthRequired();
|
||||||
if (mIsManagedProfile) {
|
if (!mIsManagedProfile) {
|
||||||
if (isStrongAuthRequired) {
|
|
||||||
return mDevicePolicyManager.getResources().getString(
|
|
||||||
WORK_PROFILE_PATTERN_REQUIRED,
|
|
||||||
() -> getString(
|
|
||||||
R.string.lockpassword_strong_auth_required_work_pattern));
|
|
||||||
} else {
|
|
||||||
return mDevicePolicyManager.getResources().getString(
|
|
||||||
WORK_PROFILE_CONFIRM_PATTERN,
|
|
||||||
() -> getString(
|
|
||||||
R.string.lockpassword_confirm_your_pattern_generic_profile));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return isStrongAuthRequired
|
return isStrongAuthRequired
|
||||||
? getString(R.string.lockpassword_strong_auth_required_device_pattern)
|
? getString(R.string.lockpassword_strong_auth_required_device_pattern)
|
||||||
: getString(R.string.lockpassword_confirm_your_pattern_generic);
|
: getString(R.string.lockpassword_confirm_your_pattern_generic);
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object[][] getActiveViews() {
|
private Object[][] getActiveViews() {
|
||||||
@@ -381,7 +368,9 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
|
|
||||||
CharSequence detailsText =
|
CharSequence detailsText =
|
||||||
mDetailsText == null ? getDefaultDetails() : mDetailsText;
|
mDetailsText == null ? getDefaultDetails() : mDetailsText;
|
||||||
mGlifLayout.setDescriptionText(detailsText);
|
if (detailsText != null) {
|
||||||
|
mGlifLayout.setDescriptionText(detailsText);
|
||||||
|
}
|
||||||
|
|
||||||
mErrorTextView.setText("");
|
mErrorTextView.setText("");
|
||||||
updateErrorMessage(
|
updateErrorMessage(
|
||||||
|
@@ -623,9 +623,11 @@ public class WifiHotspotRepository {
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
class SoftApCallback implements WifiManager.SoftApCallback {
|
class SoftApCallback implements WifiManager.SoftApCallback {
|
||||||
|
private static final String TAG = "SoftApCallback";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStateChanged(int state, int failureReason) {
|
public void onStateChanged(int state, int failureReason) {
|
||||||
log("onStateChanged(), state:" + state + ", failureReason:" + failureReason);
|
Log.d(TAG, "onStateChanged(), state:" + state + ", failureReason:" + failureReason);
|
||||||
mWifiApState = state;
|
mWifiApState = state;
|
||||||
if (!mIsRestarting) {
|
if (!mIsRestarting) {
|
||||||
return;
|
return;
|
||||||
|
@@ -108,15 +108,17 @@ public class WifiHotspotSpeedSettings extends DashboardFragment implements
|
|||||||
if (radioButton == null) {
|
if (radioButton == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (radioButton.isChecked() != speedInfo.mIsChecked) {
|
if (!speedInfo.mIsVisible) {
|
||||||
radioButton.setChecked(speedInfo.mIsChecked);
|
radioButton.setVisible(false);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (radioButton.isEnabled() != speedInfo.mIsEnabled) {
|
radioButton.setEnabled(speedInfo.mIsEnabled);
|
||||||
radioButton.setEnabled(speedInfo.mIsEnabled);
|
radioButton.setChecked(speedInfo.mIsChecked);
|
||||||
}
|
if (speedInfo.mSummary != null) {
|
||||||
if (radioButton.isVisible() != speedInfo.mIsVisible) {
|
radioButton.setSummary(speedInfo.mSummary);
|
||||||
radioButton.setVisible(speedInfo.mIsVisible);
|
|
||||||
}
|
}
|
||||||
|
// setVisible at the end to avoid UI flickering
|
||||||
|
radioButton.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,12 +22,15 @@ import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_5
|
|||||||
import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_6GHZ;
|
import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_6GHZ;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.lifecycle.AndroidViewModel;
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.lifecycle.MutableLiveData;
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.Observer;
|
import androidx.lifecycle.Observer;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.wifi.repository.WifiHotspotRepository;
|
import com.android.settings.wifi.repository.WifiHotspotRepository;
|
||||||
|
|
||||||
@@ -41,6 +44,12 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class WifiHotspotSpeedViewModel extends AndroidViewModel {
|
public class WifiHotspotSpeedViewModel extends AndroidViewModel {
|
||||||
private static final String TAG = "WifiHotspotSpeedViewModel";
|
private static final String TAG = "WifiHotspotSpeedViewModel";
|
||||||
|
@VisibleForTesting
|
||||||
|
static final int RES_SPEED_5G_SUMMARY = R.string.wifi_hotspot_speed_5g_summary;
|
||||||
|
@VisibleForTesting
|
||||||
|
static final int RES_SPEED_6G_SUMMARY = R.string.wifi_hotspot_speed_6g_summary;
|
||||||
|
@VisibleForTesting
|
||||||
|
static final int RES_SUMMARY_UNAVAILABLE = R.string.wifi_hotspot_speed_summary_unavailable;
|
||||||
|
|
||||||
protected final WifiHotspotRepository mWifiHotspotRepository;
|
protected final WifiHotspotRepository mWifiHotspotRepository;
|
||||||
protected Map<Integer, SpeedInfo> mSpeedInfoMap = new HashMap<>();
|
protected Map<Integer, SpeedInfo> mSpeedInfoMap = new HashMap<>();
|
||||||
@@ -75,14 +84,18 @@ public class WifiHotspotSpeedViewModel extends AndroidViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void on6gAvailableChanged(Boolean available) {
|
protected void on6gAvailableChanged(Boolean available) {
|
||||||
log("on6gAvailableChanged(), available:" + available);
|
Log.d(TAG, "on6gAvailableChanged(), available:" + available);
|
||||||
mSpeedInfo6g.mIsEnabled = available;
|
mSpeedInfo6g.mIsEnabled = available;
|
||||||
|
mSpeedInfo6g.mSummary = getApplication()
|
||||||
|
.getString(available ? RES_SPEED_6G_SUMMARY : RES_SUMMARY_UNAVAILABLE);
|
||||||
updateSpeedInfoMapData();
|
updateSpeedInfoMapData();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void on5gAvailableChanged(Boolean available) {
|
protected void on5gAvailableChanged(Boolean available) {
|
||||||
log("on5gAvailableChanged(), available:" + available);
|
Log.d(TAG, "on5gAvailableChanged(), available:" + available);
|
||||||
mSpeedInfo5g.mIsEnabled = available;
|
mSpeedInfo5g.mIsEnabled = available;
|
||||||
|
mSpeedInfo5g.mSummary = getApplication()
|
||||||
|
.getString(available ? RES_SPEED_5G_SUMMARY : RES_SUMMARY_UNAVAILABLE);
|
||||||
|
|
||||||
boolean showDualBand = mWifiHotspotRepository.isDualBand() && available;
|
boolean showDualBand = mWifiHotspotRepository.isDualBand() && available;
|
||||||
log("on5gAvailableChanged(), showDualBand:" + showDualBand);
|
log("on5gAvailableChanged(), showDualBand:" + showDualBand);
|
||||||
@@ -144,6 +157,7 @@ public class WifiHotspotSpeedViewModel extends AndroidViewModel {
|
|||||||
Boolean mIsChecked;
|
Boolean mIsChecked;
|
||||||
boolean mIsEnabled;
|
boolean mIsEnabled;
|
||||||
boolean mIsVisible;
|
boolean mIsVisible;
|
||||||
|
String mSummary;
|
||||||
|
|
||||||
public SpeedInfo(boolean isChecked, boolean isEnabled, boolean isVisible) {
|
public SpeedInfo(boolean isChecked, boolean isEnabled, boolean isVisible) {
|
||||||
this.mIsChecked = isChecked;
|
this.mIsChecked = isChecked;
|
||||||
@@ -157,6 +171,7 @@ public class WifiHotspotSpeedViewModel extends AndroidViewModel {
|
|||||||
.append("isChecked:").append(mIsChecked)
|
.append("isChecked:").append(mIsChecked)
|
||||||
.append(",isEnabled:").append(mIsEnabled)
|
.append(",isEnabled:").append(mIsEnabled)
|
||||||
.append(",isVisible:").append(mIsVisible)
|
.append(",isVisible:").append(mIsVisible)
|
||||||
|
.append(",mSummary:").append(mSummary)
|
||||||
.append('}').toString();
|
.append('}').toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,8 +25,10 @@ import static com.android.settings.wifi.tether.WifiHotspotSpeedSettings.KEY_SPEE
|
|||||||
import static com.android.settings.wifi.tether.WifiHotspotSpeedSettings.KEY_SPEED_5GHZ;
|
import static com.android.settings.wifi.tether.WifiHotspotSpeedSettings.KEY_SPEED_5GHZ;
|
||||||
import static com.android.settings.wifi.tether.WifiHotspotSpeedSettings.KEY_SPEED_6GHZ;
|
import static com.android.settings.wifi.tether.WifiHotspotSpeedSettings.KEY_SPEED_6GHZ;
|
||||||
|
|
||||||
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.anyBoolean;
|
import static org.mockito.Mockito.anyBoolean;
|
||||||
import static org.mockito.Mockito.doNothing;
|
import static org.mockito.Mockito.doNothing;
|
||||||
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -89,98 +91,156 @@ public class WifiHotspotSpeedSettingsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSpeedInfoMapDataChanged_checkedSpeed2g_checkedToRadioButton2g() {
|
public void onSpeedInfoMapDataChanged_checkedSpeed2g_checkedToRadioButton2g() {
|
||||||
mSpeedInfo2g = new WifiHotspotSpeedViewModel.SpeedInfo(false, true, false);
|
mSpeedInfo2g = new WifiHotspotSpeedViewModel.SpeedInfo(true, true, true);
|
||||||
updateSpeedInfoMap();
|
updateSpeedInfoMap();
|
||||||
mockRadioButton(true, false, true);
|
mockRadioButton(false, false, false);
|
||||||
mSettings.mSpeedPreferenceMap.put(SPEED_2GHZ, mRadioButton);
|
mSettings.mSpeedPreferenceMap.put(SPEED_2GHZ, mRadioButton);
|
||||||
|
|
||||||
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
verifyRadioButton(false, true, false);
|
verifyRadioButton(true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSpeedInfoMapDataChanged_uncheckedSpeed2g_uncheckedToRadioButton2g() {
|
public void onSpeedInfoMapDataChanged_uncheckedSpeed2g_uncheckedToRadioButton2g() {
|
||||||
mSpeedInfo2g = new WifiHotspotSpeedViewModel.SpeedInfo(true, false, true);
|
mSpeedInfo2g = new WifiHotspotSpeedViewModel.SpeedInfo(false, false, true);
|
||||||
updateSpeedInfoMap();
|
updateSpeedInfoMap();
|
||||||
mockRadioButton(false, true, false);
|
mockRadioButton(true, true, true);
|
||||||
mSettings.mSpeedPreferenceMap.put(SPEED_2GHZ, mRadioButton);
|
mSettings.mSpeedPreferenceMap.put(SPEED_2GHZ, mRadioButton);
|
||||||
|
|
||||||
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
verifyRadioButton(true, false, true);
|
verifyRadioButton(false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSpeedInfoMapDataChanged_checkedSpeed5g_checkedToRadioButton5g() {
|
public void onSpeedInfoMapDataChanged_checkedSpeed5g_checkedToRadioButton5g() {
|
||||||
mSpeedInfo5g = new WifiHotspotSpeedViewModel.SpeedInfo(false, true, false);
|
mSpeedInfo5g = new WifiHotspotSpeedViewModel.SpeedInfo(true, true, true);
|
||||||
updateSpeedInfoMap();
|
updateSpeedInfoMap();
|
||||||
mockRadioButton(true, false, true);
|
mockRadioButton(false, false, false);
|
||||||
mSettings.mSpeedPreferenceMap.put(SPEED_5GHZ, mRadioButton);
|
mSettings.mSpeedPreferenceMap.put(SPEED_5GHZ, mRadioButton);
|
||||||
|
|
||||||
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
verifyRadioButton(false, true, false);
|
verifyRadioButton(true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSpeedInfoMapDataChanged_uncheckedSpeed5g_uncheckedToRadioButton5g() {
|
public void onSpeedInfoMapDataChanged_uncheckedSpeed5g_uncheckedToRadioButton5g() {
|
||||||
mSpeedInfo5g = new WifiHotspotSpeedViewModel.SpeedInfo(true, false, true);
|
mSpeedInfo5g = new WifiHotspotSpeedViewModel.SpeedInfo(false, false, true);
|
||||||
updateSpeedInfoMap();
|
updateSpeedInfoMap();
|
||||||
mockRadioButton(false, true, false);
|
mockRadioButton(true, true, true);
|
||||||
mSettings.mSpeedPreferenceMap.put(SPEED_5GHZ, mRadioButton);
|
mSettings.mSpeedPreferenceMap.put(SPEED_5GHZ, mRadioButton);
|
||||||
|
|
||||||
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
verifyRadioButton(true, false, true);
|
verifyRadioButton(false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSpeedInfoMapDataChanged_checkedSpeed2g5g_checkedToRadioButton2g5g() {
|
public void onSpeedInfoMapDataChanged_checkedSpeed2g5g_checkedToRadioButton2g5g() {
|
||||||
mSpeedInfo2g5g = new WifiHotspotSpeedViewModel.SpeedInfo(false, true, false);
|
mSpeedInfo2g5g = new WifiHotspotSpeedViewModel.SpeedInfo(true, true, true);
|
||||||
updateSpeedInfoMap();
|
updateSpeedInfoMap();
|
||||||
mockRadioButton(true, false, true);
|
mockRadioButton(false, false, false);
|
||||||
mSettings.mSpeedPreferenceMap.put(SPEED_2GHZ_5GHZ, mRadioButton);
|
mSettings.mSpeedPreferenceMap.put(SPEED_2GHZ_5GHZ, mRadioButton);
|
||||||
|
|
||||||
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
verifyRadioButton(false, true, false);
|
verifyRadioButton(true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSpeedInfoMapDataChanged_uncheckedSpeed25g_uncheckedToRadioButton25g() {
|
public void onSpeedInfoMapDataChanged_uncheckedSpeed2g5g_uncheckedToRadioButton2g5g() {
|
||||||
mSpeedInfo2g5g = new WifiHotspotSpeedViewModel.SpeedInfo(true, false, true);
|
mSpeedInfo2g5g = new WifiHotspotSpeedViewModel.SpeedInfo(false, false, true);
|
||||||
updateSpeedInfoMap();
|
updateSpeedInfoMap();
|
||||||
mockRadioButton(false, true, false);
|
mockRadioButton(true, true, true);
|
||||||
mSettings.mSpeedPreferenceMap.put(SPEED_2GHZ_5GHZ, mRadioButton);
|
mSettings.mSpeedPreferenceMap.put(SPEED_2GHZ_5GHZ, mRadioButton);
|
||||||
|
|
||||||
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
verifyRadioButton(true, false, true);
|
verifyRadioButton(false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onSpeedInfoMapDataChanged_checkedSpeed6g_checkedToRadioButton6g() {
|
public void onSpeedInfoMapDataChanged_checkedSpeed6g_checkedToRadioButton6g() {
|
||||||
mSpeedInfo6g = new WifiHotspotSpeedViewModel.SpeedInfo(false, true, false);
|
mSpeedInfo6g = new WifiHotspotSpeedViewModel.SpeedInfo(true, true, true);
|
||||||
updateSpeedInfoMap();
|
updateSpeedInfoMap();
|
||||||
|
mockRadioButton(false, false, false);
|
||||||
|
mSettings.mSpeedPreferenceMap.put(SPEED_6GHZ, mRadioButton);
|
||||||
|
|
||||||
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
|
verifyRadioButton(true, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSpeedInfoMapDataChanged_uncheckedSpeed6g_uncheckedToRadioButton6g() {
|
||||||
|
mSpeedInfo6g = new WifiHotspotSpeedViewModel.SpeedInfo(false, false, true);
|
||||||
|
updateSpeedInfoMap();
|
||||||
|
mockRadioButton(true, true, true);
|
||||||
|
mSettings.mSpeedPreferenceMap.put(SPEED_6GHZ, mRadioButton);
|
||||||
|
|
||||||
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
|
verifyRadioButton(false, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSpeedInfoMapDataChanged_setVisibleFalse_setVisibleOnly() {
|
||||||
|
mSpeedInfo6g = new WifiHotspotSpeedViewModel.SpeedInfo(true, true, false);
|
||||||
|
mSpeedInfo6g.mSummary = "summary";
|
||||||
|
mSpeedInfoMap.put(SPEED_6GHZ, mSpeedInfo6g);
|
||||||
|
mockRadioButton(true, true, true);
|
||||||
|
mSettings.mSpeedPreferenceMap.put(SPEED_6GHZ, mRadioButton);
|
||||||
|
|
||||||
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
|
verify(mRadioButton).setVisible(false);
|
||||||
|
verify(mRadioButton, never()).setChecked(anyBoolean());
|
||||||
|
verify(mRadioButton, never()).setEnabled(anyBoolean());
|
||||||
|
verify(mRadioButton, never()).setSummary(anyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSpeedInfoMapDataChanged_setVisibleTrue_setAllProperties() {
|
||||||
|
mSpeedInfo6g = new WifiHotspotSpeedViewModel.SpeedInfo(true, true, true);
|
||||||
|
mSpeedInfo6g.mSummary = "summary";
|
||||||
|
mSpeedInfoMap.put(SPEED_6GHZ, mSpeedInfo6g);
|
||||||
|
mockRadioButton(true, true, true);
|
||||||
|
mSettings.mSpeedPreferenceMap.put(SPEED_6GHZ, mRadioButton);
|
||||||
|
|
||||||
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
|
verify(mRadioButton).setVisible(true);
|
||||||
|
verify(mRadioButton).setChecked(anyBoolean());
|
||||||
|
verify(mRadioButton).setEnabled(anyBoolean());
|
||||||
|
verify(mRadioButton).setSummary(anyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSpeedInfoMapDataChanged_summaryIsNull_doNotSetSummary() {
|
||||||
|
mSpeedInfo6g = new WifiHotspotSpeedViewModel.SpeedInfo(true, true, true);
|
||||||
|
mSpeedInfo6g.mSummary = null;
|
||||||
|
mSpeedInfoMap.put(SPEED_6GHZ, mSpeedInfo6g);
|
||||||
|
mockRadioButton(true, true, true);
|
||||||
|
mSettings.mSpeedPreferenceMap.put(SPEED_6GHZ, mRadioButton);
|
||||||
|
|
||||||
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
|
verify(mRadioButton, never()).setSummary(anyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onSpeedInfoMapDataChanged_summaryNotNull_setSummary() {
|
||||||
|
mSpeedInfo6g = new WifiHotspotSpeedViewModel.SpeedInfo(true, false, true);
|
||||||
|
mSpeedInfo6g.mSummary = "summary";
|
||||||
|
mSpeedInfoMap.put(SPEED_6GHZ, mSpeedInfo6g);
|
||||||
mockRadioButton(true, false, true);
|
mockRadioButton(true, false, true);
|
||||||
mSettings.mSpeedPreferenceMap.put(SPEED_6GHZ, mRadioButton);
|
mSettings.mSpeedPreferenceMap.put(SPEED_6GHZ, mRadioButton);
|
||||||
|
|
||||||
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
||||||
|
|
||||||
verifyRadioButton(false, true, false);
|
verify(mRadioButton).setSummary(mSpeedInfo6g.mSummary);
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void onSpeedInfoMapDataChanged_uncheckedSpeed6g_uncheckedToRadioButton6g() {
|
|
||||||
mSpeedInfo6g = new WifiHotspotSpeedViewModel.SpeedInfo(true, false, true);
|
|
||||||
updateSpeedInfoMap();
|
|
||||||
mockRadioButton(false, true, false);
|
|
||||||
mSettings.mSpeedPreferenceMap.put(SPEED_6GHZ, mRadioButton);
|
|
||||||
|
|
||||||
mSettings.onSpeedInfoMapDataChanged(mSpeedInfoMap);
|
|
||||||
|
|
||||||
verifyRadioButton(true, false, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -20,6 +20,9 @@ import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_2
|
|||||||
import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_2GHZ_5GHZ;
|
import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_2GHZ_5GHZ;
|
||||||
import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_5GHZ;
|
import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_5GHZ;
|
||||||
import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_6GHZ;
|
import static com.android.settings.wifi.repository.WifiHotspotRepository.SPEED_6GHZ;
|
||||||
|
import static com.android.settings.wifi.tether.WifiHotspotSpeedViewModel.RES_SPEED_5G_SUMMARY;
|
||||||
|
import static com.android.settings.wifi.tether.WifiHotspotSpeedViewModel.RES_SPEED_6G_SUMMARY;
|
||||||
|
import static com.android.settings.wifi.tether.WifiHotspotSpeedViewModel.RES_SUMMARY_UNAVAILABLE;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
@@ -128,7 +131,9 @@ public class WifiHotspotSpeedViewModelTest {
|
|||||||
mViewModel.on6gAvailableChanged(true);
|
mViewModel.on6gAvailableChanged(true);
|
||||||
|
|
||||||
verify(mSpeedInfoMapData).setValue(mViewModel.mSpeedInfoMap);
|
verify(mSpeedInfoMapData).setValue(mViewModel.mSpeedInfoMap);
|
||||||
assertThat(mViewModel.mSpeedInfoMap.get(SPEED_6GHZ).mIsEnabled).isTrue();
|
WifiHotspotSpeedViewModel.SpeedInfo speedInfo = mViewModel.mSpeedInfoMap.get(SPEED_6GHZ);
|
||||||
|
assertThat(speedInfo.mIsEnabled).isTrue();
|
||||||
|
assertThat(speedInfo.mSummary).isEqualTo(mContext.getString(RES_SPEED_6G_SUMMARY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -139,7 +144,9 @@ public class WifiHotspotSpeedViewModelTest {
|
|||||||
mViewModel.on6gAvailableChanged(false);
|
mViewModel.on6gAvailableChanged(false);
|
||||||
|
|
||||||
verify(mSpeedInfoMapData).setValue(mViewModel.mSpeedInfoMap);
|
verify(mSpeedInfoMapData).setValue(mViewModel.mSpeedInfoMap);
|
||||||
assertThat(mViewModel.mSpeedInfoMap.get(SPEED_6GHZ).mIsEnabled).isFalse();
|
WifiHotspotSpeedViewModel.SpeedInfo speedInfo = mViewModel.mSpeedInfoMap.get(SPEED_6GHZ);
|
||||||
|
assertThat(speedInfo.mIsEnabled).isFalse();
|
||||||
|
assertThat(speedInfo.mSummary).isEqualTo(mContext.getString(RES_SUMMARY_UNAVAILABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -150,7 +157,9 @@ public class WifiHotspotSpeedViewModelTest {
|
|||||||
mViewModel.on5gAvailableChanged(true);
|
mViewModel.on5gAvailableChanged(true);
|
||||||
|
|
||||||
verify(mSpeedInfoMapData).setValue(mViewModel.mSpeedInfoMap);
|
verify(mSpeedInfoMapData).setValue(mViewModel.mSpeedInfoMap);
|
||||||
assertThat(mViewModel.mSpeedInfoMap.get(SPEED_5GHZ).mIsEnabled).isTrue();
|
WifiHotspotSpeedViewModel.SpeedInfo speedInfo = mViewModel.mSpeedInfoMap.get(SPEED_5GHZ);
|
||||||
|
assertThat(speedInfo.mIsEnabled).isTrue();
|
||||||
|
assertThat(speedInfo.mSummary).isEqualTo(mContext.getString(RES_SPEED_5G_SUMMARY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -161,7 +170,9 @@ public class WifiHotspotSpeedViewModelTest {
|
|||||||
mViewModel.on5gAvailableChanged(false);
|
mViewModel.on5gAvailableChanged(false);
|
||||||
|
|
||||||
verify(mSpeedInfoMapData).setValue(mViewModel.mSpeedInfoMap);
|
verify(mSpeedInfoMapData).setValue(mViewModel.mSpeedInfoMap);
|
||||||
assertThat(mViewModel.mSpeedInfoMap.get(SPEED_5GHZ).mIsEnabled).isFalse();
|
WifiHotspotSpeedViewModel.SpeedInfo speedInfo = mViewModel.mSpeedInfoMap.get(SPEED_5GHZ);
|
||||||
|
assertThat(speedInfo.mIsEnabled).isFalse();
|
||||||
|
assertThat(speedInfo.mSummary).isEqualTo(mContext.getString(RES_SUMMARY_UNAVAILABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user