diff options
author | kschulz <k.schulz@samsung.com> | 2014-02-19 08:39:51 +0100 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-07-10 08:04:54 +0000 |
commit | ff33061e763656438daea7249e45e38b8a174288 (patch) | |
tree | d72bc723777ba4accc0b524e71b672d6fb2481e1 | |
parent | 9e78435c8538516635e377720cabec0f2c0e1d71 (diff) | |
download | android_packages_apps_Bluetooth-ff33061e763656438daea7249e45e38b8a174288.tar.gz android_packages_apps_Bluetooth-ff33061e763656438daea7249e45e38b8a174288.tar.bz2 android_packages_apps_Bluetooth-ff33061e763656438daea7249e45e38b8a174288.zip |
PBAP: New Missed calls parameter not set correctly
When a PCE pull the missed-calls-phonebook (mch.vcf) from the PSE, a parameter
stating the number of _new_ missed calls must be included in the reply.
Currently the parameter is included but it is always set to zero, which is
incorrect.
This fix corrects the variable used for new missed calls
Bug: 13022843
Change-Id: I6094c50a76711cfff9347596d70ac2300cfbb543
-rw-r--r-- | src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java b/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java index c6a939f81..caab6dadc 100644 --- a/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java +++ b/src/com/android/bluetooth/pbap/BluetoothPbapObexServer.java @@ -33,12 +33,14 @@ package com.android.bluetooth.pbap; import android.content.Context; +import android.content.ContentResolver; +import android.database.Cursor; import android.os.Message; import android.os.Handler; -import android.text.TextUtils; -import android.util.Log; import android.provider.CallLog.Calls; import android.provider.CallLog; +import android.text.TextUtils; +import android.util.Log; import java.io.IOException; import java.io.OutputStream; @@ -756,18 +758,28 @@ public class BluetoothPbapObexServer extends ServerRequestHandler { if (mNeedNewMissedCallsNum) { mNeedNewMissedCallsNum = false; - int nmnum = size - mMissedCallSize; - mMissedCallSize = size; + int nmnum = 0; + ContentResolver contentResolver; + contentResolver = mContext.getContentResolver(); + + Cursor c = contentResolver.query( + Calls.CONTENT_URI, + null, + Calls.TYPE + " = " + Calls.MISSED_TYPE + " AND " + android.provider.CallLog.Calls.NEW + " = 1", + null, + Calls.DEFAULT_SORT_ORDER); + + if (c != null) { + nmnum = c.getCount(); + c.close(); + } nmnum = nmnum > 0 ? nmnum : 0; misnum[0] = (byte)nmnum; - ap.addAPPHeader(ApplicationParameter.TRIPLET_TAGID.NEWMISSEDCALLS_TAGID, - ApplicationParameter.TRIPLET_LENGTH.NEWMISSEDCALLS_LENGTH, misnum); - if (D) Log.d(TAG, "handleAppParaForResponse(): mNeedNewMissedCallsNum=true, num= " - + nmnum); + if (D) Log.d(TAG, "handleAppParaForResponse(): mNeedNewMissedCallsNum=true, num= " + nmnum); } reply.setHeader(HeaderSet.APPLICATION_PARAMETER, ap.getAPPparam()); - + if (D) Log.d(TAG, "Send back Phonebook size only, without body info! Size= " + size); return pushHeader(op, reply); @@ -779,12 +791,26 @@ public class BluetoothPbapObexServer extends ServerRequestHandler { if (mNeedNewMissedCallsNum) { if (V) Log.v(TAG, "Need new missed call num in response header."); mNeedNewMissedCallsNum = false; - - int nmnum = size - mMissedCallSize; - mMissedCallSize = size; + int nmnum = 0; + ContentResolver contentResolver; + contentResolver = mContext.getContentResolver(); + + Cursor c = contentResolver.query( + Calls.CONTENT_URI, + null, + Calls.TYPE + " = " + Calls.MISSED_TYPE + " AND " + android.provider.CallLog.Calls.NEW + " = 1", + null, + Calls.DEFAULT_SORT_ORDER); + + if (c != null) { + nmnum = c.getCount(); + c.close(); + } nmnum = nmnum > 0 ? nmnum : 0; misnum[0] = (byte)nmnum; + if (D) Log.d(TAG, "handleAppParaForResponse(): mNeedNewMissedCallsNum=true, num= " + nmnum); + ap.addAPPHeader(ApplicationParameter.TRIPLET_TAGID.NEWMISSEDCALLS_TAGID, ApplicationParameter.TRIPLET_LENGTH.NEWMISSEDCALLS_LENGTH, misnum); reply.setHeader(HeaderSet.APPLICATION_PARAMETER, ap.getAPPparam()); |