Loading src/com/android/settings/bluetooth/BluetoothSettings.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -93,6 +93,9 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem private final IntentFilter mIntentFilter; private final IntentFilter mIntentFilter; private static String mPreDeviceAddress = null; private static boolean mNeedToRemove = false; // accessed from inner class (not private to avoid thunks) // accessed from inner class (not private to avoid thunks) Preference mMyDevicePreference; Preference mMyDevicePreference; Loading Loading @@ -408,12 +411,23 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem DeviceProfilesSettings profileFragment = (DeviceProfilesSettings)activity. DeviceProfilesSettings profileFragment = (DeviceProfilesSettings)activity. getFragmentManager().findFragmentById(R.id.bluetooth_fragment_settings); getFragmentManager().findFragmentById(R.id.bluetooth_fragment_settings); if(null != mPreDeviceAddress){ if(!((device.getAddress()).equals(mPreDeviceAddress))){ if(mNeedToRemove){ activity.getFragmentManager().beginTransaction().remove(profileFragment) .commitAllowingStateLoss(); profileFragment = null; } } } if (mSettingsDialogView != null){ if (mSettingsDialogView != null){ ViewGroup parent = (ViewGroup) mSettingsDialogView.getParent(); ViewGroup parent = (ViewGroup) mSettingsDialogView.getParent(); if (parent != null) { if (parent != null) { parent.removeView(mSettingsDialogView); parent.removeView(mSettingsDialogView); } } } } mPreDeviceAddress = device.getAddress(); if (profileFragment == null) { if (profileFragment == null) { LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater(); Loading @@ -435,6 +449,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem final DeviceProfilesSettings dpsFragment = profileFragment; final DeviceProfilesSettings dpsFragment = profileFragment; final Context context = v.getContext(); final Context context = v.getContext(); mNeedToRemove = true; settingsDialog.setView(dialogLayout); settingsDialog.setView(dialogLayout); settingsDialog.setTitle(R.string.bluetooth_preference_paired_devices); settingsDialog.setTitle(R.string.bluetooth_preference_paired_devices); settingsDialog.setPositiveButton(R.string.okay, settingsDialog.setPositiveButton(R.string.okay, Loading Loading @@ -464,6 +479,8 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem if (!activity.isDestroyed()) { if (!activity.isDestroyed()) { activity.getFragmentManager().beginTransaction().remove(dpsFragment) activity.getFragmentManager().beginTransaction().remove(dpsFragment) .commitAllowingStateLoss(); .commitAllowingStateLoss(); mNeedToRemove = false; } } } } }); }); Loading src/com/android/settings/bluetooth/CachedBluetoothDevice.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -401,6 +401,10 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { return mName; return mName; } } public String getAddress(){ return mDevice.getAddress(); } /** /** * Populate name from BluetoothDevice.ACTION_FOUND intent * Populate name from BluetoothDevice.ACTION_FOUND intent */ */ Loading Loading
src/com/android/settings/bluetooth/BluetoothSettings.java +17 −0 Original line number Original line Diff line number Diff line Loading @@ -93,6 +93,9 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem private final IntentFilter mIntentFilter; private final IntentFilter mIntentFilter; private static String mPreDeviceAddress = null; private static boolean mNeedToRemove = false; // accessed from inner class (not private to avoid thunks) // accessed from inner class (not private to avoid thunks) Preference mMyDevicePreference; Preference mMyDevicePreference; Loading Loading @@ -408,12 +411,23 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem DeviceProfilesSettings profileFragment = (DeviceProfilesSettings)activity. DeviceProfilesSettings profileFragment = (DeviceProfilesSettings)activity. getFragmentManager().findFragmentById(R.id.bluetooth_fragment_settings); getFragmentManager().findFragmentById(R.id.bluetooth_fragment_settings); if(null != mPreDeviceAddress){ if(!((device.getAddress()).equals(mPreDeviceAddress))){ if(mNeedToRemove){ activity.getFragmentManager().beginTransaction().remove(profileFragment) .commitAllowingStateLoss(); profileFragment = null; } } } if (mSettingsDialogView != null){ if (mSettingsDialogView != null){ ViewGroup parent = (ViewGroup) mSettingsDialogView.getParent(); ViewGroup parent = (ViewGroup) mSettingsDialogView.getParent(); if (parent != null) { if (parent != null) { parent.removeView(mSettingsDialogView); parent.removeView(mSettingsDialogView); } } } } mPreDeviceAddress = device.getAddress(); if (profileFragment == null) { if (profileFragment == null) { LayoutInflater inflater = getActivity().getLayoutInflater(); LayoutInflater inflater = getActivity().getLayoutInflater(); Loading @@ -435,6 +449,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem final DeviceProfilesSettings dpsFragment = profileFragment; final DeviceProfilesSettings dpsFragment = profileFragment; final Context context = v.getContext(); final Context context = v.getContext(); mNeedToRemove = true; settingsDialog.setView(dialogLayout); settingsDialog.setView(dialogLayout); settingsDialog.setTitle(R.string.bluetooth_preference_paired_devices); settingsDialog.setTitle(R.string.bluetooth_preference_paired_devices); settingsDialog.setPositiveButton(R.string.okay, settingsDialog.setPositiveButton(R.string.okay, Loading Loading @@ -464,6 +479,8 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem if (!activity.isDestroyed()) { if (!activity.isDestroyed()) { activity.getFragmentManager().beginTransaction().remove(dpsFragment) activity.getFragmentManager().beginTransaction().remove(dpsFragment) .commitAllowingStateLoss(); .commitAllowingStateLoss(); mNeedToRemove = false; } } } } }); }); Loading
src/com/android/settings/bluetooth/CachedBluetoothDevice.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -401,6 +401,10 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> { return mName; return mName; } } public String getAddress(){ return mDevice.getAddress(); } /** /** * Populate name from BluetoothDevice.ACTION_FOUND intent * Populate name from BluetoothDevice.ACTION_FOUND intent */ */ Loading