summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-02-08 10:40:11 -0800
committerDoug Zongker <dougz@android.com>2010-02-08 10:40:11 -0800
commitc9350c7138be1ebf1e9f439f2fbb3f2d313b3998 (patch)
tree704830717a6dce3e9785cdc5893191053ef51e14
parentba7043e3a57c39c3f30c29fd00c2b568f54e3d3f (diff)
downloadIM-c9350c7138be1ebf1e9f439f2fbb3f2d313b3998.tar.gz
use Base64 code from android-common
Change-Id: I7758d05eb19e356265aab936ffd52c82b0222d9b
-rw-r--r--Android.mk2
-rw-r--r--src/com/android/im/app/DatabaseUtils.java4
-rw-r--r--src/com/android/im/imps/ImpsPresenceUtils.java10
3 files changed, 9 insertions, 7 deletions
diff --git a/Android.mk b/Android.mk
index 4eecd43..41e6cee 100644
--- a/Android.mk
+++ b/Android.mk
@@ -16,6 +16,8 @@ LOCAL_SRC_FILES := $(call all-subdir-java-files) \
src/com/android/im/ISubscriptionListener.aidl \
src/com/android/im/IConnectionCreationListener.aidl \
+LOCAL_STATIC_JAVA_LIBRARIES := android-common
+
LOCAL_PACKAGE_NAME := IM
LOCAL_JNI_SHARED_LIBRARIES := libwbxml_jni
diff --git a/src/com/android/im/app/DatabaseUtils.java b/src/com/android/im/app/DatabaseUtils.java
index 4484114..640e14a 100644
--- a/src/com/android/im/app/DatabaseUtils.java
+++ b/src/com/android/im/app/DatabaseUtils.java
@@ -20,6 +20,8 @@ package com.android.im.app;
import com.android.im.plugin.ImConfigNames;
import com.android.im.provider.Imps;
+import com.android.common.Base64;
+
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
@@ -93,7 +95,7 @@ public class DatabaseUtils {
return null;
}
- rawData = android.os.Base64Utils.decodeBase64(encodedData);
+ rawData = Base64.decode(encodedData, Base64.DEFAULT);
// if (DBG) {
// log("getAvatarFromCursor for " + username + ": found encoded
diff --git a/src/com/android/im/imps/ImpsPresenceUtils.java b/src/com/android/im/imps/ImpsPresenceUtils.java
index e9b0b5f..95e1248 100644
--- a/src/com/android/im/imps/ImpsPresenceUtils.java
+++ b/src/com/android/im/imps/ImpsPresenceUtils.java
@@ -20,9 +20,7 @@ package com.android.im.imps;
import com.android.im.engine.Presence;
import com.android.im.plugin.PresenceMapping;
-import org.apache.commons.codec.binary.Base64;
-
-import android.os.Base64Utils;
+import com.android.common.Base64;
import java.util.ArrayList;
import java.util.Arrays;
@@ -102,7 +100,7 @@ public class ImpsPresenceUtils {
byte[] avatar = newPresence.getAvatarData();
if (avatar != null && !Arrays.equals(avatar, oldPresence.getAvatarData())) {
- String base64Avatar = new String(Base64.encodeBase64(avatar));
+ String base64Avatar = Base64.encodeToString(avatar, Base64.NO_WRAP);
PrimitiveElement statusContent = new PrimitiveElement(ImpsTags.StatusContent);
statusContent.addChild(ImpsTags.Qualifier, true);
statusContent.addChild(ImpsTags.DirectContent, base64Avatar);
@@ -194,8 +192,8 @@ public class ImpsPresenceUtils {
PrimitiveElement statusContentElem = presenceListElem.getChild(ImpsTags.StatusContent);
if(ImpsUtils.isQualifiedPresence(statusContentElem)) {
String avatarStr = statusContentElem.getChildContents(ImpsTags.DirectContent);
- if(avatarStr != null){
- return Base64Utils.decodeBase64(avatarStr);
+ if (avatarStr != null){
+ return Base64.decode(avatarStr, Base64.DEFAULT);
}
}
return null;