diff options
| -rw-r--r-- | core/java/android/server/BluetoothBondState.java | 8 | ||||
| -rwxr-xr-x | core/java/android/server/BluetoothService.java | 2 | ||||
| -rwxr-xr-x | keystore/tests/src/android/security/KeyStoreTest.java | 12 |
3 files changed, 19 insertions, 3 deletions
diff --git a/core/java/android/server/BluetoothBondState.java b/core/java/android/server/BluetoothBondState.java index 5fa8836c1d9c..76e78858e029 100644 --- a/core/java/android/server/BluetoothBondState.java +++ b/core/java/android/server/BluetoothBondState.java @@ -89,7 +89,12 @@ class BluetoothBondState { return mPendingOutgoingBonding; } - public synchronized void loadBondState() { + public synchronized void initBondState() { + getProfileProxy(); + loadBondState(); + } + + private void loadBondState() { if (mService.getBluetoothStateInternal() != BluetoothAdapter.STATE_TURNING_ON) { return; @@ -108,7 +113,6 @@ class BluetoothBondState { mState.put(mService.getAddressFromObjectPath(device).toUpperCase(), BluetoothDevice.BOND_BONDED); } - getProfileProxy(); } public synchronized void setBondState(String address, int state) { diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index 7f47ebcbcc90..b5ae298f36e6 100755 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -570,7 +570,7 @@ public class BluetoothService extends IBluetooth.Stub { mIsDiscovering = false; mBondState.readAutoPairingData(); - mBondState.loadBondState(); + mBondState.initBondState(); initProfileState(); // This should be the last step of the the enable thread. diff --git a/keystore/tests/src/android/security/KeyStoreTest.java b/keystore/tests/src/android/security/KeyStoreTest.java index 4582aa0ccfe8..15e253cee33e 100755 --- a/keystore/tests/src/android/security/KeyStoreTest.java +++ b/keystore/tests/src/android/security/KeyStoreTest.java @@ -75,11 +75,21 @@ public class KeyStoreTest extends ActivityUnitTestCase<Activity> { assertEquals(KeyStore.State.UNLOCKED, mKeyStore.state()); } + public void testGet() throws Exception { + assertNull(mKeyStore.get(TEST_KEYNAME)); + mKeyStore.password(TEST_PASSWD); + assertNull(mKeyStore.get(TEST_KEYNAME)); + assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE)); + assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME))); + } + public void testPut() throws Exception { + assertNull(mKeyStore.get(TEST_KEYNAME)); assertFalse(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE)); assertFalse(mKeyStore.contains(TEST_KEYNAME)); mKeyStore.password(TEST_PASSWD); assertTrue(mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE)); + assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME))); } public void testI18n() throws Exception { @@ -96,7 +106,9 @@ public class KeyStoreTest extends ActivityUnitTestCase<Activity> { assertTrue(mKeyStore.delete(TEST_KEYNAME)); mKeyStore.put(TEST_KEYNAME, TEST_KEYVALUE); + assertTrue(Arrays.equals(TEST_KEYVALUE, mKeyStore.get(TEST_KEYNAME))); assertTrue(mKeyStore.delete(TEST_KEYNAME)); + assertNull(mKeyStore.get(TEST_KEYNAME)); } public void testContains() throws Exception { |