Loading android/app/src/com/android/bluetooth/map/BluetoothMapContent.java +4 −3 Original line number Diff line number Diff line Loading @@ -3679,10 +3679,11 @@ public class BluetoothMapContent { Log.v(TAG, "c.count: " + c.getCount()); } if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) { message.setType(TYPE.SMS_GSM); } else if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) { if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) { message.setType(TYPE.SMS_CDMA); } else { // set SMS_GSM by default message.setType(TYPE.SMS_GSM); } message.setVersionString(mMessageVersion); String read = c.getString(c.getColumnIndex(Sms.READ)); Loading android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java +13 −1 Original line number Diff line number Diff line Loading @@ -762,7 +762,9 @@ public class BluetoothMapContentObserver { subject.substring(0, subject.length() < 256 ? subject.length() : 256)); } if (senderName != null) { xmlEvtReport.attribute("", "sender_name", senderName); xmlEvtReport.attribute("", "sender_name", senderName.substring( 0, senderName.length() < 256 ? senderName.length() : 255)); } if (priority != null) { xmlEvtReport.attribute("", "priority", priority); Loading Loading @@ -1428,6 +1430,9 @@ public class BluetoothMapContentObserver { String date = BluetoothMapUtils.getDateTimeString( c.getLong(c.getColumnIndex(Sms.DATE))); String subject = c.getString(c.getColumnIndex(Sms.BODY)); if (subject == null) { subject = ""; } String name = ""; String phone = ""; if (type == 1) { //inbox Loading Loading @@ -1592,6 +1597,9 @@ public class BluetoothMapContentObserver { if (subject == null || subject.length() == 0) { /* Get subject from mms text body parts - if any exists */ subject = BluetoothMapContent.getTextPartsMms(mResolver, id); if (subject == null) { subject = ""; } } int tmpPri = c.getInt(c.getColumnIndex(Mms.PRIORITY)); Log.d(TAG, "TEMP handleMsgListChangesMms, " Loading @@ -1600,6 +1608,10 @@ public class BluetoothMapContentObserver { String address = BluetoothMapContent.getAddressMms(mResolver, id, BluetoothMapContent.MMS_FROM); if (address == null) { address = ""; } String priority = "no"; if (tmpPri == PduHeaders.PRIORITY_HIGH) { priority = "yes"; Loading android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +45 −6 Original line number Diff line number Diff line Loading @@ -200,6 +200,10 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect private static final String ACCESS_AUTHORITY_CLASS = "com.android.settings.bluetooth.BluetoothPermissionRequest"; private Thread mThreadLoadContacts = null; private Thread mThreadUpdateSecVersionCounter = null; private class BluetoothPbapContentObserver extends ContentObserver { BluetoothPbapContentObserver() { super(new Handler()); Loading Loading @@ -263,11 +267,14 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (DEBUG) { Log.d(TAG, "ACL disconnected for " + device); } if (mIsWaitingAuthorization && mRemoteDevice.equals(device)) { if (mRemoteDevice.equals(device)) { if (mIsWaitingAuthorization) { mSessionStatusHandler.removeMessages(USER_TIMEOUT); mSessionStatusHandler.obtainMessage(USER_TIMEOUT).sendToTarget(); } mSessionStatusHandler.obtainMessage(MSG_SERVERSESSION_CLOSE).sendToTarget(); mSessionStatusHandler.obtainMessage(MSG_SERVERSESSION_CLOSE) .sendToTarget(); } return; } Loading Loading @@ -383,6 +390,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (mSessionStatusHandler != null) { mSessionStatusHandler.removeCallbacksAndMessages(null); } mRemoteDevice = null; if (VERBOSE) { Log.v(TAG, "Pbap Service closeService out"); } Loading Loading @@ -561,10 +569,10 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect closeService(); break; case LOAD_CONTACTS: BluetoothPbapUtils.loadAllContacts(mContext, this); loadAllContacts(); break; case CHECK_SECONDARY_VERSION_COUNTER: BluetoothPbapUtils.updateSecondaryVersionCounter(mContext, this); updateSecondaryVersion(); break; case ROLLOVER_COUNTERS: BluetoothPbapUtils.rolloverCounters(); Loading Loading @@ -941,4 +949,35 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect startSocketListeners(); } } private void loadAllContacts() { if (mThreadLoadContacts == null) { Runnable r = new Runnable() { @Override public void run() { BluetoothPbapUtils.loadAllContacts(mContext, mSessionStatusHandler); mThreadLoadContacts = null; } }; mThreadLoadContacts = new Thread(r); mThreadLoadContacts.start(); } } private void updateSecondaryVersion() { if (mThreadUpdateSecVersionCounter == null) { Runnable r = new Runnable() { @Override public void run() { BluetoothPbapUtils.updateSecondaryVersionCounter(mContext, mSessionStatusHandler); mThreadUpdateSecVersionCounter = null; } }; mThreadUpdateSecVersionCounter = new Thread(r); mThreadUpdateSecVersionCounter.start(); } } } android/app/src/com/android/bluetooth/pbap/BluetoothPbapUtils.java +5 −5 Original line number Diff line number Diff line Loading @@ -253,7 +253,7 @@ public class BluetoothPbapUtils { edit.putLong("primary", primaryCounter); edit.putLong("secondary", secondaryCounter); edit.putLong("dbIdentifier", dbIdentifier); edit.putLong("totalContacts", totalContacts); if (contactsLoaded) edit.putLong("totalContacts", totalContacts); edit.putLong("lastUpdatedTimestamp", lastUpdatedTimestamp); edit.putLong("totalFields", totalFields); edit.putLong("totalSvcFields", totalSvcFields); Loading Loading @@ -295,12 +295,12 @@ public class BluetoothPbapUtils { try { String[] projection = {Data.CONTACT_ID, Data.DATA1, Data.MIMETYPE}; int contactCount = 0; if ((contactCount = fetchAndSetContacts(mContext, mHandler, projection, null, null, true)) < 0) { totalContacts = fetchAndSetContacts(mContext, mHandler, projection, null, null, true); if (totalContacts < 0) { totalContacts = 0; return; } totalContacts = contactCount; // to set total contacts count fetched on Connect contactsLoaded = true; } catch (Exception e) { Log.e(TAG, "Exception occurred in load contacts: " + e); Loading Loading
android/app/src/com/android/bluetooth/map/BluetoothMapContent.java +4 −3 Original line number Diff line number Diff line Loading @@ -3679,10 +3679,11 @@ public class BluetoothMapContent { Log.v(TAG, "c.count: " + c.getCount()); } if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) { message.setType(TYPE.SMS_GSM); } else if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) { if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) { message.setType(TYPE.SMS_CDMA); } else { // set SMS_GSM by default message.setType(TYPE.SMS_GSM); } message.setVersionString(mMessageVersion); String read = c.getString(c.getColumnIndex(Sms.READ)); Loading
android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java +13 −1 Original line number Diff line number Diff line Loading @@ -762,7 +762,9 @@ public class BluetoothMapContentObserver { subject.substring(0, subject.length() < 256 ? subject.length() : 256)); } if (senderName != null) { xmlEvtReport.attribute("", "sender_name", senderName); xmlEvtReport.attribute("", "sender_name", senderName.substring( 0, senderName.length() < 256 ? senderName.length() : 255)); } if (priority != null) { xmlEvtReport.attribute("", "priority", priority); Loading Loading @@ -1428,6 +1430,9 @@ public class BluetoothMapContentObserver { String date = BluetoothMapUtils.getDateTimeString( c.getLong(c.getColumnIndex(Sms.DATE))); String subject = c.getString(c.getColumnIndex(Sms.BODY)); if (subject == null) { subject = ""; } String name = ""; String phone = ""; if (type == 1) { //inbox Loading Loading @@ -1592,6 +1597,9 @@ public class BluetoothMapContentObserver { if (subject == null || subject.length() == 0) { /* Get subject from mms text body parts - if any exists */ subject = BluetoothMapContent.getTextPartsMms(mResolver, id); if (subject == null) { subject = ""; } } int tmpPri = c.getInt(c.getColumnIndex(Mms.PRIORITY)); Log.d(TAG, "TEMP handleMsgListChangesMms, " Loading @@ -1600,6 +1608,10 @@ public class BluetoothMapContentObserver { String address = BluetoothMapContent.getAddressMms(mResolver, id, BluetoothMapContent.MMS_FROM); if (address == null) { address = ""; } String priority = "no"; if (tmpPri == PduHeaders.PRIORITY_HIGH) { priority = "yes"; Loading
android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +45 −6 Original line number Diff line number Diff line Loading @@ -200,6 +200,10 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect private static final String ACCESS_AUTHORITY_CLASS = "com.android.settings.bluetooth.BluetoothPermissionRequest"; private Thread mThreadLoadContacts = null; private Thread mThreadUpdateSecVersionCounter = null; private class BluetoothPbapContentObserver extends ContentObserver { BluetoothPbapContentObserver() { super(new Handler()); Loading Loading @@ -263,11 +267,14 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (DEBUG) { Log.d(TAG, "ACL disconnected for " + device); } if (mIsWaitingAuthorization && mRemoteDevice.equals(device)) { if (mRemoteDevice.equals(device)) { if (mIsWaitingAuthorization) { mSessionStatusHandler.removeMessages(USER_TIMEOUT); mSessionStatusHandler.obtainMessage(USER_TIMEOUT).sendToTarget(); } mSessionStatusHandler.obtainMessage(MSG_SERVERSESSION_CLOSE).sendToTarget(); mSessionStatusHandler.obtainMessage(MSG_SERVERSESSION_CLOSE) .sendToTarget(); } return; } Loading Loading @@ -383,6 +390,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (mSessionStatusHandler != null) { mSessionStatusHandler.removeCallbacksAndMessages(null); } mRemoteDevice = null; if (VERBOSE) { Log.v(TAG, "Pbap Service closeService out"); } Loading Loading @@ -561,10 +569,10 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect closeService(); break; case LOAD_CONTACTS: BluetoothPbapUtils.loadAllContacts(mContext, this); loadAllContacts(); break; case CHECK_SECONDARY_VERSION_COUNTER: BluetoothPbapUtils.updateSecondaryVersionCounter(mContext, this); updateSecondaryVersion(); break; case ROLLOVER_COUNTERS: BluetoothPbapUtils.rolloverCounters(); Loading Loading @@ -941,4 +949,35 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect startSocketListeners(); } } private void loadAllContacts() { if (mThreadLoadContacts == null) { Runnable r = new Runnable() { @Override public void run() { BluetoothPbapUtils.loadAllContacts(mContext, mSessionStatusHandler); mThreadLoadContacts = null; } }; mThreadLoadContacts = new Thread(r); mThreadLoadContacts.start(); } } private void updateSecondaryVersion() { if (mThreadUpdateSecVersionCounter == null) { Runnable r = new Runnable() { @Override public void run() { BluetoothPbapUtils.updateSecondaryVersionCounter(mContext, mSessionStatusHandler); mThreadUpdateSecVersionCounter = null; } }; mThreadUpdateSecVersionCounter = new Thread(r); mThreadUpdateSecVersionCounter.start(); } } }
android/app/src/com/android/bluetooth/pbap/BluetoothPbapUtils.java +5 −5 Original line number Diff line number Diff line Loading @@ -253,7 +253,7 @@ public class BluetoothPbapUtils { edit.putLong("primary", primaryCounter); edit.putLong("secondary", secondaryCounter); edit.putLong("dbIdentifier", dbIdentifier); edit.putLong("totalContacts", totalContacts); if (contactsLoaded) edit.putLong("totalContacts", totalContacts); edit.putLong("lastUpdatedTimestamp", lastUpdatedTimestamp); edit.putLong("totalFields", totalFields); edit.putLong("totalSvcFields", totalSvcFields); Loading Loading @@ -295,12 +295,12 @@ public class BluetoothPbapUtils { try { String[] projection = {Data.CONTACT_ID, Data.DATA1, Data.MIMETYPE}; int contactCount = 0; if ((contactCount = fetchAndSetContacts(mContext, mHandler, projection, null, null, true)) < 0) { totalContacts = fetchAndSetContacts(mContext, mHandler, projection, null, null, true); if (totalContacts < 0) { totalContacts = 0; return; } totalContacts = contactCount; // to set total contacts count fetched on Connect contactsLoaded = true; } catch (Exception e) { Log.e(TAG, "Exception occurred in load contacts: " + e); Loading