diff options
| author | 2023-09-19 07:22:32 +0000 | |
|---|---|---|
| committer | 2023-09-19 07:22:32 +0000 | |
| commit | 822bc09d5c618cf9e4cef07e16e6131c63b17ddf (patch) | |
| tree | 37300ad540f901bcb655004346a2e02d9e04fcc4 | |
| parent | 7248f88ab3e922b1a17b417c6b73e0bfc024de8c (diff) | |
| parent | b65d018feab5637a8113988407ec8a9f03b7546d (diff) | |
Merge "Rename the misleading variable name in setEnabled()" into main
16 files changed, 62 insertions, 68 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java index 91b852ab9f67..70126ace7d4c 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java @@ -198,19 +198,19 @@ public class A2dpProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } boolean isA2dpPlaying() { if (mService == null) return false; diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java index c7a5bd86c1cd..38cd04e8a0a3 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java @@ -140,19 +140,19 @@ final class A2dpSinkProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } boolean isAudioPlaying() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipSetCoordinatorProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipSetCoordinatorProfile.java index c3f845ca8c0a..45cafc6bf6cb 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipSetCoordinatorProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipSetCoordinatorProfile.java @@ -178,19 +178,19 @@ public class CsipSetCoordinatorProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null || device == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } @Override diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HapClientProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HapClientProfile.java index 6b7f733b5413..660090ddef2d 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HapClientProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HapClientProfile.java @@ -258,19 +258,19 @@ public class HapClientProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null || device == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } @Override diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HeadsetProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HeadsetProfile.java index 7e5c1240cc63..b79f147c321f 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HeadsetProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HeadsetProfile.java @@ -165,19 +165,19 @@ public class HeadsetProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public List<BluetoothDevice> getConnectedDevices() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java index 5fbb4c3e5712..14fab16de3e6 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java @@ -231,19 +231,19 @@ public class HearingAidProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null || device == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } /** diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HfpClientProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HfpClientProfile.java index 66225a2bffca..b0e0049a5ed4 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HfpClientProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HfpClientProfile.java @@ -150,19 +150,19 @@ final class HfpClientProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } @Override diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidDeviceProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidDeviceProfile.java index 8a2c4f8a1230..5468efbdbd3e 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidDeviceProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidDeviceProfile.java @@ -123,13 +123,13 @@ public class HidDeviceProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; // if set preferred to false, then disconnect to the current device if (!enabled) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } @Override diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java index 3c24b4a095b9..5b91ac9d3dab 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java @@ -126,19 +126,19 @@ public class HidProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public String toString() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LeAudioProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LeAudioProfile.java index e781f1307072..a93524f6d873 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LeAudioProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LeAudioProfile.java @@ -24,24 +24,18 @@ import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.annotation.Nullable; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; -import android.bluetooth.BluetoothCodecConfig; -import android.bluetooth.BluetoothCodecStatus; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothLeAudio; import android.bluetooth.BluetoothProfile; -import android.bluetooth.BluetoothUuid; import android.content.Context; import android.os.Build; -import android.os.ParcelUuid; import android.util.Log; import androidx.annotation.RequiresApi; -import com.android.internal.annotations.VisibleForTesting; import com.android.settingslib.R; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; public class LeAudioProfile implements LocalBluetoothProfile { @@ -233,19 +227,19 @@ public class LeAudioProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null || device == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public String toString() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java index 4881a86b398a..0a803bc7825d 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapClientProfile.java @@ -137,19 +137,19 @@ public final class MapClientProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public List<BluetoothDevice> getConnectedDevices() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapProfile.java index 75c1926683ef..db1ba5e3741f 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/MapProfile.java @@ -138,19 +138,19 @@ public class MapProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public List<BluetoothDevice> getConnectedDevices() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/PanProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/PanProfile.java index 767df352b70f..dec862b07a6a 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/PanProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/PanProfile.java @@ -105,7 +105,7 @@ public class PanProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } @@ -117,12 +117,12 @@ public class PanProfile implements LocalBluetoothProfile { mService.setConnectionPolicy(sink, CONNECTION_POLICY_FORBIDDEN); } } - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public String toString() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapClientProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapClientProfile.java index 0d11293a01b7..65b89baaea81 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapClientProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapClientProfile.java @@ -151,19 +151,19 @@ public final class PbapClientProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public String toString() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java index 9e2e4a14124a..784b821745bd 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/PbapServerProfile.java @@ -108,16 +108,16 @@ public class PbapServerProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (!enabled) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public String toString() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/SapProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/SapProfile.java index 104f1d738000..0f8892f760c1 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/SapProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/SapProfile.java @@ -136,19 +136,19 @@ final class SapProfile implements LocalBluetoothProfile { @Override public boolean setEnabled(BluetoothDevice device, boolean enabled) { - boolean isEnabled = false; + boolean isSuccessful = false; if (mService == null) { return false; } if (enabled) { if (mService.getConnectionPolicy(device) < CONNECTION_POLICY_ALLOWED) { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_ALLOWED); } } else { - isEnabled = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); + isSuccessful = mService.setConnectionPolicy(device, CONNECTION_POLICY_FORBIDDEN); } - return isEnabled; + return isSuccessful; } public List<BluetoothDevice> getConnectedDevices() { |