Loading services/java/com/android/server/am/ActivityManagerService.java +35 −22 Original line number Diff line number Diff line Loading @@ -3566,7 +3566,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (DEBUG_TASKS) Log.v(TAG, "Starting new activity " + r + " in new task " + r.task); newTask = true; addRecentTask(r.task); addRecentTaskLocked(r.task); } else if (sourceRecord != null) { if (!addingToTask && Loading Loading @@ -3855,7 +3855,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } private final void addRecentTask(TaskRecord task) { private final void addRecentTaskLocked(TaskRecord task) { // Remove any existing entries that are the same kind of task. int N = mRecentTasks.size(); for (int i=0; i<N; i++) { Loading Loading @@ -4931,9 +4931,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED, Uri.fromParts("package", packageName, null)); intent.putExtra(Intent.EXTRA_UID, pkgUid); synchronized (this) { broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, false, false, MY_PID, Process.SYSTEM_UID); } } catch (RemoteException e) { } } finally { Loading Loading @@ -5668,9 +5670,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen ArrayList<ProcessRecord> procs = new ArrayList<ProcessRecord>(mProcessesOnHold); for (int ip=0; ip<NP; ip++) { synchronized (this) { this.startProcessLocked(procs.get(ip), "on-hold", null); } } } if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { // Tell anyone interested that we are done booting! synchronized (this) { Loading Loading @@ -6887,7 +6891,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen taskTopI = -1; } replyChainEnd = -1; addRecentTask(target.task); addRecentTaskLocked(target.task); } else if (forceReset || finishOnTaskLaunch || clearWhenTaskReset) { // If the activity should just be removed -- either Loading Loading @@ -7109,7 +7113,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen moved.add(0, r); top--; if (first) { addRecentTask(r.task); addRecentTaskLocked(r.task); first = false; } } Loading @@ -7134,11 +7138,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen mWindowManager.validateAppTokens(mHistory); } finishTaskMove(task); finishTaskMoveLocked(task); EventLog.writeEvent(LOG_TASK_TO_FRONT, task); } private final void finishTaskMove(int task) { private final void finishTaskMoveLocked(int task) { resumeTopActivityLocked(null); } Loading Loading @@ -7256,7 +7260,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen mWindowManager.validateAppTokens(mHistory); } finishTaskMove(task); finishTaskMoveLocked(task); return true; } Loading Loading @@ -7879,10 +7883,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } public static final void installSystemProviders() { List providers = null; synchronized (mSelf) { ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID); List providers = mSelf.generateApplicationProvidersLocked(app); providers = mSelf.generateApplicationProvidersLocked(app); } if (providers != null) { mSystemThread.installSystemProviders(providers); } } // ========================================================= // GLOBAL MANAGEMENT Loading Loading @@ -8156,12 +8165,16 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } public void registerActivityWatcher(IActivityWatcher watcher) { synchronized (this) { mWatchers.register(watcher); } } public void unregisterActivityWatcher(IActivityWatcher watcher) { synchronized (this) { mWatchers.unregister(watcher); } } public final void enterSafeMode() { synchronized(this) { Loading Loading @@ -11564,7 +11577,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen // BROADCASTS // ========================================================= private final List getStickies(String action, IntentFilter filter, private final List getStickiesLocked(String action, IntentFilter filter, List cur) { final ContentResolver resolver = mContext.getContentResolver(); final ArrayList<Intent> list = mStickyBroadcasts.get(action); Loading Loading @@ -11616,10 +11629,10 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (actions != null) { while (actions.hasNext()) { String action = (String)actions.next(); allSticky = getStickies(action, filter, allSticky); allSticky = getStickiesLocked(action, filter, allSticky); } } else { allSticky = getStickies(null, filter, allSticky); allSticky = getStickiesLocked(null, filter, allSticky); } // The first sticky in the list is returned directly back to Loading Loading @@ -13357,7 +13370,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen /** * Returns true if things are idle enough to perform GCs. */ private final boolean canGcNow() { private final boolean canGcNowLocked() { return mParallelBroadcasts.size() == 0 && mOrderedBroadcasts.size() == 0 && (mSleeping || (mResumedActivity != null && Loading @@ -13373,7 +13386,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (N <= 0) { return; } if (canGcNow()) { if (canGcNowLocked()) { while (mProcessesToGc.size() > 0) { ProcessRecord proc = mProcessesToGc.remove(0); if (proc.curRawAdj > VISIBLE_APP_ADJ || proc.reportLowMemory) { Loading Loading @@ -13401,7 +13414,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen * If all looks good, perform GCs on all processes waiting for them. */ final void performAppGcsIfAppropriateLocked() { if (canGcNow()) { if (canGcNowLocked()) { performAppGcsLocked(); return; } telephony/java/com/android/internal/telephony/SMSDispatcher.java +31 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,12 @@ public abstract class SMSDispatcher extends Handler { /** Stop the sending */ static final protected int EVENT_STOP_SENDING = 10; /** Memory status reporting is acknowledged by RIL */ static final protected int EVENT_REPORT_MEMORY_STATUS_DONE = 11; /** Radio is ON */ static final protected int EVENT_RADIO_ON = 12; protected Phone mPhone; protected Context mContext; protected ContentResolver mResolver; Loading Loading @@ -152,6 +158,7 @@ public abstract class SMSDispatcher extends Handler { private SmsMessageBase.SubmitPduBase mSubmitPduBase; protected boolean mStorageAvailable = true; protected boolean mReportMemoryStatusPending = false; protected static int getNextConcatenatedRef() { sConcatenatedRef += 1; Loading Loading @@ -235,6 +242,7 @@ public abstract class SMSDispatcher extends Handler { mCm.setOnNewSMS(this, EVENT_NEW_SMS, null); mCm.setOnSmsStatus(this, EVENT_NEW_SMS_STATUS_REPORT, null); mCm.setOnIccSmsFull(this, EVENT_ICC_FULL, null); mCm.registerForOn(this, EVENT_RADIO_ON, null); // Don't always start message ref at 0. sConcatenatedRef = new Random().nextInt(256); Loading @@ -253,6 +261,7 @@ public abstract class SMSDispatcher extends Handler { mCm.unSetOnNewSMS(this); mCm.unSetOnSmsStatus(this); mCm.unSetOnIccSmsFull(this); mCm.unregisterForOn(this); } protected void finalize() { Loading Loading @@ -370,6 +379,26 @@ public abstract class SMSDispatcher extends Handler { removeMessages(EVENT_ALERT_TIMEOUT, msg.obj); } break; case EVENT_REPORT_MEMORY_STATUS_DONE: ar = (AsyncResult)msg.obj; if (ar.exception != null) { mReportMemoryStatusPending = true; Log.v(TAG, "Memory status report to modem pending : mStorageAvailable = " + mStorageAvailable); } else { mReportMemoryStatusPending = false; } break; case EVENT_RADIO_ON: if (mReportMemoryStatusPending) { Log.v(TAG, "Sending pending memory status report : mStorageAvailable = " + mStorageAvailable); mCm.reportSmsMemoryStatus(mStorageAvailable, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE)); } break; } } Loading Loading @@ -940,10 +969,10 @@ public abstract class SMSDispatcher extends Handler { public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_LOW)) { mStorageAvailable = false; mCm.reportSmsMemoryStatus(false, null); mCm.reportSmsMemoryStatus(false, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE)); } else if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_OK)) { mStorageAvailable = true; mCm.reportSmsMemoryStatus(true, null); mCm.reportSmsMemoryStatus(true, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE)); } else { // Assume the intent is one of the SMS receive intents that // was sent as an ordered broadcast. Check result and ACK. Loading Loading
services/java/com/android/server/am/ActivityManagerService.java +35 −22 Original line number Diff line number Diff line Loading @@ -3566,7 +3566,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (DEBUG_TASKS) Log.v(TAG, "Starting new activity " + r + " in new task " + r.task); newTask = true; addRecentTask(r.task); addRecentTaskLocked(r.task); } else if (sourceRecord != null) { if (!addingToTask && Loading Loading @@ -3855,7 +3855,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } private final void addRecentTask(TaskRecord task) { private final void addRecentTaskLocked(TaskRecord task) { // Remove any existing entries that are the same kind of task. int N = mRecentTasks.size(); for (int i=0; i<N; i++) { Loading Loading @@ -4931,9 +4931,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen Intent intent = new Intent(Intent.ACTION_PACKAGE_DATA_CLEARED, Uri.fromParts("package", packageName, null)); intent.putExtra(Intent.EXTRA_UID, pkgUid); synchronized (this) { broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, false, false, MY_PID, Process.SYSTEM_UID); } } catch (RemoteException e) { } } finally { Loading Loading @@ -5668,9 +5670,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen ArrayList<ProcessRecord> procs = new ArrayList<ProcessRecord>(mProcessesOnHold); for (int ip=0; ip<NP; ip++) { synchronized (this) { this.startProcessLocked(procs.get(ip), "on-hold", null); } } } if (mFactoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { // Tell anyone interested that we are done booting! synchronized (this) { Loading Loading @@ -6887,7 +6891,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen taskTopI = -1; } replyChainEnd = -1; addRecentTask(target.task); addRecentTaskLocked(target.task); } else if (forceReset || finishOnTaskLaunch || clearWhenTaskReset) { // If the activity should just be removed -- either Loading Loading @@ -7109,7 +7113,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen moved.add(0, r); top--; if (first) { addRecentTask(r.task); addRecentTaskLocked(r.task); first = false; } } Loading @@ -7134,11 +7138,11 @@ public final class ActivityManagerService extends ActivityManagerNative implemen mWindowManager.validateAppTokens(mHistory); } finishTaskMove(task); finishTaskMoveLocked(task); EventLog.writeEvent(LOG_TASK_TO_FRONT, task); } private final void finishTaskMove(int task) { private final void finishTaskMoveLocked(int task) { resumeTopActivityLocked(null); } Loading Loading @@ -7256,7 +7260,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen mWindowManager.validateAppTokens(mHistory); } finishTaskMove(task); finishTaskMoveLocked(task); return true; } Loading Loading @@ -7879,10 +7883,15 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } public static final void installSystemProviders() { List providers = null; synchronized (mSelf) { ProcessRecord app = mSelf.mProcessNames.get("system", Process.SYSTEM_UID); List providers = mSelf.generateApplicationProvidersLocked(app); providers = mSelf.generateApplicationProvidersLocked(app); } if (providers != null) { mSystemThread.installSystemProviders(providers); } } // ========================================================= // GLOBAL MANAGEMENT Loading Loading @@ -8156,12 +8165,16 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } public void registerActivityWatcher(IActivityWatcher watcher) { synchronized (this) { mWatchers.register(watcher); } } public void unregisterActivityWatcher(IActivityWatcher watcher) { synchronized (this) { mWatchers.unregister(watcher); } } public final void enterSafeMode() { synchronized(this) { Loading Loading @@ -11564,7 +11577,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen // BROADCASTS // ========================================================= private final List getStickies(String action, IntentFilter filter, private final List getStickiesLocked(String action, IntentFilter filter, List cur) { final ContentResolver resolver = mContext.getContentResolver(); final ArrayList<Intent> list = mStickyBroadcasts.get(action); Loading Loading @@ -11616,10 +11629,10 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (actions != null) { while (actions.hasNext()) { String action = (String)actions.next(); allSticky = getStickies(action, filter, allSticky); allSticky = getStickiesLocked(action, filter, allSticky); } } else { allSticky = getStickies(null, filter, allSticky); allSticky = getStickiesLocked(null, filter, allSticky); } // The first sticky in the list is returned directly back to Loading Loading @@ -13357,7 +13370,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen /** * Returns true if things are idle enough to perform GCs. */ private final boolean canGcNow() { private final boolean canGcNowLocked() { return mParallelBroadcasts.size() == 0 && mOrderedBroadcasts.size() == 0 && (mSleeping || (mResumedActivity != null && Loading @@ -13373,7 +13386,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if (N <= 0) { return; } if (canGcNow()) { if (canGcNowLocked()) { while (mProcessesToGc.size() > 0) { ProcessRecord proc = mProcessesToGc.remove(0); if (proc.curRawAdj > VISIBLE_APP_ADJ || proc.reportLowMemory) { Loading Loading @@ -13401,7 +13414,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen * If all looks good, perform GCs on all processes waiting for them. */ final void performAppGcsIfAppropriateLocked() { if (canGcNow()) { if (canGcNowLocked()) { performAppGcsLocked(); return; }
telephony/java/com/android/internal/telephony/SMSDispatcher.java +31 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,12 @@ public abstract class SMSDispatcher extends Handler { /** Stop the sending */ static final protected int EVENT_STOP_SENDING = 10; /** Memory status reporting is acknowledged by RIL */ static final protected int EVENT_REPORT_MEMORY_STATUS_DONE = 11; /** Radio is ON */ static final protected int EVENT_RADIO_ON = 12; protected Phone mPhone; protected Context mContext; protected ContentResolver mResolver; Loading Loading @@ -152,6 +158,7 @@ public abstract class SMSDispatcher extends Handler { private SmsMessageBase.SubmitPduBase mSubmitPduBase; protected boolean mStorageAvailable = true; protected boolean mReportMemoryStatusPending = false; protected static int getNextConcatenatedRef() { sConcatenatedRef += 1; Loading Loading @@ -235,6 +242,7 @@ public abstract class SMSDispatcher extends Handler { mCm.setOnNewSMS(this, EVENT_NEW_SMS, null); mCm.setOnSmsStatus(this, EVENT_NEW_SMS_STATUS_REPORT, null); mCm.setOnIccSmsFull(this, EVENT_ICC_FULL, null); mCm.registerForOn(this, EVENT_RADIO_ON, null); // Don't always start message ref at 0. sConcatenatedRef = new Random().nextInt(256); Loading @@ -253,6 +261,7 @@ public abstract class SMSDispatcher extends Handler { mCm.unSetOnNewSMS(this); mCm.unSetOnSmsStatus(this); mCm.unSetOnIccSmsFull(this); mCm.unregisterForOn(this); } protected void finalize() { Loading Loading @@ -370,6 +379,26 @@ public abstract class SMSDispatcher extends Handler { removeMessages(EVENT_ALERT_TIMEOUT, msg.obj); } break; case EVENT_REPORT_MEMORY_STATUS_DONE: ar = (AsyncResult)msg.obj; if (ar.exception != null) { mReportMemoryStatusPending = true; Log.v(TAG, "Memory status report to modem pending : mStorageAvailable = " + mStorageAvailable); } else { mReportMemoryStatusPending = false; } break; case EVENT_RADIO_ON: if (mReportMemoryStatusPending) { Log.v(TAG, "Sending pending memory status report : mStorageAvailable = " + mStorageAvailable); mCm.reportSmsMemoryStatus(mStorageAvailable, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE)); } break; } } Loading Loading @@ -940,10 +969,10 @@ public abstract class SMSDispatcher extends Handler { public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_LOW)) { mStorageAvailable = false; mCm.reportSmsMemoryStatus(false, null); mCm.reportSmsMemoryStatus(false, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE)); } else if (intent.getAction().equals(Intent.ACTION_DEVICE_STORAGE_OK)) { mStorageAvailable = true; mCm.reportSmsMemoryStatus(true, null); mCm.reportSmsMemoryStatus(true, obtainMessage(EVENT_REPORT_MEMORY_STATUS_DONE)); } else { // Assume the intent is one of the SMS receive intents that // was sent as an ordered broadcast. Check result and ACK. Loading