mirror of
https://github.com/home-assistant/android
synced 2024-09-06 17:23:32 +00:00
Migrate more sensors to Wear OS (#3115)
This commit is contained in:
parent
84d392f681
commit
8df504e1d7
|
@ -14,13 +14,24 @@ import io.homeassistant.companion.android.BuildConfig
|
|||
import io.homeassistant.companion.android.common.sensors.AudioSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.BatterySensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.DNDSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.DisplaySensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.KeyguardSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.LastRebootSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.LastUpdateManager
|
||||
import io.homeassistant.companion.android.common.sensors.LightSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.MobileDataManager
|
||||
import io.homeassistant.companion.android.common.sensors.NetworkSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.NextAlarmManager
|
||||
import io.homeassistant.companion.android.common.sensors.PhoneStateSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.PowerSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.PressureSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.ProximitySensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.SensorReceiverBase
|
||||
import io.homeassistant.companion.android.common.sensors.StepsSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.StorageSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.TimeZoneManager
|
||||
import io.homeassistant.companion.android.common.sensors.TrafficStatsManager
|
||||
import io.homeassistant.companion.android.settings.SettingsActivity
|
||||
|
||||
@AndroidEntryPoint
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.content.Context
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
||||
class DisplaySensorManager : SensorManager {
|
|
@ -1,11 +1,10 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.app.KeyguardManager
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.getSystemService
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
||||
class KeyguardSensorManager : SensorManager {
|
|
@ -1,10 +1,9 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.database.AppDatabase
|
||||
import io.homeassistant.companion.android.database.sensor.SensorSetting
|
||||
import io.homeassistant.companion.android.database.sensor.SensorSettingType
|
|
@ -1,4 +1,4 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
|
@ -8,7 +8,6 @@ import android.hardware.SensorEventListener
|
|||
import android.hardware.SensorManager.SENSOR_DELAY_NORMAL
|
||||
import android.util.Log
|
||||
import androidx.core.content.getSystemService
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import kotlin.math.roundToInt
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
|
@ -8,7 +8,6 @@ import android.provider.Settings
|
|||
import android.provider.Settings.Global.getInt
|
||||
import android.telephony.TelephonyManager
|
||||
import androidx.core.content.getSystemService
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
||||
class MobileDataManager : SensorManager {
|
|
@ -1,4 +1,4 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
|
@ -9,7 +9,6 @@ import android.telephony.SubscriptionManager
|
|||
import android.telephony.TelephonyManager
|
||||
import android.util.Log
|
||||
import androidx.core.content.getSystemService
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
||||
class PhoneStateSensorManager : SensorManager {
|
|
@ -1,4 +1,4 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
|
@ -8,7 +8,6 @@ import android.hardware.SensorEventListener
|
|||
import android.hardware.SensorManager.SENSOR_DELAY_NORMAL
|
||||
import android.util.Log
|
||||
import androidx.core.content.getSystemService
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import java.math.RoundingMode
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
|
@ -8,7 +8,6 @@ import android.hardware.SensorEventListener
|
|||
import android.hardware.SensorManager.SENSOR_DELAY_NORMAL
|
||||
import android.util.Log
|
||||
import androidx.core.content.getSystemService
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import kotlin.math.roundToInt
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import android.os.StatFs
|
||||
import android.util.Log
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import java.io.File
|
||||
import kotlin.math.roundToInt
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
|
@ -1,7 +1,6 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.content.Context
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
|
@ -1,4 +1,4 @@
|
|||
package io.homeassistant.companion.android.sensors
|
||||
package io.homeassistant.companion.android.common.sensors
|
||||
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
|
@ -6,7 +6,6 @@ import android.net.NetworkCapabilities
|
|||
import android.net.TrafficStats
|
||||
import android.util.Log
|
||||
import androidx.core.content.getSystemService
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import java.math.RoundingMode
|
||||
import kotlin.math.absoluteValue
|
||||
import io.homeassistant.companion.android.common.R as commonR
|
|
@ -16,13 +16,24 @@ import io.homeassistant.companion.android.BuildConfig
|
|||
import io.homeassistant.companion.android.common.sensors.AudioSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.BatterySensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.DNDSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.DisplaySensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.KeyguardSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.LastRebootSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.LastUpdateManager
|
||||
import io.homeassistant.companion.android.common.sensors.LightSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.MobileDataManager
|
||||
import io.homeassistant.companion.android.common.sensors.NetworkSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.NextAlarmManager
|
||||
import io.homeassistant.companion.android.common.sensors.PhoneStateSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.PowerSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.PressureSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.ProximitySensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.SensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.SensorReceiverBase
|
||||
import io.homeassistant.companion.android.common.sensors.StepsSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.StorageSensorManager
|
||||
import io.homeassistant.companion.android.common.sensors.TimeZoneManager
|
||||
import io.homeassistant.companion.android.common.sensors.TrafficStatsManager
|
||||
import io.homeassistant.companion.android.home.HomeActivity
|
||||
import io.homeassistant.companion.android.home.views.DEEPLINK_SENSOR_MANAGER
|
||||
|
||||
|
@ -45,15 +56,26 @@ class SensorReceiver : SensorReceiverBase() {
|
|||
AudioSensorManager(),
|
||||
BatterySensorManager(),
|
||||
BedtimeModeSensorManager(),
|
||||
DisplaySensorManager(),
|
||||
DNDSensorManager(),
|
||||
HeartRateSensorManager(),
|
||||
KeyguardSensorManager(),
|
||||
LastRebootSensorManager(),
|
||||
LastUpdateManager(),
|
||||
LightSensorManager(),
|
||||
MobileDataManager(),
|
||||
NetworkSensorManager(),
|
||||
NextAlarmManager(),
|
||||
OnBodySensorManager(),
|
||||
PhoneStateSensorManager(),
|
||||
PowerSensorManager(),
|
||||
PressureSensorManager(),
|
||||
ProximitySensorManager(),
|
||||
StepsSensorManager(),
|
||||
StorageSensorManager(),
|
||||
TheaterModeSensorManager(),
|
||||
TimeZoneManager(),
|
||||
TrafficStatsManager(),
|
||||
WetModeSensorManager()
|
||||
)
|
||||
val MANAGERS = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
|
||||
|
|
Loading…
Reference in a new issue