diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/DeviceSettings.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/DeviceSettings.kt index 8b6644c..22887c8 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/DeviceSettings.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/DeviceSettings.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Xiaomi-SM6250 Project + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package com.eurekateam.samsungextras import android.content.Intent import android.os.Bundle +import android.os.Build import android.widget.Toast import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat @@ -47,8 +48,10 @@ class DeviceSettings : PreferenceFragmentCompat(), Preference.OnPreferenceChange mFpsInfo.onPreferenceChangeListener = this val mDT2W = findPreference(PREF_DOUBLE_TAP)!! mDT2W.onPreferenceChangeListener = this + mDT2W.isEnabled = !(Build.PRODUCT == "a10" || Build.PRODUCT == "a20e") val mGloveMode = findPreference(PREF_GLOVE_MODE)!! mGloveMode.onPreferenceChangeListener = this + mGloveMode.isEnabled = !(Build.PRODUCT == "a10" || Build.PRODUCT == "a20e") val mFlashLight = findPreference(PREF_FLASHLIGHT)!! mFlashLight.onPreferenceClickListener = Preference.OnPreferenceClickListener { @@ -79,10 +82,12 @@ class DeviceSettings : PreferenceFragmentCompat(), Preference.OnPreferenceChange PREF_DOUBLE_TAP -> { DT2W = value as Boolean } - PREF_GLOVE_MODE -> { - GloveMode = value as Boolean - } - else -> {} + PREF_GLOVE_MODE -> { + GloveMode = value as Boolean + } + else -> { + return false + } } return true } @@ -92,7 +97,7 @@ class DeviceSettings : PreferenceFragmentCompat(), Preference.OnPreferenceChange private const val PREF_CLEAR_SPEAKER = "clear_speaker_settings" private const val PREF_FLASHLIGHT = "flashlight_settings" const val PREF_DOUBLE_TAP = "dt2w_settings" - const val PREF_GLOVE_MODE = "glove_mode_settings" + const val PREF_GLOVE_MODE = "glove_mode_settings" const val PREF_BATTERY = "battery_settings" } } diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/DeviceSettingsActivity.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/DeviceSettingsActivity.kt index 8c8e103..4cb18ae 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/DeviceSettingsActivity.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/DeviceSettingsActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Xiaomi-SM6250 Project + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/GlobalConstants.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/GlobalConstants.kt index 33f32ac..fe18170 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/GlobalConstants.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/GlobalConstants.kt @@ -1,10 +1,24 @@ +/* + * Copyright (C) 2022 Eureka Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.eurekateam.samsungextras object GlobalConstants { /** * Global Variables */ - const val FLASHLIGHT_SYSFS = "/sys/class/camera/flash/" + - "torch_brightness_lvl" + const val FLASHLIGHT_SYSFS = "/sys/class/camera/flash/torch_brightness_lvl" const val TAG = "SamsungExtras" } \ No newline at end of file diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/battery/BatteryActivity.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/battery/BatteryActivity.kt index ec89473..fc2c8eb 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/battery/BatteryActivity.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/battery/BatteryActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Paranoid Android + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/battery/BatteryFragment.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/battery/BatteryFragment.kt index 66a55f7..7ab2e41 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/battery/BatteryFragment.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/battery/BatteryFragment.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Paranoid Android + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/flashlight/FlashLightActivity.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/flashlight/FlashLightActivity.kt index bfb229d..bfdf7a3 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/flashlight/FlashLightActivity.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/flashlight/FlashLightActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Paranoid Android + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/flashlight/FlashLightFragment.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/flashlight/FlashLightFragment.kt index 04e54e6..7d24297 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/flashlight/FlashLightFragment.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/flashlight/FlashLightFragment.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Paranoid Android + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,13 @@ package com.eurekateam.samsungextras.flashlight import android.os.Bundle +import android.os.Build import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import com.eurekateam.samsungextras.GlobalConstants import com.eurekateam.samsungextras.R import com.eurekateam.samsungextras.interfaces.Flashlight import com.eurekateam.samsungextras.preferences.CustomSeekBarPreference -import com.eurekateam.samsungextras.utils.SystemProperties import java.io.File class FlashLightFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener { @@ -37,7 +37,7 @@ class FlashLightFragment : PreferenceFragmentCompat(), Preference.OnPreferenceCh } mFlashLightPref!!.setMax(10) mFlashLightPref!!.setMin(1) - val isa10 = SystemProperties.read("ro.product.device") == "a10" + val isa10 = Build.DEVICE == "a10" mFlashLightPref!!.value = Flashlight.getFlash(if (isa10) 1 else 0) } diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/fps/FPSInfoService.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/fps/FPSInfoService.kt index 322afea..585c79b 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/fps/FPSInfoService.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/fps/FPSInfoService.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Xiaomi-SM6250 Project + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/fps/FPSTileService.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/fps/FPSTileService.kt index f33dc4e..7fb3f48 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/fps/FPSTileService.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/fps/FPSTileService.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Xiaomi-SM6250 Project + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Battery.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Battery.kt index 41fd7a1..516eb42 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Battery.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Battery.kt @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 Eureka Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.eurekateam.samsungextras.interfaces object Battery { diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Display.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Display.kt index 7007368..caef097 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Display.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Display.kt @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2022 Eureka Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.eurekateam.samsungextras.interfaces object Display { @@ -5,5 +21,5 @@ object Display { external set var GloveMode: Boolean = false - external set + external set } diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Flashlight.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Flashlight.kt index 6149279..b08a024 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Flashlight.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/interfaces/Flashlight.kt @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2022 Eureka Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.eurekateam.samsungextras.interfaces object Flashlight { diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/preferences/CustomSeekBarPreference.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/preferences/CustomSeekBarPreference.kt index ea663fd..cb69861 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/preferences/CustomSeekBarPreference.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/preferences/CustomSeekBarPreference.kt @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2022 Eureka Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.eurekateam.samsungextras.preferences import android.content.Context diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/speaker/ClearSpeakerActivity.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/speaker/ClearSpeakerActivity.kt index 92986d7..66670f6 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/speaker/ClearSpeakerActivity.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/speaker/ClearSpeakerActivity.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Paranoid Android + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/speaker/ClearSpeakerFragment.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/speaker/ClearSpeakerFragment.kt index 0a061ff..a05ffd7 100644 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/speaker/ClearSpeakerFragment.kt +++ b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/speaker/ClearSpeakerFragment.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Paranoid Android + * Copyright (C) 2022 Eureka Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/utils/SystemProperties.kt b/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/utils/SystemProperties.kt deleted file mode 100644 index 7508365..0000000 --- a/universal7885-common/apps/SamsungParts/src/com/eurekateam/samsungextras/utils/SystemProperties.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.eurekateam.samsungextras.utils - -import android.util.Log -import com.eurekateam.samsungextras.GlobalConstants -import java.io.BufferedReader -import java.io.IOException -import java.io.InputStreamReader - -object SystemProperties { - /** - * To read a prop using getprop - * @param propName the prop name to get - * @return the prop's value, empty string is not found - */ - fun read(propName: String): String { - var process: Process? = null - var bufferedReader: BufferedReader? = null - val TAG = GlobalConstants.TAG - return try { - val GETPROP_EXECUTABLE_PATH = "/system/bin/getprop" - process = ProcessBuilder().command(GETPROP_EXECUTABLE_PATH, propName) - .redirectErrorStream(true).start() - bufferedReader = BufferedReader(InputStreamReader(process.inputStream)) - var line = bufferedReader.readLine() - if (line == null) { - line = "" //prop not set - } - Log.i(TAG, "read System Property: $propName=$line") - line - } catch (e: Exception) { - Log.e(TAG, "Failed to read System Property $propName", e) - "" - } finally { - if (bufferedReader != null) { - try { - bufferedReader.close() - } catch (ignored: IOException) { - } - } - process?.destroy() - } - } -} \ No newline at end of file