diff options
| -rw-r--r-- | core/java/android/provider/Settings.java | 21 | ||||
| -rw-r--r-- | services/core/java/com/android/server/BluetoothManagerService.java | 20 |
2 files changed, 29 insertions, 12 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 07feb44efea9..54952fc2dc39 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6364,6 +6364,27 @@ public final class Settings { public static final String ALLOW_MOCK_LOCATION = "mock_location"; /** + * This is used by Bluetooth Manager to store adapter name + * @hide + */ + @Readable(maxTargetSdk = Build.VERSION_CODES.S) + public static final String BLUETOOTH_NAME = "bluetooth_name"; + + /** + * This is used by Bluetooth Manager to store adapter address + * @hide + */ + @Readable(maxTargetSdk = Build.VERSION_CODES.S) + public static final String BLUETOOTH_ADDRESS = "bluetooth_address"; + + /** + * This is used by Bluetooth Manager to store whether adapter address is valid + * @hide + */ + @Readable(maxTargetSdk = Build.VERSION_CODES.S) + public static final String BLUETOOTH_ADDR_VALID = "bluetooth_addr_valid"; + + /** * Setting to indicate that on device captions are enabled. * * @hide diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index ea637922e6cc..ff24c6f16c42 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -110,10 +110,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { private static final String BLUETOOTH_PRIVILEGED = android.Manifest.permission.BLUETOOTH_PRIVILEGED; - private static final String SECURE_SETTINGS_BLUETOOTH_ADDR_VALID = "bluetooth_addr_valid"; - private static final String SECURE_SETTINGS_BLUETOOTH_ADDRESS = "bluetooth_address"; - private static final String SECURE_SETTINGS_BLUETOOTH_NAME = "bluetooth_name"; - private static final int ACTIVE_LOG_MAX_SIZE = 20; private static final int CRASH_LOG_MAX_SIZE = 100; @@ -636,7 +632,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (mContext.getResources() .getBoolean(com.android.internal.R.bool.config_bluetooth_address_validation) && Settings.Secure.getIntForUser(mContentResolver, - SECURE_SETTINGS_BLUETOOTH_ADDR_VALID, 0, mUserId) + Settings.Secure.BLUETOOTH_NAME, 0, mUserId) == 0) { // if the valid flag is not set, don't load the address and name if (DBG) { @@ -645,9 +641,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { return; } mName = Settings.Secure.getStringForUser( - mContentResolver, SECURE_SETTINGS_BLUETOOTH_NAME, mUserId); + mContentResolver, Settings.Secure.BLUETOOTH_NAME, mUserId); mAddress = Settings.Secure.getStringForUser( - mContentResolver, SECURE_SETTINGS_BLUETOOTH_ADDRESS, mUserId); + mContentResolver, Settings.Secure.BLUETOOTH_ADDRESS, mUserId); if (DBG) { Slog.d(TAG, "Stored bluetooth Name=" + mName + ",Address=" + mAddress); } @@ -661,30 +657,30 @@ class BluetoothManagerService extends IBluetoothManager.Stub { */ private void storeNameAndAddress(String name, String address) { if (name != null) { - Settings.Secure.putStringForUser(mContentResolver, SECURE_SETTINGS_BLUETOOTH_NAME, name, + Settings.Secure.putStringForUser(mContentResolver, Settings.Secure.BLUETOOTH_NAME, name, mUserId); mName = name; if (DBG) { Slog.d(TAG, "Stored Bluetooth name: " + Settings.Secure.getStringForUser( - mContentResolver, SECURE_SETTINGS_BLUETOOTH_NAME, + mContentResolver, Settings.Secure.BLUETOOTH_NAME, mUserId)); } } if (address != null) { - Settings.Secure.putStringForUser(mContentResolver, SECURE_SETTINGS_BLUETOOTH_ADDRESS, + Settings.Secure.putStringForUser(mContentResolver, Settings.Secure.BLUETOOTH_ADDRESS, address, mUserId); mAddress = address; if (DBG) { Slog.d(TAG, "Stored Bluetoothaddress: " + Settings.Secure.getStringForUser( - mContentResolver, SECURE_SETTINGS_BLUETOOTH_ADDRESS, + mContentResolver, Settings.Secure.BLUETOOTH_ADDRESS, mUserId)); } } if ((name != null) && (address != null)) { - Settings.Secure.putIntForUser(mContentResolver, SECURE_SETTINGS_BLUETOOTH_ADDR_VALID, 1, + Settings.Secure.putIntForUser(mContentResolver, Settings.Secure.BLUETOOTH_ADDR_VALID, 1, mUserId); } } |