Merge "Avrcp_ext: add PORSCHE carkit to playstatus blacklist" into bt.lnx.5.0
diff --git a/packages_apps_bluetooth_ext/src/map/src/BluetoothMapCommonUtils.java b/packages_apps_bluetooth_ext/src/map/src/BluetoothMapCommonUtils.java
index ffb21cb..b326526 100644
--- a/packages_apps_bluetooth_ext/src/map/src/BluetoothMapCommonUtils.java
+++ b/packages_apps_bluetooth_ext/src/map/src/BluetoothMapCommonUtils.java
@@ -46,6 +46,8 @@
protected static String TAG = "BluetoothMapCommonUtils";
+ static final String EMAIL_UI_PKG = "com.android.email";
+
public static class BMsgReaderExt extends BluetoothMapbMessage.BMsgReader{
public BMsgReaderExt(InputStream is)
diff --git a/packages_apps_bluetooth_ext/src/map/src/BluetoothMapContentEmail.java b/packages_apps_bluetooth_ext/src/map/src/BluetoothMapContentEmail.java
index 655fbf1..dd43299 100644
--- a/packages_apps_bluetooth_ext/src/map/src/BluetoothMapContentEmail.java
+++ b/packages_apps_bluetooth_ext/src/map/src/BluetoothMapContentEmail.java
@@ -247,7 +247,7 @@
} else {
sent = "no";
}
- if (V) Log.d(TAG, "setSent: " + sent);
+ if (V) Log.v(TAG, "setSent: " + sent);
e.setSent(sent);
}
}
@@ -261,7 +261,7 @@
}
String setread = null;
- if (V) Log.d(TAG, "setRead: " + setread);
+ if (V) Log.v(TAG, "setRead: " + setread);
e.setRead((read==1?true:false), ((ap.getParameterMask() & MASK_READ) != 0));
}
/**
@@ -281,15 +281,15 @@
//ATTACHMENT DB
Uri attchmntUri = BluetoothMapEmailContract
.buildEmailAttachmentUri(BluetoothMapEmailContract.EMAIL_AUTHORITY);
- Log.d(TAG, "attchURI: "+attchmntUri);
+ if (V) Log.v(TAG, "attchURI: "+attchmntUri);
String whereAttch = setWhereFilterMessagekey(
c.getLong(fi.mMessageColId));
- Log.d(TAG, "whereAttch: "+whereAttch+" handle: "
+ if (V) Log.v(TAG, "whereAttch: "+whereAttch+" handle: "
+ c.getLong(fi.mMessageColId));
Cursor emailAttachmentCursor = mResolver.query(attchmntUri,
BluetoothMapEmailContract.BT_EMAIL_ATTACHMENT_PROJECTION,
whereAttch, null, null);
- Log.d(TAG, "Found " + emailAttachmentCursor.getCount() + " size messages.");
+ if (V) Log.v(TAG, "Found " + emailAttachmentCursor.getCount() + " size messages.");
fi.setEmailAttachmentColumns(emailAttachmentCursor);
if(emailAttachmentCursor != null) {
if( emailAttachmentCursor.moveToNext()) {
@@ -297,7 +297,7 @@
}
emailAttachmentCursor.close();
emailAttachmentCursor = null;
- Log.d(TAG, "size: "+size);
+ if (V) Log.v(TAG, "size: "+size);
}
if(attachment == 1 && size == 0) {
if (D) Log.d(TAG, "Error in message database, attachment size reported as: "
@@ -307,7 +307,7 @@
report a size */
}
}
- if (V) Log.d(TAG, "setAttachmentSize: " + size + "\n" +
+ if (D) Log.d(TAG, "setAttachmentSize: " + size + "\n" +
"setAttachmentMimeTypes: " + attachmentMimeTypes );
e.setAttachmentSize(size);
}
@@ -320,7 +320,7 @@
if (fi.mMsgType == FilterInfo.TYPE_EMAIL ) {
hasText = "yes";
}
- if (V) Log.d(TAG, "setText: " + hasText);
+ if (V) Log.v(TAG, "setText: " + hasText);
e.setText(hasText);
}
}
@@ -353,7 +353,7 @@
BluetoothMapEmailContract.EmailBodyColumns.TEXT_CONTENT_URI));
if (textContentURI != null ) {
try {
- Log.v(TAG, " TRY EMAIL BODY textURI " + textContentURI);
+ if(V) Log.v(TAG, " setSize textContentURI " + textContentURI);
fd = mResolver.openFileDescriptor(Uri.parse(textContentURI), "r");
} catch (FileNotFoundException ex) {
if(V) Log.w(TAG, ex);
@@ -365,7 +365,7 @@
.EmailBodyColumns.HTML_CONTENT_URI));
if (htmlContentURI != null ) {
try {
- Log.v(TAG, " TRY EMAIL BODY htmlURI " + htmlContentURI);
+ if(V) Log.v(TAG, " setSize htmlContentURI " + htmlContentURI);
fd = mResolver.openFileDescriptor(Uri.parse(htmlContentURI), "r");
} catch (FileNotFoundException ex) {
if(V) Log.w(TAG, ex);
@@ -400,18 +400,17 @@
+ " Changing size to 1");
size = 1;
}
- if (V) Log.d(TAG, "setSize: " + size);
+ if (V) Log.v(TAG, "setSize: " + size);
e.setSize(size);
}
}
private TYPE getType(Cursor c, FilterInfo fi) {
TYPE type = null;
- if (V) Log.d(TAG, "getType: for filterMsgType" + fi.mMsgType);
if (fi.mMsgType == FilterInfo.TYPE_EMAIL) {
type = TYPE.EMAIL;
}
- if (V) Log.d(TAG, "getType: " + type);
+ if (V) Log.v(TAG, "getType: " + type+", filterMsgType : " + fi.mMsgType);
return type;
}
@@ -423,7 +422,7 @@
if (fi.mMsgType == FilterInfo.TYPE_EMAIL) {
// TODO: need to find name from id and then set folder type
}
- if (V) Log.d(TAG, "setFolderType: " + folderType);
+ if (V) Log.v(TAG, "setFolderType: " + folderType);
e.setFolderType(folderType);
}
}
@@ -564,7 +563,7 @@
FilterInfo fi, BluetoothMapAppParams ap) {
if ((ap.getParameterMask() & MASK_PROTECTED) != 0) {
String protect = "no";
- if (V) Log.d(TAG, "setProtected: " + protect + "\n");
+ if (V) Log.v(TAG, "setProtected: " + protect);
e.setProtect(protect);
}
}
@@ -710,7 +709,7 @@
} else if(subject == null ) {
subject = "";
}
- if (V) Log.d(TAG, "setSubject: " + subject);
+ if (V) Log.v(TAG, "setSubject: " + subject);
e.setSubject(subject);
}
}
@@ -721,7 +720,7 @@
if (fi.mMsgType == FilterInfo.TYPE_EMAIL) {
handle = c.getLong(fi.mMessageColId);
}
- if (V) Log.d(TAG, "setHandle: " + handle );
+ if (V) Log.v(TAG, "setHandle: " + handle );
e.setHandle(handle);
}
@@ -1034,7 +1033,8 @@
long id = c.getLong(c.getColumnIndex(BluetoothMapContract.FolderColumns._ID));
int type = c.getInt(c.getColumnIndex(BluetoothMapEmailContract.MailBoxColumns
.FOLDER_TYPE));
- Log.d(TAG, "addEmailFolders(): id: "+id+ " Name: " + name + "Type: " + type);
+ if (V) Log.v(TAG, "addEmailFolders id: " + id + " Name: " + name
+ + "Type: " + type);
newFolder = parentFolder.addEmailFolder(name, id);
newFolder.setFolderType(type);
addEmailFolders(newFolder); // Use recursion to add any sub folders
@@ -1055,6 +1055,8 @@
Intent emailIn = new Intent();
emailIn.setAction(BluetoothMapEmailContract.ACTION_CHECK_MAIL);
emailIn.putExtra(BluetoothMapEmailContract.EXTRA_ACCOUNT, accountId);
+ emailIn.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ emailIn.setPackage(BluetoothMapCommonUtils.EMAIL_UI_PKG);
mContext.sendBroadcast(emailIn);
}
diff --git a/packages_apps_bluetooth_ext/src/map/src/BluetoothMapContentObserverEmail.java b/packages_apps_bluetooth_ext/src/map/src/BluetoothMapContentObserverEmail.java
index a99f7a0..95434ba 100644
--- a/packages_apps_bluetooth_ext/src/map/src/BluetoothMapContentObserverEmail.java
+++ b/packages_apps_bluetooth_ext/src/map/src/BluetoothMapContentObserverEmail.java
@@ -128,7 +128,7 @@
private boolean mObserverRegistered = false;
private BluetoothMapAccountItem mAccount;
private String mAuthority = null;
-
+ private String mEmailPackage = "";
// Default supported feature bit mask is 0x1f
private int mMapSupportedFeatures = BluetoothMapUtils.MAP_FEATURE_DEFAULT_BITMASK;
// Default event report version is 1.0
@@ -231,6 +231,7 @@
}
mEnableSmsMms = enableSmsMms;
mMnsClient = mnsClient;
+ mEmailPackage = BluetoothMapCommonUtils.EMAIL_UI_PKG;
}
private Map<Long, Msg> getMsgListMsg() {
@@ -265,9 +266,10 @@
| BluetoothMapUtils.MAP_FEATURE_PARTICIPANT_CHAT_STATE_CHANGE_BIT)
& mMapSupportedFeatures) != 0) {
// Warning according to page 46/123 of MAP 1.3 spec
- Log.w(TAG, "setObserverRemoteFeatureMask: Extended Event Reports 1.2 is not set even"
- + "though PARTICIPANT_PRESENCE_CHANGE_BIT or PARTICIPANT_CHAT_STATE_CHANGE_BIT"
- + " were set, mMapSupportedFeatures=" + mMapSupportedFeatures);
+ if (V) {
+ Log.w(TAG, "Event Reports 1.2 is not set even though PARTICIPANT_PRESENCE_"
+ + "CHANGE_BIT or PARTICIPANT_CHAT_STATE_CHANGE_BIT were set");
+ }
}
if (D) {
Log.d(TAG, "setObserverRemoteFeatureMask: mMapEventReportVersion="
@@ -562,8 +564,8 @@
}
sendEvent(evt);
} else {
- if(V) Log.v(TAG, "handleMsgListChangesMsg id: " + id + "folderId: "
- + folderId + " newFolder: " +newFolder + "oldFolder: "
+ if(V) Log.v(TAG, "handleMsgListChangesMsg id: " + id + ", folderId: "
+ + folderId + ", newFolder: " +newFolder + ", oldFolder: "
+ msg.folderId);
/* Existing message */
if (folderId != msg.folderId && msg.folderId != -1) {
@@ -728,17 +730,17 @@
*/
public boolean setMessageStatusDeleted(long handle, TYPE type,
BluetoothMapFolderElement mCurrentFolder, String uriStr, int statusValue) {
- if (D) Log.d(TAG, "setMessageStatusDeleted: EMAIL handle " + handle
+ if (D) Log.d(TAG, "setMessageStatusDeleted: handle " + handle
+ " type " + type + " value " + statusValue + " URI: " +uriStr);
boolean res = false;
long accountId = mAccount.getAccountId();
Uri uri = Uri.withAppendedPath(mMessageUri, Long.toString(handle));
- Log.d(TAG,"URI print: " + uri.toString());
+ if (D) Log.d(TAG,"URI print: " + uri.toString());
Cursor crEmail = mResolver.query(uri, null, null, null, null);
if (crEmail != null && crEmail.moveToFirst()) {
- if (V) Log.d(TAG, "setMessageStatusDeleted: EMAIL handle " + handle
- + " type " + type + " value " + statusValue + "accountId: "+accountId);
+ if (V) Log.v(TAG, "setMessageStatusDeleted: handle " + handle
+ + " type " + type + " value " + statusValue + "accountId: " + accountId);
Intent emailIn = new Intent();
Msg msg = null;
synchronized(getMsgListMsg()) {
@@ -748,15 +750,14 @@
emailIn.setAction(BluetoothMapEmailContract.ACTION_DELETE_MESSAGE);
} else {
emailIn.setAction(BluetoothMapEmailContract.ACTION_MOVE_MESSAGE);
- //Undelete - Move the message to Inbox
- long folderId = -1;
- BluetoothMapFolderElement inboxFolder = mCurrentFolder
- .getFolderByName(BluetoothMapContract.FOLDER_NAME_INBOX);
+ int folderId = mCurrentFolder.getFolderType();
if(folderId == -1) folderId = BluetoothMapEmailContract.TYPE_INBOX;
emailIn.putExtra(BluetoothMapEmailContract.EXTRA_MESSAGE_INFO, folderId);
}
emailIn.putExtra(BluetoothMapEmailContract.EXTRA_ACCOUNT, accountId);
emailIn.putExtra(BluetoothMapEmailContract.EXTRA_MESSAGE_ID, handle);
+ emailIn.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ emailIn.setPackage(mEmailPackage);
mContext.sendBroadcast(emailIn);
res = true;
//Mark local initiated message delete to avoid notification
@@ -767,8 +768,8 @@
if (crEmail != null) {
crEmail.close();
}
- if(V) Log.d(TAG, " END setMessageStatusDeleted: EMAIL handle " + handle + " type " + type
- + " value " + statusValue + "accountId: "+accountId);
+ if(V) Log.v(TAG, " END setMessageStatusDeleted: handle " + handle + " type " + type
+ + " value " + statusValue + "accountId: " + accountId);
return res;
}
@@ -797,6 +798,8 @@
emailIn.putExtra(BluetoothMapEmailContract.EXTRA_MESSAGE_INFO,statusValue);
emailIn.putExtra(BluetoothMapEmailContract.EXTRA_ACCOUNT, accountId);
emailIn.putExtra(BluetoothMapEmailContract.EXTRA_MESSAGE_ID, handle);
+ emailIn.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ emailIn.setPackage(mEmailPackage);
//Mark local initiage message status change to avoid notification
if (msg != null ) msg.localInitiatedReadStatus = true;
mContext.sendBroadcast(emailIn);
@@ -992,6 +995,8 @@
if(V) Log.d(TAG, "sendIntent SEND: " + handle + "accounId: " +accountId);
emailIn.setAction(BluetoothMapEmailContract.ACTION_SEND_PENDING_MAIL);
emailIn.putExtra(BluetoothMapEmailContract.EXTRA_ACCOUNT, accountId);
+ emailIn.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ emailIn.setPackage(mEmailPackage);
mContext.sendBroadcast(emailIn);
}
getMsgListMsg().put(handle, newMsg);