DeviceModule.kt 924 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Nextcloud - Android Client
  3. *
  4. * SPDX-FileCopyrightText: 2020 Chris Narkiewicz <hello@ezaquarii.com>
  5. * SPDX-FileCopyrightText: 2019 Tobias Kaminsky
  6. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH
  7. * SPDX-License-Identifier: AGPL-3.0-or-later
  8. */
  9. package com.nextcloud.client.device
  10. import android.content.Context
  11. import android.os.PowerManager
  12. import com.nextcloud.client.preferences.AppPreferences
  13. import dagger.Module
  14. import dagger.Provides
  15. @Module
  16. class DeviceModule {
  17. @Provides
  18. fun powerManagementService(context: Context, preferences: AppPreferences): PowerManagementService {
  19. val platformPowerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
  20. return PowerManagementServiceImpl(
  21. context = context,
  22. platformPowerManager = platformPowerManager,
  23. deviceInfo = DeviceInfo(),
  24. preferences = preferences
  25. )
  26. }
  27. }