summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/performance/PerfHintController.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/performance/PerfHintController.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/performance/PerfHintController.kt
index f7977f88006e..c655d86c3ece 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/performance/PerfHintController.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/performance/PerfHintController.kt
@@ -45,9 +45,15 @@ class PerfHintController(private val mContext: Context,
private fun onInit() {
mShellCommandHandler.addDumpCallback(this::dump, this)
val perfHintMgr = mContext.getSystemService(PerformanceHintManager::class.java)
- val adpfSession = perfHintMgr!!.createHintSession(intArrayOf(Process.myTid()),
- TimeUnit.SECONDS.toNanos(1))
- hinter.setAdpfSession(adpfSession)
+ if (perfHintMgr != null) {
+ val adpfSession = perfHintMgr.createHintSession(
+ intArrayOf(Process.myTid()),
+ TimeUnit.SECONDS.toNanos(1)
+ )
+ if (adpfSession != null) {
+ hinter.setAdpfSession(adpfSession)
+ }
+ }
}
fun dump(pw: PrintWriter, prefix: String?) {