universal7885: parts: Implement SmartCharge settings

Using the interface vendor.eureka.hardware.parts.ISmartCharge, this intends to add simple implementation of smart charge. If the battery percent is above set limit percent, it will stop charging, else if the battery percents goes under the set restart percent, it will start charging again.

While I'm on this parts, I refactored kotlin srcs using ktlint, formatted xml manually.
This commit is contained in:
roynatech2544 2022-10-13 16:04:00 +09:00
commit 8d1811d574
43 changed files with 779 additions and 568 deletions

View file

@ -37,7 +37,8 @@ class CameraLightSensorService : Service() {
private fun pushNotification(): Notification {
val nm = mContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
val channel = NotificationChannel(
mContext.packageName, "CameraLightSensor",
mContext.packageName,
"CameraLightSensor",
NotificationManager.IMPORTANCE_NONE
)
channel.isBlockable = true
@ -45,8 +46,10 @@ class CameraLightSensorService : Service() {
val builder = NotificationCompat.Builder(mContext, mContext.packageName)
val notificationIntent = Intent(mContext, CameraLightSensorService::class.java)
val contentIntent = PendingIntent.getActivity(
mContext, 50,
notificationIntent, PendingIntent.FLAG_IMMUTABLE
mContext,
50,
notificationIntent,
PendingIntent.FLAG_IMMUTABLE
)
builder.setContentIntent(contentIntent)
@ -88,7 +91,10 @@ class CameraLightSensorService : Service() {
if (mPoolExecutor == null) {
mPoolExecutor = ScheduledThreadPoolExecutor(4)
mPoolExecutor!!.scheduleWithFixedDelay(
mScheduler, 0, 2, TimeUnit.SECONDS
mScheduler,
0,
2,
TimeUnit.SECONDS
)
}
} else if (intent.action == Intent.ACTION_SCREEN_OFF) {
@ -119,7 +125,10 @@ class CameraLightSensorService : Service() {
if (mPoolExecutor == null) {
mPoolExecutor = ScheduledThreadPoolExecutor(4)
mPoolExecutor!!.scheduleWithFixedDelay(
mScheduler, 0, 2, TimeUnit.SECONDS
mScheduler,
0,
2,
TimeUnit.SECONDS
)
}
} else {
@ -196,7 +205,7 @@ class CameraLightSensorService : Service() {
@SuppressLint("MissingPermission")
fun readyCamera() {
if (mIAutoBrightness != null){
if (mIAutoBrightness != null) {
if (!mIAutoBrightness!!.CameraIsFree()) return
}
try {
@ -213,9 +222,13 @@ class CameraLightSensorService : Service() {
mCameraHandlerThread.start()
mCameraHandler = Handler(mCameraHandlerThread.looper)
mContext = this
bindService(Intent(mContext, IAutoBrightness::class.java).apply {
setClassName("com.eurekateam.camera", "com.eurekateam.camera.CameraAIDL")
}, mConnection, Context.BIND_AUTO_CREATE)
bindService(
Intent(mContext, IAutoBrightness::class.java).apply {
setClassName("com.eurekateam.camera", "com.eurekateam.camera.CameraAIDL")
},
mConnection,
Context.BIND_AUTO_CREATE
)
@Suppress("SameParameterValue")
startForeground(50, pushNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA)
mRegistered = false
@ -248,8 +261,13 @@ class CameraLightSensorService : Service() {
fun actOnReadyCameraDevice() {
try {
cameraDevice.createCaptureSession(
SessionConfiguration(SessionConfiguration.SESSION_REGULAR,
listOf(OutputConfiguration(imageReader.surface)), mExecutor, sessionStateCallback))
SessionConfiguration(
SessionConfiguration.SESSION_REGULAR,
listOf(OutputConfiguration(imageReader.surface)),
mExecutor,
sessionStateCallback
)
)
} catch (e: CameraAccessException) {
e.printStackTrace()
}
@ -301,11 +319,13 @@ class CameraLightSensorService : Service() {
if (DEBUG) Log.i(TAG, "AdjustBrightness: Received Brightness Value $brightness")
val oldbrightness =
Settings.System.getInt(contentResolver, Settings.System.SCREEN_BRIGHTNESS)
if (DEBUG) Log.i(
TAG,
"AdjustBrightness: OldVal = " + oldbrightness + " NewVal = " +
brightness + " Adjusting.."
)
if (DEBUG) {
Log.i(
TAG,
"AdjustBrightness: OldVal = " + oldbrightness + " NewVal = " +
brightness + " Adjusting.."
)
}
var newbrightness = 2 * brightness - oldbrightness
if (newbrightness > 255) {
newbrightness = 255

View file

@ -48,16 +48,18 @@ class FMRadioService : Service() {
ACTION_BEFORE -> {
mPlayState = PlayState.STATE_PLAYING
Log.i("mCurrentIndex $mIndex")
if (mIndex > 0)
if (mIndex > 0) {
mIndex -= 1
}
mNativeFMInterface.setFMFreq(fd, mTracks[mIndex].toInt())
MainFragment.mFreqCurrent = mTracks[mIndex].toInt()
}
ACTION_NEXT -> {
mPlayState = PlayState.STATE_PLAYING
Log.i("mCurrentIndex $mIndex")
if (mIndex < mTracks.size - 1)
if (mIndex < mTracks.size - 1) {
mIndex += 1
}
mNativeFMInterface.setFMFreq(fd, mTracks[mIndex].toInt())
MainFragment.mFreqCurrent = mTracks[mIndex].toInt()
}
@ -118,7 +120,8 @@ class FMRadioService : Service() {
private fun pushNotification(): Notification {
val nm = mContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
val channel = NotificationChannel(
mContext.packageName, "FM Radio Playing",
mContext.packageName,
"FM Radio Playing",
NotificationManager.IMPORTANCE_HIGH
)
nm.createNotificationChannel(channel)
@ -146,7 +149,8 @@ class FMRadioService : Service() {
Icon.createWithResource(this, R.drawable.ic_headphones)
}
},
"Output Configuration", output
"Output Configuration",
output
).build()
val mPausePlayAction: Notification.Action = Notification.Action.Builder(
when (mPlayState) {
@ -157,20 +161,24 @@ class FMRadioService : Service() {
Icon.createWithResource(this, R.drawable.ic_play)
}
},
"Start/Stop", togglePlay
"Start/Stop",
togglePlay
).build()
val mRewindAction: Notification.Action = Notification.Action.Builder(
Icon.createWithResource(this, R.drawable.ic_rewind),
"Rewind", rewind
"Rewind",
rewind
).build()
val mForwardAction: Notification.Action = Notification.Action.Builder(
Icon.createWithResource(this, R.drawable.ic_forward),
"Forward", forward
"Forward",
forward
).build()
val mCloseAction: Notification.Action = Notification.Action.Builder(
Icon.createWithResource(this, R.drawable.ic_close),
"Close", close
"Close",
close
).build()
builder.addAction(mOutputAction)
builder.addAction(mRewindAction)

View file

@ -1,15 +1,14 @@
package com.eurekateam.fmradio
import vendor.eureka.hardware.fmradio.IFMDevControl
import android.os.ServiceManager
import vendor.eureka.hardware.fmradio.GetType
import vendor.eureka.hardware.fmradio.IFMDevControl
import vendor.eureka.hardware.fmradio.SetType
import android.os.ServiceManager
class NativeFMInterface {
private val mDevCtl : IFMDevControl
private val mSysfsCtl : IFMDevControl
private val mDefaultCtl : IFMDevControl
private val mDevCtl: IFMDevControl
private val mSysfsCtl: IFMDevControl
private val mDefaultCtl: IFMDevControl
init {
mDevCtl = IFMDevControl.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.fmradio.IFMDevControl/default"))
@ -26,7 +25,7 @@ class NativeFMInterface {
fun setFMFreq(a: Int, freq: Int) = mDevCtl.setValue(SetType.SET_TYPE_FM_FREQ, freq)
fun setFMVolume(a: Int, volume: Int) = mDevCtl.setValue(SetType.SET_TYPE_FM_VOLUME, volume)
fun setFMMute(a: Int, mute: Boolean) = mDevCtl.setValue(SetType.SET_TYPE_FM_MUTE, if (mute) 1 else 0)
fun getFmUpper(a: Int) : Int = mDevCtl.getValue(GetType.GET_TYPE_FM_UPPER_LIMIT)
fun getFmUpper(a: Int): Int = mDevCtl.getValue(GetType.GET_TYPE_FM_UPPER_LIMIT)
fun getFMLower(a: Int): Int = mDevCtl.getValue(GetType.GET_TYPE_FM_LOWER_LIMIT)
fun getRMSSI(a: Int): Int = mDevCtl.getValue(GetType.GET_TYPE_FM_RMSSI)
fun getFMTracks(fd: Int): IntArray = mDefaultCtl.getFreqsList()
@ -37,5 +36,5 @@ class NativeFMInterface {
fun setFMRSSI(a: Int, rssi: Long) = mDevCtl.setValue(SetType.SET_TYPE_FM_RMSSI, rssi.toInt())
fun closeFMDevice(fd: Int) = mDevCtl.close()
fun getSysfsSupport(): Boolean = mSysfsCtl.getValue(GetType.GET_TYPE_FM_SYSFS_IF) == 0
fun setAudioRoute(speaker: Boolean) = mDevCtl.setValue(SetType.SET_TYPE_FM_SPEAKER_ROUTE, if (speaker) 1 else 0)
fun setAudioRoute(speaker: Boolean) = mDevCtl.setValue(SetType.SET_TYPE_FM_SPEAKER_ROUTE, if (speaker) 1 else 0)
}

View file

@ -45,7 +45,6 @@ class PebbleTextView(context: Context, attrs: AttributeSet?, defStyleAttr: Int)
desiredWidth: Float,
text: String
) {
// Pick a reasonably large value for the test. Larger values produce
// more accurate results, but may cause problems with hardware
// acceleration. But there are workarounds for that, too; refer to

View file

@ -32,7 +32,9 @@ class ListViewAdapter(private val mContext: Context) : BaseAdapter() {
override fun getView(id: Int, mConvertView: View?, parent: ViewGroup?): View {
val mAnotherConvertView = mConvertView
?: (mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(
R.layout.channel_list_items, parent, false
R.layout.channel_list_items,
parent,
false
)
mAnotherConvertView.findViewById<MaterialTextView>(R.id.channel_list_title).text =
String.format(
@ -44,7 +46,8 @@ class ListViewAdapter(private val mContext: Context) : BaseAdapter() {
MainFragment.mFreqCurrent = MainFragment.mTracks[id].toInt()
FileUtilities.writeToFile(
FileUtilities.mFMFreqFileName,
MainFragment.mFreqCurrent.toString(), mContext
MainFragment.mFreqCurrent.toString(),
mContext
)
setCurrentFMChannel(id)
}
@ -52,7 +55,8 @@ class ListViewAdapter(private val mContext: Context) : BaseAdapter() {
val mStar = ResourcesCompat.getDrawable(mContext.resources, R.drawable.ic_star, mContext.theme)
val mStarFilled = ResourcesCompat.getDrawable(
mContext.resources,
R.drawable.ic_star_filled, mContext.theme
R.drawable.ic_star_filled,
mContext.theme
)
val mIndex = MainFragment.mTracks[id].toInt()
if (MainFragment.mFavStats[mIndex] == null) {
@ -77,14 +81,16 @@ class ListViewAdapter(private val mContext: Context) : BaseAdapter() {
mItem.value.setBackgroundColor(
ResourcesCompat.getColor(
mContext.resources,
android.R.color.system_accent2_100, mContext.theme
android.R.color.system_accent2_100,
mContext.theme
)
)
}
mListofViews[mPosition]?.setBackgroundColor(
ResourcesCompat.getColor(
mContext.resources,
android.R.color.system_accent3_400, mContext.theme
android.R.color.system_accent3_400,
mContext.theme
)
)
}

View file

@ -43,12 +43,15 @@ class PebbleLayoutAdapter(private val mContext: Context) : BaseAdapter() {
override fun getView(id: Int, mConvertView: View?, parent: ViewGroup?): View {
val mAnotherConvertView = mConvertView
?: (mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(
R.layout.favorite_channel_items, parent, false
R.layout.favorite_channel_items,
parent,
false
)
mAnotherConvertView.findViewById<PebbleTextView>(R.id.pebble_textview).apply {
mText = (mFavoriteList[id].toFloat() / 1000).toString()
mColor = ResourcesCompat.getColor(
mContext.resources, android.R.color.system_accent1_400,
mContext.resources,
android.R.color.system_accent1_400,
mContext.theme
)
setOnClickListener {
@ -56,7 +59,8 @@ class PebbleLayoutAdapter(private val mContext: Context) : BaseAdapter() {
MainFragment.mFreqCurrent = mFavoriteList[id]
FileUtilities.writeToFile(
FileUtilities.mFMFreqFileName,
MainFragment.mFreqCurrent.toString(), mContext
MainFragment.mFreqCurrent.toString(),
mContext
)
}
}

View file

@ -7,5 +7,5 @@ package com.eurekateam.fmradio.enums
*/
enum class HeadsetState {
HEADSET_STATE_CONNECTED,
HEADSET_STATE_DISCONNECTED,
HEADSET_STATE_DISCONNECTED
}

View file

@ -41,10 +41,11 @@ class ChannelListFragment :
Configuration.UI_MODE_NIGHT_UNDEFINED -> mIsLight = true
}
mRootView.findViewById<FrameLayout>(R.id.channel_list_layout).apply {
if (mIsLight)
if (mIsLight) {
setBackgroundColor(resources.getColor(android.R.color.system_accent1_50, requireContext().theme))
else
} else {
setBackgroundColor(resources.getColor(android.R.color.system_accent1_100, requireContext().theme))
}
}
return mRootView
}

View file

@ -28,10 +28,11 @@ class FavouriteFragment : Fragment(R.layout.fragment_fav_list) {
Configuration.UI_MODE_NIGHT_UNDEFINED -> mIsLight = true
}
mRootView.findViewById<GridView>(R.id.fav_list_grid).apply {
if (mIsLight)
if (mIsLight) {
setBackgroundColor(resources.getColor(android.R.color.system_accent1_50, requireContext().theme))
else
} else {
setBackgroundColor(resources.getColor(android.R.color.system_accent1_100, requireContext().theme))
}
}
return mRootView
}

View file

@ -57,11 +57,13 @@ class MainFragment :
super.onCreate(savedInstanceState)
mStar = ResourcesCompat.getDrawable(
requireContext().resources,
R.drawable.ic_star, requireContext().theme
R.drawable.ic_star,
requireContext().theme
)!!
mStarFilled = ResourcesCompat.getDrawable(
requireContext().resources,
R.drawable.ic_star_filled, requireContext().theme
R.drawable.ic_star_filled,
requireContext().theme
)!!
mAudioManager = requireContext().getSystemService(Context.AUDIO_SERVICE) as AudioManager
mVolumeUp = mRootView.findViewById(R.id.volume_up)
@ -92,27 +94,31 @@ class MainFragment :
val mTextViewList = listOf(R.id.app_banner, R.id.fm_freq, R.id.freq_misc)
for (mResID in mTextViewList) {
mRootView.findViewById<MaterialTextView>(mResID).apply {
if (mIsLight)
if (mIsLight) {
setTextColor(resources.getColor(android.R.color.system_accent2_500, requireContext().theme))
else
} else {
setTextColor(resources.getColor(android.R.color.system_accent2_100, requireContext().theme))
}
}
}
mRootView.findViewById<FrameLayout>(R.id.main_fragment).apply {
if (mIsLight)
if (mIsLight) {
setBackgroundColor(resources.getColor(android.R.color.system_accent1_100, requireContext().theme))
else
} else {
setBackgroundColor(resources.getColor(android.R.color.system_accent1_700, requireContext().theme))
}
}
GlobalScope.launch {
withContext(Dispatchers.IO) {
if (FileUtilities.checkIfExistFile(FileUtilities.mFavouriteChannelFileName, requireContext())) {
val mFavData = FileUtilities.readFromFile(
FileUtilities.mFavouriteChannelFileName, requireContext()
FileUtilities.mFavouriteChannelFileName,
requireContext()
)
for (mItem in mFavData.split("\\r?\\n".toRegex())) {
if (mItem.isNotBlank())
if (mItem.isNotBlank()) {
mFavStats[mItem.toInt()] = true
}
}
}
var mMute = false
@ -157,8 +163,9 @@ class MainFragment :
}
}
}
if (!mMute)
if (!mMute) {
mFMInterface.setFMMute(fd, true)
}
mFMInterface.setFMFreq(fd, mFMInterface.getFMLower(fd))
mRefreshTracks()
if (mFreqCurrent != -1) {
@ -171,10 +178,12 @@ class MainFragment :
withContext(Dispatchers.Main) {
mFMFreq.text = mCleanFormat.format(mFreqCurrent.toFloat() / 1000)
}
if (!mMute)
if (!mMute) {
mFMInterface.setFMMute(fd, false)
if (mFreqCurrent == -1)
}
if (mFreqCurrent == -1) {
mFMInterface.setFMThread(fd, true)
}
withContext(Dispatchers.Main) {
mFavButton.let {
if (mFavStats[mFreqCurrent] == null) {
@ -201,6 +210,7 @@ class MainFragment :
alpha = .7f
if (!mTextView) isEnabled = false
}
/**
* Extension function for [View], for reverting Grayed out, disabled View
* @param mTextView Whether the target view is touchable [FloatingActionButton] or
@ -222,20 +232,25 @@ class MainFragment :
private fun mUpdateEnableDisable(mEnabled: Boolean, mView: View = requireView()) {
val mTextViewList = listOf(R.id.fm_freq, R.id.freq_misc)
val mFloatButtonList = listOf(
R.id.volume_down, R.id.volume_up,
R.id.before_channel, R.id.next_channel, R.id.fm_output_btn
R.id.volume_down,
R.id.volume_up,
R.id.before_channel,
R.id.next_channel,
R.id.fm_output_btn
)
for (i in mTextViewList) {
if (mEnabled)
if (mEnabled) {
mView.findViewById<View>(i).enable(true)
else
} else {
mView.findViewById<View>(i).disable(true)
}
}
for (i in mFloatButtonList) {
if (mEnabled)
if (mEnabled) {
mView.findViewById<View>(i).enable()
else
} else {
mView.findViewById<View>(i).disable()
}
}
}
@ -268,25 +283,29 @@ class MainFragment :
}
}
mVolumeUp.id -> {
if (mVolume < 15)
if (mVolume < 15) {
mVolume += 1
}
mFMInterface.setFMVolume(fd, mVolume)
mSeekBar.progress = mVolume
Toast.makeText(requireContext(), "Volume set to $mVolume", Toast.LENGTH_SHORT).show()
FileUtilities.writeToFile(
FileUtilities.mFMVolumeFileName,
mVolume.toString(), requireContext()
mVolume.toString(),
requireContext()
)
}
mVolumeDown.id -> {
if (mVolume > 0)
if (mVolume > 0) {
mVolume -= 1
}
mFMInterface.setFMVolume(fd, mVolume)
mSeekBar.progress = mVolume
Toast.makeText(requireContext(), "Volume set to $mVolume", Toast.LENGTH_SHORT).show()
FileUtilities.writeToFile(
FileUtilities.mFMVolumeFileName,
mVolume.toString(), requireContext()
mVolume.toString(),
requireContext()
)
}
mBeforeChannelBtn.id -> {
@ -304,7 +323,8 @@ class MainFragment :
mFMInterface.setFMMute(fd, false)
FileUtilities.writeToFile(
FileUtilities.mFMFreqFileName,
mFreqCurrent.toString(), requireContext()
mFreqCurrent.toString(),
requireContext()
)
mFavButton.let {
if (mFavStats[mFreqCurrent] == null) {
@ -343,7 +363,8 @@ class MainFragment :
mFMInterface.setFMMute(fd, false)
FileUtilities.writeToFile(
FileUtilities.mFMFreqFileName,
mFreqCurrent.toString(), requireContext()
mFreqCurrent.toString(),
requireContext()
)
mFavButton.let {
if (mFavStats[mFreqCurrent] == null) {

View file

@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<group
android:name="rotationGroup"
android:pivotX="10.0"
android:pivotY="10.0"
android:rotation="15.0" >
<path
android:name="vect"
android:fillColor="#FF000000"
android:pathData="M15.67,4H14V2h-4v2H8.33C7.6,4 7,4.6 7,5.33V9h4.93L13,7v2h4V5.33C17,4.6 16.4,4 15.67,4z"
android:fillAlpha=".3"/>
<path
android:name="draw"
android:fillColor="#FF000000"
android:pathData="M13,12.5h2L11,20v-5.5H9L11.93,9H7v11.67C7,21.4 7.6,22 8.33,22h7.33c0.74,0 1.34,-0.6 1.34,-1.33V9h-4v3.5z"/>
</group>
</vector>

View file

@ -1,79 +0,0 @@
<!-- Copyright (C) 2021 The SamsungParts Project
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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="advanced_settings">SamsungParts</string>
<string name="advanced_settings_summary">Gerät Spezifische Tweaks</string>
<!-- Display category -->
<string name="display_category">Display</string>
<!-- FPS Info -->
<string name="fps_info_title">FPS Info Overlay</string>
<string name="fps_info_summary">Zeige Overlay mit aktueller Frames per Second. (FPS)</string>
<!-- Speaker category -->
<string name="speaker_category">Sound</string>
<!-- Clear Speaker -->
<string name="clear_speaker_title">Lautsprecher reinigen</string>
<string name="clear_speaker_summary">Spiele ein 30 sekündigen Ton ab, um den Lautsprecher zu reinigen.</string>
<string name="clear_speaker_description">Starte die Eigenschaft, um den Lautsprecher von Schmutz und Staub zu befreien. Setzte die Lautstärke dabei auf das Maximum.\n\nWenn in dem Lautsprecher zuviel Schmutz und Staub ist, führe dies 2-5 mal aus.</string>
<!-- Dolby -->
<string name="dolby_title">Dolby Atmos</string>
<string name="dolby_summary">Aktivere den Dolby Atmos Sound Effekt</string>
<string name="dolby_description">Aktiviere Dolby Sound, wie in OneUI (Stock ROM).</string>
<string name="dolby_modes_title">Verfügbare Dolby Modi</string>
<string name="dolby_modes_summary">Wähle ein Modi aus</string>
<string name="dolby_profile_auto">Auto Profil</string>
<string name="dolby_profile_movie">Film Profil</string>
<string name="dolby_profile_music">Musik Profil</string>
<string name="dolby_profile_voice">Sprach Profil</string>
<string name="dolby_profile_game">Spiel Profil</string>
<string name="dolby_profile_off">Kein Profil</string>
<string name="dolby_profile_game_1">Spiel 1 Profil</string>
<string name="dolby_profile_game_2">Spiel 2 Profil</string>
<string name="dolby_profile_special_audio">Spezial Sound Profil</string>
<!-- Eureka Kernel features category -->
<string name="eureka_kernel_features">Eureka Kernel Eigenschaften</string>
<!-- FlashLight -->
<string name="flashlight_title">Taschenlampe Helligkeit</string>
<string name="flashlight_summary">Einstellen der Taschenlampe Helligkeit</string>
<string name="flashlight_description">Samsung\'s OneUI hat eine Option zum Einstellen der
Taschenlampe Helligkeit. AOSP hat nicht diese möglichkeit.\n\n
Benutze das feature zum Einstellen der Helligkeit von wenig bis viel. Parameter zwischen 0 bis 10 wählbar.</string>
<!-- GPU Category -->
<string name="misc_category">Sonstiges</string>
<!-- Battery -->
<string name="fastcharge_category">Batterie</string>
<string name="fastcharge_2nd_title">Schnellladen Einstellung</string>
<string name="charge_title">Laden Einstellung</string>
<string name="charge_summary">Aktiviere/Deaktiviere den Ladevorgang hier.</string>
<string name="fastcharge_title">Batterie Info und Einstellungen</string>
<string name="fastcharge_summary">Aktiviere/Deaktiviere Schnellladen Eigenschaft</string>
<string name="fastcharge_description">Verwalte die Ladevorgang Eigenschaft hier.</string>
<string name="battery_info_title">Sonstige Batterie Info</string>
<string name="battery_info_summary">Sektion für Geeks</string>
<string name="battery_max_capa">Batterie Max Kapazität (mAh)</string>
<string name="battery_status">Batterie Status</string>
<string name="battery_chrged_up_to">Batterie geladen in (%)</string>
<string name="battery_chrged_up_to_mah">Batterie geladen in (mAh)</string>
<string name="battery_temp">Aktuelle Batterie Temperatur</string>
<string name="battery_current">Batterie aktuell (mA)</string>
<!-- Label for feature switch -->
<string name="switch_bar_on">An</string>
<!-- Label for feature switch -->
<string name="switch_bar_off">Aus</string>
<!-- Custom seekbar -->
<string name="custom_seekbar_value">Werte: <xliff:g id="v">%s</xliff:g></string>
<string name="custom_seekbar_default_value">Standard</string>
<string name="custom_seekbar_default_value_to_set">Standard Wert: <xliff:g id="v">%s</xliff:g>\nLanges drücken um zu setzen.</string>
<string name="custom_seekbar_default_value_is_set">Standard Werte sind gesetzt.</string>
</resources>

View file

@ -1,77 +0,0 @@
<!-- Copyright (C) 2020 The Xiaomi-SM6250 Project
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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="advanced_settings">SamsungParts</string>
<string name="advanced_settings_summary">Ajustes específicos del dispositivo</string>
<!-- Categoría Pantalla -->
<string name="display_category">Pantalla</string>
<!-- FPS Info -->
<string name="fps_info_title">Superposición FPS</string>
<string name="fps_info_summary">Muestra una superposición con los fotogramas actuales por segundo </string>
<!-- Categoría Altavoz -->
<string name="speaker_category">Audio</string>
<!-- Limpiar Altavoz -->
<string name="clear_speaker_title">Limpiar altavoz</string>
<string name="clear_speaker_summary">Reproduce un audio de 30 segundos para limpiar el altavoz</string>
<string name="clear_speaker_description">Ejecuta esta función una o varias veces si encuentra que su altavoz está ligeramente bloqueado por el polvo. Establezca el volumen multimedia al máximo.\n\nSi el altavoz está muy bloqueado, ejecute esta función de 2 a 5 veces mientras agita el dispositivo con el altavoz hacia abajo.</string>
<!-- Dolby -->
<string name="dolby_title">Dolby Atmos</string>
<string name="dolby_summary">Habilita el efecto de audio Dolby Atmos</string>
<string name="dolby_description">Habilita el audio Dolby, como en One UI.</string>
<string name="dolby_modes_title">Modos Dolby disponibles</string>
<string name="dolby_modes_summary">Elige uno de estos</string>
<string name="dolby_profile_auto">Auto Profile</string>
<string name="dolby_profile_movie">Movie Profile</string>
<string name="dolby_profile_music">Music Profile</string>
<string name="dolby_profile_voice">Voice Profile</string>
<string name="dolby_profile_game">Game Profile</string>
<string name="dolby_profile_off">No Profile</string>
<string name="dolby_profile_game_1">Game 1 Profile</string>
<string name="dolby_profile_game_2">Game 2 Profile</string>
<string name="dolby_profile_special_audio">Special Audio Profile</string>
<!-- Categoría de características de Eureka Kernel -->
<string name="eureka_kernel_features">Características de Eureka Kernel</string>
<!-- Linterna -->
<string name="flashlight_title">Brillo de la linterna</string>
<string name="flashlight_summary">Ajusta el brillo de la linterna</string>
<string name="flashlight_description">Samsung OneUI Tiene una opción para ajustar el brillo de la linterna. AOSP no tiene esta función.\n\nUtilice esta función para ajustar el brillo de la linterna bajo o alto. Va de 1 a 10.</string>
<!-- Categoría del GPU -->
<string name="misc_category">Misc</string>
<!-- Batería -->
<string name="fastcharge_category">Batería</string>
<string name="fastcharge_2nd_title">Configuración de Carga rápida</string>
<string name="charge_title">Configuración de carga</string>
<string name="charge_summary">Habilite / deshabilite la carga aquí.</string>
<string name="fastcharge_title">Información y configuración de la batería</string>
<string name="fastcharge_summary">Habilitar / deshabilitar la función de carga rápida</string>
<string name="fastcharge_description">Administre la función de carga aquí.</string>
<string name="battery_info_title">Info Variada de la batería</string>
<string name="battery_info_summary">Sección para geeks</string>
<string name="battery_max_capa">Capacidad máxima de la batería (mAh)</string>
<string name="battery_status">Estado de la batería</string>
<string name="battery_chrged_up_to">Batería cargada hasta (%)</string>
<string name="battery_chrged_up_to_mah">Batería cargada hasta (mAh)</string>
<string name="battery_temp">Temperatura actual de la batería</string>
<string name="battery_current">Corriente de la batería (mA)</string>
<!-- Label for feature switch -->
<string name="switch_bar_on">On</string>
<!-- Label for feature switch -->
<string name="switch_bar_off">Off</string>
<!-- Custom seekbar -->
<string name="custom_seekbar_value">Value: <xliff:g id="v">%s</xliff:g></string>
<string name="custom_seekbar_default_value">Default</string>
<string name="custom_seekbar_default_value_to_set">Default value: <xliff:g id="v">%s</xliff:g>\nLong press to set</string>
<string name="custom_seekbar_default_value_is_set">Default value is set</string>
</resources>

View file

@ -1,79 +0,0 @@
<!-- Copyright (C) 2021 The SamsungParts Project
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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="advanced_settings">SamsungParts</string>
<string name="advanced_settings_summary">Tweaks específicos do dispositivo</string>
<!-- Display category -->
<string name="display_category">Tela</string>
<!-- FPS Info -->
<string name="fps_info_title">FPS info overlay</string>
<string name="fps_info_summary">Mostrar overlay com informações atuais sobre o FPS</string>
<!-- Speaker category -->
<string name="speaker_category">Áudio</string>
<!-- Clear Speaker -->
<string name="clear_speaker_title">Limpar alto falante</string>
<string name="clear_speaker_summary">Tocar um áudio de 30 segundos para limpar o alto falante</string>
<string name="clear_speaker_description">Execute este recurso uma ou duas vezes se o alto-falante está ligeiramente bloqueado por poeira. Defina o volume da mídia para o máximo.\n\nSe o alto-falante estiver muito bloqueado, execute este recurso 2 a 5 vezes enquanto agita seu dispositivo com o alto-falante voltado para baixo.</string>
<!-- Dolby -->
<string name="dolby_title">Dolby Atmos</string>
<string name="dolby_summary">Ativar o efeito de áudio Dolby Atmos</string>
<string name="dolby_description">Ativar Dolby Atmos, Assim como na OneUI.</string>
<string name="dolby_modes_title">Modos do Dolby Disponíveis</string>
<string name="dolby_modes_summary">Selecione um destes</string>
<string name="dolby_profile_auto">Perfil automático</string>
<string name="dolby_profile_movie">Perfil de Filme</string>
<string name="dolby_profile_music">Perfil de Música</string>
<string name="dolby_profile_voice">Perfil de Voz</string>
<string name="dolby_profile_game">Perfil de Jogos</string>
<string name="dolby_profile_off">Nenhum Perfil</string>
<string name="dolby_profile_game_1">Perfil de Jogos 1</string>
<string name="dolby_profile_game_2">Perfil de Jogos 2</string>
<string name="dolby_profile_special_audio">Perfil automático especial</string>
<!-- Eureka Kernel features category -->
<string name="eureka_kernel_features">Recursos do Eureka Kernel</string>
<!-- FlashLight -->
<string name="flashlight_title">Brilho da lanterna</string>
<string name="flashlight_summary">Ajustar o brilho da lanterna</string>
<string name="flashlight_description">a OneUI da Samsung tem um recurso para ajustar
o brilho da lanterna. AOSP não tem esse recurso.\n\n
Use isto para deixar o brilho da lanterna baixo ou alto. Varia de 0 a 10.</string>
<!-- GPU Category -->
<string name="misc_category">Diversos</string>
<!-- Battery -->
<string name="fastcharge_category">Bateria</string>
<string name="fastcharge_2nd_title">Configurações do Carregamento rápido</string>
<string name="charge_title">Configurações de Carregamento</string>
<string name="charge_summary">Ative/Desative o carregamento aqui.</string>
<string name="fastcharge_title">Informações da bateria e configurações</string>
<string name="fastcharge_summary">Ativar/Desativar o recurso de carregamento rápido</string>
<string name="fastcharge_description">Controle o carregamento rápido aqui.</string>
<string name="battery_info_title">Informações diversas sobre a bateria</string>
<string name="battery_info_summary">Seção para Geeks</string>
<string name="battery_max_capa">Capacidade máxima da bateria (mAh)</string>
<string name="battery_status">Status da bateria</string>
<string name="battery_chrged_up_to">Bateria carregada até (%)</string>
<string name="battery_chrged_up_to_mah">Bateria carregada até (mAh)</string>
<string name="battery_temp">Temperatura atual da bateria</string>
<string name="battery_current">Corrente da bateria (mA)</string>
<!-- Label for feature switch -->
<string name="switch_bar_on">Ligado</string>
<!-- Label for feature switch -->
<string name="switch_bar_off">Desligado</string>
<!-- Custom seekbar -->
<string name="custom_seekbar_value">Valor: <xliff:g id="v">%s</xliff:g></string>
<string name="custom_seekbar_default_value">Padrão</string>
<string name="custom_seekbar_default_value_to_set">Valor padrão: <xliff:g id="v">%s</xliff:g>\nPressione longamente para definir</string>
<string name="custom_seekbar_default_value_is_set">Valor padrão está definido</string>
</resources>

View file

@ -1,79 +0,0 @@
<!-- Copyright (C) 2020 The Xiaomi-SM6250 Project
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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="advanced_settings">Parti Samsung</string>
<string name="advanced_settings_summary">Tweak-uri specifice dispozitivului</string>
<!-- Display category -->
<string name="display_category">Afisaj</string>
<!-- FPS Info -->
<string name="fps_info_title">FPS Overlay</string>
<string name="fps_info_summary">Arata un overlay cu cate FPS-uri sunt</string>
<!-- Speaker category -->
<string name="speaker_category">Speaker</string>
<!-- Clear Speaker -->
<string name="clear_speaker_title">Curata speakerul</string>
<string name="clear_speaker_summary">Audiaza un sunet de 30 de secunde cu care sa cureti speakerul</string>
<string name="clear_speaker_description">Utilizeaza acest feature odata sau de doua ori daca speakerul tau este blocat de praf. Seteaza volumul media la maxim.\n\nDaca speakerul este blocat greu, utilizeaza acest feature de 2-5 ori miscand device-ul cu speakerul in jos.</string>
<!-- Dolby -->
<string name="dolby_title">Dolby Atmos</string>
<string name="dolby_summary">Activeaza efectul de Dolby Atmos</string>
<string name="dolby_description">Activeaza Dolby Audio, ca in OneUI.</string>
<string name="dolby_modes_title">Moduri existente Dolby</string>
<string name="dolby_modes_summary">Alege una din cele de mai jos</string>
<string name="dolby_profile_auto">Profil Auto</string>
<string name="dolby_profile_movie">Profil Film</string>
<string name="dolby_profile_music">Profil Muzica</string>
<string name="dolby_profile_voice">Profil Voce</string>
<string name="dolby_profile_game">Profil Jocuri</string>
<string name="dolby_profile_off">Profil No</string>
<string name="dolby_profile_game_1">Profil joc 1</string>
<string name="dolby_profile_game_2">Profil joc 2</string>
<string name="dolby_profile_special_audio">Profil Audio Special</string>
<!-- Eureka Kernel features category -->
<string name="eureka_kernel_features">Eureka Kernel Features</string>
<!-- FlashLight -->
<string name="flashlight_title">Luminozitate lanterna</string>
<string name="flashlight_summary">Ajusteaza luminozitatea lanternei</string>
<string name="flashlight_description">OneUI-ul samsungului are o optiune de ajustare a luminozitatii lanternei
AOSP nu are acest feature.\n\n
Utilizeaza acest feature pentru a ajusta luminozitatea lanternei mare sau mica. Intre 0 si 10.</string>
<!-- GPU Category -->
<string name="misc_category">Misc</string>
<!-- Battery -->
<string name="fastcharge_category">Baterie</string>
<string name="fastcharge_2nd_title">Setari FastCharge</string>
<string name="charge_title">Setari incarcare.</string>
<string name="charge_summary">Activeaza/Dezactiveaza incarcarea aici.</string>
<string name="fastcharge_title">Informatii baterie si Setari</string>
<string name="fastcharge_summary">Activeaza/Dezactiveaza feature-ul Fastcharge</string>
<string name="fastcharge_description">Manage Charging Feature here.</string>
<string name="battery_info_title">Battery Misc Info</string>
<string name="battery_info_summary">Section for geeks</string>
<string name="battery_max_capa">Capacitate maxima baterie (mAh)</string>
<string name="battery_status">Status baterie</string>
<string name="battery_chrged_up_to">Bateria se poate incarca pana la (%)</string>
<string name="battery_chrged_up_to_mah">Bateria s-a incarcat pana la (mAh)</string>
<string name="battery_temp">Temperatura actuala a bateriei</string>
<string name="battery_current">Curent Baterie (mA)</string>
<!-- Label for feature switch -->
<string name="switch_bar_on">Activat</string>
<!-- Label for feature switch -->
<string name="switch_bar_off">Dezactivat</string>
<!-- Custom seekbar -->
<string name="custom_seekbar_value">Value: <xliff:g id="v">%s</xliff:g></string>
<string name="custom_seekbar_default_value">Default</string>
<string name="custom_seekbar_default_value_to_set">Valoare Default: <xliff:g id="v">%s</xliff:g>\nTine apasat pentru a face modificari.</string>
<string name="custom_seekbar_default_value_is_set">Valoarea Default este setata</string>
</resources>

View file

@ -1,77 +0,0 @@
<!-- Copyright (C) 2020 The Xiaomi-SM6250 Project
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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="advanced_settings">Опции Samsung</string>
<string name="advanced_settings_summary">Дополнительные функции устройства</string>
<!-- Display category -->
<string name="display_category">Экран</string>
<!-- FPS Info -->
<string name="fps_info_title">Мониторинг FPS</string>
<string name="fps_info_summary">Показывать частоту кадров в секунду</string>
<!-- Speaker category -->
<string name="speaker_category">Звук</string>
<!-- Clear Speaker -->
<string name="clear_speaker_title">Очистка динамика</string>
<string name="clear_speaker_summary">Воспроизведение 30-секундного звука для очистки динамика</string>
<string name="clear_speaker_description">Запустите эту функцию один или два раза, если обнаружите, что ваш динамик слегка загрязнён пылью. Установите максимальную громкость мультимедиа.\n\nЕсли динамик сильно загрязнён, запустите эту опцию 2-5 раз, встряхивая устройство динамиком вниз.</string>
<!-- Dolby -->
<string name="dolby_title">Dolby Atmos</string>
<string name="dolby_summary">Включение звуковых эффектов от Dolby Atmos</string>
<string name="dolby_description">Включите звук Dolby, как в OneUI.</string>
<string name="dolby_modes_title">Доступные режимы Dolby</string>
<string name="dolby_modes_summary">Выберите один из них</string>
<string name="dolby_profile_auto">Автомотический</string>
<string name="dolby_profile_movie">Фильм</string>
<string name="dolby_profile_music">Музыка</string>
<string name="dolby_profile_voice">Голос</string>
<string name="dolby_profile_game">Игра</string>
<string name="dolby_profile_off">Без профиля</string>
<string name="dolby_profile_game_1">Игровой профиль 1</string>
<string name="dolby_profile_game_2">Игровой профиль 2</string>
<string name="dolby_profile_special_audio">Свой профиль звука</string>
<!-- Eureka Kernel features category -->
<string name="eureka_kernel_features">Функции Eureka Kernel</string>
<!-- FlashLight -->
<string name="flashlight_title">Яркость фонарика</string>
<string name="flashlight_summary">Отрегулируйте яркость фонарика</string>
<string name="flashlight_description">У OneUI есть возможность регулировать яркость фонарика, но данной опции нет в AOSP.\n\nИспользуйте эту функцию для регулировки низкой или высокой яркости фонарика. Колеблется от 0 до 10.</string>
<!-- GPU Category -->
<string name="misc_category">Разное</string>
<!-- Battery -->
<string name="fastcharge_category">Батарея</string>
<string name="fastcharge_2nd_title">Экспресс зарядка</string>
<string name="charge_title">Зарядка</string>
<string name="charge_summary">Включение/Отключение зарядки</string>
<string name="fastcharge_title">Информация о батареи и настройки</string>
<string name="fastcharge_summary">Включение/Отключение функции быстрой зарядки</string>
<string name="fastcharge_description">Здесь происходит управление зарядкой.</string>
<string name="battery_info_title">Прочая информация о батареи</string>
<string name="battery_info_summary">Полезная информация (не для всех)</string>
<string name="battery_max_capa">Максимальная ёмкость АКБ (mAh)</string>
<string name="battery_status">Статус батареи</string>
<string name="battery_chrged_up_to">Заряд батареи (%)</string>
<string name="battery_chrged_up_to_mah">Заряд батареи (mAh)</string>
<string name="battery_temp">Текущая температура АКБ</string>
<string name="battery_current">Использовано заряда (mA)</string>
<!-- Label for feature switch -->
<string name="switch_bar_on">Включено</string>
<!-- Label for feature switch -->
<string name="switch_bar_off">Отключено</string>
<!-- Custom seekbar -->
<string name="custom_seekbar_value">Значение: <xliff:g id="v">%s</xliff:g></string>
<string name="custom_seekbar_default_value">По-умолчанию</string>
<string name="custom_seekbar_default_value_to_set">Значение по-умолчанию: <xliff:g id="v">%s</xliff:g>\nДлительное нажатие для настройки</string>
<string name="custom_seekbar_default_value_is_set">Установлено значение по-умолчанию</string>
</resources>

View file

@ -86,4 +86,20 @@
<string name="switch_bar_on">On</string>
<!-- Label for feature switch -->
<string name="switch_bar_off">Off</string>
<!-- SmartCharge -->
<string name="smartcharge_title">Simple SmartCharge Implementation</string>
<string name="smartcharge_switch">Enable The Implementation</string>
<string name="choose_limit_title">Adjust Charge Limit %</string>
<string name="choose_summary">Tap here to adjust the settings</string>
<string name="choose_restart_title">Adjust Charge Restart %</string>
<string name="limit_title">Current Limit Charge % Setting</string>
<string name="restart_title">Current Restart Charge % Setting</string>
<string name="limit_stat_title">Stats of limited charging count since last boot</string>
<string name="restart_stat_title">Stats of restarted charging count since last boot</string>
<string name="apply">Apply current settings</string>
<string name="adjust_title">Move the seekbar to adjust values</string>
<string name="adjust_summary">From the most left, the value will move by -10 -1 0 1 10</string>
<string name="smartcharge_description">This is a simple smartcharge implementation based on
battery percentage. If the battery percent is above limit, the charging stops, or if it is
below restart, it charges again. Said to improve battery life in long term</string>
</resources>

View file

@ -1,12 +1,60 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/fastcharge_title">
<com.android.settingslib.widget.MainSwitchPreference android:key="show_data" android:title="@string/show_data"/>
<SwitchPreference android:key="fastcharge_pref" android:title="@string/fastcharge_2nd_title" android:icon="@drawable/ic_bolt" android:summary="@string/fastcharge_summary"/>
<SwitchPreference android:key="charge_pref" android:title="@string/charge_title" android:icon="@drawable/ic_bolt" android:summary="@string/charge_summary"/>
<Preference android:key="battery_capacity" android:title="@string/battery_max_capa" android:summary="@string/not_shown" android:selectable="false"/>
<Preference android:key="battery_charged_up_to" android:title="@string/battery_chrged_up_to" android:summary="@string/not_shown" android:selectable="false"/>
<Preference android:key="battery_charged_up_to_mah" android:title="@string/battery_chrged_up_to_mah" android:summary="@string/not_shown" android:selectable="false"/>
<Preference android:key="battery_current" android:title="@string/battery_current" android:summary="@string/not_shown" android:selectable="false"/>
<Preference android:key="battery_status" android:title="@string/battery_status" android:summary="@string/not_shown" android:selectable="false"/>
<Preference android:key="battery_temp" android:title="@string/battery_temp" android:summary="@string/not_shown" android:selectable="false"/>
<com.android.settingslib.widget.FooterPreference android:key="footer_preference" android:title="@string/fastcharge_description" android:selectable="false"/>
<com.android.settingslib.widget.MainSwitchPreference
android:key="show_data"
android:title="@string/show_data"/>
<SwitchPreference
android:key="fastcharge_pref"
android:title="@string/fastcharge_2nd_title"
android:icon="@drawable/ic_bolt"
android:summary="@string/fastcharge_summary"/>
<SwitchPreference
android:key="charge_pref"
android:title="@string/charge_title"
android:icon="@drawable/ic_bolt"
android:summary="@string/charge_summary"/>
<Preference
android:key="battery_capacity"
android:title="@string/battery_max_capa"
android:summary="@string/not_shown"
android:selectable="false"/>
<Preference
android:key="battery_charged_up_to"
android:title="@string/battery_chrged_up_to"
android:summary="@string/not_shown"
android:selectable="false"/>
<Preference
android:key="battery_charged_up_to_mah"
android:title="@string/battery_chrged_up_to_mah"
android:summary="@string/not_shown"
android:selectable="false"/>
<Preference
android:key="battery_current"
android:title="@string/battery_current"
android:summary="@string/not_shown"
android:selectable="false"/>
<Preference
android:key="battery_status"
android:title="@string/battery_status"
android:summary="@string/not_shown"
android:selectable="false"/>
<Preference
android:key="battery_temp"
android:title="@string/battery_temp"
android:summary="@string/not_shown"
android:selectable="false"/>
<com.android.settingslib.widget.FooterPreference
android:key="footer_preference"
android:title="@string/fastcharge_description"
android:selectable="false"/>
</PreferenceScreen>

View file

@ -1,4 +1,13 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/clear_speaker_title">
<com.android.settingslib.widget.MainSwitchPreference android:key="clear_speaker_pref" android:title="@string/clear_speaker_title" android:icon="@drawable/ic_sound" android:summary="@string/clear_speaker_summary"/>
<com.android.settingslib.widget.FooterPreference android:key="footer_preference" android:title="@string/clear_speaker_description" android:selectable="false"/>
<com.android.settingslib.widget.MainSwitchPreference
android:key="clear_speaker_pref"
android:title="@string/clear_speaker_title"
android:icon="@drawable/ic_sound"
android:summary="@string/clear_speaker_summary"/>
<com.android.settingslib.widget.FooterPreference
android:key="footer_preference"
android:title="@string/clear_speaker_description"
android:selectable="false"/>
</PreferenceScreen>

View file

@ -1,13 +1,49 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/dolby_title">
<com.android.settingslib.widget.MainSwitchPreference android:defaultValue="false" android:key="dolby_enable" android:title="@string/dolby_enable_title"/>
<com.android.settingslib.widget.RadioButtonPreference android:defaultValue="true" android:key="dolby_profile_auto" android:title="@string/dolby_profile_auto"/>
<com.android.settingslib.widget.RadioButtonPreference android:key="dolby_profile_game" android:title="@string/dolby_profile_game"/>
<com.android.settingslib.widget.RadioButtonPreference android:key="dolby_profile_game_1" android:title="@string/dolby_profile_game_1"/>
<com.android.settingslib.widget.RadioButtonPreference android:key="dolby_profile_game_2" android:title="@string/dolby_profile_game_2"/>
<com.android.settingslib.widget.RadioButtonPreference android:key="dolby_profile_movie" android:title="@string/dolby_profile_movie"/>
<com.android.settingslib.widget.RadioButtonPreference android:key="dolby_profile_music" android:title="@string/dolby_profile_music"/>
<com.android.settingslib.widget.RadioButtonPreference android:key="dolby_profile_off" android:title="@string/dolby_profile_off"/>
<com.android.settingslib.widget.RadioButtonPreference android:key="dolby_profile_spacial_audio" android:title="@string/dolby_profile_spacial_audio"/>
<com.android.settingslib.widget.RadioButtonPreference android:key="dolby_profile_voice" android:title="@string/dolby_profile_voice"/>
<com.android.settingslib.widget.FooterPreference android:key="dolby_top_intro" android:title="@string/dolby_top_intro_summary"/>
<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="false"
android:key="dolby_enable"
android:title="@string/dolby_enable_title"/>
<com.android.settingslib.widget.RadioButtonPreference
android:defaultValue="true"
android:key="dolby_profile_auto"
android:title="@string/dolby_profile_auto"/>
<com.android.settingslib.widget.RadioButtonPreference
android:key="dolby_profile_game"
android:title="@string/dolby_profile_game"/>
<com.android.settingslib.widget.RadioButtonPreference
android:key="dolby_profile_game_1"
android:title="@string/dolby_profile_game_1"/>
<com.android.settingslib.widget.RadioButtonPreference
android:key="dolby_profile_game_2"
android:title="@string/dolby_profile_game_2"/>
<com.android.settingslib.widget.RadioButtonPreference
android:key="dolby_profile_movie"
android:title="@string/dolby_profile_movie"/>
<com.android.settingslib.widget.RadioButtonPreference
android:key="dolby_profile_music"
android:title="@string/dolby_profile_music"/>
<com.android.settingslib.widget.RadioButtonPreference
android:key="dolby_profile_off"
android:title="@string/dolby_profile_off"/>
<com.android.settingslib.widget.RadioButtonPreference
android:key="dolby_profile_spacial_audio"
android:title="@string/dolby_profile_spacial_audio"/>
<com.android.settingslib.widget.RadioButtonPreference
android:key="dolby_profile_voice"
android:title="@string/dolby_profile_voice"/>
<com.android.settingslib.widget.FooterPreference
android:key="dolby_top_intro"
android:title="@string/dolby_top_intro_summary"/>
</PreferenceScreen>

View file

@ -1,5 +1,19 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/flashlight_title">
<com.android.settingslib.widget.MainSwitchPreference android:defaultValue="false" android:key="flashlight_enable" android:title="@string/flash_enable_title"/>
<SeekBarPreference android:key="flashlight_pref" android:title="@string/flashlight_title" android:icon="@drawable/ic_led" android:summary="@string/flashlight_summary"/>
<com.android.settingslib.widget.FooterPreference android:key="footer_preference" android:title="@string/flashlight_description" android:selectable="false"/>
<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="false"
android:key="flashlight_enable"
android:title="@string/flash_enable_title"/>
<SeekBarPreference
android:key="flashlight_pref"
android:title="@string/flashlight_title"
android:icon="@drawable/ic_led"
android:summary="@string/flashlight_summary"/>
<com.android.settingslib.widget.FooterPreference
android:key="footer_preference"
android:title="@string/flashlight_description"
android:selectable="false"/>
</PreferenceScreen>

View file

@ -1,31 +1,103 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/advanced_settings">
<PreferenceCategory android:key="display" android:title="@string/display_category">
<SwitchPreference android:key="fps_info" android:icon="@drawable/ic_fps_info" android:title="@string/fps_info_title" android:summary="@string/fps_info_summary" android:persistent="true"/>
</PreferenceCategory>
<PreferenceCategory android:key="speaker" android:title="@string/speaker_category">
<Preference android:key="clear_speaker_settings" android:title="@string/clear_speaker_title" android:summary="@string/clear_speaker_summary" android:icon="@drawable/ic_sound">
<intent android:action="android.intent.action.MAIN" android:targetClass="com.eurekateam.samsungextras.speaker.ClearSpeakerActivity" android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
<Preference android:key="dolby_settings" android:title="@string/dolby_title" android:summary="@string/dolby_summary" android:icon="@drawable/ic_speaker_cleaner_icon">
<intent android:action="android.intent.action.MAIN" android:targetClass="com.eurekateam.samsungextras.dolby.DolbyActivity" android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
</PreferenceCategory>
<PreferenceCategory android:key="eureka_kernel_features" android:title="@string/eureka_kernel_features">
<Preference android:key="flashlight_settings" android:title="@string/flashlight_title" android:summary="@string/flashlight_summary" android:icon="@drawable/ic_led">
<intent android:action="android.intent.action.MAIN" android:targetClass="com.eurekateam.samsungextras.flashlight.FlashLightActivity" android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
</PreferenceCategory>
<PreferenceCategory android:key="fastcharge" android:title="@string/fastcharge_category">
<Preference android:key="battery_settings" android:title="@string/fastcharge_title" android:icon="@drawable/ic_bolt" android:summary="@string/fastcharge_summary" android:persistent="true">
<intent android:action="android.intent.action.MAIN" android:targetClass="com.eurekateam.samsungextras.battery.BatteryActivity" android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/misc_category">
<Preference android:key="swap_settings" android:title="@string/swap_title" android:icon="@drawable/ic_memory" android:summary="@string/swap_description" android:persistent="true">
<intent android:action="android.intent.action.MAIN" android:targetClass="com.eurekateam.samsungextras.swap.SwapActivity" android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
<SwitchPreference android:key="dt2w_settings" android:title="@string/dt2w_mode" android:persistent="true"/>
<SwitchPreference android:key="glove_mode_settings" android:title="@string/glove_mode" android:persistent="true"/>
</PreferenceCategory>
<com.android.settingslib.widget.FooterPreference android:title="@string/advanced_settings_summary" android:selectable="false"/>
<PreferenceCategory
android:key="display"
android:title="@string/display_category">
<SwitchPreference
android:key="fps_info"
android:icon="@drawable/ic_fps_info"
android:title="@string/fps_info_title"
android:summary="@string/fps_info_summary"
android:persistent="true"/>
</PreferenceCategory>
<PreferenceCategory
android:key="speaker"
android:title="@string/speaker_category">
<Preference
android:key="clear_speaker_settings"
android:title="@string/clear_speaker_title"
android:summary="@string/clear_speaker_summary"
android:icon="@drawable/ic_sound">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.eurekateam.samsungextras.speaker.ClearSpeakerActivity"
android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
<Preference
android:key="dolby_settings"
android:title="@string/dolby_title"
android:summary="@string/dolby_summary"
android:icon="@drawable/ic_speaker_cleaner_icon">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.eurekateam.samsungextras.dolby.DolbyActivity"
android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
</PreferenceCategory>
<PreferenceCategory
android:key="eureka_kernel_features"
android:title="@string/eureka_kernel_features">
<Preference
android:key="flashlight_settings"
android:title="@string/flashlight_title"
android:summary="@string/flashlight_summary"
android:icon="@drawable/ic_led">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.eurekateam.samsungextras.flashlight.FlashLightActivity"
android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
</PreferenceCategory>
<PreferenceCategory
android:key="fastcharge"
android:title="@string/fastcharge_category">
<Preference
android:key="battery_settings"
android:title="@string/fastcharge_title"
android:icon="@drawable/ic_bolt"
android:summary="@string/fastcharge_summary"
android:persistent="true">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.eurekateam.samsungextras.battery.BatteryActivity"
android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
<Preference
android:key="smartcharge_settings"
android:title="@string/smartcharge_title"
android:icon="@drawable/ic_charge"
android:summary="@string/smartcharge_switch"
android:persistent="true">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.eurekateam.samsungextras.smartcharge.SmartChargeActivity"
android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/misc_category">
<Preference
android:key="swap_settings"
android:title="@string/swap_title"
android:icon="@drawable/ic_memory"
android:summary="@string/swap_description"
android:persistent="true">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.eurekateam.samsungextras.swap.SwapActivity"
android:targetPackage="com.eurekateam.samsungextras"/>
</Preference>
<SwitchPreference
android:key="dt2w_settings"
android:title="@string/dt2w_mode"
android:persistent="true"/>
<SwitchPreference
android:key="glove_mode_settings"
android:title="@string/glove_mode"
android:persistent="true"/>
</PreferenceCategory>
<com.android.settingslib.widget.FooterPreference
android:title="@string/advanced_settings_summary"
android:selectable="false"/>
</PreferenceScreen>

View file

@ -0,0 +1,55 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/smartcharge_title">
<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="false"
android:key="smartcharge"
android:title="@string/smartcharge_switch"/>
<com.android.settingslib.widget.SelectorWithWidgetPreference
android:key="choose_limit"
android:title="@string/choose_limit_title"
android:summary="@string/choose_summary"/>
<com.android.settingslib.widget.SelectorWithWidgetPreference
android:key="choose_restart"
android:title="@string/choose_restart_title"
android:summary="@string/choose_summary"/>
<SeekBarPreference
android:key="adjust"
android:title="@string/adjust_title"
android:summary="@string/adjust_summary"/>
<Preference
android:key="limit"
android:title="@string/limit_title"
android:icon="@drawable/ic_battery"
android:selectable="false"/>
<Preference
android:key="restart"
android:title="@string/restart_title"
android:icon="@drawable/ic_battery"
android:selectable="false"/>
<Preference
android:key="limit_stat"
android:title="@string/limit_stat_title"
android:icon="@drawable/ic_charge"
android:selectable="false"/>
<Preference
android:key="restart_stat"
android:title="@string/restart_stat_title"
android:icon="@drawable/ic_charge"
android:selectable="false"/>
<com.android.settingslib.widget.ButtonPreference
android:key="apply"
android:title="@string/apply"/>
<com.android.settingslib.widget.FooterPreference
android:title="@string/smartcharge_description"
android:selectable="false"/>
</PreferenceScreen>

View file

@ -1,7 +1,25 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/swap_title">
<com.android.settingslib.widget.MainSwitchPreference android:defaultValue="false" android:key="swap_enable" android:title="@string/swap_enable_title"/>
<SeekBarPreference android:key="swap_size" android:title="@string/swap_size_title" android:icon="@drawable/ic_memory" android:summary="@string/swap_size_summary"/>
<Preference android:key="free_space" android:title="@string/free_space" android:selectable="false"/>
<Preference android:key="swap_file_size" android:title="@string/swap_file_size" android:selectable="false"/>
<com.android.settingslib.widget.FooterPreference android:title="@string/swap_description" android:selectable="false"/>
<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="false"
android:key="swap_enable"
android:title="@string/swap_enable_title"/>
<SeekBarPreference
android:key="swap_size"
android:title="@string/swap_size_title"
android:icon="@drawable/ic_memory"
android:summary="@string/swap_size_summary"/>
<Preference
android:key="free_space"
android:title="@string/free_space"
android:selectable="false"/>
<Preference
android:key="swap_file_size"
android:title="@string/swap_file_size"
android:selectable="false"/>
<com.android.settingslib.widget.FooterPreference
android:title="@string/swap_description"
android:selectable="false"/>
</PreferenceScreen>

View file

@ -42,8 +42,11 @@ class BootReceiver : BroadcastReceiver() {
// ZRAM
val mSwap = Swap()
if (mSharedPreferences.getBoolean(SwapFragment.PREF_SWAP_ENABLE, false))
mSwap.setSwapOn(false) else mSwap.setSwapOff()
if (mSharedPreferences.getBoolean(SwapFragment.PREF_SWAP_ENABLE, false)) {
mSwap.setSwapOn(false)
} else {
mSwap.setSwapOff()
}
// Display
val mDisplay = Display()

View file

@ -28,6 +28,7 @@ import com.eurekateam.samsungextras.flashlight.FlashLightActivity
import com.eurekateam.samsungextras.fps.FPSInfoService
import com.eurekateam.samsungextras.interfaces.Display
import com.eurekateam.samsungextras.speaker.ClearSpeakerActivity
import com.eurekateam.samsungextras.smartcharge.SmartChargeActivity
class DeviceSettings : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener {
@ -69,6 +70,13 @@ class DeviceSettings : PreferenceFragmentCompat(), Preference.OnPreferenceChange
startActivity(intent)
true
}
val mSmartCharge = findPreference<Preference>(PREF_SMARTCHARGE)!!
mSmartCharge.onPreferenceClickListener =
Preference.OnPreferenceClickListener {
val intent = Intent(requireActivity().applicationContext, SmartChargeActivity::class.java)
startActivity(intent)
true
}
}
override fun onPreferenceChange(preference: Preference, value: Any): Boolean {
@ -106,5 +114,6 @@ class DeviceSettings : PreferenceFragmentCompat(), Preference.OnPreferenceChange
const val PREF_DOUBLE_TAP = "dt2w_settings"
const val PREF_GLOVE_MODE = "glove_mode_settings"
const val PREF_BATTERY = "battery_settings"
const val PREF_SMARTCHARGE = "smartcharge_settings"
}
}

View file

@ -64,7 +64,7 @@ class BatteryFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChang
return true
} else if (preference == mFastChargePref) {
mBattery.FastCharge = newValue as Boolean
mFastChargePref.isChecked = mBattery.FastCharge
mFastChargePref.isChecked = mBattery.FastCharge
mSharedPreferences.edit().putBoolean(PREF_FASTCHARGE, mBattery.FastCharge).apply()
return true
}
@ -86,7 +86,10 @@ class BatteryFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChang
if (mPoolExecutor == null) {
mPoolExecutor = ScheduledThreadPoolExecutor(2)
mPoolExecutor!!.scheduleWithFixedDelay(
mScheduler, 0, 2, TimeUnit.SECONDS
mScheduler,
0,
2,
TimeUnit.SECONDS
)
}
} else {

View file

@ -53,7 +53,9 @@ object DolbyCore {
return context.resources.getString(
context.resources.getIdentifier(
resourceName, "string", context.packageName
resourceName,
"string",
context.packageName
)
)
}

View file

@ -73,7 +73,7 @@ class DolbyFragment : PreferenceFragmentCompat(), OnMainSwitchChangeListener {
"dolby_profile_off" to DolbyCore.PROFILE_OFF,
"dolby_profile_game_1" to DolbyCore.PROFILE_GAME_1,
"dolby_profile_game_2" to DolbyCore.PROFILE_GAME_2,
"dolby_profile_spacial_audio" to DolbyCore.PROFILE_SPACIAL_AUDIO,
"dolby_profile_spacial_audio" to DolbyCore.PROFILE_SPACIAL_AUDIO
)
}
}

View file

@ -68,7 +68,10 @@ class DolbySearchIndexablesProvider : SearchIndexablesProvider() {
private val INDEXABLE_RES = arrayOf<SearchIndexableResource>(
SearchIndexableResource(
1, R.xml.dolby_settings, DolbyActivity::class.java.name, 0
1,
R.xml.dolby_settings,
DolbyActivity::class.java.name,
0
)
)
}

View file

@ -63,9 +63,7 @@ class FlashLightFragment : PreferenceFragmentCompat(), Preference.OnPreferenceCh
mFlash.setEnabled(isChecked)
mSharedPreferences.edit().putBoolean(PREF_FLASHLIGHT_ENABLE, isChecked)
mFlashLightPref.isEnabled = isChecked
}
companion object {
} companion object {
const val PREF_FLASHLIGHT = "flashlight_pref"
const val PREF_FLASHLIGHT_ENABLE = "flashlight_enable"
}

View file

@ -78,7 +78,8 @@ open class FPSInfoService : Service() {
val y = mPaddingTop - mAscent.toInt()
val s = fPSInfoString
canvas.drawText(
s, (LEFT - mPaddingLeft - mMaxWidth).toFloat(),
s,
(LEFT - mPaddingLeft - mMaxWidth).toFloat(),
(
y - 1
).toFloat(),

View file

@ -15,13 +15,12 @@
*/
package com.eurekateam.samsungextras.interfaces
import vendor.eureka.hardware.parts.IBatteryStats
import vendor.eureka.hardware.parts.BatterySys
import android.os.ServiceManager
import vendor.eureka.hardware.parts.BatterySys
import vendor.eureka.hardware.parts.IBatteryStats
class Battery {
private val mBattery : IBatteryStats
private val mBattery: IBatteryStats
init {
mBattery = IBatteryStats.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.parts.IBatteryStats/default"))
@ -44,11 +43,11 @@ class Battery {
}
fun getGeneralBatteryStats(id: BatteryIds): Int = when (id) {
BatteryIds.BATTERY_CAPACITY_MAX -> mBattery.getBatteryStats(BatterySys.CAPACITY_MAX) / 1000
BatteryIds.BATTERY_CAPACITY_CURRENT -> mBattery.getBatteryStats(BatterySys.CAPACITY_CURRENT)
BatteryIds.BATTERY_CAPACITY_CURRENT_MAH -> (mBattery.getBatteryStats(BatterySys.CAPACITY_CURRENT).toFloat() * mBattery.getBatteryStats(BatterySys.CAPACITY_MAX).toFloat() / 100000).toInt()
BatteryIds.CHARGING_STATE -> if (mBattery.getBatteryStats(BatterySys.CURRENT) > 0) 1 else 0
BatteryIds.BATTERY_TEMP -> mBattery.getBatteryStats(BatterySys.TEMP) / 10
BatteryIds.BATTERY_CURRENT -> mBattery.getBatteryStats(BatterySys.CURRENT)
BatteryIds.BATTERY_CAPACITY_MAX -> mBattery.getBatteryStats(BatterySys.CAPACITY_MAX) / 1000
BatteryIds.BATTERY_CAPACITY_CURRENT -> mBattery.getBatteryStats(BatterySys.CAPACITY_CURRENT)
BatteryIds.BATTERY_CAPACITY_CURRENT_MAH -> (mBattery.getBatteryStats(BatterySys.CAPACITY_CURRENT).toFloat() * mBattery.getBatteryStats(BatterySys.CAPACITY_MAX).toFloat() / 100000).toInt()
BatteryIds.CHARGING_STATE -> if (mBattery.getBatteryStats(BatterySys.CURRENT) > 0) 1 else 0
BatteryIds.BATTERY_TEMP -> mBattery.getBatteryStats(BatterySys.TEMP) / 10
BatteryIds.BATTERY_CURRENT -> mBattery.getBatteryStats(BatterySys.CURRENT)
}
}

View file

@ -1,10 +1,10 @@
package com.eurekateam.samsungextras.interfaces
enum class BatteryIds {
BATTERY_CAPACITY_MAX,
BATTERY_CAPACITY_CURRENT,
BATTERY_CAPACITY_CURRENT_MAH,
CHARGING_STATE,
BATTERY_TEMP,
BATTERY_CURRENT
BATTERY_CAPACITY_MAX,
BATTERY_CAPACITY_CURRENT,
BATTERY_CAPACITY_CURRENT_MAH,
CHARGING_STATE,
BATTERY_TEMP,
BATTERY_CURRENT
}

View file

@ -16,16 +16,15 @@
package com.eurekateam.samsungextras.interfaces
import vendor.eureka.hardware.parts.IDisplayConfigs
import vendor.eureka.hardware.parts.DisplaySys
import android.os.ServiceManager
import vendor.eureka.hardware.parts.DisplaySys
import vendor.eureka.hardware.parts.IDisplayConfigs
class Display {
private val mDisplay : IDisplayConfigs
private val mDisplay: IDisplayConfigs
init {
mDisplay = IDisplayConfigs.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.parts.IDisplayConfigs/default"))
mDisplay = IDisplayConfigs.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.parts.IDisplayConfigs/default"))
}
var DT2W: Boolean = false

View file

@ -16,19 +16,18 @@
package com.eurekateam.samsungextras.interfaces
import android.os.ServiceManager
import vendor.eureka.hardware.parts.IFlashBrightness
import android.os.ServiceManager
class Flashlight {
private val mFlash : IFlashBrightness
private val mFlash: IFlashBrightness
init {
mFlash = IFlashBrightness.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.parts.IFlashBrightness/default"))
mFlash = IFlashBrightness.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.parts.IFlashBrightness/default"))
}
fun setFlash(value: Int) = mFlash.setFlashlightWritable(value)
fun getFlash(a10: Boolean): Int = mFlash.readFlashlightstats(!a10)
fun setEnabled(enable: Boolean) = mFlash.setFlashlightEnable(enable)
}

View file

@ -0,0 +1,37 @@
/*
* 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
import android.os.ServiceManager
import vendor.eureka.hardware.parts.ISmartCharge
class SmartCharge {
private val mSmartCharge: ISmartCharge
init {
mSmartCharge = ISmartCharge.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.parts.ISmartCharge/default"))
}
fun start() = mSmartCharge.start()
fun stop() = mSmartCharge.stop()
fun setConfig(limit: Int, restart: Int) = mSmartCharge.setConfig(limit, restart)
fun getStats(type: StatsType): Int = when (type) {
StatsType.TYPE_LIMITED_CNT -> mSmartCharge.getLimitCnt()
StatsType.TYPE_RESTARTED_CNT -> mSmartCharge.getRestartCnt()
}
}

View file

@ -0,0 +1,6 @@
package com.eurekateam.samsungextras.interfaces
enum class StatsType {
TYPE_LIMITED_CNT,
TYPE_RESTARTED_CNT
}

View file

@ -16,22 +16,20 @@
package com.eurekateam.samsungextras.interfaces
import vendor.eureka.hardware.parts.ISwapOnData
import vendor.eureka.hardware.parts.IBoolCallback
import android.os.ServiceManager
import vendor.eureka.hardware.parts.ISwapOnData
class Swap {
private val mSwap : ISwapOnData
private val mSwap: ISwapOnData
init {
mSwap = ISwapOnData.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.parts.ISwapOnData/default"))
mSwap = ISwapOnData.Stub.asInterface(ServiceManager.waitForDeclaredService("vendor.eureka.hardware.parts.ISwapOnData/default"))
}
external fun setSwapOn(mCallBackEnabled: Boolean)
fun setSwapOff() = mSwap.setSwapOff()
fun mkFile(mSize: Int) = mSwap.makeSwapFile(mSize)
fun delFile() = mSwap.removeSwapFile()
fun isLocked() : Boolean = mSwap.isMutexLocked()
fun isLocked(): Boolean = mSwap.isMutexLocked()
external fun getFreeSpace(): Double
external fun getSwapSize(): Long
}

View file

@ -0,0 +1,6 @@
package com.eurekateam.samsungextras.smartcharge
enum class SelectedOption {
SELECTED_LIMIT,
SELECTED_RESTART
}

View file

@ -0,0 +1,30 @@
/*
* 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.smartcharge
import android.os.Bundle
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity
import com.android.settingslib.collapsingtoolbar.R
class SmartChargeActivity : CollapsingToolbarBaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
supportFragmentManager.beginTransaction().replace(
R.id.content_frame,
SmartChargeFragment()
).commit()
}
}

View file

@ -0,0 +1,163 @@
/*
* 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.smartcharge
import android.content.SharedPreferences
import android.os.Bundle
import android.view.View
import android.widget.Switch
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceManager
import androidx.preference.SeekBarPreference
import com.android.settingslib.widget.ButtonPreference
import com.android.settingslib.widget.MainSwitchPreference
import com.android.settingslib.widget.OnMainSwitchChangeListener
import com.android.settingslib.widget.SelectorWithWidgetPreference
import com.eurekateam.samsungextras.R
import com.eurekateam.samsungextras.interfaces.StatsType
import com.eurekateam.samsungextras.interfaces.SmartCharge
import java.util.concurrent.ScheduledThreadPoolExecutor
import java.util.concurrent.TimeUnit
class SmartChargeFragment : PreferenceFragmentCompat(), OnMainSwitchChangeListener, View.OnClickListener, Preference.OnPreferenceChangeListener, SelectorWithWidgetPreference.OnClickListener {
private lateinit var mLimit: SelectorWithWidgetPreference
private lateinit var mRestart: SelectorWithWidgetPreference
private lateinit var mSharedPreferences: SharedPreferences
private lateinit var mSmartChargeBtn: MainSwitchPreference
private lateinit var mAdjust: SeekBarPreference
private lateinit var mApplyBtn: ButtonPreference
private lateinit var mLimitShow: Preference
private lateinit var mRestartShow: Preference
private lateinit var mLimitStat: Preference
private lateinit var mRestartStat: Preference
private val mPoolExecutor = ScheduledThreadPoolExecutor(3)
private var mSelected = SelectedOption.SELECTED_LIMIT
private val mSmartCharge = SmartCharge()
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.smartcharge_settings)
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
mSmartChargeBtn = findPreference(PREF_SMARTCHARGE_MAIN)!!
mAdjust = findPreference(PREF_ADJUST)!!
mLimit = findPreference(PREF_LIMIT_SELECT)!!
mRestart = findPreference(PREF_RESTART_SELECT)!!
mLimitShow = findPreference(PREF_LIMIT)!!
mRestartShow = findPreference(PREF_RESTART)!!
mLimitStat = findPreference(PREF_LIMIT_STAT)!!
mRestartStat = findPreference(PREF_RESTART_STAT)!!
mApplyBtn = findPreference(PREF_APPLY)!!
mApplyBtn.setOnClickListener(this)
mApplyBtn.isEnabled = false
mSmartChargeBtn.addOnSwitchChangeListener(this)
mAdjust.min = 1
mAdjust.max = 5
mAdjust.value = 3
mAdjust.onPreferenceChangeListener = this
mLimit.setOnClickListener(this)
mRestart.setOnClickListener(this)
}
override fun onRadioButtonClicked(btn: SelectorWithWidgetPreference) {
when (btn) {
mLimit -> {
mSelected = SelectedOption.SELECTED_LIMIT
mRestart.isChecked = false
}
mRestart -> {
mSelected = SelectedOption.SELECTED_RESTART
mLimit.isChecked = false
}
else -> {}
}
}
private inline fun fromStringToNum(s: String): Int {
return if (s.contains("ten")) 10 else if (s.contains("one")) 1 else 0
}
private inline fun fromSelectedToId(): String = when (mSelected) {
SelectedOption.SELECTED_LIMIT -> PREF_LIMIT
SelectedOption.SELECTED_RESTART -> PREF_RESTART
}
override fun onPreferenceChange(preference: Preference, newValue: Any): Boolean {
if (preference == mAdjust) {
var tmp = mSharedPreferences.getInt(fromSelectedToId(), 50)
val toAdd = when (newValue as Int) {
0 -> -10
1 -> -1
3 -> 1
4 -> 10
else -> 0
}
if (tmp + toAdd > 99) tmp = 99 else if (tmp + toAdd < 1) tmp = 1 else tmp += toAdd
mSharedPreferences.edit().putInt(fromSelectedToId(), tmp).apply()
when (mSelected) {
SelectedOption.SELECTED_LIMIT -> mLimitShow
SelectedOption.SELECTED_RESTART -> mRestartShow
}.summary = "$tmp %"
mSmartChargeBtn.isEnabled = false
mApplyBtn.isEnabled = true
mAdjust.value = 3
return true
}
return false
}
override fun onClick(v: View) {
if (v == mApplyBtn) {
val limit = mSharedPreferences.getInt(PREF_LIMIT, 20)
val restart = mSharedPreferences.getInt(PREF_RESTART, 80)
if (limit < restart) {
mSmartCharge.setConfig(limit, restart)
mSmartChargeBtn.isEnabled = true
mApplyBtn.isEnabled = false
}
}
}
private val mScheduler = Runnable {
requireActivity().runOnUiThread {
mLimitStat.summary = "${mSmartCharge.getStats(StatsType.TYPE_LIMITED_CNT)} times"
mRestartStat.summary = "${mSmartCharge.getStats(StatsType.TYPE_RESTARTED_CNT)} times"
}
}
override fun onSwitchChanged(switchView: Switch, isChecked: Boolean) {
if (isChecked) {
mSmartCharge.start()
mPoolExecutor.scheduleWithFixedDelay(mScheduler, 0, 5, TimeUnit.MINUTES)
} else {
mSmartCharge.stop()
mPoolExecutor.shutdown()
}
}
companion object {
const val PREF_SMARTCHARGE_MAIN = "smartcharge"
const val PREF_LIMIT_SELECT = "choose_limit"
const val PREF_RESTART_SELECT = "choose_restart"
const val PREF_LIMIT = "limit"
const val PREF_RESTART = "restart"
const val PREF_LIMIT_STAT = "limit_stat"
const val PREF_RESTART_STAT = "restart_stat"
const val PREF_APPLY = "apply"
const val PREF_ADJUST = "adjust"
}
}

View file

@ -28,10 +28,8 @@ import com.android.settingslib.widget.MainSwitchPreference
import com.android.settingslib.widget.OnMainSwitchChangeListener
import com.eurekateam.samsungextras.R
import com.eurekateam.samsungextras.interfaces.Swap
import java.lang.Thread
import java.util.concurrent.ScheduledThreadPoolExecutor
import java.util.concurrent.TimeUnit
import vendor.eureka.hardware.parts.IBoolCallback
class SwapFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener, OnMainSwitchChangeListener {
private lateinit var mSwapSizePref: SeekBarPreference
@ -79,7 +77,7 @@ class SwapFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeLi
}
// This is called from native - DO NOT CHANGE SIGNATURE
fun reactToCallbackNative(res : Boolean) {
fun reactToCallbackNative(res: Boolean) {
if (!res) {
mSwap.delFile()
mSharedPreferences.edit().putBoolean(PREF_SWAP_ENABLE, false).apply()
@ -101,8 +99,8 @@ class SwapFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeLi
mSwapEnable.isEnabled = true
mSharedPreferences.edit().putBoolean(PREF_SWAP_ENABLE, isChecked).apply()
mSwapSizePref.isEnabled = !isChecked
mFreeSpace.summary = "${mSwap.getFreeSpace()} GB"
mSwapFileSize.summary = "${mSwap.getSwapSize()} MB"
mFreeSpace.summary = "${mSwap.getFreeSpace()} GB"
mSwapFileSize.summary = "${mSwap.getSwapSize()} MB"
}
companion object {