Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +0 −38 Original line number Diff line number Diff line Loading @@ -71,15 +71,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> boolean mJustDiscovered; private int mMessageRejectionCount; private final Collection<Callback> mCallbacks = new ArrayList<>(); // How many times user should reject the connection to make the choice persist. private final static int MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST = 2; private final static String MESSAGE_REJECTION_COUNT_PREFS_NAME = "bluetooth_message_reject"; /** * Last time a bt profile auto-connect was attempted. * If an ACTION_UUID intent comes in within Loading Loading @@ -348,7 +341,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> fetchActiveDevices(); migratePhonebookPermissionChoice(); migrateMessagePermissionChoice(); fetchMessageRejectionCount(); dispatchAttributesChanged(); } Loading Loading @@ -642,8 +634,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_UNKNOWN); mDevice.setMessageAccessPermission(BluetoothDevice.ACCESS_UNKNOWN); mDevice.setSimAccessPermission(BluetoothDevice.ACCESS_UNKNOWN); mMessageRejectionCount = 0; saveMessageRejectionCount(); } refresh(); Loading Loading @@ -797,34 +787,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> editor.commit(); } /** * @return Whether this rejection should persist. */ public boolean checkAndIncreaseMessageRejectionCount() { if (mMessageRejectionCount < MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST) { mMessageRejectionCount++; saveMessageRejectionCount(); } return mMessageRejectionCount >= MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST; } private void fetchMessageRejectionCount() { SharedPreferences preference = mContext.getSharedPreferences( MESSAGE_REJECTION_COUNT_PREFS_NAME, Context.MODE_PRIVATE); mMessageRejectionCount = preference.getInt(mDevice.getAddress(), 0); } private void saveMessageRejectionCount() { SharedPreferences.Editor editor = mContext.getSharedPreferences( MESSAGE_REJECTION_COUNT_PREFS_NAME, Context.MODE_PRIVATE).edit(); if (mMessageRejectionCount == 0) { editor.remove(mDevice.getAddress()); } else { editor.putInt(mDevice.getAddress(), mMessageRejectionCount); } editor.commit(); } private void processPhonebookAccess() { if (mDevice.getBondState() != BluetoothDevice.BOND_BONDED) return; Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +0 −38 Original line number Diff line number Diff line Loading @@ -71,15 +71,8 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> boolean mJustDiscovered; private int mMessageRejectionCount; private final Collection<Callback> mCallbacks = new ArrayList<>(); // How many times user should reject the connection to make the choice persist. private final static int MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST = 2; private final static String MESSAGE_REJECTION_COUNT_PREFS_NAME = "bluetooth_message_reject"; /** * Last time a bt profile auto-connect was attempted. * If an ACTION_UUID intent comes in within Loading Loading @@ -348,7 +341,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> fetchActiveDevices(); migratePhonebookPermissionChoice(); migrateMessagePermissionChoice(); fetchMessageRejectionCount(); dispatchAttributesChanged(); } Loading Loading @@ -642,8 +634,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_UNKNOWN); mDevice.setMessageAccessPermission(BluetoothDevice.ACCESS_UNKNOWN); mDevice.setSimAccessPermission(BluetoothDevice.ACCESS_UNKNOWN); mMessageRejectionCount = 0; saveMessageRejectionCount(); } refresh(); Loading Loading @@ -797,34 +787,6 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> editor.commit(); } /** * @return Whether this rejection should persist. */ public boolean checkAndIncreaseMessageRejectionCount() { if (mMessageRejectionCount < MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST) { mMessageRejectionCount++; saveMessageRejectionCount(); } return mMessageRejectionCount >= MESSAGE_REJECTION_COUNT_LIMIT_TO_PERSIST; } private void fetchMessageRejectionCount() { SharedPreferences preference = mContext.getSharedPreferences( MESSAGE_REJECTION_COUNT_PREFS_NAME, Context.MODE_PRIVATE); mMessageRejectionCount = preference.getInt(mDevice.getAddress(), 0); } private void saveMessageRejectionCount() { SharedPreferences.Editor editor = mContext.getSharedPreferences( MESSAGE_REJECTION_COUNT_PREFS_NAME, Context.MODE_PRIVATE).edit(); if (mMessageRejectionCount == 0) { editor.remove(mDevice.getAddress()); } else { editor.putInt(mDevice.getAddress(), mMessageRejectionCount); } editor.commit(); } private void processPhonebookAccess() { if (mDevice.getBondState() != BluetoothDevice.BOND_BONDED) return; Loading