Snap for 7949225 from 13d7e086e6 to tm-release

Change-Id: Icf37aeba4ae9db053c6f425ba7feff222e833c8e
This commit is contained in:
Android Build Coastguard Worker
2021-11-27 04:08:36 +00:00
18 changed files with 147 additions and 62 deletions

View File

@@ -4174,7 +4174,7 @@
<activity android:name="Settings$MediaControlsSettingsActivity"
android:exported="true"
android:label="@strings/media_controls_title">
android:label="@string/media_controls_title">
<intent-filter>
<action android:name="android.settings.ACTION_MEDIA_CONTROLS_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />

View File

@@ -7462,7 +7462,7 @@
<!-- Button label to disconnect from a VPN profile. [CHAR LIMIT=40] -->
<string name="vpn_disconnect">Disconnect</string>
<!-- Field label to show the version number for a VPN app. [CHAR LIMIT=40] -->
<string name="vpn_version">Version <xliff:g id="version" example="3.3.0">%s</xliff:g></string>
<string name="vpn_version">Version</string>
<!-- Button label to forget a VPN profile [CHAR LIMIT=40] -->
<string name="vpn_forget_long">Forget VPN</string>
<!-- Dialog message title to set another VPN app to be always-on [CHAR LIMIT=40] -->

View File

@@ -237,6 +237,16 @@
<item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Small</item>
</style>
<style name="vpn_app_management_version_title">
<item name="android:textAppearance">?android:attr/textAppearanceListItem</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="vpn_app_management_version_summary">
<item name="android:textAppearance">?android:attr/textAppearanceListItemSecondary</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="screen_size_imageview_style">
<item name="android:layout_width">48dp</item>
<item name="android:layout_height">48dp</item>

View File

@@ -15,14 +15,24 @@
-->
<PreferenceScreen 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"
orderingFromXml="false"
>
<!-- To limit the size (in height) of version Preference displayed here,
maximum height of TextView need to be set programmingly.
Therefore, this Preference got removed from here and will be added
dynamically through source code.
<Preference
android:order="0"
android:key="version"
android:textColor="?android:attr/textColorSecondary"
android:selectable="false"/>
-->
<com.android.settingslib.RestrictedSwitchPreference
android:order="10"
android:key="always_on_vpn"
android:title="@string/vpn_menu_lockdown"
android:defaultValue="false"
@@ -32,6 +42,7 @@
settings:restrictedSwitchSummary="@string/disabled_by_admin_summary_text" />
<com.android.settingslib.RestrictedSwitchPreference
android:order="20"
android:key="lockdown_vpn"
android:title="@string/vpn_require_connection"
android:defaultValue="false"
@@ -41,6 +52,7 @@
settings:restrictedSwitchSummary="@string/disabled_by_admin_summary_text" />
<com.android.settingslib.RestrictedPreference
android:order="30"
android:key="forget_vpn"
android:title="@string/vpn_forget_long"
android:icon="@drawable/ic_delete"

View File

@@ -295,8 +295,8 @@ public class AccessibilitySettings extends DashboardFragment {
}
static boolean isRampingRingerEnabled(final Context context) {
return Settings.Global.getInt(
context.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, 0) == 1;
return Settings.System.getInt(
context.getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, 0) == 1;
}
@VisibleForTesting

View File

