Loading AndroidManifest.xml +12 −0 Original line number Diff line number Diff line Loading @@ -2987,6 +2987,18 @@ android:value="true" /> </activity> <activity android:name="Settings$BluetoothDeviceDetailActivity" android:label="@string/device_details_title" android:permission="android.permission.BLUETOOTH_PRIVILEGED" android:parentActivityName="Settings$ConnectedDeviceDashboardActivity"> <intent-filter android:priority="1"> <action android:name="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="com.android.settings.FRAGMENT_CLASS" android:value="com.android.settings.bluetooth.BluetoothDeviceDetailsFragment" /> </activity> <activity android:name=".panel.SettingsPanelActivity" android:label="@string/settings_panel_title" android:theme="@style/Theme.BottomDialog" Loading src/com/android/settings/Settings.java +1 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ public class Settings extends SettingsActivity { } public static class WebViewAppPickerActivity extends SettingsActivity { /* empty */ } public static class AdvancedConnectedDeviceActivity extends SettingsActivity { /* empty */ } public static class BluetoothDeviceDetailActivity extends SettingsActivity { /* empty */ } // Top level categories for new IA public static class NetworkDashboardActivity extends SettingsActivity {} Loading src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +31 −4 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ import java.util.List; * supports, such as "Phone audio", "Media audio", "Contact sharing", etc. */ public class BluetoothDetailsProfilesController extends BluetoothDetailsController implements Preference.OnPreferenceClickListener { implements Preference.OnPreferenceClickListener, LocalBluetoothProfileManager.ServiceListener { private static final String KEY_PROFILES_GROUP = "bluetooth_profiles"; @VisibleForTesting Loading Loading @@ -87,6 +88,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll pref.setKey(profile.toString()); pref.setTitle(profile.getNameResource(mCachedDevice.getDevice())); pref.setOnPreferenceClickListener(this); pref.setOrder(profile.getOrdinal()); return pref; } Loading Loading @@ -221,7 +223,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } BluetoothDevice device = mCachedDevice.getDevice(); A2dpProfile a2dp = (A2dpProfile) profile; if (a2dp.supportsHighQualityAudio(device)) { if (a2dp.isProfileReady() && a2dp.supportsHighQualityAudio(device)) { SwitchPreference highQualityAudioPref = new SwitchPreference( mProfilesContainer.getContext()); highQualityAudioPref.setKey(HIGH_QUALITY_AUDIO_PREF_TAG); Loading @@ -235,6 +237,28 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } } @Override public void onPause() { super.onPause(); mProfileManager.removeServiceListener(this); } @Override public void onResume() { super.onResume(); mProfileManager.addServiceListener(this); } @Override public void onServiceConnected() { refresh(); } @Override public void onServiceDisconnected() { refresh(); } /** * Refreshes the state of the switches for all profiles, possibly adding or removing switches as * needed. Loading @@ -242,7 +266,10 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll @Override protected void refresh() { for (LocalBluetoothProfile profile : getProfiles()) { SwitchPreference pref = (SwitchPreference) mProfilesContainer.findPreference( if (!profile.isProfileReady()) { continue; } SwitchPreference pref = mProfilesContainer.findPreference( profile.toString()); if (pref == null) { pref = createProfilePreference(mProfilesContainer.getContext(), profile); Loading @@ -252,7 +279,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll refreshProfilePreference(pref, profile); } for (LocalBluetoothProfile removedProfile : mCachedDevice.getRemovedProfiles()) { SwitchPreference pref = (SwitchPreference) mProfilesContainer.findPreference( final SwitchPreference pref = mProfilesContainer.findPreference( removedProfile.toString()); if (pref != null) { mProfilesContainer.removePreference(pref); Loading src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java +5 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,11 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment mDeviceAddress = getArguments().getString(KEY_DEVICE_ADDRESS); mManager = getLocalBluetoothManager(context); mCachedDevice = getCachedDevice(mDeviceAddress); if (mCachedDevice == null) { // Close this page if device is null with invalid device mac address finish(); return; } super.onAttach(context); use(AdvancedBluetoothDetailsHeaderController.class).init(mCachedDevice); Loading tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsProfilesControllerTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -294,6 +294,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont PbapServerProfile psp = mock(PbapServerProfile.class); when(psp.getNameResource(mDevice)).thenReturn(R.string.bluetooth_profile_pbap); when(psp.toString()).thenReturn(PbapServerProfile.NAME); when(psp.isProfileReady()).thenReturn(true); when(mProfileManager.getPbapProfile()).thenReturn(psp); showScreen(mController); Loading @@ -316,6 +317,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont PbapServerProfile psp = mock(PbapServerProfile.class); when(psp.getNameResource(mDevice)).thenReturn(R.string.bluetooth_profile_pbap); when(psp.toString()).thenReturn(PbapServerProfile.NAME); when(psp.isProfileReady()).thenReturn(true); when(mProfileManager.getPbapProfile()).thenReturn(psp); showScreen(mController); Loading @@ -336,6 +338,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont setupDevice(makeDefaultDeviceConfig()); MapProfile mapProfile = mock(MapProfile.class); when(mapProfile.getNameResource(mDevice)).thenReturn(R.string.bluetooth_profile_map); when(mapProfile.isProfileReady()).thenReturn(true); when(mProfileManager.getMapProfile()).thenReturn(mapProfile); when(mProfileManager.getProfileByName(eq(mapProfile.toString()))).thenReturn(mapProfile); mDevice.setMessageAccessPermission(BluetoothDevice.ACCESS_REJECTED); Loading @@ -361,6 +364,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont when(profile.supportsHighQualityAudio(mDevice)).thenReturn(supportsHighQualityAudio); when(profile.isHighQualityAudioEnabled(mDevice)).thenReturn(highQualityAudioEnabled); when(profile.isPreferred(mDevice)).thenReturn(preferred); when(profile.isProfileReady()).thenReturn(true); mConnectableProfiles.add(profile); return profile; } Loading Loading @@ -442,12 +446,25 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont setupDevice(makeDefaultDeviceConfig()); A2dpProfile audioProfile = addMockA2dpProfile(false, true, true); showScreen(mController); SwitchPreference audioPref = (SwitchPreference) mScreen.findPreference(audioProfile.toString()); SwitchPreference audioPref = mScreen.findPreference(audioProfile.toString()); SwitchPreference highQualityAudioPref = getHighQualityAudioPref(); assertThat(audioPref).isNotNull(); assertThat(audioPref.isChecked()).isFalse(); assertThat(highQualityAudioPref).isNotNull(); assertThat(highQualityAudioPref.isVisible()).isFalse(); } @Test public void onResume_addServiceListener() { mController.onResume(); verify(mProfileManager).addServiceListener(mController); } @Test public void onPause_removeServiceListener() { mController.onPause(); verify(mProfileManager).removeServiceListener(mController); } } tests/unit/src/com/android/settings/bluetooth/BluetoothDeviceDetailsRotationTest.java +10 −10 File changed.Contains only whitespace changes. Show changes Loading
AndroidManifest.xml +12 −0 Original line number Diff line number Diff line Loading @@ -2987,6 +2987,18 @@ android:value="true" /> </activity> <activity android:name="Settings$BluetoothDeviceDetailActivity" android:label="@string/device_details_title" android:permission="android.permission.BLUETOOTH_PRIVILEGED" android:parentActivityName="Settings$ConnectedDeviceDashboardActivity"> <intent-filter android:priority="1"> <action android:name="com.android.settings.BLUETOOTH_DEVICE_DETAIL_SETTINGS" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <meta-data android:name="com.android.settings.FRAGMENT_CLASS" android:value="com.android.settings.bluetooth.BluetoothDeviceDetailsFragment" /> </activity> <activity android:name=".panel.SettingsPanelActivity" android:label="@string/settings_panel_title" android:theme="@style/Theme.BottomDialog" Loading
src/com/android/settings/Settings.java +1 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ public class Settings extends SettingsActivity { } public static class WebViewAppPickerActivity extends SettingsActivity { /* empty */ } public static class AdvancedConnectedDeviceActivity extends SettingsActivity { /* empty */ } public static class BluetoothDeviceDetailActivity extends SettingsActivity { /* empty */ } // Top level categories for new IA public static class NetworkDashboardActivity extends SettingsActivity {} Loading
src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +31 −4 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ import java.util.List; * supports, such as "Phone audio", "Media audio", "Contact sharing", etc. */ public class BluetoothDetailsProfilesController extends BluetoothDetailsController implements Preference.OnPreferenceClickListener { implements Preference.OnPreferenceClickListener, LocalBluetoothProfileManager.ServiceListener { private static final String KEY_PROFILES_GROUP = "bluetooth_profiles"; @VisibleForTesting Loading Loading @@ -87,6 +88,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll pref.setKey(profile.toString()); pref.setTitle(profile.getNameResource(mCachedDevice.getDevice())); pref.setOnPreferenceClickListener(this); pref.setOrder(profile.getOrdinal()); return pref; } Loading Loading @@ -221,7 +223,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } BluetoothDevice device = mCachedDevice.getDevice(); A2dpProfile a2dp = (A2dpProfile) profile; if (a2dp.supportsHighQualityAudio(device)) { if (a2dp.isProfileReady() && a2dp.supportsHighQualityAudio(device)) { SwitchPreference highQualityAudioPref = new SwitchPreference( mProfilesContainer.getContext()); highQualityAudioPref.setKey(HIGH_QUALITY_AUDIO_PREF_TAG); Loading @@ -235,6 +237,28 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } } @Override public void onPause() { super.onPause(); mProfileManager.removeServiceListener(this); } @Override public void onResume() { super.onResume(); mProfileManager.addServiceListener(this); } @Override public void onServiceConnected() { refresh(); } @Override public void onServiceDisconnected() { refresh(); } /** * Refreshes the state of the switches for all profiles, possibly adding or removing switches as * needed. Loading @@ -242,7 +266,10 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll @Override protected void refresh() { for (LocalBluetoothProfile profile : getProfiles()) { SwitchPreference pref = (SwitchPreference) mProfilesContainer.findPreference( if (!profile.isProfileReady()) { continue; } SwitchPreference pref = mProfilesContainer.findPreference( profile.toString()); if (pref == null) { pref = createProfilePreference(mProfilesContainer.getContext(), profile); Loading @@ -252,7 +279,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll refreshProfilePreference(pref, profile); } for (LocalBluetoothProfile removedProfile : mCachedDevice.getRemovedProfiles()) { SwitchPreference pref = (SwitchPreference) mProfilesContainer.findPreference( final SwitchPreference pref = mProfilesContainer.findPreference( removedProfile.toString()); if (pref != null) { mProfilesContainer.removePreference(pref); Loading
src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java +5 −0 Original line number Diff line number Diff line Loading @@ -107,6 +107,11 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment mDeviceAddress = getArguments().getString(KEY_DEVICE_ADDRESS); mManager = getLocalBluetoothManager(context); mCachedDevice = getCachedDevice(mDeviceAddress); if (mCachedDevice == null) { // Close this page if device is null with invalid device mac address finish(); return; } super.onAttach(context); use(AdvancedBluetoothDetailsHeaderController.class).init(mCachedDevice); Loading
tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsProfilesControllerTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -294,6 +294,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont PbapServerProfile psp = mock(PbapServerProfile.class); when(psp.getNameResource(mDevice)).thenReturn(R.string.bluetooth_profile_pbap); when(psp.toString()).thenReturn(PbapServerProfile.NAME); when(psp.isProfileReady()).thenReturn(true); when(mProfileManager.getPbapProfile()).thenReturn(psp); showScreen(mController); Loading @@ -316,6 +317,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont PbapServerProfile psp = mock(PbapServerProfile.class); when(psp.getNameResource(mDevice)).thenReturn(R.string.bluetooth_profile_pbap); when(psp.toString()).thenReturn(PbapServerProfile.NAME); when(psp.isProfileReady()).thenReturn(true); when(mProfileManager.getPbapProfile()).thenReturn(psp); showScreen(mController); Loading @@ -336,6 +338,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont setupDevice(makeDefaultDeviceConfig()); MapProfile mapProfile = mock(MapProfile.class); when(mapProfile.getNameResource(mDevice)).thenReturn(R.string.bluetooth_profile_map); when(mapProfile.isProfileReady()).thenReturn(true); when(mProfileManager.getMapProfile()).thenReturn(mapProfile); when(mProfileManager.getProfileByName(eq(mapProfile.toString()))).thenReturn(mapProfile); mDevice.setMessageAccessPermission(BluetoothDevice.ACCESS_REJECTED); Loading @@ -361,6 +364,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont when(profile.supportsHighQualityAudio(mDevice)).thenReturn(supportsHighQualityAudio); when(profile.isHighQualityAudioEnabled(mDevice)).thenReturn(highQualityAudioEnabled); when(profile.isPreferred(mDevice)).thenReturn(preferred); when(profile.isProfileReady()).thenReturn(true); mConnectableProfiles.add(profile); return profile; } Loading Loading @@ -442,12 +446,25 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont setupDevice(makeDefaultDeviceConfig()); A2dpProfile audioProfile = addMockA2dpProfile(false, true, true); showScreen(mController); SwitchPreference audioPref = (SwitchPreference) mScreen.findPreference(audioProfile.toString()); SwitchPreference audioPref = mScreen.findPreference(audioProfile.toString()); SwitchPreference highQualityAudioPref = getHighQualityAudioPref(); assertThat(audioPref).isNotNull(); assertThat(audioPref.isChecked()).isFalse(); assertThat(highQualityAudioPref).isNotNull(); assertThat(highQualityAudioPref.isVisible()).isFalse(); } @Test public void onResume_addServiceListener() { mController.onResume(); verify(mProfileManager).addServiceListener(mController); } @Test public void onPause_removeServiceListener() { mController.onPause(); verify(mProfileManager).removeServiceListener(mController); } }
tests/unit/src/com/android/settings/bluetooth/BluetoothDeviceDetailsRotationTest.java +10 −10 File changed.Contains only whitespace changes. Show changes