RM6785: doze: Fix build on QPR2

Change-Id: I7b1486116c89f7df89753ba1ac2493c7bbb9cf95
diff --git a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.kt b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.kt
index 0d61885..54d8cb0 100644
--- a/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.kt
+++ b/doze/src/org/lineageos/settings/doze/DozeSettingsFragment.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021 The LineageOS Project
+ * Copyright (C) 2021-2024 The LineageOS Project
  * SPDX-License-Identifier: Apache-2.0
  */
 
@@ -49,7 +49,7 @@
         alwaysOnDisplayPreference.onPreferenceChangeListener = this
 
         val pickupSensorCategory =
-            preferenceScreen.findPreference<PreferenceCategory>(Utils.CATEGORY_PICKUP_SENSOR)
+            preferenceScreen.findPreference<PreferenceCategory>(Utils.CATEGORY_PICKUP_SENSOR)!!
         if (getString(R.string.pickup_sensor_type).isEmpty()) {
             preferenceScreen.removePreference(pickupSensorCategory)
         }
@@ -62,7 +62,7 @@
         if (!Utils.alwaysOnDisplayAvailable(context)) {
             preferenceScreen.removePreference(alwaysOnDisplayPreference)
         } else {
-            pickupSensorCategory?.dependency = Utils.ALWAYS_ON_DISPLAY
+            pickupSensorCategory.dependency = Utils.ALWAYS_ON_DISPLAY
         }
     }
 
diff --git a/doze/src/org/lineageos/settings/doze/PickupSensor.kt b/doze/src/org/lineageos/settings/doze/PickupSensor.kt
index 3a46c83..a7fc0d5 100644
--- a/doze/src/org/lineageos/settings/doze/PickupSensor.kt
+++ b/doze/src/org/lineageos/settings/doze/PickupSensor.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021-2022 The LineageOS Project
+ * Copyright (C) 2021-2024 The LineageOS Project
  * SPDX-License-Identifier: Apache-2.0
  */
 
@@ -19,10 +19,10 @@
 class PickupSensor(
     private val context: Context, sensorType: String, private val sensorValue: Float
 ) : SensorEventListener {
-    private val powerManager = context.getSystemService(PowerManager::class.java)
+    private val powerManager = context.getSystemService(PowerManager::class.java)!!
     private val wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG)
 
-    private val sensorManager = context.getSystemService(SensorManager::class.java)
+    private val sensorManager = context.getSystemService(SensorManager::class.java)!!
     private val sensor = Utils.getSensor(sensorManager, sensorType)
 
     private val executorService = Executors.newSingleThreadExecutor()
diff --git a/doze/src/org/lineageos/settings/doze/PocketSensor.kt b/doze/src/org/lineageos/settings/doze/PocketSensor.kt
index 3af29c6..951e7c3 100644
--- a/doze/src/org/lineageos/settings/doze/PocketSensor.kt
+++ b/doze/src/org/lineageos/settings/doze/PocketSensor.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021-2022 The LineageOS Project
+ * Copyright (C) 2021-2024 The LineageOS Project
  * SPDX-License-Identifier: Apache-2.0
  */
 
@@ -18,7 +18,7 @@
 class PocketSensor(
     private val context: Context, sensorType: String, private val sensorValue: Float
 ) : SensorEventListener {
-    private val sensorManager = context.getSystemService(SensorManager::class.java)
+    private val sensorManager = context.getSystemService(SensorManager::class.java)!!
     private val sensor = Utils.getSensor(sensorManager, sensorType)
 
     private val executorService = Executors.newSingleThreadExecutor()
diff --git a/doze/src/org/lineageos/settings/doze/Utils.kt b/doze/src/org/lineageos/settings/doze/Utils.kt
index 58a7d7f..4baf7b1 100644
--- a/doze/src/org/lineageos/settings/doze/Utils.kt
+++ b/doze/src/org/lineageos/settings/doze/Utils.kt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021 The LineageOS Project
+ * Copyright (C) 2021-2024 The LineageOS Project
  * SPDX-License-Identifier: Apache-2.0
  */
 
@@ -76,22 +76,22 @@
         return AmbientDisplayConfiguration(context).alwaysOnAvailable()
     }
 
-    private fun isGestureEnabled(context: Context?, gesture: String?): Boolean {
+    private fun isGestureEnabled(context: Context, gesture: String?): Boolean {
         return PreferenceManager.getDefaultSharedPreferences(context)
             .getBoolean(gesture, false)
     }
 
-    fun isPickUpEnabled(context: Context?): Boolean {
+    fun isPickUpEnabled(context: Context): Boolean {
         return PreferenceManager.getDefaultSharedPreferences(context)
             .getString(GESTURE_PICK_UP_KEY, "0") != "0"
     }
 
-    fun isPickUpSetToWake(context: Context?): Boolean {
+    fun isPickUpSetToWake(context: Context): Boolean {
         return PreferenceManager.getDefaultSharedPreferences(context)
             .getString(GESTURE_PICK_UP_KEY, "0") == "2"
     }
 
-    private fun areGesturesEnabled(context: Context?): Boolean {
+    private fun areGesturesEnabled(context: Context): Boolean {
         return isPickUpEnabled(context)
     }