@@ -47,7 +47,7 @@ public class RingVibrationPreferenceFragment extends VibrationPreferenceFragment
@Override
protected String getVibrationEnabledSetting() {
if (AccessibilitySettings.isRampingRingerEnabled(getContext())) {
return Settings.Global.APPLY_RAMPING_RINGER;
return Settings.System.APPLY_RAMPING_RINGER;
} else {
return Settings.System.VIBRATE_WHEN_RINGING;
}

View File

@@ -116,12 +116,12 @@ public abstract class VibrationPreferenceFragment extends RadioButtonPickerFragm
// Update vibration enabled setting
final String vibrationEnabledSetting = getVibrationEnabledSetting();
final boolean wasEnabled = TextUtils.equals(
vibrationEnabledSetting, Settings.Global.APPLY_RAMPING_RINGER)
vibrationEnabledSetting, Settings.System.APPLY_RAMPING_RINGER)
? true
: (Settings.System.getInt(
getContext().getContentResolver(), vibrationEnabledSetting, 1) == 1);
if (vibrationEnabled != wasEnabled) {
if (vibrationEnabledSetting.equals(Settings.Global.APPLY_RAMPING_RINGER)) {
if (vibrationEnabledSetting.equals(Settings.System.APPLY_RAMPING_RINGER)) {
Settings.Global.putInt(getContext().getContentResolver(),
vibrationEnabledSetting, 0);
} else {
@@ -212,7 +212,7 @@ public abstract class VibrationPreferenceFragment extends RadioButtonPickerFragm
getVibrationIntensitySetting(), getDefaultVibrationIntensity());
final String vibrationEnabledSetting = getVibrationEnabledSetting();
final boolean vibrationEnabled = TextUtils.equals(
vibrationEnabledSetting, Settings.Global.APPLY_RAMPING_RINGER)
vibrationEnabledSetting, Settings.System.APPLY_RAMPING_RINGER)
? true
: (Settings.System.getInt(
getContext().getContentResolver(), vibrationEnabledSetting, 1) == 1);

View File

@@ -29,6 +29,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.DeviceConfig;
import android.text.TextUtils;
import android.util.Log;
@@ -126,8 +127,8 @@ public class BluetoothDetailsCompanionAppsController extends BluetoothDetailsCon
try {
java.util.Objects.requireNonNull(ICompanionDeviceManager.Stub.asInterface(
ServiceManager.getService(
Context.COMPANION_DEVICE_SERVICE))).disassociate(
address, packageName);
Context.COMPANION_DEVICE_SERVICE))).legacyDisassociate(
address, packageName, UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException(e);
}

View File

