標籤:android io ar java for 檔案 sp art 問題
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,導致連絡人開機後丟失怎麼辦?