標籤:register sql 部分 activity icon 優先順序 androi constant stop
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);
... ...
android Contacts/Acore進程常常被Kill,導致連絡人開機後丟失怎麼辦?