@@ -54,6 +54,7 @@ import android.util.Log;
import androidx.annotation.VisibleForTesting;
import com.android.internal.util.CollectionUtils;
import com.android.settingslib.R;
import com.android.settingslib.Utils;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
@@ -159,7 +160,9 @@ public class NotificationBackend {
StringBuilder sb = new StringBuilder();
try {
List<String> associatedMacAddrs = cdm.getAssociations(pkg, userId);
List<String> associatedMacAddrs = CollectionUtils.mapNotNull(
cdm.getAssociations(pkg, userId),
a -> a.isSelfManaged() ? null : a.getDeviceMacAddress().toString());
if (associatedMacAddrs != null) {
for (String assocMac : associatedMacAddrs) {
final Collection<CachedBluetoothDevice> cachedDevices =

View File

@@ -51,9 +51,9 @@ public class VibrateForCallsPreferenceController extends BasePreferenceControlle
@Override
public CharSequence getSummary() {
if (Settings.Global.getInt(
if (Settings.System.getInt(
mContext.getContentResolver(),
Settings.Global.APPLY_RAMPING_RINGER, OFF) == ON) {
Settings.System.APPLY_RAMPING_RINGER, OFF) == ON) {
return mContext.getText(R.string.vibrate_when_ringing_option_ramping_ringer);
} else if (Settings.System.getInt(
mContext.getContentResolver(),

View File

@@ -78,18 +78,18 @@ public class VibrateForCallsPreferenceFragment extends RadioButtonPickerFragment
if (TextUtils.equals(key, KEY_ALWAYS_VIBRATE)) {
Settings.System.putInt(
getContext().getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING, ON);
Settings.Global.putInt(
getContext().getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, OFF);
Settings.System.putInt(
getContext().getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, OFF);
} else if (TextUtils.equals(key, KEY_RAMPING_RINGER)) {
Settings.System.putInt(
getContext().getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING, OFF);
Settings.Global.putInt(
getContext().getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, ON);
Settings.System.putInt(
getContext().getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, ON);
} else {
Settings.System.putInt(
getContext().getContentResolver(), Settings.System.VIBRATE_WHEN_RINGING, OFF);
Settings.Global.putInt(
getContext().getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, OFF);
Settings.System.putInt(
getContext().getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, OFF);
}
}
@@ -104,9 +104,9 @@ public class VibrateForCallsPreferenceFragment extends RadioButtonPickerFragment
@Override
protected String getDefaultKey() {
if (Settings.Global.getInt(
if (Settings.System.getInt(
getContext().getContentResolver(),
Settings.Global.APPLY_RAMPING_RINGER, OFF) == ON) {
Settings.System.APPLY_RAMPING_RINGER, OFF) == ON) {
return KEY_RAMPING_RINGER;
} else if (Settings.System.getInt(
getContext().getContentResolver(),

View File

@@ -34,11 +34,13 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
import android.util.Log;
import android.widget.TextView;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import com.android.internal.net.VpnConfig;
import com.android.internal.util.ArrayUtils;
@@ -77,7 +79,6 @@ public class AppManagementFragment extends SettingsPreferenceFragment
private String mVpnLabel;
// UI preference
private Preference mPreferenceVersion;
private RestrictedSwitchPreference mPreferenceAlwaysOn;
private RestrictedSwitchPreference mPreferenceLockdown;
private RestrictedPreference mPreferenceForget;
@@ -122,7 +123,6 @@ public class AppManagementFragment extends SettingsPreferenceFragment
mDevicePolicyManager = getContext().getSystemService(DevicePolicyManager.class);
mVpnManager = getContext().getSystemService(VpnManager.class);
mPreferenceVersion = findPreference(KEY_VERSION);
mPreferenceAlwaysOn = (RestrictedSwitchPreference) findPreference(KEY_ALWAYS_ON_VPN);
mPreferenceLockdown = (RestrictedSwitchPreference) findPreference(KEY_LOCKDOWN_VPN);
mPreferenceForget = (RestrictedPreference) findPreference(KEY_FORGET_VPN);
@@ -138,9 +138,52 @@ public class AppManagementFragment extends SettingsPreferenceFragment
boolean isInfoLoaded = loadInfo();
if (isInfoLoaded) {
mPreferenceVersion.setTitle(
getPrefContext().getString(R.string.vpn_version, mPackageInfo.versionName));
updateUI();
Preference version = getPreferenceScreen().findPreference(KEY_VERSION);
if (version != null) {
// Version field has been added.
return;
}
/**
* Create version field at runtime, and set max height on the display area.
*
* When long length of text given within version field, a large text area
* might be created and inconvenient to the user (User need to scroll
* for a long time in order to get to the Preferences after this field.)
*/
version = new Preference(getPrefContext()) {
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
TextView titleView =
(TextView) holder.findViewById(android.R.id.title);
if (titleView != null) {
titleView.setTextAppearance(R.style.vpn_app_management_version_title);
}
TextView summaryView =
(TextView) holder.findViewById(android.R.id.summary);
if (summaryView != null) {
summaryView.setTextAppearance(R.style.vpn_app_management_version_summary);
// Set max height in summary area.
int versionMaxHeight = getListView().getHeight();
summaryView.setMaxHeight(versionMaxHeight);
summaryView.setVerticalScrollBarEnabled(false);
summaryView.setHorizontallyScrolling(false);
}
}
};
version.setOrder(0); // Set order to 0 in order to be placed
// in front of other Preference(s).
version.setKey(KEY_VERSION); // Set key to avoid from creating multi instance.
version.setTitle(R.string.vpn_version);
version.setSummary(mPackageInfo.versionName);
version.setSelectable(false);
getPreferenceScreen().addPreference(version);
} else {
finish();
}

View File

@@ -146,16 +146,16 @@ public class AccessibilitySettingsTest {
@Test
@Config(shadows = {ShadowDeviceConfig.class})
public void isRampingRingerEnabled_settingsFlagOn_Enabled() {
Settings.Global.putInt(
mContext.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, ON);
Settings.System.putInt(
mContext.getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, ON);
assertThat(AccessibilitySettings.isRampingRingerEnabled(mContext)).isTrue();
}
@Test
@Config(shadows = {ShadowDeviceConfig.class})
public void isRampingRingerEnabled_settingsFlagOff_Disabled() {
Settings.Global.putInt(
mContext.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, OFF);
Settings.System.putInt(
mContext.getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, OFF);
assertThat(AccessibilitySettings.isRampingRingerEnabled(mContext)).isFalse();
}

View File

@@ -50,17 +50,17 @@ public class RingVibrationPreferenceFragmentTest {
@Config(shadows = {ShadowDeviceConfig.class})
public void getVibrationEnabledSetting_rampingRingerEnabled_returnApplyRampingRinger() {
// Turn on both flags to enable ramping ringer.
Settings.Global.putInt(
mContext.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, 1 /* ON */);
Settings.System.putInt(
mContext.getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, 1 /* ON */);
assertThat(mFragment.getVibrationEnabledSetting()).isEqualTo(
Settings.Global.APPLY_RAMPING_RINGER);
Settings.System.APPLY_RAMPING_RINGER);
}
@Test
public void getVibrationEnabledSetting_rampingRingerDisabled_returnVibrationWhenRinging() {
// Turn off Settings.Global.APPLY_RAMPING_RINGER to disable ramping ringer.
Settings.Global.putInt(
mContext.getContentResolver(), Settings.Global.APPLY_RAMPING_RINGER, 0 /* OFF */);
// Turn off Settings.System.APPLY_RAMPING_RINGER to disable ramping ringer.
Settings.System.putInt(
mContext.getContentResolver(), Settings.System.APPLY_RAMPING_RINGER, 0 /* OFF */);
assertThat(mFragment.getVibrationEnabledSetting()).isEqualTo(
Settings.System.VIBRATE_WHEN_RINGING);
}

View File

@@ -24,9 +24,9 @@ import static org.mockito.Mockito.when;
import android.companion.AssociationInfo;
import android.companion.CompanionDeviceManager;
import android.companion.DeviceId;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.net.MacAddress;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
@@ -100,15 +100,14 @@ public class BluetoothDetailsCompanionAppsControllerTest extends
setupFakeLabelAndInfo(packageName, appName);
final int associationId = mAssociations.size() + 1;
final DeviceId deviceId =
new DeviceId(DeviceId.TYPE_MAC_ADDRESS, mCachedDevice.getAddress());
final AssociationInfo association = new AssociationInfo(
associationId,
/* userId */ 0,
packageName,
Arrays.asList(deviceId),
MacAddress.fromString(mCachedDevice.getAddress()),
/* displayName */ null,
/* deviceProfile */ "",
/* managedByCompanionApp */ false,
/* selfManaged */ false,
/* notifyOnDeviceNearby */ true,
/* timeApprovedMs */ System.currentTimeMillis());

View File

@@ -31,11 +31,13 @@ import android.app.INotificationManager;
import android.app.role.RoleManager;
import android.app.usage.UsageEvents;
import android.bluetooth.BluetoothAdapter;
import android.companion.AssociationInfo;
import android.companion.ICompanionDeviceManager;
import android.content.ComponentName;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.MacAddress;
import android.os.Parcel;
import android.provider.Settings;
@@ -234,8 +236,9 @@ public class NotificationBackendTest {
@Test
public void getDeviceList_associationsButNoDevice() throws Exception {
List<String> macs = ImmutableList.of("00:00:00:00:00:10", "00:00:00:00:00:20");
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(macs);
List<AssociationInfo> associations =
mockAssociations("00:00:00:00:00:10", "00:00:00:00:00:20");
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(associations);
when(mCbm.getCachedDevicesCopy()).thenReturn(new ArrayList<>());
@@ -245,12 +248,13 @@ public class NotificationBackendTest {
@Test
public void getDeviceList_singleDevice() throws Exception {
List<String> macs = ImmutableList.of("00:00:00:00:00:10", "00:00:00:00:00:20");
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(macs);
String[] macs = { "00:00:00:00:00:10", "00:00:00:00:00:20" };
List<AssociationInfo> associations = mockAssociations(macs);
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(associations);
Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
CachedBluetoothDevice cbd1 = mock(CachedBluetoothDevice.class);
when(cbd1.getAddress()).thenReturn(macs.get(0));
when(cbd1.getAddress()).thenReturn(macs[0]);
when(cbd1.getName()).thenReturn("Device 1");
cachedDevices.add(cbd1);
when(mCbm.getCachedDevicesCopy()).thenReturn(cachedDevices);
@@ -261,17 +265,18 @@ public class NotificationBackendTest {
@Test
public void getDeviceList_multipleDevices() throws Exception {
List<String> macs = ImmutableList.of("00:00:00:00:00:10", "00:00:00:00:00:20");
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(macs);
String[] macs = { "00:00:00:00:00:10", "00:00:00:00:00:20" };
List<AssociationInfo> associations = mockAssociations(macs);
when(mCdm.getAssociations(mCn.getPackageName(), 0)).thenReturn(associations);
Collection<CachedBluetoothDevice> cachedDevices = new ArrayList<>();
CachedBluetoothDevice cbd1 = mock(CachedBluetoothDevice.class);
when(cbd1.getAddress()).thenReturn(macs.get(0));
when(cbd1.getAddress()).thenReturn(macs[0]);
when(cbd1.getName()).thenReturn("Device 1");
cachedDevices.add(cbd1);
CachedBluetoothDevice cbd2 = mock(CachedBluetoothDevice.class);
when(cbd2.getAddress()).thenReturn(macs.get(1));
when(cbd2.getAddress()).thenReturn(macs[1]);
when(cbd2.getName()).thenReturn("Device 2");
cachedDevices.add(cbd2);
when(mCbm.getCachedDevicesCopy()).thenReturn(cachedDevices);
@@ -279,4 +284,16 @@ public class NotificationBackendTest {
assertThat(new NotificationBackend().getDeviceList(
mCdm, mBm, mCn.getPackageName(), 0).toString()).isEqualTo("Device 1, Device 2");
}
private ImmutableList<AssociationInfo> mockAssociations(String... macAddresses) {
final AssociationInfo[] associations = new AssociationInfo[macAddresses.length];
for (int index = 0; index < macAddresses.length; index++) {
final AssociationInfo association = mock(AssociationInfo.class);
when(association.isSelfManaged()).thenReturn(false);
when(association.getDeviceMacAddress())
.thenReturn(MacAddress.fromString(macAddresses[index]));
associations[index] = association;
}
return ImmutableList.copyOf(associations);
}
}

View File

@@ -94,7 +94,7 @@ public class VibrateForCallsPreferenceControllerTest {
@Test
public void getSummary_applyRampingRinger_rampingRingerSummary() {
Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, OFF);
Settings.Global.putInt(mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, ON);
Settings.System.putInt(mContentResolver, Settings.System.APPLY_RAMPING_RINGER, ON);
assertThat(mController.getSummary()).isEqualTo(
mContext.getText(R.string.vibrate_when_ringing_option_ramping_ringer));
@@ -103,7 +103,7 @@ public class VibrateForCallsPreferenceControllerTest {
@Test
public void getSummary_enableVibrateWhenRinging_alwaysVibrateSummary() {
Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, ON);
Settings.Global.putInt(mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, OFF);
Settings.System.putInt(mContentResolver, Settings.System.APPLY_RAMPING_RINGER, OFF);
assertThat(mController.getSummary()).isEqualTo(
mContext.getText(R.string.vibrate_when_ringing_option_always_vibrate));
@@ -112,7 +112,7 @@ public class VibrateForCallsPreferenceControllerTest {
@Test
public void getSummary_notApplyRampingRingerDisableVibrateWhenRinging_neverVibrateSummary() {
Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, OFF);
Settings.Global.putInt(mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, OFF);
Settings.System.putInt(mContentResolver, Settings.System.APPLY_RAMPING_RINGER, OFF);
assertThat(mController.getSummary()).isEqualTo(
mContext.getText(R.string.vibrate_when_ringing_option_never_vibrate));

View File

@@ -52,7 +52,7 @@ public class VibrateForCallsPreferenceFragmentTest {
@Test
public void getDefaultKey_applyRampingRinger_keyRampingRinger() {
Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, OFF);
Settings.Global.putInt(mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, ON);
Settings.System.putInt(mContentResolver, Settings.System.APPLY_RAMPING_RINGER, ON);
assertThat(mFragment.getDefaultKey()).isEqualTo(
VibrateForCallsPreferenceFragment.KEY_RAMPING_RINGER);
@@ -61,7 +61,7 @@ public class VibrateForCallsPreferenceFragmentTest {
@Test
public void getDefaultKey_enableVibrateWhenRinging_keyAlwaysVibrate() {
Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, ON);
Settings.Global.putInt(mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, OFF);
Settings.System.putInt(mContentResolver, Settings.System.APPLY_RAMPING_RINGER, OFF);
assertThat(mFragment.getDefaultKey()).isEqualTo(
VibrateForCallsPreferenceFragment.KEY_ALWAYS_VIBRATE);
@@ -70,7 +70,7 @@ public class VibrateForCallsPreferenceFragmentTest {
@Test
public void getDefaultKey_notApplyRampingRingerDisableVibrateWhenRinging_keyNeverVibrate() {
Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, OFF);
Settings.Global.putInt(mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, OFF);
Settings.System.putInt(mContentResolver, Settings.System.APPLY_RAMPING_RINGER, OFF);
assertThat(mFragment.getDefaultKey()).isEqualTo(
VibrateForCallsPreferenceFragment.KEY_NEVER_VIBRATE);
@@ -80,8 +80,8 @@ public class VibrateForCallsPreferenceFragmentTest {
public void setDefaultKey_keyRampingRinger_applyRampingRingerDisableVibrateWhenRinging() {
mFragment.setDefaultKey(VibrateForCallsPreferenceFragment.KEY_RAMPING_RINGER);
assertThat(Settings.Global.getInt(
mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, OFF)).isEqualTo(ON);
assertThat(Settings.System.getInt(
mContentResolver, Settings.System.APPLY_RAMPING_RINGER, OFF)).isEqualTo(ON);
assertThat(Settings.System.getInt(
mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, OFF)).isEqualTo(OFF);
}
@@ -90,8 +90,8 @@ public class VibrateForCallsPreferenceFragmentTest {
public void setDefaultKey_keyAlwaysVibrate_notApplyRampingRingerEnableVibrateWhenRinging() {
mFragment.setDefaultKey(VibrateForCallsPreferenceFragment.KEY_ALWAYS_VIBRATE);
assertThat(Settings.Global.getInt(
mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, OFF)).isEqualTo(OFF);
assertThat(Settings.System.getInt(
mContentResolver, Settings.System.APPLY_RAMPING_RINGER, OFF)).isEqualTo(OFF);
assertThat(Settings.System.getInt(
mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, OFF)).isEqualTo(ON);
}
@@ -100,8 +100,8 @@ public class VibrateForCallsPreferenceFragmentTest {
public void setDefaultKey_keyNeverVibrate_notApplyRampingRingerDisableVibrateWhenRinging() {
mFragment.setDefaultKey(VibrateForCallsPreferenceFragment.KEY_NEVER_VIBRATE);
assertThat(Settings.Global.getInt(
mContentResolver, Settings.Global.APPLY_RAMPING_RINGER, OFF)).isEqualTo(OFF);
assertThat(Settings.System.getInt(
mContentResolver, Settings.System.APPLY_RAMPING_RINGER, OFF)).isEqualTo(OFF);
assertThat(Settings.System.getInt(
mContentResolver, Settings.System.VIBRATE_WHEN_RINGING, OFF)).isEqualTo(OFF);
}