summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-03-23 13:39:58 -0700
committerSteve Kondik <steve@cyngn.com>2015-03-23 13:52:36 -0700
commitadc1fe36fa0266baba292a0a99b3ab82bdb6cd72 (patch)
treef6a85d3f619c9956e5c6c84f17b3b945da319a97
parent34d85429c0234a1eb8e6fc738ac589e2a33457ce (diff)
downloadandroid_packages_providers_TelephonyProvider-adc1fe36fa0266baba292a0a99b3ab82bdb6cd72.tar.gz
android_packages_providers_TelephonyProvider-adc1fe36fa0266baba292a0a99b3ab82bdb6cd72.tar.bz2
android_packages_providers_TelephonyProvider-adc1fe36fa0266baba292a0a99b3ab82bdb6cd72.zip
Revert QC features we aren't using.
Revert "TelephonyProvider: Add CDMA call forwarding/waiting function" This reverts commit ea8aad945e06112e16293af5254c43c6fb4cad1f. Revert "TelephonyProvider: Enhance RCS messages performance." This reverts commit 0d554bbfcffd3764ce9d39d85cac6e9a97b01e47. Revert "TelephonyProvider: add RCS message clomn in telephonyProvider" This reverts commit 9b7de1dc374e96917e1e6c1f166c7b29dc1a168e. Change-Id: I7e357fa684953b3167c933c661f7c891f3633c85
-rw-r--r--AndroidManifest.xml4
-rw-r--r--src/com/android/providers/telephony/CdmaCallOptionProvider.java450
-rw-r--r--src/com/android/providers/telephony/MmsSmsDatabaseHelper.java47
-rw-r--r--src/com/android/providers/telephony/MmsSmsProvider.java96
4 files changed, 12 insertions, 585 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 423440b..acd4fb7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -84,9 +84,5 @@
android:singleUser="true"
android:multiprocess="false"
android:writePermission="android.permission.MODIFY_PHONE_STATE" />
-
- <provider android:name="CdmaCallOptionProvider"
- android:authorities="cdma"
- android:exported="true" />
</application>
</manifest>
diff --git a/src/com/android/providers/telephony/CdmaCallOptionProvider.java b/src/com/android/providers/telephony/CdmaCallOptionProvider.java
deleted file mode 100644
index fd42b2a..0000000
--- a/src/com/android/providers/telephony/CdmaCallOptionProvider.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*
-** Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
-** Not a Contribution.
-**
-** Copyright 2006, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-package com.android.providers.telephony;
-
-import android.content.ContentProvider;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.UriMatcher;
-import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteOpenHelper;
-import android.database.sqlite.SQLiteQueryBuilder;
-import android.net.Uri;
-import android.os.Environment;
-import android.provider.Telephony;
-import android.util.Config;
-import android.util.Log;
-import android.util.Xml;
-
-import com.android.internal.util.XmlUtils;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-
-public class CdmaCallOptionProvider extends ContentProvider {
-
- private static final String DATABASE_NAME = "cdmacalloption.db";
-
- private static final int DATABASE_VERSION = 1;
-
- // call option type: call forwarding, cancel all, call waiting
- private static final int CFUNCONDITIONAL = 0;
- private static final int CFBUSY = 1;
- private static final int CFNOREPLY = 2;
- private static final int CFNOREACHABLE = 3;
- private static final int CFDEACTIVATEALL = 4;
- private static final int CALLWAITING = 6;
-
- // call option state: activate, deactivate
- private static final int ACTIVATE = 1;
- private static final int DEACTIVATE = 2;
-
- private static final int URL_TELEPHONY = 1;
- private static final int URL_CFU = 2;
- private static final int URL_CFB = 3;
- private static final int URL_CFNRY = 4;
- private static final int URL_CFNRC = 5;
- private static final int URL_CFDA = 6;
- private static final int URL_CW = 7;
-
- private static final String TAG = "CdmaCallOptionProvider";
- private static final String CALL_OPTION_TABLE = "calloption";
- private static final String PARTNER_CDMA_CALL_PATH = "etc/cdma_call_conf.xml";
- private static final UriMatcher s_urlMatcher = new UriMatcher(UriMatcher.NO_MATCH);
-
- private SQLiteOpenHelper mOpenHelper;
-
- static {
- s_urlMatcher.addURI("cdma", "calloption", URL_TELEPHONY);
- s_urlMatcher.addURI("cdma", "calloption/cfu", URL_CFU);
- s_urlMatcher.addURI("cdma", "calloption/cfb", URL_CFB);
- s_urlMatcher.addURI("cdma", "calloption/cfnry", URL_CFNRY);
- s_urlMatcher.addURI("cdma", "calloption/cfnrc", URL_CFNRC);
- s_urlMatcher.addURI("cdma", "calloption/cfda", URL_CFDA);
- s_urlMatcher.addURI("cdma", "calloption/cw", URL_CW);
- }
-
- private static class DatabaseHelper extends SQLiteOpenHelper {
- // Context to access resources with
- private Context mContext;
-
- /**
- * DatabaseHelper helper class for loading data profiles into a database.
- *
- * @param parser the system-default parser for apns.xml
- * @param confidential an optional parser for confidential APNS (stored separately)
- */
- public DatabaseHelper(Context context) {
- super(context, DATABASE_NAME, null, DATABASE_VERSION);
- mContext = context;
- }
-
- @Override
- public void onCreate(SQLiteDatabase db) {
- // Set up the database schema
- db.execSQL("CREATE TABLE " + CALL_OPTION_TABLE +
- "(_id INTEGER PRIMARY KEY," +
- "name TEXT," +
- "numeric TEXT," +
- "mcc TEXT," +
- "mnc TEXT," +
- "number TEXT," +
- "type INTEGER," +
- "category INTEGER," +
- "state INTEGER);");
-
- initDatabase(db);
- }
-
- private void initDatabase(SQLiteDatabase db) {
- // Read cdma call option data (partner-provided)
- XmlPullParser confparser = null;
- // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system".
- File confFile = new File(Environment.getRootDirectory(), PARTNER_CDMA_CALL_PATH);
- FileReader confreader = null;
- try {
- confreader = new FileReader(confFile);
- confparser = Xml.newPullParser();
- confparser.setInput(confreader);
- XmlUtils.beginDocument(confparser, "calloptions");
- loadProfiles(db, confparser);
- } catch (FileNotFoundException e) {
- // It's ok if the file isn't found. It means there isn't a confidential file
- // Log.e(TAG, "File not found: '" + confFile.getAbsolutePath() + "'");
- } catch (Exception e) {
- Log.e(TAG, "Exception while parsing '" + confFile.getAbsolutePath() + "'", e);
- } finally {
- try { if (confreader != null) confreader.close(); } catch (IOException e) { }
- }
- }
-
- @Override
- public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- db.execSQL("DROP TABLE IF EXISTS " + CALL_OPTION_TABLE);
- onCreate(db);
- }
-
- /**
- * Gets the next row of data profile values.
- *
- * @param parser the parser
- * @return the row or null if it's not an call option
- */
- private ContentValues getRow(XmlPullParser parser) {
- // get the profile type from the XML file tags
- String prof_type = parser.getName();
- if (!"option".equals(prof_type)) {
- return null;
- }
- ContentValues map = new ContentValues();
-
- String mcc = parser.getAttributeValue(null, "mcc");
- String mnc = parser.getAttributeValue(null, "mnc");
- String numeric = mcc + mnc;
-
- map.put(Telephony.CdmaCallOptions.NUMERIC,numeric);
- map.put(Telephony.CdmaCallOptions.MCC, mcc);
- map.put(Telephony.CdmaCallOptions.MNC, mnc);
- map.put(Telephony.CdmaCallOptions.NAME, parser.getAttributeValue(null, "carrier"));
- map.put(Telephony.CdmaCallOptions.NUMBER, parser.getAttributeValue(null, "number"));
-
- // do not add NULL to the map so that insert() will set the default value
- String category = parser.getAttributeValue(null, "category");
- if (category != null) {
- map.put(Telephony.CdmaCallOptions.CATEGORY, Integer.parseInt(category));
- }
- String state = parser.getAttributeValue(null, "state");
- if (state != null) {
- map.put(Telephony.CdmaCallOptions.STATE, Integer.parseInt(state));
- }
- String type = parser.getAttributeValue(null, "type");
- if (type != null) {
- map.put(Telephony.CdmaCallOptions.TYPE, Integer.parseInt(type));
- }
-
- return map;
- }
-
- /*
- * Loads data profiles from xml file into the database
- *
- * @param db the sqlite database to write to
- * @param parser the xml parser
- *
- */
- private void loadProfiles(SQLiteDatabase db, XmlPullParser parser) {
- if (parser != null) {
- try {
- while (true) {
- XmlUtils.nextElement(parser);
- ContentValues row = getRow(parser);
- if (row != null) {
- insertAddingDefaults(db, CALL_OPTION_TABLE, row);
- } else {
- break; // do we really want to skip the rest of the file?
- }
- }
- } catch (XmlPullParserException e) {
- Log.e(TAG, "Got execption while getting perferred time zone.", e);
- } catch (IOException e) {
- Log.e(TAG, "Got execption while getting perferred time zone.", e);
- }
- }
- }
-
- private void insertAddingDefaults(SQLiteDatabase db, String table, ContentValues row) {
- // Initialize defaults if any
- if (row.containsKey(Telephony.CdmaCallOptions.CATEGORY) == false) {
- row.put(Telephony.CdmaCallOptions.CATEGORY, -1);
- }
- if (row.containsKey(Telephony.CdmaCallOptions.STATE) == false) {
- row.put(Telephony.CdmaCallOptions.STATE, -1);
- }
- db.insert(CALL_OPTION_TABLE, null, row);
- }
- }
-
- @Override
- public boolean onCreate() {
- mOpenHelper = new DatabaseHelper(getContext());
- SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- return true;
- }
-
-
-
- @Override
- public Cursor query(Uri url, String[] projectionIn, String selection,
- String[] selectionArgs, String sort) {
- SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
- qb.setTables("calloption");
-
- int match = s_urlMatcher.match(url);
- switch (match) {
- // do nothing
- case URL_TELEPHONY: {
- break;
- }
-
- case URL_CFU: {
- qb.appendWhere("type = " + CFUNCONDITIONAL);
- break;
- }
-
- case URL_CFB: {
- qb.appendWhere("type = " + CFBUSY);
- break;
- }
-
- case URL_CFNRY: {
- qb.appendWhere("type = " + CFNOREPLY);
- break;
- }
-
- case URL_CFNRC: {
- qb.appendWhere("type = " + CFNOREACHABLE);
- break;
- }
-
- case URL_CFDA: {
- qb.appendWhere("type = " + CFDEACTIVATEALL);
- break;
- }
-
- case URL_CW: {
- qb.appendWhere("type = " + CALLWAITING);
- break;
- }
-
- default: {
- return null;
- }
- }
-
- SQLiteDatabase db = mOpenHelper.getReadableDatabase();
- Cursor ret = qb.query(db, projectionIn, selection, selectionArgs, null, null, sort);
- ret.setNotificationUri(getContext().getContentResolver(), url);
- return ret;
- }
-
-
- @Override
- public Uri insert(Uri url, ContentValues initialValues)
- {
- Uri result = null;
-
- //checkPermission();
-
- SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- int match = s_urlMatcher.match(url);
- boolean notify = false;
- ContentValues values = new ContentValues(initialValues);
- switch (match)
- {
- case URL_TELEPHONY:
- {
- // TODO Review this. This code should probably not bet here.
- // It is valid for the database to return a null string.
- if (values.containsKey(Telephony.CdmaCallOptions.NAME) == false) {
- values.put(Telephony.CdmaCallOptions.NAME, "");
- }
- if (values.containsKey(Telephony.CdmaCallOptions.NUMBER) == false) {
- values.put(Telephony.CdmaCallOptions.NUMBER, "");
- }
- if (values.containsKey(Telephony.CdmaCallOptions.TYPE) == false) {
- values.put(Telephony.CdmaCallOptions.TYPE, -1);
- }
- break;
- }
- case URL_CFU: {
- values.put(Telephony.CdmaCallOptions.TYPE, CFUNCONDITIONAL);
- break;
- }
- case URL_CFB: {
- values.put(Telephony.CdmaCallOptions.TYPE, CFBUSY);
- break;
- }
- case URL_CFNRY: {
- values.put(Telephony.CdmaCallOptions.TYPE, CFNOREPLY);
- break;
- }
- case URL_CFNRC: {
- values.put(Telephony.CdmaCallOptions.TYPE, CFNOREACHABLE);
- break;
- }
- case URL_CFDA: {
- values.put(Telephony.CdmaCallOptions.TYPE, CFDEACTIVATEALL);
- values.put(Telephony.CdmaCallOptions.STATE, DEACTIVATE);
- values.put(Telephony.CdmaCallOptions.CATEGORY, -1);
- break;
- }
- case URL_CW: {
- values.put(Telephony.CdmaCallOptions.TYPE, CALLWAITING);
- values.put(Telephony.CdmaCallOptions.CATEGORY, -1);
- break;
- }
- default: {
- throw new UnsupportedOperationException("Cannot delete that URL: " + url);
- }
- }
- long rowID = db.insert(CALL_OPTION_TABLE, null, values);
- if (rowID > 0) {
- result = ContentUris.withAppendedId(Telephony.CdmaCallOptions.CONTENT_URI, rowID);
- notify = true;
- }
-
- if (Config.LOGD) Log.d(TAG, "inserted " + values.toString() + " rowID = " + rowID);
-
- if (notify) {
- getContext().getContentResolver().notifyChange(
- Telephony.CdmaCallOptions.CONTENT_URI, null);
- }
-
- return result;
- }
-
- @Override
- public int delete(Uri url, String where, String[] whereArgs)
- {
- int count;
-
- /**
- * we need to delete all the ssfc with the same mnc/mcc when a new card is inserted
- */
- //checkPermission();
-
- SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- int match = s_urlMatcher.match(url);
- switch (match)
- {
- case URL_TELEPHONY:
- {
- count = db.delete(CALL_OPTION_TABLE, where, whereArgs);
- break;
- }
-
- default: {
- throw new UnsupportedOperationException("Cannot delete that URL: " + url);
- }
- }
-
- getContext().getContentResolver().notifyChange(
- Telephony.CdmaCallOptions.CONTENT_URI, null);
-
- return count;
- }
-
- @Override
- public int update(Uri url, ContentValues values, String where, String[] whereArgs)
- {
- int count = 0;
-
- checkPermission();
-
- SQLiteDatabase db = mOpenHelper.getWritableDatabase();
- int match = s_urlMatcher.match(url);
- switch (match)
- {
- case URL_TELEPHONY:
- {
- count = db.update(CALL_OPTION_TABLE, values, where, whereArgs);
- break;
- }
- default: {
- throw new UnsupportedOperationException("Cannot update that URL: " + url);
- }
- }
-
- if (count > 0) {
- getContext().getContentResolver().notifyChange(
- Telephony.CdmaCallOptions.CONTENT_URI, null);
- }
-
- return count;
- }
-
- @Override
- public String getType(Uri url)
- {
- switch (s_urlMatcher.match(url)) {
- case URL_TELEPHONY:
- return "vnd.android.cursor.dir/telephony-calloption";
-
- default:
- throw new IllegalArgumentException("Unknown URL " + url);
- }
- }
-
- private void checkPermission() {
- // Check the permissions
- getContext().enforceCallingOrSelfPermission("android.permission.WRITE_CDMA_CALL_SETTINGS",
- "No permission to write Cdma call settings");
- }
-}
diff --git a/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java b/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
index e56e25d..c01f63d 100644
--- a/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
+++ b/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
@@ -607,7 +607,6 @@ public class MmsSmsDatabaseHelper extends SQLiteOpenHelper {
Mms.PHONE_ID + " INTEGER DEFAULT -1, " +
Mms.SEEN + " INTEGER DEFAULT 0," +
Mms.CREATOR + " TEXT," +
- "favourite INTEGER DEFAULT 0," +
Mms.TEXT_ONLY + " INTEGER DEFAULT 0" +
");");
@@ -835,39 +834,7 @@ public class MmsSmsDatabaseHelper extends SQLiteOpenHelper {
"error_code INTEGER DEFAULT 0," +
"creator TEXT," +
"seen INTEGER DEFAULT 0," +
- "priority INTEGER DEFAULT -1," +
- "favourite INTEGER DEFAULT 0," +
- "rcs_message_id TEXT, " +
- "rcs_data TEXT, " +
- "rcs_filename TEXT, " +
- "rcs_filesize LONG, " +
- "rcs_mime_type TEXT, " +
- "rcs_msg_type INTEGER DEFAULT -1, " +
- "rcs_send_receive INTEGER, " +
- "rcs_is_read INTEGER, " +
- "rcs_msg_state INTEGER, " +
- "rcs_chat_type INTEGER, " +
- "rcs_thread_id TEXT, " +
- "rcs_conversation_id TEXT, " +
- "rcs_contribution_id TEXT, " +
- "rcs_file_selector TEXT, " +
- "rcs_file_transfer_ext TEXT," +
- "rcs_file_transfer_id TEXT, " +
- "rcs_file_icon TEXT, " +
- "rcs_burn_flag INTEGER DEFAULT -1, " +
- "rcs_barcycle INTEGER, " +
- "rcs_header TEXT, " +
- "is_rcs INTEGER DEFAULT -1," +
- "rcs_have_attach INTEGER DEFAULT -1," +
- "rcs_path TEXT," +
- "rcs_is_burn INTEGER, "+
- "rcs_is_download INTEGER DEFAULT 0 , "+
- "rcs_play_time INTEGER DEFAULT 0 , "+
- "rcs_file_size INTEGER DEFAULT 0 , "+
- "rcs_id INTEGER DEFAULT -1, "+
- "rcs_thumb_path TEXT, " +
- "rcs_burn_body TEXT, " +
- "rcs_nmsg_state TEXT " +
+ "priority INTEGER DEFAULT -1" +
");");
/**
@@ -936,10 +903,7 @@ public class MmsSmsDatabaseHelper extends SQLiteOpenHelper {
Threads.ARCHIVED + " INTEGER DEFAULT 0," +
Threads.TYPE + " INTEGER DEFAULT 0," +
Threads.ERROR + " INTEGER DEFAULT 0," +
- Threads.HAS_ATTACHMENT + " INTEGER DEFAULT 0," +
- "top" + " INTEGER DEFAULT 0," +
- "top_time" + " INTEGER DEFAULT 0," +
- "is_group_chat" + " INTEGER DEFAULT 0);");
+ Threads.HAS_ATTACHMENT + " INTEGER DEFAULT 0);");
/**
* This table stores the queue of messages to be sent/downloaded.
@@ -1623,13 +1587,6 @@ public class MmsSmsDatabaseHelper extends SQLiteOpenHelper {
private void upgradeDatabaseToVersion61(SQLiteDatabase db) {
try {
- db.execSQL("ALTER TABLE " + MmsSmsProvider.TABLE_THREADS +" ADD COLUMN "
- + "is_group_chat" + " INTEGER DEFAULT 0");
-
- db.execSQL("ALTER TABLE " + SmsProvider.TABLE_RAW +" ADD COLUMN "
- + "favorited" + " INTEGER DEFAULT 0");
- db.execSQL("ALTER TABLE " + SmsProvider.TABLE_RAW +" ADD COLUMN "
- + "rcs_message_id" + " INTEGER DEFAULT -1");
db.execSQL("ALTER TABLE " + SmsProvider.TABLE_SMS + " ADD COLUMN "
+ "priority INTEGER DEFAULT -1");
// Try to update the "priority" column with existing "pri" column.
diff --git a/src/com/android/providers/telephony/MmsSmsProvider.java b/src/com/android/providers/telephony/MmsSmsProvider.java
index 00451c7..7c398aa 100644
--- a/src/com/android/providers/telephony/MmsSmsProvider.java
+++ b/src/com/android/providers/telephony/MmsSmsProvider.java
@@ -103,8 +103,6 @@ public class MmsSmsProvider extends ContentProvider {
private static final int URI_MESSAGES_COUNT = 22;
private static final int URI_UPDATE_THREAD = 23;
private static final int URI_UPDATE_THREAD_DATE = 24;
- private static final int URI_FAVOURITE_MESSAGES = 25;
- private static final int URI_UPDATE_THREAD_TOP = 26;
private static final int URI_CONVERSATION_TYPE_COUNT = 27;
// Escape character
private static final char SEARCH_ESCAPE_CHARACTER = '!';
@@ -145,7 +143,7 @@ public class MmsSmsProvider extends ContentProvider {
// SMS ("sms") message tables.
private static final String[] MMS_SMS_COLUMNS =
{ BaseColumns._ID, Mms.DATE, Mms.DATE_SENT, Mms.READ, Mms.THREAD_ID, Mms.LOCKED,
- Mms.PHONE_ID, "favourite"};
+ Mms.PHONE_ID };
// These are the columns that appear only in the MMS message
// table.
@@ -162,10 +160,7 @@ public class MmsSmsProvider extends ContentProvider {
// table.
private static final String[] SMS_ONLY_COLUMNS =
{ "address", "body", "person", "reply_path_present",
- "service_center", "status", "subject", "type", "error_code", "priority", "rcs_path", "rcs_thumb_path", "is_rcs",
- "rcs_mime_type", "rcs_msg_type", "rcs_chat_type", "favourite", "rcs_is_burn", "rcs_id",
- "rcs_msg_state", "rcs_burn_flag", "rcs_is_download", "rcs_file_size", "rcs_play_time",
- "rcs_burn_body","rcs_message_id", "rcs_nmsg_state" };
+ "service_center", "status", "subject", "type", "error_code", "priority" };
// These are all the columns that appear in the "threads" table.
private static final String[] THREADS_COLUMNS = {
@@ -247,21 +242,7 @@ public class MmsSmsProvider extends ContentProvider {
" GROUP BY thread_id ORDER BY thread_id ASC, date DESC";
private static final String SMS_PROJECTION = "'sms' AS transport_type, _id, thread_id,"
- + "address, body,"
- + "rcs_path ,"
- + "rcs_thumb_path ,"
- + "rcs_msg_type ,"
- + "rcs_id ,"
- + "rcs_burn_flag, "
- + "rcs_is_burn ,"
- + "rcs_is_download, "
- + "rcs_msg_state, "
- + "favourite ,"
- + "rcs_file_size,"
- + "rcs_play_time,"
- + "rcs_message_id,"
- + "rcs_chat_type,"
- + "phone_id, date, date_sent, read, type,"
+ + "address, body, phone_id, date, date_sent, read, type,"
+ "status, locked, NULL AS error_code,"
+ "NULL AS sub, NULL AS sub_cs, date, date_sent, read,"
+ "NULL as m_type,"
@@ -271,15 +252,6 @@ public class MmsSmsProvider extends ContentProvider {
+ "phone_id, NULL AS recipient_ids";
private static final String MMS_PROJECTION = "'mms' AS transport_type, pdu._id, thread_id,"
+ "addr.address AS address, part.text as body, phone_id,"
-
- + "NULL AS rcs_path ," + "NULL AS rcs_thumb_path ," +
- "NULL AS rcs_msg_type , " + "NULL AS rcs_id ," + "NULL AS rcs_burn_flag ,"
- + "NULL AS rcs_is_burn ," + "NULL AS rcs_is_download ," +
- "NULL AS rcs_msg_state , " + "NULL AS favourite ," + "NULL AS rcs_file_size,"+
- "NULL AS rcs_play_time,"+
- "NULL AS rcs_message_id,"+
- "NULL AS rcs_chat_type,"
-
+ "pdu.date * 1000 AS date, date_sent, read, NULL AS type,"
+ "NULL AS status, locked, NULL AS error_code,"
+ "sub, sub_cs, date, date_sent, read,"
@@ -304,14 +276,6 @@ public class MmsSmsProvider extends ContentProvider {
private static final String MMS_PROJECTION_FOR_NUMBER_SEARCH =
"'mms' AS transport_type, pdu._id, thread_id,"
+ "addr.address AS address, NULL AS body, phone_id,"
- + "NULL AS rcs_path ," + "NULL AS rcs_thumb_path ," +
- "NULL AS rcs_msg_type , " + "NULL AS rcs_id ," + "NULL AS rcs_burn_flag ,"
- + "NULL AS rcs_is_burn ," + "NULL AS rcs_is_download ," +
- "NULL AS rcs_msg_state , " + "NULL AS favourite ," + "NULL AS rcs_file_size,"+
- "NULL AS rcs_play_time,"+
- "NULL AS rcs_message_id,"+
- "NULL AS rcs_chat_type,"
-
+ "pdu.date * 1000 AS date, date_sent, read, NULL AS type,"
+ "NULL AS status, locked, NULL AS error_code,"
+ "sub, sub_cs, date, date_sent, read,"
@@ -335,9 +299,6 @@ public class MmsSmsProvider extends ContentProvider {
URI_MATCHER.addURI(
AUTHORITY, "conversations/#", URI_CONVERSATIONS_MESSAGES);
URI_MATCHER.addURI(
- AUTHORITY, "conversations/favourite", URI_FAVOURITE_MESSAGES);
-
- URI_MATCHER.addURI(
AUTHORITY, "conversations/#/recipients",
URI_CONVERSATIONS_RECIPIENTS);
URI_MATCHER.addURI(
@@ -373,9 +334,6 @@ public class MmsSmsProvider extends ContentProvider {
URI_MATCHER.addURI(AUTHORITY, "update-date", URI_UPDATE_THREAD_DATE);
- URI_MATCHER.addURI(AUTHORITY, "update-top", URI_UPDATE_THREAD_TOP);
-
-
// Use this pattern to query the canonical address by given ID.
URI_MATCHER.addURI(AUTHORITY, "canonical-address/#", URI_CANONICAL_ADDRESS);
@@ -463,10 +421,6 @@ public class MmsSmsProvider extends ContentProvider {
cursor = getConversationMessages(uri.getPathSegments().get(1), projection,
selection, sortOrder, false);
break;
- case URI_FAVOURITE_MESSAGES:
- cursor = getFavourateMessages(uri.getPathSegments().get(1), projection,
- selection, sortOrder);
- break;
case URI_MAILBOX_MESSAGES:
cursor = getMailboxMessages(
uri.getPathSegments().get(1), projection, selection,
@@ -490,9 +444,8 @@ public class MmsSmsProvider extends ContentProvider {
break;
case URI_THREAD_ID:
List<String> recipients = uri.getQueryParameters("recipient");
- boolean isGroupChat = "1".equals(uri.getQueryParameter("isGroupChat"));
- cursor = getThreadId(recipients, isGroupChat);
+ cursor = getThreadId(recipients);
break;
case URI_CANONICAL_ADDRESS: {
String extraSelection = "_id=" + uri.getPathSegments().get(1);
@@ -765,8 +718,8 @@ public class MmsSmsProvider extends ContentProvider {
/**
* Insert a record for a new thread.
*/
- private void insertThread(String recipientIds, int numberOfRecipients, boolean isGroupChat) {
- ContentValues values = new ContentValues(5);
+ private void insertThread(String recipientIds, int numberOfRecipients) {
+ ContentValues values = new ContentValues(4);
long date = System.currentTimeMillis();
values.put(ThreadsColumns.DATE, date - date % 1000);
@@ -775,7 +728,6 @@ public class MmsSmsProvider extends ContentProvider {
values.put(Threads.TYPE, Threads.BROADCAST_THREAD);
}
values.put(ThreadsColumns.MESSAGE_COUNT, 0);
- values.put("is_group_chat", isGroupChat ? 1 : 0);
long result = mOpenHelper.getWritableDatabase().insert(TABLE_THREADS, null, values);
Log.d(LOG_TAG, "insertThread: created new thread_id " + result +
@@ -785,12 +737,6 @@ public class MmsSmsProvider extends ContentProvider {
UserHandle.USER_ALL);
}
- /**
- * Insert a record for a new thread.
- */
- private void insertThread(String recipientIds, int numberOfRecipients) {
- insertThread(recipientIds, numberOfRecipients, false);
- }
private static final String THREAD_QUERY =
"SELECT _id FROM threads " + "WHERE recipient_ids=?";
@@ -800,7 +746,7 @@ public class MmsSmsProvider extends ContentProvider {
* one and return it. Callers should always use
* Threads.getThreadId to access this information.
*/
- private synchronized Cursor getThreadId(List<String> recipients, boolean isGroupChat) {
+ private synchronized Cursor getThreadId(List<String> recipients) {
Set<Long> addressIds = getAddressIds(recipients);
String recipientIds = "";
@@ -837,7 +783,7 @@ public class MmsSmsProvider extends ContentProvider {
Log.d(LOG_TAG, "getThreadId: create new thread_id for recipients " +
/*recipients*/ "xxxxxxxx");
- insertThread(recipientIds, recipients.size(), isGroupChat);
+ insertThread(recipientIds, recipients.size());
// The thread was just created, now find it and return it.
cursor = db.rawQuery(THREAD_QUERY, selectionArgs);
@@ -854,15 +800,7 @@ public class MmsSmsProvider extends ContentProvider {
}
return cursor;
}
- /**
- * Return the thread ID for this list of
- * recipients IDs. If no thread exists with this ID, create
- * one and return it. Callers should always use
- * Threads.getThreadId to access this information.
- */
- private synchronized Cursor getThreadId(List<String> recipients) {
- return getThreadId(recipients, false);
- }
+
private static String concatSelections(String selection1, String selection2) {
if (TextUtils.isEmpty(selection1)) {
return selection2;
@@ -928,7 +866,7 @@ public class MmsSmsProvider extends ContentProvider {
private Cursor getSimpleConversations(String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
return mOpenHelper.getReadableDatabase().query(TABLE_THREADS, projection,
- selection, selectionArgs, null, null, sortOrder /*" date DESC"*/);
+ selection, selectionArgs, null, null, " date DESC");
}
/**
@@ -1148,17 +1086,6 @@ public class MmsSmsProvider extends ContentProvider {
return mOpenHelper.getReadableDatabase().rawQuery(unionQuery, EMPTY_STRING_ARRAY);
}
- private Cursor getFavourateMessages(
- String threadIdString, String[] projection, String selection,
- String sortOrder) {
-
- String finalSelection = concatSelections(
- selection, " "+"favourite = " + 1);
-
- String unionQuery = buildConversationQuery(projection, finalSelection, sortOrder);
-
- return mOpenHelper.getReadableDatabase().rawQuery(unionQuery, EMPTY_STRING_ARRAY);
- }
/**
* Return the union of MMS and SMS messages in one mailbox.
*/
@@ -1718,9 +1645,6 @@ public class MmsSmsProvider extends ContentProvider {
case URI_UPDATE_THREAD_DATE:
MmsSmsDatabaseHelper.updateThreadsDate(db, selection, selectionArgs);
break;
- case URI_UPDATE_THREAD_TOP:
- db.update("threads", values, selection, selectionArgs);
- break;
default:
throw new UnsupportedOperationException(
NO_DELETES_INSERTS_OR_UPDATES + uri);