Loading core/java/android/window/SystemPerformanceHinter.java +2 −4 Original line number Original line Diff line number Diff line Loading @@ -163,7 +163,6 @@ public class SystemPerformanceHinter { // The active sessions // The active sessions private final ArrayList<HighPerfSession> mActiveSessions = new ArrayList<>(); private final ArrayList<HighPerfSession> mActiveSessions = new ArrayList<>(); private final SurfaceControl.Transaction mTransaction; private final SurfaceControl.Transaction mTransaction; private final PerformanceHintManager mPerfHintManager; private @Nullable PerformanceHintManager.Session mAdpfSession; private @Nullable PerformanceHintManager.Session mAdpfSession; private @Nullable DisplayRootProvider mDisplayRootProvider; private @Nullable DisplayRootProvider mDisplayRootProvider; Loading @@ -184,7 +183,6 @@ public class SystemPerformanceHinter { @Nullable DisplayRootProvider displayRootProvider, @Nullable DisplayRootProvider displayRootProvider, @Nullable Supplier<SurfaceControl.Transaction> transactionSupplier) { @Nullable Supplier<SurfaceControl.Transaction> transactionSupplier) { mDisplayRootProvider = displayRootProvider; mDisplayRootProvider = displayRootProvider; mPerfHintManager = context.getSystemService(PerformanceHintManager.class); mTransaction = transactionSupplier != null mTransaction = transactionSupplier != null ? transactionSupplier.get() ? transactionSupplier.get() : new SurfaceControl.Transaction(); : new SurfaceControl.Transaction(); Loading Loading @@ -273,7 +271,7 @@ public class SystemPerformanceHinter { asyncTraceBegin(HINT_SF_EARLY_WAKEUP, Display.INVALID_DISPLAY); asyncTraceBegin(HINT_SF_EARLY_WAKEUP, Display.INVALID_DISPLAY); } } } } if (nowEnabled(oldGlobalFlags, newGlobalFlags, HINT_ADPF)) { if (mAdpfSession != null && nowEnabled(oldGlobalFlags, newGlobalFlags, HINT_ADPF)) { mAdpfSession.sendHint(PerformanceHintManager.Session.CPU_LOAD_UP); mAdpfSession.sendHint(PerformanceHintManager.Session.CPU_LOAD_UP); if (isTraceEnabled) { if (isTraceEnabled) { asyncTraceBegin(HINT_ADPF, Display.INVALID_DISPLAY); asyncTraceBegin(HINT_ADPF, Display.INVALID_DISPLAY); Loading Loading @@ -323,7 +321,7 @@ public class SystemPerformanceHinter { asyncTraceEnd(HINT_SF_EARLY_WAKEUP); asyncTraceEnd(HINT_SF_EARLY_WAKEUP); } } } } if (nowDisabled(oldGlobalFlags, newGlobalFlags, HINT_ADPF)) { if (mAdpfSession != null && nowDisabled(oldGlobalFlags, newGlobalFlags, HINT_ADPF)) { mAdpfSession.sendHint(PerformanceHintManager.Session.CPU_LOAD_RESET); mAdpfSession.sendHint(PerformanceHintManager.Session.CPU_LOAD_RESET); if (isTraceEnabled) { if (isTraceEnabled) { asyncTraceEnd(HINT_ADPF); asyncTraceEnd(HINT_ADPF); Loading libs/WindowManager/Shell/src/com/android/wm/shell/performance/PerfHintController.kt +9 −3 Original line number Original line Diff line number Diff line Loading @@ -45,10 +45,16 @@ class PerfHintController(private val mContext: Context, private fun onInit() { private fun onInit() { mShellCommandHandler.addDumpCallback(this::dump, this) mShellCommandHandler.addDumpCallback(this::dump, this) val perfHintMgr = mContext.getSystemService(PerformanceHintManager::class.java) val perfHintMgr = mContext.getSystemService(PerformanceHintManager::class.java) val adpfSession = perfHintMgr!!.createHintSession(intArrayOf(Process.myTid()), if (perfHintMgr != null) { TimeUnit.SECONDS.toNanos(1)) val adpfSession = perfHintMgr.createHintSession( intArrayOf(Process.myTid()), TimeUnit.SECONDS.toNanos(1) ) if (adpfSession != null) { hinter.setAdpfSession(adpfSession) hinter.setAdpfSession(adpfSession) } } } } fun dump(pw: PrintWriter, prefix: String?) { fun dump(pw: PrintWriter, prefix: String?) { hinter.dump(pw, prefix) hinter.dump(pw, prefix) Loading Loading
core/java/android/window/SystemPerformanceHinter.java +2 −4 Original line number Original line Diff line number Diff line Loading @@ -163,7 +163,6 @@ public class SystemPerformanceHinter { // The active sessions // The active sessions private final ArrayList<HighPerfSession> mActiveSessions = new ArrayList<>(); private final ArrayList<HighPerfSession> mActiveSessions = new ArrayList<>(); private final SurfaceControl.Transaction mTransaction; private final SurfaceControl.Transaction mTransaction; private final PerformanceHintManager mPerfHintManager; private @Nullable PerformanceHintManager.Session mAdpfSession; private @Nullable PerformanceHintManager.Session mAdpfSession; private @Nullable DisplayRootProvider mDisplayRootProvider; private @Nullable DisplayRootProvider mDisplayRootProvider; Loading @@ -184,7 +183,6 @@ public class SystemPerformanceHinter { @Nullable DisplayRootProvider displayRootProvider, @Nullable DisplayRootProvider displayRootProvider, @Nullable Supplier<SurfaceControl.Transaction> transactionSupplier) { @Nullable Supplier<SurfaceControl.Transaction> transactionSupplier) { mDisplayRootProvider = displayRootProvider; mDisplayRootProvider = displayRootProvider; mPerfHintManager = context.getSystemService(PerformanceHintManager.class); mTransaction = transactionSupplier != null mTransaction = transactionSupplier != null ? transactionSupplier.get() ? transactionSupplier.get() : new SurfaceControl.Transaction(); : new SurfaceControl.Transaction(); Loading Loading @@ -273,7 +271,7 @@ public class SystemPerformanceHinter { asyncTraceBegin(HINT_SF_EARLY_WAKEUP, Display.INVALID_DISPLAY); asyncTraceBegin(HINT_SF_EARLY_WAKEUP, Display.INVALID_DISPLAY); } } } } if (nowEnabled(oldGlobalFlags, newGlobalFlags, HINT_ADPF)) { if (mAdpfSession != null && nowEnabled(oldGlobalFlags, newGlobalFlags, HINT_ADPF)) { mAdpfSession.sendHint(PerformanceHintManager.Session.CPU_LOAD_UP); mAdpfSession.sendHint(PerformanceHintManager.Session.CPU_LOAD_UP); if (isTraceEnabled) { if (isTraceEnabled) { asyncTraceBegin(HINT_ADPF, Display.INVALID_DISPLAY); asyncTraceBegin(HINT_ADPF, Display.INVALID_DISPLAY); Loading Loading @@ -323,7 +321,7 @@ public class SystemPerformanceHinter { asyncTraceEnd(HINT_SF_EARLY_WAKEUP); asyncTraceEnd(HINT_SF_EARLY_WAKEUP); } } } } if (nowDisabled(oldGlobalFlags, newGlobalFlags, HINT_ADPF)) { if (mAdpfSession != null && nowDisabled(oldGlobalFlags, newGlobalFlags, HINT_ADPF)) { mAdpfSession.sendHint(PerformanceHintManager.Session.CPU_LOAD_RESET); mAdpfSession.sendHint(PerformanceHintManager.Session.CPU_LOAD_RESET); if (isTraceEnabled) { if (isTraceEnabled) { asyncTraceEnd(HINT_ADPF); asyncTraceEnd(HINT_ADPF); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/performance/PerfHintController.kt +9 −3 Original line number Original line Diff line number Diff line Loading @@ -45,10 +45,16 @@ class PerfHintController(private val mContext: Context, private fun onInit() { private fun onInit() { mShellCommandHandler.addDumpCallback(this::dump, this) mShellCommandHandler.addDumpCallback(this::dump, this) val perfHintMgr = mContext.getSystemService(PerformanceHintManager::class.java) val perfHintMgr = mContext.getSystemService(PerformanceHintManager::class.java) val adpfSession = perfHintMgr!!.createHintSession(intArrayOf(Process.myTid()), if (perfHintMgr != null) { TimeUnit.SECONDS.toNanos(1)) val adpfSession = perfHintMgr.createHintSession( intArrayOf(Process.myTid()), TimeUnit.SECONDS.toNanos(1) ) if (adpfSession != null) { hinter.setAdpfSession(adpfSession) hinter.setAdpfSession(adpfSession) } } } } fun dump(pw: PrintWriter, prefix: String?) { fun dump(pw: PrintWriter, prefix: String?) { hinter.dump(pw, prefix) hinter.dump(pw, prefix) Loading