Loading android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +10 −3 Original line number Diff line number Diff line Loading @@ -121,8 +121,9 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect static final int START_LISTENER = 1; static final int USER_TIMEOUT = 2; static final int SHUTDOWN = 4; static final int LOAD_CONTACTS = 5; static final int SHUTDOWN = 3; static final int LOAD_CONTACTS = 4; static final int CONTACTS_LOADED = 5; static final int CHECK_SECONDARY_VERSION_COUNTER = 6; static final int ROLLOVER_COUNTERS = 7; Loading Loading @@ -160,6 +161,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect "com.android.settings.bluetooth.BluetoothPermissionRequest"; private Thread mThreadLoadContacts; private boolean mContactsLoaded = false; private Thread mThreadUpdateSecVersionCounter; Loading @@ -173,7 +175,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect @Override public void onChange(boolean selfChange) { Log.d(TAG, " onChange on contact uri "); if (BluetoothPbapUtils.sContactsLoaded) { if (mContactsLoaded) { if (!mSessionStatusHandler.hasMessages(CHECK_SECONDARY_VERSION_COUNTER)) { mSessionStatusHandler.sendMessage( mSessionStatusHandler.obtainMessage(CHECK_SECONDARY_VERSION_COUNTER)); Loading Loading @@ -384,6 +386,9 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect case LOAD_CONTACTS: loadAllContacts(); break; case CONTACTS_LOADED: mContactsLoaded = true; break; case CHECK_SECONDARY_VERSION_COUNTER: updateSecondaryVersion(); break; Loading Loading @@ -476,6 +481,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect Log.v(TAG, "start()"); } mContext = this; mContactsLoaded = false; mHandlerThread = new HandlerThread("PbapHandlerThread"); mHandlerThread.start(); mSessionStatusHandler = new PbapHandler(mHandlerThread.getLooper()); Loading Loading @@ -523,6 +529,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (mHandlerThread != null) { mHandlerThread.quitSafely(); } mContactsLoaded = false; if (mContactChangeObserver == null) { Log.i(TAG, "Avoid unregister when receiver it is not registered"); return true; Loading android/app/src/com/android/bluetooth/pbap/BluetoothPbapUtils.java +2 −5 Original line number Diff line number Diff line Loading @@ -63,7 +63,6 @@ class BluetoothPbapUtils { private static long sTotalFields = 0; private static long sTotalSvcFields = 0; private static long sContactsLastUpdated = 0; static boolean sContactsLoaded = false; private static class ContactData { private String mName; Loading Loading @@ -167,9 +166,7 @@ class BluetoothPbapUtils { edit.putLong("primary", sPrimaryVersionCounter); edit.putLong("secondary", sSecondaryVersionCounter); edit.putLong("dbIdentifier", dbIdentifier); if (sContactsLoaded) { edit.putLong("totalContacts", sTotalContacts); } edit.putLong("lastUpdatedTimestamp", sContactsLastUpdated); edit.putLong("totalFields", sTotalFields); edit.putLong("totalSvcFields", sTotalSvcFields); Loading Loading @@ -212,7 +209,7 @@ class BluetoothPbapUtils { sTotalContacts = 0; return; } sContactsLoaded = true; handler.sendMessage(handler.obtainMessage(BluetoothPbapService.CONTACTS_LOADED)); } static void updateSecondaryVersionCounter(Context context, Handler handler) { Loading Loading
android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +10 −3 Original line number Diff line number Diff line Loading @@ -121,8 +121,9 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect static final int START_LISTENER = 1; static final int USER_TIMEOUT = 2; static final int SHUTDOWN = 4; static final int LOAD_CONTACTS = 5; static final int SHUTDOWN = 3; static final int LOAD_CONTACTS = 4; static final int CONTACTS_LOADED = 5; static final int CHECK_SECONDARY_VERSION_COUNTER = 6; static final int ROLLOVER_COUNTERS = 7; Loading Loading @@ -160,6 +161,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect "com.android.settings.bluetooth.BluetoothPermissionRequest"; private Thread mThreadLoadContacts; private boolean mContactsLoaded = false; private Thread mThreadUpdateSecVersionCounter; Loading @@ -173,7 +175,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect @Override public void onChange(boolean selfChange) { Log.d(TAG, " onChange on contact uri "); if (BluetoothPbapUtils.sContactsLoaded) { if (mContactsLoaded) { if (!mSessionStatusHandler.hasMessages(CHECK_SECONDARY_VERSION_COUNTER)) { mSessionStatusHandler.sendMessage( mSessionStatusHandler.obtainMessage(CHECK_SECONDARY_VERSION_COUNTER)); Loading Loading @@ -384,6 +386,9 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect case LOAD_CONTACTS: loadAllContacts(); break; case CONTACTS_LOADED: mContactsLoaded = true; break; case CHECK_SECONDARY_VERSION_COUNTER: updateSecondaryVersion(); break; Loading Loading @@ -476,6 +481,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect Log.v(TAG, "start()"); } mContext = this; mContactsLoaded = false; mHandlerThread = new HandlerThread("PbapHandlerThread"); mHandlerThread.start(); mSessionStatusHandler = new PbapHandler(mHandlerThread.getLooper()); Loading Loading @@ -523,6 +529,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (mHandlerThread != null) { mHandlerThread.quitSafely(); } mContactsLoaded = false; if (mContactChangeObserver == null) { Log.i(TAG, "Avoid unregister when receiver it is not registered"); return true; Loading
android/app/src/com/android/bluetooth/pbap/BluetoothPbapUtils.java +2 −5 Original line number Diff line number Diff line Loading @@ -63,7 +63,6 @@ class BluetoothPbapUtils { private static long sTotalFields = 0; private static long sTotalSvcFields = 0; private static long sContactsLastUpdated = 0; static boolean sContactsLoaded = false; private static class ContactData { private String mName; Loading Loading @@ -167,9 +166,7 @@ class BluetoothPbapUtils { edit.putLong("primary", sPrimaryVersionCounter); edit.putLong("secondary", sSecondaryVersionCounter); edit.putLong("dbIdentifier", dbIdentifier); if (sContactsLoaded) { edit.putLong("totalContacts", sTotalContacts); } edit.putLong("lastUpdatedTimestamp", sContactsLastUpdated); edit.putLong("totalFields", sTotalFields); edit.putLong("totalSvcFields", sTotalSvcFields); Loading Loading @@ -212,7 +209,7 @@ class BluetoothPbapUtils { sTotalContacts = 0; return; } sContactsLoaded = true; handler.sendMessage(handler.obtainMessage(BluetoothPbapService.CONTACTS_LOADED)); } static void updateSecondaryVersionCounter(Context context, Handler handler) { Loading