Search in sources :

Example 96 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by omnirom.

the class BluetoothSampleRateDialogPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
    mActiveDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
    mController = spy(new BluetoothSampleRateDialogPreferenceController(mContext, mLifecycle, mBluetoothA2dpConfigStore));
    mPreference = new BluetoothSampleRateDialogPreference(mContext);
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    mController.displayPreference(mScreen);
    mCodecConfigAAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_48000 | BluetoothCodecConfig.SAMPLE_RATE_88200, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig.CHANNEL_MODE_NONE, 0, 0, 0, 0);
    mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_96000, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig.CHANNEL_MODE_NONE, 0, 0, 0, 0);
    when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
}
Also used : BluetoothA2dpConfigStore(com.android.settings.development.BluetoothA2dpConfigStore) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Before(org.junit.Before)

Example 97 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by omnirom.

the class LogPersistPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mController = spy(new LogPersistPreferenceController(mContext, mFragment, mLifecycle));
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    SystemProperties.set("ro.debuggable", "1");
    mController.displayPreference(mScreen);
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) Before(org.junit.Before)

Example 98 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by omnirom.

the class BluetoothBitPerSampleDialogPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
    mActiveDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
    mController = spy(new BluetoothBitPerSampleDialogPreferenceController(mContext, mLifecycle, mBluetoothA2dpConfigStore));
    mPreference = new BluetoothBitPerSampleDialogPreference(mContext);
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    mController.displayPreference(mScreen);
    mCodecConfigAAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_16 | BluetoothCodecConfig.BITS_PER_SAMPLE_24, BluetoothCodecConfig.CHANNEL_MODE_NONE, 0, 0, 0, 0);
    mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_24, BluetoothCodecConfig.CHANNEL_MODE_NONE, 0, 0, 0, 0);
    when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
}
Also used : BluetoothA2dpConfigStore(com.android.settings.development.BluetoothA2dpConfigStore) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Before(org.junit.Before)

Example 99 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by omnirom.

the class BluetoothChannelModeDialogPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
    mActiveDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
    mController = new BluetoothChannelModeDialogPreferenceController(mContext, mLifecycle, mBluetoothA2dpConfigStore);
    mPreference = new BluetoothChannelModeDialogPreference(mContext);
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    mController.displayPreference(mScreen);
    mCodecConfigAAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig.CHANNEL_MODE_STEREO, 0, 0, 0, 0);
    mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT, BluetoothCodecConfig.SAMPLE_RATE_NONE, BluetoothCodecConfig.BITS_PER_SAMPLE_NONE, BluetoothCodecConfig.CHANNEL_MODE_MONO | BluetoothCodecConfig.CHANNEL_MODE_STEREO, 0, 0, 0, 0);
    when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
}
Also used : BluetoothA2dpConfigStore(com.android.settings.development.BluetoothA2dpConfigStore) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Before(org.junit.Before)

Example 100 with Lifecycle

use of com.android.settingslib.core.lifecycle.Lifecycle in project android_packages_apps_Settings by omnirom.

the class BluetoothCodecDialogPreferenceControllerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    mContext = RuntimeEnvironment.application;
    mLifecycleOwner = () -> mLifecycle;
    mLifecycle = new Lifecycle(mLifecycleOwner);
    mBluetoothA2dpConfigStore = spy(new BluetoothA2dpConfigStore());
    mActiveDevice = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
    mController = new BluetoothCodecDialogPreferenceController(mContext, mLifecycle, mBluetoothA2dpConfigStore, mCallback);
    mPreference = new BluetoothCodecDialogPreference(mContext);
    when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
    mController.displayPreference(mScreen);
    mCodecConfigSBC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC, BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST, BluetoothCodecConfig.SAMPLE_RATE_96000 | BluetoothCodecConfig.SAMPLE_RATE_176400, BluetoothCodecConfig.BITS_PER_SAMPLE_32, BluetoothCodecConfig.CHANNEL_MODE_MONO | BluetoothCodecConfig.CHANNEL_MODE_STEREO, 0, 0, 0, 0);
    mCodecConfigAAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC, BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST, BluetoothCodecConfig.SAMPLE_RATE_48000 | BluetoothCodecConfig.SAMPLE_RATE_88200, BluetoothCodecConfig.BITS_PER_SAMPLE_16 | BluetoothCodecConfig.BITS_PER_SAMPLE_24, BluetoothCodecConfig.CHANNEL_MODE_STEREO, 0, 0, 0, 0);
    mCodecConfigAPTX = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX);
    mCodecConfigAPTXHD = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD);
    mCodecConfigLDAC = new BluetoothCodecConfig(BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC);
    when(mBluetoothA2dp.getActiveDevice()).thenReturn(mActiveDevice);
}
Also used : BluetoothA2dpConfigStore(com.android.settings.development.BluetoothA2dpConfigStore) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Before(org.junit.Before)

Aggregations

Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)259 Before (org.junit.Before)218 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)33 ArrayList (java.util.ArrayList)32 PreferenceManager (androidx.preference.PreferenceManager)16 Preference (androidx.preference.Preference)15 TextView (android.widget.TextView)11 SettingsActivity (com.android.settings.SettingsActivity)10 Handler (android.os.Handler)9 LinkProperties (android.net.LinkProperties)8 Network (android.net.Network)8 NetworkRequest (android.net.NetworkRequest)8 LockScreenNotificationPreferenceController (com.android.settings.notification.LockScreenNotificationPreferenceController)8 BluetoothManager (android.bluetooth.BluetoothManager)7 Intent (android.content.Intent)7 PreferenceCategory (androidx.preference.PreferenceCategory)7 SwitchBar (com.android.settings.widget.SwitchBar)7 BluetoothCodecConfig (android.bluetooth.BluetoothCodecConfig)6 Bundle (android.os.Bundle)6 RecyclerView (android.support.v7.widget.RecyclerView)6