• android Contacts/Acore进程常常被Kill,导致联系人开机后丢失怎么办?


    Contacts/Acore进程,在内存较少和开机进程过多的情况下会常常被 ActivityManager Kill 掉。
    导致Sim卡联系人开机后未导入或者仅仅导入一部分,造成联系人丢失的现象,可是又一次开机后能够恢复正常。


    遇到这种问题能够採用下面方法提供Contacts/Acore进程的优先级,减少被ActivityManager 杀掉的概率。
     
    方法1:
    提高进程优先级
            startForeground(1, new Notification());
    减少进程优先级
            stopForeground(true); 
    NOTICE:
        这种方法能够将相应AP的ADJ暂时提高到2。
     
    方法2:
    找到这个进程相应的AndroidMannifest.xml文件,在当中加入属性『android:persistent="true"』,
    这样能够将该进程设置为常驻内存进程,就能够减少被Kill的概率。
    以Acore进程为例。
    在 /package/providers/ContactsProvider/AndroidMannifest.xml 文件里添加一行『android:persistent="true"』
    详细改动示比例如以下:
       <application android:process="android.process.acore"
                 android:label="@string/app_label"
                 android:icon="@drawable/app_icon"
                 android:allowBackup="false"
                 android:persistent="true" <!--新添加代码。保证acore进程不被ActivityManager杀死-->
         >
    NOTICE:
        这种方法能够将相应AP的ADJ暂时提高到2。
     
        解决发生JE问题(必须合入):
        CallLogProvider.java  (Line1000)
        public static final void notifyNewCallsCount(SQLiteDatabase db, Context context) {
            ... ...
            Log.i(TAG, "[notifyNewCallsCount] newCallsCount = " + newCallsCount);
            //send count=0 to clear the unread icon
            if (newCallsCount >= 0) {
                Intent newIntent = new Intent(Intent.MTK_ACTION_UNREAD_CHANGED);
                newIntent.putExtra(Intent.MTK_EXTRA_UNREAD_NUMBER, newCallsCount);
                newIntent.putExtra(Intent.MTK_EXTRA_UNREAD_COMPONENT, new ComponentName(Constants.CONTACTS_PACKAGE,
                        Constants.CONTACTS_DIALTACTS_ACTIVITY));
    // New add for fixed JE
                newIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
    // End
                context.sendBroadcast(newIntent);
            ... ...
  • 相关阅读:
    Centos启动Cassandra交互模式失败:No appropriate python interpreter found
    删除Kafka的topic
    《面向中国资本市场应用的分布式总账白皮书》笔记
    搭建Kafka集群(3-broker)
    【转】矩阵求导计算规则
    二次型求导
    解决: org.iq80.leveldb.DBException: IO error: C:data rie00945.sst: Could not create random access file.
    SSH遇见的问题
    解决:Redis:java.util.NoSuchElementException: Unable to validate object at
    【转】mysql查询结果输出到文件
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/6727345.html
Copyright © 2020-2023  润新知