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

Commit e8fddd72 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Fix NullPointerException in ActivityStack"

parents d1bbfbe9 1bb884a8
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -163,7 +163,6 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -1681,14 +1680,17 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        if (prev != null) {
            prev.resumeKeyDispatchingLocked();

            if (prev.hasProcess() && prev.cpuTimeAtResume > 0) {
                final long diff = prev.app.getCpuTime() - prev.cpuTimeAtResume;
            if (prev.hasProcess() && prev.cpuTimeAtResume > 0 && diff > 0) {
                if (diff > 0) {
                    final Runnable r = PooledLambda.obtainRunnable(
                            ActivityManagerInternal::updateForegroundTimeIfOnBattery,
                        mService.mAmInternal, prev.info.packageName, prev.info.applicationInfo.uid,
                            mService.mAmInternal, prev.info.packageName,
                            prev.info.applicationInfo.uid,
                            diff);
                    mService.mH.post(r);
                }
            }
            prev.cpuTimeAtResume = 0; // reset it
        }