当前位置: 代码迷 >> 综合 >> Android 设置彩信限制,删除旧彩信有误,设置为10,删除之后会少于10。
  详细解决方案

Android 设置彩信限制,删除旧彩信有误,设置为10,删除之后会少于10。

热度:28   发布时间:2024-01-19 17:47:55.0

在文件Recycler.java (alps\packages\apps\mms\src\com\android\mms\util)里,

修改前:

    public static class MmsRecycler extends Recycler {

        ......

        protected void deleteMessagesForThread(Context context, long threadId, int keep) {

            ......

                cursor = SqliteWrapper.query(context, resolver,

                        Telephony.Mms.CONTENT_URI,

                        MMS_MESSAGE_PROJECTION,

                        "thread_id=" + threadId + " AND locked=0",

                        null, "date DESC");     // get in newest to oldest order

            .....

        }

 

        private void deleteMessagesOlderThanDate(Context context, long threadId,

                long latestDate) {

            long cntDeleted = SqliteWrapper.delete(context, context.getContentResolver(),

                    Telephony.Mms.CONTENT_URI,

                    "thread_id=" + threadId + " AND locked=0 AND date<" + latestDate,

                    null);

            ......

        }

        ......

    }

 

修改后:

    public static class MmsRecycler extends Recycler {

        ......

                cursor = SqliteWrapper.query(context, resolver,

                        Telephony.Mms.CONTENT_URI,

                        MMS_MESSAGE_PROJECTION,

                        "thread_id=" + threadId + " AND locked=0" + " AND (" +

                        Mms.MESSAGE_TYPE + "= 132 OR " +

                        Mms.MESSAGE_TYPE + "= 130 OR " +

                        Mms.MESSAGE_TYPE + "= 128)",

                        null, "date DESC");     // get in newest to oldest order

            .....

        }

 

        private void deleteMessagesOlderThanDate(Context context, long threadId,

                long latestDate) {

            long cntDeleted = SqliteWrapper.delete(context, context.getContentResolver(),

                    Telephony.Mms.CONTENT_URI,

                    "thread_id=" + threadId + " AND locked=0 AND date<" + latestDate + " AND (" +

                    Mms.MESSAGE_TYPE + "= 132 OR " +

                    Mms.MESSAGE_TYPE + "= 130 OR " +

                    Mms.MESSAGE_TYPE + "= 128)",

                    null);

            ......

        }

        ......

    }

  相关解决方案