Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e11f2b77 authored by Craig Mautner's avatar Craig Mautner
Browse files

Minor refactors

- Eliminate unused mLooper.
- Rename isSleeping to isSleepingOrShuttingDown.
- Fix dump formats.

Change-Id: I4cfc99605ac34213bf9b705562f2c701810434fd
parent 60aab1d2
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -866,8 +866,6 @@ public final class ActivityManagerService extends ActivityManagerNative
    static ActivityManagerService mSelf;
    static ActivityThread mSystemThread;
    private Looper mLooper;
    private int mCurrentUserId = 0;
    private UserManagerService mUserManager;
@@ -1469,7 +1467,6 @@ public final class ActivityManagerService extends ActivityManagerNative
        context.setTheme(android.R.style.Theme_Holo);
        m.mContext = context;
        m.mFactoryTest = factoryTest;
        m.mLooper = thr.mLooper;
        m.mStackSupervisor = new ActivityStackSupervisor(m, context, thr.mLooper);
        m.mStackSupervisor.init();
@@ -2524,6 +2521,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        mPendingActivityLaunches.clear();
    }
    @Override
    public final int startActivity(IApplicationThread caller, String callingPackage,
            Intent intent, String resolvedType, IBinder resultTo,
            String resultWho, int requestCode, int startFlags,
@@ -2575,6 +2573,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        return ret;
    }
    @Override
    public int startActivityIntentSender(IApplicationThread caller,
            IntentSender intent, Intent fillInIntent, String resolvedType,
            IBinder resultTo, String resultWho, int requestCode,
@@ -7013,7 +7012,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    // Actually is sleeping or shutting down or whatever else in the future
    // is an inactive state.
    public boolean isSleeping() {
    public boolean isSleepingOrShuttingDown() {
        return mSleeping || mShuttingDown;
    }
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ final class ActivityRecord {
        pw.print(prefix); pw.print("packageName="); pw.print(packageName);
                pw.print(" processName="); pw.println(processName);
        pw.print(prefix); pw.print("launchedFromUid="); pw.print(launchedFromUid);
                pw.print(" launchedFromPackage="); pw.println(launchedFromPackage);
                pw.print(" launchedFromPackage="); pw.print(launchedFromPackage);
                pw.print(" userId="); pw.println(userId);
        pw.print(prefix); pw.print("app="); pw.println(app);
        pw.print(prefix); pw.println(intent.toInsecureStringWithClip());
+10 −12
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ final class ActivityStack {
            switch (msg.what) {
                case SLEEP_TIMEOUT_MSG: {
                    synchronized (mService) {
                        if (mService.isSleeping()) {
                        if (mService.isSleepingOrShuttingDown()) {
                            Slog.w(TAG, "Sleep timeout!  Sleeping now.");
                            mSleepTimeout = true;
                            checkReadyForSleepLocked();
@@ -875,7 +875,7 @@ final class ActivityStack {
    }

    void stopIfSleepingLocked() {
        if (mService.isSleeping()) {
        if (mService.isSleepingOrShuttingDown()) {
            if (!mGoingToSleep.isHeld()) {
                mGoingToSleep.acquire();
                if (mLaunchingActivity.isHeld()) {
@@ -912,7 +912,7 @@ final class ActivityStack {
    }

    void checkReadyForSleepLocked() {
        if (!mService.isSleeping()) {
        if (!mService.isSleepingOrShuttingDown()) {
            // Do not care.
            return;
        }
@@ -1003,14 +1003,13 @@ final class ActivityStack {

    private final void startPausingLocked(boolean userLeaving, boolean uiSleeping) {
        if (mPausingActivity != null) {
            RuntimeException e = new RuntimeException();
            Slog.e(TAG, "Trying to pause when pause is already pending for "
                  + mPausingActivity, e);
                  + mPausingActivity, new RuntimeException("here").fillInStackTrace());
        }
        ActivityRecord prev = mResumedActivity;
        if (prev == null) {
            RuntimeException e = new RuntimeException();
            Slog.e(TAG, "Trying to pause when nothing is resumed", e);
            Slog.e(TAG, "Trying to pause when nothing is resumed",
                    new RuntimeException("here").fillInStackTrace());
            resumeTopActivityLocked(null);
            return;
        }
@@ -1049,7 +1048,7 @@ final class ActivityStack {

        // If we are not going to sleep, we want to ensure the device is
        // awake until the next activity is started.
        if (!mService.mSleeping && !mService.mShuttingDown) {
        if (!mService.isSleepingOrShuttingDown()) {
            mLaunchingActivity.acquire();
            if (!mHandler.hasMessages(LAUNCH_TIMEOUT_MSG)) {
                // To be safe, don't allow the wake lock to be held for too long.
@@ -1058,7 +1057,6 @@ final class ActivityStack {
            }
        }


        if (mPausingActivity != null) {
            // Have the window manager pause its key dispatching until the new
            // activity has started.  If we're pausing the activity just because
@@ -1205,7 +1203,7 @@ final class ActivityStack {
            mPausingActivity = null;
        }

        if (!mService.isSleeping()) {
        if (!mService.isSleepingOrShuttingDown()) {
            resumeTopActivityLocked(prev);
        } else {
            checkReadyForSleepLocked();
@@ -3375,7 +3373,7 @@ final class ActivityStack {
                    mService.mWindowManager.setAppVisibility(r.appToken, false);
                }
                r.app.thread.scheduleStopActivity(r.appToken, r.visible, r.configChangeFlags);
                if (mService.isSleeping()) {
                if (mService.isSleepingOrShuttingDown()) {
                    r.setSleeping(true);
                }
                Message msg = mHandler.obtainMessage(STOP_TIMEOUT_MSG);
@@ -3425,7 +3423,7 @@ final class ActivityStack {
                    mService.mWindowManager.setAppVisibility(s.appToken, false);
                }
            }
            if ((!s.waitingVisible || mService.isSleeping()) && remove) {
            if ((!s.waitingVisible || mService.isSleepingOrShuttingDown()) && remove) {
                if (localLOGV) Slog.v(TAG, "Ready to stop: " + s);
                if (stops == null) {
                    stops = new ArrayList<ActivityRecord>();