diff options
author | Casper Bonde <c.bonde@samsung.com> | 2014-07-24 13:47:23 +0200 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2014-08-06 00:06:12 -0700 |
commit | 326b5e610063ac24c0ba467ac585bd4c7f618a67 (patch) | |
tree | 863e6fa83714e668d7fc9eeab1c693942763b219 /src/com/android/bluetooth/map/BluetoothMapUtils.java | |
parent | f021c4ee6ba53c8512807c1469b2432278cf6cca (diff) | |
download | android_packages_apps_Bluetooth-326b5e610063ac24c0ba467ac585bd4c7f618a67.tar.gz android_packages_apps_Bluetooth-326b5e610063ac24c0ba467ac585bd4c7f618a67.tar.bz2 android_packages_apps_Bluetooth-326b5e610063ac24c0ba467ac585bd4c7f618a67.zip |
BT MAP: added support for email sharing over BT
- added support for Emails
- added activity to do setup of the email accounts to share
- added improved handling of MMS, SMS and Email
- Many optimizations to speed (especially getMessageListing)
- fixed wakelock problem
- fixed user timeout problem when user do not react to msg access request
- added missing privileges
- support for Quoted Printable format
- added accountId in test case URIs
- fixed problem with service numbers being strings
- fixed problem with read flag in getMessage
- added support for transparent flag in Email Push
- added missing send-event for non-imap accounts
- set attachment size to 0 if text-only message
- fixed double send for sms messages with retry
- removed secondary phone numbers from recipient/originator
- removed insert-address-token in MMS messages
- fixed null-pointer exception in settings (missing extra in intent)
- send text-only mms as sms (workaround to make it cheaper)
- fixed rejection of native and fraction requests
- better handling of unknown message types in push
- fixed problem with possible illigal xml chars in message listing
- added missing WRITE_APN_SETTINGS permission to manifest
- fixed problem with notifications when pushing to folders other than OUTBOX
- removed debugging code
- added support for threadId
- fixed permission problems
- changed to use ContentProviderClients for Email app access
- fixed names for member vars
UPDATE: Moved the MAP E-mail API to the bluetooth package.
UPDATE: Added check for the presense of MMS parts.
This is needed due to a change in the MMS app/subsystem,
where deleted messages gets corrupted.
Signed-off-by: Casper Bonde <c.bonde@samsung.com>
Change-Id: Ib5dbe7c2d5c0ba8d978ae843d840028592e3cab4
Diffstat (limited to 'src/com/android/bluetooth/map/BluetoothMapUtils.java')
-rw-r--r-- | src/com/android/bluetooth/map/BluetoothMapUtils.java | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMapUtils.java b/src/com/android/bluetooth/map/BluetoothMapUtils.java index e57cf16b1..d0b7e2de8 100644 --- a/src/com/android/bluetooth/map/BluetoothMapUtils.java +++ b/src/com/android/bluetooth/map/BluetoothMapUtils.java @@ -14,6 +14,8 @@ */ package com.android.bluetooth.map; +import android.util.Log; + /** * Various utility methods and generic defines that can be used throughout MAPS @@ -21,16 +23,18 @@ package com.android.bluetooth.map; public class BluetoothMapUtils { private static final String TAG = "MapUtils"; + private static final boolean D = BluetoothMapService.DEBUG; private static final boolean V = BluetoothMapService.VERBOSE; - /* We use the upper 5 bits for the type mask - avoid using the top bit, since it - * indicates a negative value, hence corrupting the formatter when converting to - * type String. (I really miss the unsigned type in Java:)) + /* We use the upper 4 bits for the type mask. + * TODO: When more types are needed, consider just using a number + * in stead of a bit to indicate the message type. Then 4 + * bit can be use for 16 different message types. */ - private static final long HANDLE_TYPE_MASK = 0xf<<59; - private static final long HANDLE_TYPE_MMS_MASK = 0x1<<59; - private static final long HANDLE_TYPE_EMAIL_MASK = 0x2<<59; - private static final long HANDLE_TYPE_SMS_GSM_MASK = 0x4<<59; - private static final long HANDLE_TYPE_SMS_CDMA_MASK = 0x8<<59; + private static final long HANDLE_TYPE_MASK = (((long)0xf)<<60); + private static final long HANDLE_TYPE_MMS_MASK = (((long)0x1)<<60); + private static final long HANDLE_TYPE_EMAIL_MASK = (((long)0x2)<<60); + private static final long HANDLE_TYPE_SMS_GSM_MASK = (((long)0x4)<<60); + private static final long HANDLE_TYPE_SMS_CDMA_MASK = (((long)0x8)<<60); /** * This enum is used to convert from the bMessage type property to a type safe @@ -43,27 +47,46 @@ public class BluetoothMapUtils { MMS } + public static String getLongAsString(long v) { + char[] result = new char[16]; + int v1 = (int) (v & 0xffffffff); + int v2 = (int) ((v>>32) & 0xffffffff); + int c; + for (int i = 0; i < 8; i++) { + c = v2 & 0x0f; + c += (c < 10) ? '0' : ('A'-10); + result[7 - i] = (char) c; + v2 >>= 4; + c = v1 & 0x0f; + c += (c < 10) ? '0' : ('A'-10); + result[15 - i] = (char)c; + v1 >>= 4; + } + return new String(result); + } + /** * Convert a Content Provider handle and a Messagetype into a unique handle * @param cpHandle content provider handle * @param messageType message type (TYPE_MMS/TYPE_SMS_GSM/TYPE_SMS_CDMA/TYPE_EMAIL) * @return String Formatted Map Handle */ - static public String getMapHandle(long cpHandle, TYPE messageType){ + public static String getMapHandle(long cpHandle, TYPE messageType){ String mapHandle = "-1"; switch(messageType) { + case MMS: - mapHandle = String.format("%016X",(cpHandle | HANDLE_TYPE_MMS_MASK)); + mapHandle = getLongAsString(cpHandle | HANDLE_TYPE_MMS_MASK); break; case SMS_GSM: - mapHandle = String.format("%016X",cpHandle | HANDLE_TYPE_SMS_GSM_MASK); + mapHandle = getLongAsString(cpHandle | HANDLE_TYPE_SMS_GSM_MASK); break; case SMS_CDMA: - mapHandle = String.format("%016X",cpHandle | HANDLE_TYPE_SMS_CDMA_MASK); + mapHandle = getLongAsString(cpHandle | HANDLE_TYPE_SMS_CDMA_MASK); break; case EMAIL: - mapHandle = String.format("%016X",(cpHandle | HANDLE_TYPE_EMAIL_MASK)); //TODO correct when email support is implemented + mapHandle = getLongAsString(cpHandle | HANDLE_TYPE_EMAIL_MASK); break; default: throw new IllegalArgumentException("Message type not supported"); @@ -88,8 +111,11 @@ public class BluetoothMapUtils { static public long getCpHandle(String mapHandle) { long cpHandle = getMsgHandleAsLong(mapHandle); + if(D)Log.d(TAG,"-> MAP handle:"+mapHandle); /* remove masks as the call should already know what type of message this handle is for */ cpHandle &= ~HANDLE_TYPE_MASK; + if(D)Log.d(TAG,"->CP handle:"+cpHandle); + return cpHandle; } |