Loading services/core/java/com/android/server/Watchdog.java +7 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.util.Slog; import com.android.internal.os.ZygoteConnectionConstants; import com.android.server.am.ActivityManagerService; import com.android.server.wm.SurfaceAnimationThread; import java.io.File; import java.io.FileWriter; Loading Loading @@ -280,6 +281,12 @@ public class Watchdog extends Thread { // And the display thread. mHandlerCheckers.add(new HandlerChecker(DisplayThread.getHandler(), "display thread", DEFAULT_TIMEOUT)); // And the animation thread. mHandlerCheckers.add(new HandlerChecker(AnimationThread.getHandler(), "animation thread", DEFAULT_TIMEOUT)); // And the surface animation thread. mHandlerCheckers.add(new HandlerChecker(SurfaceAnimationThread.getHandler(), "surface animation thread", DEFAULT_TIMEOUT)); // Initialize monitor for Binder threads. addMonitor(new BinderThreadMonitor()); Loading services/core/java/com/android/server/am/ActivityManagerService.java +101 −49 Original line number Diff line number Diff line Loading @@ -1134,9 +1134,46 @@ public class ActivityManagerService extends IActivityManager.Stub boolean mOrigWaitForDebugger = false; boolean mAlwaysFinishActivities = false; String mProfileApp = null; ProcessRecord mProfileProc = null; ProfilerInfo mProfilerInfo = null; class ProfileData { private String mProfileApp = null; private ProcessRecord mProfileProc = null; private ProfilerInfo mProfilerInfo = null; void setProfileApp(String profileApp) { mProfileApp = profileApp; if (mAtmInternal != null) { mAtmInternal.setProfileApp(profileApp); } } String getProfileApp() { return mProfileApp; } void setProfileProc(ProcessRecord profileProc) { mProfileProc = profileProc; if (mAtmInternal != null) { mAtmInternal.setProfileProc( profileProc.getWindowProcessController()); } } ProcessRecord getProfileProc() { return mProfileProc; } void setProfilerInfo(ProfilerInfo profilerInfo) { mProfilerInfo = profilerInfo; if (mAtmInternal != null) { mAtmInternal.setProfilerInfo(profilerInfo); } } ProfilerInfo getProfilerInfo() { return mProfilerInfo; } } final ProfileData mProfileData = new ProfileData(); /** * Stores a map of process name -> agent string. When a process is started and mAgentAppMap Loading Loading @@ -2225,8 +2262,7 @@ public class ActivityManagerService extends IActivityManager.Stub mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler); mActivityTaskManager = atm; mActivityTaskManager.setActivityManagerService(this, mHandlerThread.getLooper(), mIntentFirewall, mPendingIntentController); mActivityTaskManager.setActivityManagerService(mIntentFirewall, mPendingIntentController); mAtmInternal = LocalServices.getService(ActivityTaskManagerInternal.class); mProcessCpuThread = new Thread("CpuTracker") { Loading Loading @@ -3129,7 +3165,7 @@ public class ActivityManagerService extends IActivityManager.Stub } } if (mProfileProc == app) { if (mProfileData.getProfileProc() == app) { clearProfilerLocked(); } Loading Loading @@ -4416,16 +4452,18 @@ public class ActivityManagerService extends IActivityManager.Stub ProfilerInfo profilerInfo = null; String preBindAgent = null; if (mProfileApp != null && mProfileApp.equals(processName)) { mProfileProc = app; if (mProfilerInfo != null) { if (mProfileData.getProfileApp() != null && mProfileData.getProfileApp().equals(processName)) { mProfileData.setProfileProc(app); if (mProfileData.getProfilerInfo() != null) { // Send a profiler info object to the app if either a file is given, or // an agent should be loaded at bind-time. boolean needsInfo = mProfilerInfo.profileFile != null || mProfilerInfo.attachAgentDuringBind; profilerInfo = needsInfo ? new ProfilerInfo(mProfilerInfo) : null; if (mProfilerInfo.agent != null) { preBindAgent = mProfilerInfo.agent; boolean needsInfo = mProfileData.getProfilerInfo().profileFile != null || mProfileData.getProfilerInfo().attachAgentDuringBind; profilerInfo = needsInfo ? new ProfilerInfo(mProfileData.getProfilerInfo()) : null; if (mProfileData.getProfilerInfo().agent != null) { preBindAgent = mProfileData.getProfilerInfo().agent; } } } else if (instr != null && instr.mProfileFile != null) { Loading @@ -4449,7 +4487,8 @@ public class ActivityManagerService extends IActivityManager.Stub if (profilerInfo != null && profilerInfo.profileFd != null) { profilerInfo.profileFd = profilerInfo.profileFd.dup(); if (TextUtils.equals(mProfileApp, processName) && mProfilerInfo != null) { if (TextUtils.equals(mProfileData.getProfileApp(), processName) && mProfileData.getProfilerInfo() != null) { clearProfilerLocked(); } } Loading Loading @@ -7450,17 +7489,17 @@ public class ActivityManagerService extends IActivityManager.Stub throw new SecurityException("Process not debuggable: " + app.packageName); } } mProfileApp = processName; mProfileData.setProfileApp(processName); if (mProfilerInfo != null) { if (mProfilerInfo.profileFd != null) { if (mProfileData.getProfilerInfo() != null) { if (mProfileData.getProfilerInfo().profileFd != null) { try { mProfilerInfo.profileFd.close(); mProfileData.getProfilerInfo().profileFd.close(); } catch (IOException e) { } } } mProfilerInfo = new ProfilerInfo(profilerInfo); mProfileData.setProfilerInfo(new ProfilerInfo(profilerInfo)); mProfileType = 0; } } Loading Loading @@ -9977,20 +10016,25 @@ public class ActivityManagerService extends IActivityManager.Stub pw.println(" mTrackAllocationApp=" + mTrackAllocationApp); } } if (mProfileApp != null || mProfileProc != null || (mProfilerInfo != null && (mProfilerInfo.profileFile != null || mProfilerInfo.profileFd != null))) { if (dumpPackage == null || dumpPackage.equals(mProfileApp)) { if (mProfileData.getProfileApp() != null || mProfileData.getProfileProc() != null || (mProfileData.getProfilerInfo() != null && (mProfileData.getProfilerInfo().profileFile != null || mProfileData.getProfilerInfo().profileFd != null))) { if (dumpPackage == null || dumpPackage.equals(mProfileData.getProfileApp())) { if (needSep) { pw.println(); needSep = false; } pw.println(" mProfileApp=" + mProfileApp + " mProfileProc=" + mProfileProc); if (mProfilerInfo != null) { pw.println(" mProfileFile=" + mProfilerInfo.profileFile + " mProfileFd=" + mProfilerInfo.profileFd); pw.println(" mSamplingInterval=" + mProfilerInfo.samplingInterval + " mAutoStopProfiler=" + mProfilerInfo.autoStopProfiler + " mStreamingOutput=" + mProfilerInfo.streamingOutput); pw.println(" mProfileApp=" + mProfileData.getProfileApp() + " mProfileProc=" + mProfileData.getProfileProc()); if (mProfileData.getProfilerInfo() != null) { pw.println(" mProfileFile=" + mProfileData.getProfilerInfo().profileFile + " mProfileFd=" + mProfileData.getProfilerInfo().profileFd); pw.println(" mSamplingInterval=" + mProfileData.getProfilerInfo().samplingInterval + " mAutoStopProfiler=" + mProfileData.getProfilerInfo().autoStopProfiler + " mStreamingOutput=" + mProfileData.getProfilerInfo().streamingOutput); pw.println(" mProfileType=" + mProfileType); } } Loading Loading @@ -10270,19 +10314,26 @@ public class ActivityManagerService extends IActivityManager.Stub if (mTrackAllocationApp != null) { if (dumpPackage == null || dumpPackage.equals(mTrackAllocationApp)) { proto.write(ActivityManagerServiceDumpProcessesProto.TRACK_ALLOCATION_APP, mTrackAllocationApp); proto.write(ActivityManagerServiceDumpProcessesProto.TRACK_ALLOCATION_APP, mTrackAllocationApp); } } if (mProfileApp != null || mProfileProc != null || (mProfilerInfo != null && (mProfilerInfo.profileFile != null || mProfilerInfo.profileFd != null))) { if (dumpPackage == null || dumpPackage.equals(mProfileApp)) { if (mProfileData.getProfileApp() != null || mProfileData.getProfileProc() != null || (mProfileData.getProfilerInfo() != null && (mProfileData.getProfilerInfo().profileFile != null || mProfileData.getProfilerInfo().profileFd != null))) { if (dumpPackage == null || dumpPackage.equals(mProfileData.getProfileApp())) { final long token = proto.start(ActivityManagerServiceDumpProcessesProto.PROFILE); proto.write(ActivityManagerServiceDumpProcessesProto.Profile.APP_NAME, mProfileApp); mProfileProc.writeToProto(proto,ActivityManagerServiceDumpProcessesProto.Profile.PROC); if (mProfilerInfo != null) { mProfilerInfo.writeToProto(proto, ActivityManagerServiceDumpProcessesProto.Profile.INFO); proto.write(ActivityManagerServiceDumpProcessesProto.Profile.TYPE, mProfileType); proto.write(ActivityManagerServiceDumpProcessesProto.Profile.APP_NAME, mProfileData.getProfileApp()); mProfileData.getProfileProc().writeToProto(proto, ActivityManagerServiceDumpProcessesProto.Profile.PROC); if (mProfileData.getProfilerInfo() != null) { mProfileData.getProfilerInfo().writeToProto(proto, ActivityManagerServiceDumpProcessesProto.Profile.INFO); proto.write(ActivityManagerServiceDumpProcessesProto.Profile.TYPE, mProfileType); } proto.end(token); } Loading Loading @@ -18039,8 +18090,8 @@ public class ActivityManagerService extends IActivityManager.Stub } private void stopProfilerLocked(ProcessRecord proc, int profileType) { if (proc == null || proc == mProfileProc) { proc = mProfileProc; if (proc == null || proc == mProfileData.getProfileProc()) { proc = mProfileData.getProfileProc(); profileType = mProfileType; clearProfilerLocked(); } Loading @@ -18055,15 +18106,16 @@ public class ActivityManagerService extends IActivityManager.Stub } void clearProfilerLocked() { if (mProfilerInfo !=null && mProfilerInfo.profileFd != null) { if (mProfileData.getProfilerInfo() != null && mProfileData.getProfilerInfo().profileFd != null) { try { mProfilerInfo.profileFd.close(); mProfileData.getProfilerInfo().profileFd.close(); } catch (IOException e) { } } mProfileApp = null; mProfileProc = null; mProfilerInfo = null; mProfileData.setProfileApp(null); mProfileData.setProfileProc(null); mProfileData.setProfilerInfo(null); } public boolean profileControl(String process, int userId, boolean start, Loading Loading @@ -18095,7 +18147,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (start) { stopProfilerLocked(null, 0); setProfileApp(proc.info, proc.processName, profilerInfo); mProfileProc = proc; mProfileData.setProfileProc(proc); mProfileType = profileType; ParcelFileDescriptor fd = profilerInfo.profileFd; try { Loading @@ -18107,10 +18159,10 @@ public class ActivityManagerService extends IActivityManager.Stub proc.thread.profilerControl(start, profilerInfo, profileType); fd = null; try { mProfilerInfo.profileFd.close(); mProfileData.getProfilerInfo().profileFd.close(); } catch (IOException e) { } mProfilerInfo.profileFd = null; mProfileData.getProfilerInfo().profileFd = null; if (proc.pid == MY_PID) { // When profiling the system server itself, avoid closing the file services/core/java/com/android/server/am/ProcessRecord.java +6 −22 Original line number Diff line number Diff line Loading @@ -1123,8 +1123,9 @@ final class ProcessRecord implements WindowProcessListener { @Override public void clearProfilerIfNeeded() { synchronized (mService) { if (mService.mProfileProc == null || mService.mProfilerInfo == null || mService.mProfileProc != this) { if (mService.mProfileData.getProfileProc() == null || mService.mProfileData.getProfilerInfo() == null || mService.mProfileData.getProfileProc() != this) { return; } mService.clearProfilerLocked(); Loading Loading @@ -1198,32 +1199,15 @@ final class ProcessRecord implements WindowProcessListener { } @Override public ProfilerInfo onStartActivity(int topProcessState) { public void onStartActivity(int topProcessState, boolean setProfileProc) { synchronized (mService) { ProfilerInfo profilerInfo = null; if (mService.mProfileApp != null && mService.mProfileApp.equals(processName)) { if (mService.mProfileProc == null || mService.mProfileProc == this) { mService.mProfileProc = this; final ProfilerInfo profilerInfoSvc = mService.mProfilerInfo; if (profilerInfoSvc != null && profilerInfoSvc.profileFile != null) { if (profilerInfoSvc.profileFd != null) { try { profilerInfoSvc.profileFd = profilerInfoSvc.profileFd.dup(); } catch (IOException e) { profilerInfoSvc.closeFd(); } } profilerInfo = new ProfilerInfo(profilerInfoSvc); } } if (setProfileProc) { mService.mProfileData.setProfileProc(this); } hasShownUi = true; setPendingUiClean(true); forceProcessStateUpTo(topProcessState); return profilerInfo; } } Loading services/core/java/com/android/server/wm/ActivityStack.java +136 −145 Original line number Diff line number Diff line Loading @@ -2698,12 +2698,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai || (lastFocusedStack.mLastPausedActivity != null && !lastFocusedStack.mLastPausedActivity.fullscreen)); // The contained logic must be synchronized, since we are both changing the visibility // and updating the {@link Configuration}. {@link ActivityRecord#setVisibility} will // ultimately cause the client code to schedule a layout. Since layouts retrieve the // current {@link Configuration}, we must ensure that the below code updates it before // the layout can occur. synchronized(mWindowManager.getWindowManagerLock()) { // This activity is now becoming visible. if (!next.visible || next.stopped || lastActivityTranslucent) { next.setVisibility(true); Loading Loading @@ -2828,7 +2822,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked(); return true; } } // From this point on, if something goes wrong there is no way // to recover the activity. Loading Loading @@ -4860,7 +4853,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai mTmpBounds.clear(); mTmpInsetBounds.clear(); synchronized (mWindowManager.getWindowManagerLock()) { for (int i = mTaskHistory.size() - 1; i >= 0; i--) { final TaskRecord task = mTaskHistory.get(i); if (task.isResizeable()) { Loading Loading @@ -4889,7 +4881,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai mWindowContainerController.resize(bounds, mTmpBounds, mTmpInsetBounds); setBounds(bounds); } } void onPipAnimationEndResize() { mWindowContainerController.onPipAnimationEndResize(); Loading services/core/java/com/android/server/wm/ActivityStackSupervisor.java +1 −1 Original line number Diff line number Diff line Loading @@ -2051,7 +2051,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } mService.mAmInternal.trimApplications(); mService.mH.post(() -> mService.mAmInternal.trimApplications()); //dump(); //mWindowManager.dump(); Loading Loading
services/core/java/com/android/server/Watchdog.java +7 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.util.Slog; import com.android.internal.os.ZygoteConnectionConstants; import com.android.server.am.ActivityManagerService; import com.android.server.wm.SurfaceAnimationThread; import java.io.File; import java.io.FileWriter; Loading Loading @@ -280,6 +281,12 @@ public class Watchdog extends Thread { // And the display thread. mHandlerCheckers.add(new HandlerChecker(DisplayThread.getHandler(), "display thread", DEFAULT_TIMEOUT)); // And the animation thread. mHandlerCheckers.add(new HandlerChecker(AnimationThread.getHandler(), "animation thread", DEFAULT_TIMEOUT)); // And the surface animation thread. mHandlerCheckers.add(new HandlerChecker(SurfaceAnimationThread.getHandler(), "surface animation thread", DEFAULT_TIMEOUT)); // Initialize monitor for Binder threads. addMonitor(new BinderThreadMonitor()); Loading
services/core/java/com/android/server/am/ActivityManagerService.java +101 −49 Original line number Diff line number Diff line Loading @@ -1134,9 +1134,46 @@ public class ActivityManagerService extends IActivityManager.Stub boolean mOrigWaitForDebugger = false; boolean mAlwaysFinishActivities = false; String mProfileApp = null; ProcessRecord mProfileProc = null; ProfilerInfo mProfilerInfo = null; class ProfileData { private String mProfileApp = null; private ProcessRecord mProfileProc = null; private ProfilerInfo mProfilerInfo = null; void setProfileApp(String profileApp) { mProfileApp = profileApp; if (mAtmInternal != null) { mAtmInternal.setProfileApp(profileApp); } } String getProfileApp() { return mProfileApp; } void setProfileProc(ProcessRecord profileProc) { mProfileProc = profileProc; if (mAtmInternal != null) { mAtmInternal.setProfileProc( profileProc.getWindowProcessController()); } } ProcessRecord getProfileProc() { return mProfileProc; } void setProfilerInfo(ProfilerInfo profilerInfo) { mProfilerInfo = profilerInfo; if (mAtmInternal != null) { mAtmInternal.setProfilerInfo(profilerInfo); } } ProfilerInfo getProfilerInfo() { return mProfilerInfo; } } final ProfileData mProfileData = new ProfileData(); /** * Stores a map of process name -> agent string. When a process is started and mAgentAppMap Loading Loading @@ -2225,8 +2262,7 @@ public class ActivityManagerService extends IActivityManager.Stub mIntentFirewall = new IntentFirewall(new IntentFirewallInterface(), mHandler); mActivityTaskManager = atm; mActivityTaskManager.setActivityManagerService(this, mHandlerThread.getLooper(), mIntentFirewall, mPendingIntentController); mActivityTaskManager.setActivityManagerService(mIntentFirewall, mPendingIntentController); mAtmInternal = LocalServices.getService(ActivityTaskManagerInternal.class); mProcessCpuThread = new Thread("CpuTracker") { Loading Loading @@ -3129,7 +3165,7 @@ public class ActivityManagerService extends IActivityManager.Stub } } if (mProfileProc == app) { if (mProfileData.getProfileProc() == app) { clearProfilerLocked(); } Loading Loading @@ -4416,16 +4452,18 @@ public class ActivityManagerService extends IActivityManager.Stub ProfilerInfo profilerInfo = null; String preBindAgent = null; if (mProfileApp != null && mProfileApp.equals(processName)) { mProfileProc = app; if (mProfilerInfo != null) { if (mProfileData.getProfileApp() != null && mProfileData.getProfileApp().equals(processName)) { mProfileData.setProfileProc(app); if (mProfileData.getProfilerInfo() != null) { // Send a profiler info object to the app if either a file is given, or // an agent should be loaded at bind-time. boolean needsInfo = mProfilerInfo.profileFile != null || mProfilerInfo.attachAgentDuringBind; profilerInfo = needsInfo ? new ProfilerInfo(mProfilerInfo) : null; if (mProfilerInfo.agent != null) { preBindAgent = mProfilerInfo.agent; boolean needsInfo = mProfileData.getProfilerInfo().profileFile != null || mProfileData.getProfilerInfo().attachAgentDuringBind; profilerInfo = needsInfo ? new ProfilerInfo(mProfileData.getProfilerInfo()) : null; if (mProfileData.getProfilerInfo().agent != null) { preBindAgent = mProfileData.getProfilerInfo().agent; } } } else if (instr != null && instr.mProfileFile != null) { Loading @@ -4449,7 +4487,8 @@ public class ActivityManagerService extends IActivityManager.Stub if (profilerInfo != null && profilerInfo.profileFd != null) { profilerInfo.profileFd = profilerInfo.profileFd.dup(); if (TextUtils.equals(mProfileApp, processName) && mProfilerInfo != null) { if (TextUtils.equals(mProfileData.getProfileApp(), processName) && mProfileData.getProfilerInfo() != null) { clearProfilerLocked(); } } Loading Loading @@ -7450,17 +7489,17 @@ public class ActivityManagerService extends IActivityManager.Stub throw new SecurityException("Process not debuggable: " + app.packageName); } } mProfileApp = processName; mProfileData.setProfileApp(processName); if (mProfilerInfo != null) { if (mProfilerInfo.profileFd != null) { if (mProfileData.getProfilerInfo() != null) { if (mProfileData.getProfilerInfo().profileFd != null) { try { mProfilerInfo.profileFd.close(); mProfileData.getProfilerInfo().profileFd.close(); } catch (IOException e) { } } } mProfilerInfo = new ProfilerInfo(profilerInfo); mProfileData.setProfilerInfo(new ProfilerInfo(profilerInfo)); mProfileType = 0; } } Loading Loading @@ -9977,20 +10016,25 @@ public class ActivityManagerService extends IActivityManager.Stub pw.println(" mTrackAllocationApp=" + mTrackAllocationApp); } } if (mProfileApp != null || mProfileProc != null || (mProfilerInfo != null && (mProfilerInfo.profileFile != null || mProfilerInfo.profileFd != null))) { if (dumpPackage == null || dumpPackage.equals(mProfileApp)) { if (mProfileData.getProfileApp() != null || mProfileData.getProfileProc() != null || (mProfileData.getProfilerInfo() != null && (mProfileData.getProfilerInfo().profileFile != null || mProfileData.getProfilerInfo().profileFd != null))) { if (dumpPackage == null || dumpPackage.equals(mProfileData.getProfileApp())) { if (needSep) { pw.println(); needSep = false; } pw.println(" mProfileApp=" + mProfileApp + " mProfileProc=" + mProfileProc); if (mProfilerInfo != null) { pw.println(" mProfileFile=" + mProfilerInfo.profileFile + " mProfileFd=" + mProfilerInfo.profileFd); pw.println(" mSamplingInterval=" + mProfilerInfo.samplingInterval + " mAutoStopProfiler=" + mProfilerInfo.autoStopProfiler + " mStreamingOutput=" + mProfilerInfo.streamingOutput); pw.println(" mProfileApp=" + mProfileData.getProfileApp() + " mProfileProc=" + mProfileData.getProfileProc()); if (mProfileData.getProfilerInfo() != null) { pw.println(" mProfileFile=" + mProfileData.getProfilerInfo().profileFile + " mProfileFd=" + mProfileData.getProfilerInfo().profileFd); pw.println(" mSamplingInterval=" + mProfileData.getProfilerInfo().samplingInterval + " mAutoStopProfiler=" + mProfileData.getProfilerInfo().autoStopProfiler + " mStreamingOutput=" + mProfileData.getProfilerInfo().streamingOutput); pw.println(" mProfileType=" + mProfileType); } } Loading Loading @@ -10270,19 +10314,26 @@ public class ActivityManagerService extends IActivityManager.Stub if (mTrackAllocationApp != null) { if (dumpPackage == null || dumpPackage.equals(mTrackAllocationApp)) { proto.write(ActivityManagerServiceDumpProcessesProto.TRACK_ALLOCATION_APP, mTrackAllocationApp); proto.write(ActivityManagerServiceDumpProcessesProto.TRACK_ALLOCATION_APP, mTrackAllocationApp); } } if (mProfileApp != null || mProfileProc != null || (mProfilerInfo != null && (mProfilerInfo.profileFile != null || mProfilerInfo.profileFd != null))) { if (dumpPackage == null || dumpPackage.equals(mProfileApp)) { if (mProfileData.getProfileApp() != null || mProfileData.getProfileProc() != null || (mProfileData.getProfilerInfo() != null && (mProfileData.getProfilerInfo().profileFile != null || mProfileData.getProfilerInfo().profileFd != null))) { if (dumpPackage == null || dumpPackage.equals(mProfileData.getProfileApp())) { final long token = proto.start(ActivityManagerServiceDumpProcessesProto.PROFILE); proto.write(ActivityManagerServiceDumpProcessesProto.Profile.APP_NAME, mProfileApp); mProfileProc.writeToProto(proto,ActivityManagerServiceDumpProcessesProto.Profile.PROC); if (mProfilerInfo != null) { mProfilerInfo.writeToProto(proto, ActivityManagerServiceDumpProcessesProto.Profile.INFO); proto.write(ActivityManagerServiceDumpProcessesProto.Profile.TYPE, mProfileType); proto.write(ActivityManagerServiceDumpProcessesProto.Profile.APP_NAME, mProfileData.getProfileApp()); mProfileData.getProfileProc().writeToProto(proto, ActivityManagerServiceDumpProcessesProto.Profile.PROC); if (mProfileData.getProfilerInfo() != null) { mProfileData.getProfilerInfo().writeToProto(proto, ActivityManagerServiceDumpProcessesProto.Profile.INFO); proto.write(ActivityManagerServiceDumpProcessesProto.Profile.TYPE, mProfileType); } proto.end(token); } Loading Loading @@ -18039,8 +18090,8 @@ public class ActivityManagerService extends IActivityManager.Stub } private void stopProfilerLocked(ProcessRecord proc, int profileType) { if (proc == null || proc == mProfileProc) { proc = mProfileProc; if (proc == null || proc == mProfileData.getProfileProc()) { proc = mProfileData.getProfileProc(); profileType = mProfileType; clearProfilerLocked(); } Loading @@ -18055,15 +18106,16 @@ public class ActivityManagerService extends IActivityManager.Stub } void clearProfilerLocked() { if (mProfilerInfo !=null && mProfilerInfo.profileFd != null) { if (mProfileData.getProfilerInfo() != null && mProfileData.getProfilerInfo().profileFd != null) { try { mProfilerInfo.profileFd.close(); mProfileData.getProfilerInfo().profileFd.close(); } catch (IOException e) { } } mProfileApp = null; mProfileProc = null; mProfilerInfo = null; mProfileData.setProfileApp(null); mProfileData.setProfileProc(null); mProfileData.setProfilerInfo(null); } public boolean profileControl(String process, int userId, boolean start, Loading Loading @@ -18095,7 +18147,7 @@ public class ActivityManagerService extends IActivityManager.Stub if (start) { stopProfilerLocked(null, 0); setProfileApp(proc.info, proc.processName, profilerInfo); mProfileProc = proc; mProfileData.setProfileProc(proc); mProfileType = profileType; ParcelFileDescriptor fd = profilerInfo.profileFd; try { Loading @@ -18107,10 +18159,10 @@ public class ActivityManagerService extends IActivityManager.Stub proc.thread.profilerControl(start, profilerInfo, profileType); fd = null; try { mProfilerInfo.profileFd.close(); mProfileData.getProfilerInfo().profileFd.close(); } catch (IOException e) { } mProfilerInfo.profileFd = null; mProfileData.getProfilerInfo().profileFd = null; if (proc.pid == MY_PID) { // When profiling the system server itself, avoid closing the file
services/core/java/com/android/server/am/ProcessRecord.java +6 −22 Original line number Diff line number Diff line Loading @@ -1123,8 +1123,9 @@ final class ProcessRecord implements WindowProcessListener { @Override public void clearProfilerIfNeeded() { synchronized (mService) { if (mService.mProfileProc == null || mService.mProfilerInfo == null || mService.mProfileProc != this) { if (mService.mProfileData.getProfileProc() == null || mService.mProfileData.getProfilerInfo() == null || mService.mProfileData.getProfileProc() != this) { return; } mService.clearProfilerLocked(); Loading Loading @@ -1198,32 +1199,15 @@ final class ProcessRecord implements WindowProcessListener { } @Override public ProfilerInfo onStartActivity(int topProcessState) { public void onStartActivity(int topProcessState, boolean setProfileProc) { synchronized (mService) { ProfilerInfo profilerInfo = null; if (mService.mProfileApp != null && mService.mProfileApp.equals(processName)) { if (mService.mProfileProc == null || mService.mProfileProc == this) { mService.mProfileProc = this; final ProfilerInfo profilerInfoSvc = mService.mProfilerInfo; if (profilerInfoSvc != null && profilerInfoSvc.profileFile != null) { if (profilerInfoSvc.profileFd != null) { try { profilerInfoSvc.profileFd = profilerInfoSvc.profileFd.dup(); } catch (IOException e) { profilerInfoSvc.closeFd(); } } profilerInfo = new ProfilerInfo(profilerInfoSvc); } } if (setProfileProc) { mService.mProfileData.setProfileProc(this); } hasShownUi = true; setPendingUiClean(true); forceProcessStateUpTo(topProcessState); return profilerInfo; } } Loading
services/core/java/com/android/server/wm/ActivityStack.java +136 −145 Original line number Diff line number Diff line Loading @@ -2698,12 +2698,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai || (lastFocusedStack.mLastPausedActivity != null && !lastFocusedStack.mLastPausedActivity.fullscreen)); // The contained logic must be synchronized, since we are both changing the visibility // and updating the {@link Configuration}. {@link ActivityRecord#setVisibility} will // ultimately cause the client code to schedule a layout. Since layouts retrieve the // current {@link Configuration}, we must ensure that the below code updates it before // the layout can occur. synchronized(mWindowManager.getWindowManagerLock()) { // This activity is now becoming visible. if (!next.visible || next.stopped || lastActivityTranslucent) { next.setVisibility(true); Loading Loading @@ -2828,7 +2822,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked(); return true; } } // From this point on, if something goes wrong there is no way // to recover the activity. Loading Loading @@ -4860,7 +4853,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai mTmpBounds.clear(); mTmpInsetBounds.clear(); synchronized (mWindowManager.getWindowManagerLock()) { for (int i = mTaskHistory.size() - 1; i >= 0; i--) { final TaskRecord task = mTaskHistory.get(i); if (task.isResizeable()) { Loading Loading @@ -4889,7 +4881,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai mWindowContainerController.resize(bounds, mTmpBounds, mTmpInsetBounds); setBounds(bounds); } } void onPipAnimationEndResize() { mWindowContainerController.onPipAnimationEndResize(); Loading
services/core/java/com/android/server/wm/ActivityStackSupervisor.java +1 −1 Original line number Diff line number Diff line Loading @@ -2051,7 +2051,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } mService.mAmInternal.trimApplications(); mService.mH.post(() -> mService.mAmInternal.trimApplications()); //dump(); //mWindowManager.dump(); Loading