universal7885: add Samsungparts

* It is based on XiaomiParts usually found on Xiaomi device trees

Change-Id: If34ba79bba05ede0ce98bbedf14a1c318bee8fc4
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
roynatech2544 2021-10-21 23:59:46 +09:00
commit 651386dfff
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
75 changed files with 3094 additions and 723 deletions

View file

@ -7,7 +7,7 @@ TARGET_OTA_ASSERT_DEVICE := a20,a20dd
TARGET_KEYMASTER_VARIANT := samsung
# Kernel
TARGET_KERNEL_CONFIG := exynos7885-a20_permissive_defconfig
TARGET_KERNEL_CONFIG := exynos7885-a20_enforcing_defconfig
# Display
TARGET_SCREEN_DENSITY := 411

View file

@ -1,13 +0,0 @@
$(call inherit-product, device/samsung/a20/full_a20.mk)
# Inherit some common Lineage stuff.
$(call inherit-product, vendor/aosp/config/common_full_phone.mk)
PRODUCT_NAME := aosp_a20
TARGET_FACE_UNLOCK_SUPPORTED := true
TARGET_SUPPORTS_GOOGLE_RECORDER := true
TARGET_INCLUDE_STOCK_ARCORE := true
TARGET_INCLUDE_LIVE_WALLPAPERS := true
# Set bootanimation resolution to 7200p
TARGET_BOOT_ANIMATION_RES := 720

View file

@ -1,597 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2009, The Android Open Source 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.
*/
-->
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. Do not translate. -->
<resources>
<bool name="config_dozeAlwaysOnDisplayAvailable">true</bool>
<bool name="config_displayBlanksAfterDoze">true</bool>
<bool name="config_dozePulsePickup">false</bool>
<string name="config_mainBuiltInDisplayCutout">M62,0l-3.8,0l-3.9,0.2l-3.9,0.4l-4,0.8l-3.9,1.2l-3.8,1.6l-3.7,2l-3.4,2.4l-3.1,2.8l-2.9,3l-2.7,3.1l-2.6,3.1 l-2.7,2.8C12.5,28,6.2,30.3,0,30.3c-6.3,0-12.5-2.3-17.5-6.8l-2.7-2.8l-2.6-3.1l-2.7-3.1l-2.9-3l-3.2-2.8 L-35,6.2l-3.7-2l-3.8-1.6l-3.9-1.2l-4-0.8L-54.3,0.2L-58.2,0L-62,0Z @dp</string>
<bool name="config_supportDoubleTapWake">true</bool>
<bool name="config_enableBurnInProtection">true</bool>
<bool name="config_allowAutoBrightnessWhileDozing">true</bool>
<bool name="config_automatic_brightness_available">true</bool>
<integer name="config_autoBrightnessBrighteningLightDebounce">2000</integer>
<integer name="config_autoBrightnessDarkeningLightDebounce">4000</integer>
<integer-array name="config_autoBrightnessDisplayValuesNits">
<item>10</item>
<item>11</item>
<item>15</item>
<item>17</item>
<item>19</item>
<item>25</item>
<item>30</item>
<item>34</item>
<item>38</item>
<item>44</item>
<item>49</item>
<item>67</item>
<item>82</item>
<item>90</item>
<item>102</item>
<item>108</item>
<item>148</item>
<item>183</item>
<item>247</item>
<item>304</item>
<item>350</item>
<item>391</item>
<item>420</item>
<item>420</item>
<item>450</item>
<item>500</item>
<item>550</item>
<item>575</item>
<item>600</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>10</item>
<item>80</item>
<item>162</item>
<item>190</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLevels">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>15</item>
<item>20</item>
<item>25</item>
<item>50</item>
<item>100</item>
<item>300</item>
<item>500</item>
<item>1000</item>
<item>1500</item>
<item>2000</item>
<item>3000</item>
<item>4000</item>
<item>4999</item>
<item>5000</item>
<item>10000</item>
<item>20000</item>
<item>30000</item>
<item>40000</item>
</integer-array>
<integer-array name="config_screenBrightnessBacklight">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>17</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>21</item>
<item>22</item>
<item>23</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>27</item>
<item>28</item>
<item>29</item>
<item>30</item>
<item>31</item>
<item>32</item>
<item>33</item>
<item>34</item>
<item>35</item>
<item>36</item>
<item>37</item>
<item>38</item>
<item>39</item>
<item>40</item>
<item>41</item>
<item>42</item>
<item>43</item>
<item>44</item>
<item>45</item>
<item>46</item>
<item>47</item>
<item>48</item>
<item>49</item>
<item>50</item>
<item>51</item>
<item>52</item>
<item>53</item>
<item>54</item>
<item>55</item>
<item>56</item>
<item>57</item>
<item>58</item>
<item>59</item>
<item>60</item>
<item>61</item>
<item>62</item>
<item>63</item>
<item>64</item>
<item>65</item>
<item>66</item>
<item>67</item>
<item>68</item>
<item>69</item>
<item>70</item>
<item>71</item>
<item>72</item>
<item>73</item>
<item>74</item>
<item>75</item>
<item>76</item>
<item>77</item>
<item>78</item>
<item>79</item>
<item>80</item>
<item>81</item>
<item>82</item>
<item>83</item>
<item>84</item>
<item>85</item>
<item>86</item>
<item>87</item>
<item>88</item>
<item>89</item>
<item>90</item>
<item>91</item>
<item>92</item>
<item>93</item>
<item>94</item>
<item>95</item>
<item>96</item>
<item>97</item>
<item>98</item>
<item>99</item>
<item>100</item>
<item>101</item>
<item>102</item>
<item>103</item>
<item>104</item>
<item>105</item>
<item>106</item>
<item>107</item>
<item>108</item>
<item>109</item>
<item>110</item>
<item>111</item>
<item>112</item>
<item>113</item>
<item>114</item>
<item>115</item>
<item>116</item>
<item>117</item>
<item>118</item>
<item>119</item>
<item>120</item>
<item>121</item>
<item>122</item>
<item>123</item>
<item>124</item>
<item>125</item>
<item>126</item>
<item>127</item>
<item>128</item>
<item>129</item>
<item>130</item>
<item>131</item>
<item>132</item>
<item>133</item>
<item>134</item>
<item>135</item>
<item>136</item>
<item>137</item>
<item>138</item>
<item>139</item>
<item>140</item>
<item>141</item>
<item>142</item>
<item>143</item>
<item>144</item>
<item>145</item>
<item>146</item>
<item>147</item>
<item>148</item>
<item>149</item>
<item>150</item>
<item>151</item>
<item>152</item>
<item>153</item>
<item>154</item>
<item>155</item>
<item>156</item>
<item>157</item>
<item>158</item>
<item>159</item>
<item>160</item>
<item>161</item>
<item>162</item>
<item>163</item>
<item>164</item>
<item>165</item>
<item>166</item>
<item>167</item>
<item>168</item>
<item>169</item>
<item>170</item>
<item>171</item>
<item>172</item>
<item>173</item>
<item>174</item>
<item>175</item>
<item>176</item>
<item>177</item>
<item>178</item>
<item>179</item>
<item>180</item>
<item>181</item>
<item>182</item>
<item>183</item>
<item>184</item>
<item>185</item>
<item>186</item>
<item>187</item>
<item>188</item>
<item>189</item>
<item>190</item>
<item>191</item>
<item>192</item>
<item>193</item>
<item>194</item>
<item>195</item>
<item>196</item>
<item>197</item>
<item>198</item>
<item>199</item>
<item>200</item>
<item>201</item>
<item>202</item>
<item>203</item>
<item>204</item>
<item>205</item>
<item>206</item>
<item>207</item>
<item>208</item>
<item>209</item>
<item>210</item>
<item>211</item>
<item>212</item>
<item>213</item>
<item>214</item>
<item>215</item>
<item>216</item>
<item>217</item>
<item>218</item>
<item>219</item>
<item>220</item>
<item>221</item>
<item>222</item>
<item>223</item>
<item>224</item>
<item>225</item>
<item>226</item>
<item>227</item>
<item>228</item>
<item>229</item>
<item>230</item>
<item>231</item>
<item>232</item>
<item>233</item>
<item>234</item>
<item>235</item>
<item>236</item>
<item>237</item>
<item>238</item>
<item>239</item>
<item>240</item>
<item>241</item>
<item>242</item>
<item>243</item>
<item>244</item>
<item>245</item>
<item>246</item>
<item>247</item>
<item>248</item>
<item>249</item>
<item>250</item>
<item>251</item>
<item>252</item>
<item>253</item>
<item>254</item>
<item>255</item>
</integer-array>
<integer-array name="config_screenBrightnessNits">
<item>2</item>
<item>3</item>
<item>4</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
<item>16</item>
<item>18</item>
<item>19</item>
<item>20</item>
<item>22</item>
<item>24</item>
<item>25</item>
<item>26</item>
<item>28</item>
<item>29</item>
<item>31</item>
<item>32</item>
<item>34</item>
<item>35</item>
<item>36</item>
<item>38</item>
<item>39</item>
<item>41</item>
<item>42</item>
<item>44</item>
<item>45</item>
<item>46</item>
<item>48</item>
<item>49</item>
<item>51</item>
<item>52</item>
<item>54</item>
<item>55</item>
<item>57</item>
<item>58</item>
<item>60</item>
<item>61</item>
<item>62</item>
<item>64</item>
<item>65</item>
<item>67</item>
<item>68</item>
<item>70</item>
<item>71</item>
<item>72</item>
<item>74</item>
<item>75</item>
<item>77</item>
<item>78</item>
<item>80</item>
<item>81</item>
<item>83</item>
<item>84</item>
<item>86</item>
<item>87</item>
<item>88</item>
<item>90</item>
<item>91</item>
<item>93</item>
<item>94</item>
<item>95</item>
<item>97</item>
<item>98</item>
<item>100</item>
<item>101</item>
<item>103</item>
<item>104</item>
<item>105</item>
<item>107</item>
<item>109</item>
<item>110</item>
<item>111</item>
<item>113</item>
<item>114</item>
<item>116</item>
<item>117</item>
<item>119</item>
<item>120</item>
<item>121</item>
<item>123</item>
<item>124</item>
<item>126</item>
<item>127</item>
<item>129</item>
<item>130</item>
<item>131</item>
<item>133</item>
<item>135</item>
<item>136</item>
<item>137</item>
<item>139</item>
<item>140</item>
<item>142</item>
<item>143</item>
<item>145</item>
<item>146</item>
<item>147</item>
<item>149</item>
<item>150</item>
<item>152</item>
<item>153</item>
<item>155</item>
<item>156</item>
<item>157</item>
<item>159</item>
<item>161</item>
<item>162</item>
<item>163</item>
<item>165</item>
<item>166</item>
<item>168</item>
<item>169</item>
<item>171</item>
<item>172</item>
<item>173</item>
<item>175</item>
<item>176</item>
<item>178</item>
<item>179</item>
<item>181</item>
<item>182</item>
<item>183</item>
<item>186</item>
<item>188</item>
<item>189</item>
<item>191</item>
<item>193</item>
<item>195</item>
<item>197</item>
<item>198</item>
<item>201</item>
<item>202</item>
<item>204</item>
<item>206</item>
<item>208</item>
<item>210</item>
<item>212</item>
<item>214</item>
<item>216</item>
<item>217</item>
<item>219</item>
<item>221</item>
<item>223</item>
<item>225</item>
<item>226</item>
<item>229</item>
<item>230</item>
<item>232</item>
<item>234</item>
<item>236</item>
<item>238</item>
<item>240</item>
<item>242</item>
<item>244</item>
<item>245</item>
<item>247</item>
<item>249</item>
<item>251</item>
<item>253</item>
<item>254</item>
<item>257</item>
<item>258</item>
<item>260</item>
<item>262</item>
<item>264</item>
<item>266</item>
<item>268</item>
<item>270</item>
<item>272</item>
<item>273</item>
<item>275</item>
<item>277</item>
<item>279</item>
<item>281</item>
<item>282</item>
<item>285</item>
<item>286</item>
<item>288</item>
<item>290</item>
<item>292</item>
<item>294</item>
<item>296</item>
<item>298</item>
<item>300</item>
<item>301</item>
<item>303</item>
<item>305</item>
<item>307</item>
<item>309</item>
<item>310</item>
<item>313</item>
<item>314</item>
<item>316</item>
<item>318</item>
<item>320</item>
<item>322</item>
<item>324</item>
<item>326</item>
<item>327</item>
<item>329</item>
<item>331</item>
<item>333</item>
<item>335</item>
<item>337</item>
<item>338</item>
<item>341</item>
<item>342</item>
<item>344</item>
<item>346</item>
<item>348</item>
<item>350</item>
<item>352</item>
<item>354</item>
<item>355</item>
<item>357</item>
<item>359</item>
<item>361</item>
<item>363</item>
<item>365</item>
<item>366</item>
<item>369</item>
<item>370</item>
<item>372</item>
<item>374</item>
<item>376</item>
<item>378</item>
<item>379</item>
<item>382</item>
<item>383</item>
<item>385</item>
<item>387</item>
<item>389</item>
<item>391</item>
<item>393</item>
<item>395</item>
<item>397</item>
<item>398</item>
<item>400</item>
<item>402</item>
<item>404</item>
<item>406</item>
<item>407</item>
<item>410</item>
<item>411</item>
<item>413</item>
<item>415</item>
<item>417</item>
<item>419</item>
<item>420</item>
</integer-array>
<!-- The bounding path of the cutout region of the main built-in display.
Must either be empty if there is no cutout region, or a string that is parsable by
{@link android.util.PathParser}.
The path is assumed to be specified in display coordinates with pixel units and in
the display's native orientation, with the origin of the coordinate system at the
center top of the display.
To facilitate writing device-independent emulation overlays, the marker `@dp` can be
appended after the path string to interpret coordinates in dp instead of px units.
Note that a physical cutout should be configured in pixels for the best results.
Example for a 10px x 10px square top-center cutout:
<string ...>M -5,0 L -5,10 L 5,10 L 5,0 Z</string>
Example for a 10dp x 10dp square top-center cutout:
<string ...>M -5,0 L -5,10 L 5,10 L 5,0 Z @dp</string>
@see https://www.w3.org/TR/SVG/paths.html#PathData
-->
<string translatable="false" name="config_mainBuiltInDisplayCutout">M 0,0 H -67.42857142857143 V 30.85714285714286 H 67.42857142857143 V 0 H 0 Z @dp</string>
<string translatable="false" name="config_mainBuiltInDisplayCutoutRectApproximation">@*android:string/config_mainBuiltInDisplayCutout</string>
<!-- If supported, are dreams enabled? (by default) -->
<bool name="config_dreamsEnabledByDefault">false</bool>
<!-- List of biometric sensors on the device, in decreasing strength. Consumed by AuthService
when registering authenticators with BiometricService. Format must be ID:Modality:Strength,
where: IDs are unique per device, Modality as defined in BiometricAuthenticator.java,
and Strength as defined in Authenticators.java -->
<string-array name="config_biometric_sensors" translatable="false" >
<item>0:2:15</item> <!-- ID0:Fingerprint:Strong -->
</string-array>
<!-- For performance and storage reasons, limit the number of fingerprints per user -->
<integer name="config_fingerprintMaxTemplatesPerUser">4</integer>
<!-- Specify if the fingerprint hardware support gestures-->
<bool name="config_fingerprintSupportsGestures">true</bool>
<!-- True if the device supports system navigation keys. -->
<bool name="config_supportSystemNavigationKeys">true</bool>
<!-- Limit for the number of face templates per user -->
<integer name="config_faceMaxTemplatesPerUser">2</integer>
</resources>

View file

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Height of the status bar in landscape. The height should be
Max((status bar content height + waterfall top size), top cutout size) -->
<dimen name="status_bar_height_landscape">24.0dip</dimen>
<!-- Height of the status bar in portrait. The height should be
Max((status bar content height + waterfall top size), top cutout size) -->
<dimen name="status_bar_height_portrait">31.0dip</dimen>
<!-- Default radius of the software rounded corners. -->
<dimen name="rounded_corner_radius">40px</dimen>
</resources>

View file

@ -70,6 +70,7 @@
<item name="cpu.idle">3.79</item>
<item name="cpu.awake">23</item>
<item name="battery.capacity">4000</item>
<item name="battery.typical.capacity">4000</item>
<item name="wifi.controller.idle">1</item>
<item name="wifi.controller.rx">65</item>
<item name="wifi.controller.tx">265</item>

View file

@ -1,2 +0,0 @@
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/aosp_a20e.mk

View file

@ -7,7 +7,7 @@ TARGET_OTA_ASSERT_DEVICE := a20e,a20edd
TARGET_KEYMASTER_VARIANT := samsung
# Kernel
TARGET_KERNEL_CONFIG := exynos7885-a20e_permissive_defconfig
TARGET_KERNEL_CONFIG := exynos7885-a20e_enforcing_defconfig
# Display
TARGET_SCREEN_DENSITY := 320

View file

@ -1,13 +0,0 @@
$(call inherit-product, device/samsung/a20e/full_a20e.mk)
# Inherit some common Lineage stuff.
$(call inherit-product, vendor/aosp/config/common_full_phone.mk)
PRODUCT_NAME := aosp_a20e
TARGET_FACE_UNLOCK_SUPPORTED := true
TARGET_SUPPORTS_GOOGLE_RECORDER := true
TARGET_INCLUDE_STOCK_ARCORE := true
TARGET_INCLUDE_LIVE_WALLPAPERS := true
# Set bootanimation resolution to 7200p
TARGET_BOOT_ANIMATION_RES := 720

View file

@ -0,0 +1,35 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_ANDROID_LIBRARIES := \
androidx.preference_preference
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := SamsungParts
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_USE_AAPT2 := true
LOCAL_RESOURCE_DIR := \
$(LOCAL_PATH)/res \
$(TOP)/packages/resources/devicesettings/res
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
include frameworks/base/packages/SettingsLib/common.mk
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
include $(CLEAR_VARS)
LOCAL_MODULE := SamsungParts.rc
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := $(LOCAL_MODULE)
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/init
include $(BUILD_PREBUILT)

View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eurekateam.samsungextras"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER"/>
<uses-permission android:name="android.permission.CAMERA" />
<protected-broadcast android:name="com.android.systemui.doze.pulse" />
<application
android:label="@string/advanced_settings"
android:supportsRtl="true"
android:theme="@style/CustomOptionsTheme"
android:fullBackupOnly="true"
android:allowBackup="true">
<receiver
android:name=".BootReceiver"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.android.settings.action.EXTRA_SETTINGS" />
</intent-filter>
</receiver>
<activity
android:name=".DeviceSettingsActivity"
android:exported="true"
android:label="@string/advanced_settings"
android:excludeFromRecents="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="com.android.settings.action.EXTRA_SETTINGS" />
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
</intent-filter>
<meta-data
android:name="com.android.settings.dismiss"
android:value="9,13,30" />
<meta-data
android:name="com.android.settings.bg.hint"
android:resource="@color/homepage_parts_background" />
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.homepage" />
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/advanced_settings_summary" />
<meta-data
android:name="com.android.settings.icon"
android:resource="@drawable/ic_device" />
</activity>
<activity
android:name=".speaker.ClearSpeakerActivity"
android:exported="true"
android:label="@string/clear_speaker_title">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".flashlight.FlashLightActivity"
android:exported="true"
android:label="@string/flashlight_title">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".battery.BatteryActivity"
android:exported="true"
android:label="@string/fastcharge_title">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name=".SamsungPartsTile"
android:enabled="true"
android:icon="@drawable/ic_device"
android:label="@string/advanced_settings"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
<service
android:name=".FPSInfoService"
android:exported="false">
</service>
<service
android:name=".FPSTileService"
android:icon="@drawable/ic_fps_info"
android:label="@string/fps_info_title"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
<intent-filter>
<action
android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
</application>
</manifest>

View file

@ -0,0 +1,11 @@
on property:sys.boot_completed=1
chmod 664 /sys/devices/platform/11500000.mali/tmu
chown system system /sys/devices/platform/11500000.mali/tmu
chmod 664 /sys/class/camera/flash/torch_brightness_lvl
chown system system /sys/class/camera/flash/torch_brightness_lvl
chmod 664 /sys/class/camera/flash/torch_brightness_lvl_enable
chown system system /sys/class/camera/flash/torch_brightness_lvl_enable
chmod 664 /sys/devices/platform/battery/power_supply/battery/batt_slate_mode
chmod system system /sys/devices/platform/battery/power_supply/battery/batt_slate_mode
chmod 644 /sys/class/sec/switch/afc_disable
chmod system system /sys/class/sec/switch/afc_disable

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/colorAccent"
android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9c0.83,0 1.5,-0.67 1.5,-1.5 0,-0.39 -0.15,-0.74 -0.39,-1.01 -0.23,-0.26 -0.38,-0.61 -0.38,-0.99 0,-0.83 0.67,-1.5 1.5,-1.5L16,16c2.76,0 5,-2.24 5,-5 0,-4.42 -4.03,-8 -9,-8zM6.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zM9.5,8C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zM14.5,8c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zM17.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z" />
</vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/colorAccent"
android:pathData="M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z" />
</vector>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M16,9H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z" />
</vector>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M7,2V13H10V22L17,10H13L17,2H7Z" />
</vector>

View file

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M10.38 12.33h1.18l-0.59-1.87l-0.59 1.87zm4.69-2.02V7.9h-2.4l-1.7-1.7l-1.7 1.7h-2.4v2.4L5.19 12l1.7 1.7v2.4h2.4l1.7 1.69l1.69-1.7h2.4v-2.4L16.76 12l-1.7-1.7zm-2.92 3.74l-0.36-1.03h-1.64L9.8 14.05H8.82l1.64-4.6h1.02l1.64 4.6h-0.97z"/>
<path
android:fillColor="#000"
android:pathData="M21.06 8.47h2.06v7.06h-2.06z"/>
<path
android:fillColor="#000"
android:pathData="M19.23 3.74H2.7c-1 0-1.83 0.83-1.83 1.84v12.84c0 1.01 0.83 1.84 1.83 1.84h16.52c1 0 1.83-0.83 1.83-1.84V5.58c0-1.01-0.82-1.84-1.83-1.84zm0 14.7H2.7V5.56h16.52v12.86z"/>
</vector>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 crDroid Android 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0" >
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M14.102040767669678,13 H0.10204076766967773 V11 H14.102040767669678 V13 z" />
</vector>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 crDroid Android 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0" >
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M38.0,26.0L26.0,26.0l0.0,12.0l-4.0,0.0L22.0,26.0L10.0,26.0l0.0,-4.0l12.0,0.0L22.0,10.0l4.0,0.0l0.0,12.0l12.0,0.0l0.0,4.0z" />
</vector>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 Havoc-OS
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal" >
<path
android:fillColor="#FFFFFFFF"
android:pathData="M14.123456746339798,12.042328000068665 c0,-0.7430335164070133 -0.6079365134239197,-1.3509700298309326 -1.3509700298309326,-1.3509700298309326 s-1.3509700298309326,0.6079365134239197 -1.3509700298309326,1.3509700298309326 s0.6079365134239197,1.3509700298309326 1.3509700298309326,1.3509700298309326 s1.3509700298309326,-0.6079365134239197 1.3509700298309326,-1.3509700298309326 zM12.772486716508865,5.962962865829468 c-3.3571605241298674,0 -6.079365134239197,2.7222046101093293 -6.079365134239197,6.079365134239197 L4.66666653752327,12.042328000068665 l2.7019400596618652,2.7019400596618652 l2.7019400596618652,-2.7019400596618652 L8.044091612100601,12.042328000068665 c0,-2.6141270077228547 2.1142680966854095,-4.728395104408264 4.728395104408264,-4.728395104408264 s4.728395104408264,2.1142680966854095 4.728395104408264,4.728395104408264 s-2.1142680966854095,4.728395104408264 -4.728395104408264,4.728395104408264 c-1.0199823725223542,0 -1.965661393404007,-0.3309876573085789 -2.742469160556793,-0.8781305193901066 l-0.9591887211799618,0.9726984214782719 C10.097566057443618,17.648853623867033 11.380987585783004,18.12169313430786 12.772486716508865,18.12169313430786 c3.3571605241298674,0 6.079365134239197,-2.7222046101093293 6.079365134239197,-6.079365134239197 s-2.7222046101093293,-6.079365134239197 -6.079365134239197,-6.079365134239197 z" />
</vector>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M16,15H8V5H16M16,1H8C6.89,1 6,1.89 6,3V17A2,2 0 0,0 8,19H16A2,2 0 0,0 18,17V3C18,1.89 17.1,1 16,1M8,23H16V21H8V23Z" />
</vector>

View file

@ -0,0 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000" android:pathData="M11,17V7H4V17H11M11,3A2,2 0 0,1 13,5V19A2,2 0 0,1 11,21H4C2.89,21 2,20.1 2,19V5A2,2 0 0,1 4,3H11M16.5,3H21.5A1.5,1.5 0 0,1 23,4.5V7.5A1.5,1.5 0 0,1 21.5,9H18L15,12V9L15,4.5A1.5,1.5 0 0,1 16.5,3Z" />
</vector>

View file

@ -0,0 +1,12 @@
<!-- drawable/fps_info.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12C20,14.4 19,16.5 17.3,18C15.9,16.7 14,16 12,16C10,16 8.2,16.7 6.7,18C5,16.5 4,14.4 4,12A8,8 0 0,1 12,4M10,6A1,1 0 0,0 9,7A1,1 0 0,0 10,8A1,1 0 0,0 11,7A1,1 0 0,0 10,6M14,6A1,1 0 0,0 13,7A1,1 0 0,0 14,8A1,1 0 0,0 15,7A1,1 0 0,0 14,6M17.09,8.94C16.96,8.94 16.84,8.97 16.7,9L13.5,10.32L13.23,10.43C12.67,10 11.91,9.88 11.25,10.15C10.23,10.56 9.73,11.73 10.15,12.75C10.56,13.77 11.73,14.27 12.75,13.85C13.41,13.59 13.88,13 14,12.28L14.23,12.18L17.45,10.88L17.47,10.87C18,10.66 18.23,10.08 18.03,9.56C17.87,9.18 17.5,8.93 17.09,8.94M7,9A1,1 0 0,0 6,10A1,1 0 0,0 7,11A1,1 0 0,0 8,10A1,1 0 0,0 7,9Z" />
</vector>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M16,6C14.87,6 13.77,6.35 12.84,7H4C2.89,7 2,7.89 2,9V15C2,16.11 2.89,17 4,17H5V18A1,1 0 0,0 6,19H8A1,1 0 0,0 9,18V17H15V18A1,1 0 0,0 16,19H18A1,1 0 0,0 19,18V17H20C21.11,17 22,16.11 22,15V9C22,7.89 21.11,7 20,7H19.15C18.23,6.35 17.13,6 16,6M16,7.5A3.5,3.5 0 0,1 19.5,11A3.5,3.5 0 0,1 16,14.5A3.5,3.5 0 0,1 12.5,11A3.5,3.5 0 0,1 16,7.5M4,9H8V10H4V9M16,9A2,2 0 0,0 14,11A2,2 0 0,0 16,13A2,2 0 0,0 18,11A2,2 0 0,0 16,9M4,11H8V12H4V11M4,13H8V14H4V13Z" />
</vector>

View file

@ -0,0 +1,9 @@
<!-- drawable/hand.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal" >
<path android:fillColor="#000" android:pathData="M6.58,19H14.58V22H6.58V19M19.74,11.6C19.55,11.4 19.29,11.28 19,11.28L18.78,11.31L15.58,13V11.83L16.09,2.9C16.12,2.35 15.7,1.87 15.15,1.84C14.6,1.81 14.12,2.23 14.09,2.78L13.82,7.47H13.58L12.54,7.58V2A1,1 0 0,0 11.54,1C11,1 10.54,1.45 10.54,2V8.41L9.72,8.78L9.03,3.32C8.96,2.77 8.46,2.38 7.91,2.45C7.36,2.5 6.97,3 7.04,3.57L7.81,9.63L7.43,9.8C7.3,9.85 7.18,9.93 7.07,10L5.97,6.11C5.81,5.54 5.25,5.2 4.71,5.34C4.18,5.5 3.88,6.08 4.04,6.65L6.61,15.77C6.61,15.8 6.63,15.84 6.64,15.87L6.67,16H6.68C6.9,16.57 7.47,17 8.08,17H14.58C14.97,17 15.32,16.84 15.58,16.57L20.5,12.37L19.74,11.6Z" />
</vector>

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal" >
<path
android:fillColor="#000"
android:pathData="M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0 c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2 c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1 C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06 c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41 l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41 c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36 c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z" />
</vector>

View file

@ -0,0 +1,9 @@
<!-- drawable/headphone-settings.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000" android:pathData="M19,15v3c0,0.55 -0.45,1 -1,1h-1v-4H19M7,15v4H6c-0.55,0 -1,-0.45 -1,-1v-3H7M12,2c-4.97,0 -9,4.03 -9,9v7c0,1.66 1.34,3 3,3h3v-8H5v-2c0,-3.87 3.13,-7 7,-7s7,3.13 7,7v2h-4v8h3c1.66,0 3,-1.34 3,-3v-7C21,6.03 16.97,2 12,2L12,2z" />
</vector>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000"
android:pathData="M11,0V4H13V0H11M18.3,2.29L15.24,5.29L16.64,6.71L19.7,3.71L18.3,2.29M5.71,2.29L4.29,3.71L7.29,6.71L8.71,5.29L5.71,2.29M12,6A4,4 0 0,0 8,10V16H6V18H9V23H11V18H13V23H15V18H18V16H16V10A4,4 0 0,0 12,6M2,9V11H6V9H2M18,9V11H22V9H18Z" />
</vector>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M0 0h24v24H0z" />
<path
android:fillColor="#000000"
android:pathData="M20 8h-2.81c-0.45-0.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-0.49 0-0.96 0.06 -1.41 0.17 L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-0.05 0.33 -0.09 0.66 -0.09 1v1H4v2h2v1c0 0.34 0.04 0.67 0.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c0.05-0.33 0.09 -0.66 0.09 -1v-1h2v-2h-2v-1c0-0.34-0.04-0.67-0.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z" />
</vector>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:tint="?android:attr/colorControlNormal"
android:viewportHeight="24">
<path
android:pathData="M0 0h24v24H0z" />
<path
android:fillColor="#FFFFFFFF"
android:pathData="M20 4H4c-1.1 0-2 0.9-2 2v12c0 1.1 0.9 2 2 2h16c1.1 0 2-0.9 2-2V6c0-1.1-0.9-2-2-2zM7.76 16.24l-1.41 1.41C4.78 16.1 4 14.05 4 12c0-2.05 0.78 -4.1 2.34-5.66l1.41 1.41C6.59 8.93 6 10.46 6 12s0.59 3.07 1.76 4.24zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm5.66 1.66l-1.41-1.41C17.41 15.07 18 13.54 18 12s-0.59-3.07-1.76-4.24l1.41-1.41C19.22 7.9 20 9.95 20 12c0 2.05-0.78 4.1-2.34 5.66zM12 10c-1.1 0-2 0.9-2 2s0.9 2 2 2 2-0.9 2-2-0.9-2-2-2z" />
</vector>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- drawable/vibration.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0"
android:width="24dp"
android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000" android:pathData="M1,15c0.55,0 1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v4c0,0.55 0.45,1 1,1zM4,17c0.55,0 1,-0.45 1,-1L5,8c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v8c0,0.55 0.45,1 1,1zM22,10v4c0,0.55 0.45,1 1,1s1,-0.45 1,-1v-4c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1zM20,17c0.55,0 1,-0.45 1,-1L21,8c0,-0.55 -0.45,-1 -1,-1s-1,0.45 -1,1v8c0,0.55 0.45,1 1,1zM16.5,3h-9C6.67,3 6,3.67 6,4.5v15c0,0.83 0.67,1.5 1.5,1.5h9c0.83,0 1.5,-0.67 1.5,-1.5v-15c0,-0.83 -0.67,-1.5 -1.5,-1.5zM16,19L8,19L8,5h8v14z" />
</vector>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source 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.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:attr/colorControlHighlight">
<item android:drawable="?android:attr/colorSecondary" />
</ripple>

View file

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014-2016 The Android Open Source 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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="?android:attr/activatedBackgroundIndicator"
android:clipToPadding="false">
<LinearLayout
android:id="@android:id/icon_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="-4dp"
android:minWidth="60dp"
android:gravity="start|center_vertical"
android:orientation="horizontal"
android:paddingEnd="12dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<com.android.internal.widget.PreferenceImageView
android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="48dp"
android:maxHeight="48dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
android:ellipsize="marquee" />
<TextView
android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignStart="@android:id/title"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="10"
android:ellipsize="end" />
<RelativeLayout
android:id="@+id/value_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_below="@android:id/summary"
android:layout_alignStart="@android:id/title" >
<TextView
android:id="@+id/value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="1"
android:ellipsize="end" />
<ImageView
android:id="@+id/reset"
android:src="@drawable/ic_custom_seekbar_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_toEndOf="@id/value"
android:layout_centerVertical="true" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/seekbar_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/value_frame"
android:layout_alignStart="@android:id/title" >
<ImageView
android:id="@+id/minus"
android:src="@drawable/ic_custom_seekbar_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/plus"
android:src="@drawable/ic_custom_seekbar_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true" />
<LinearLayout
android:id="@+id/seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="3dp"
android:layout_toEndOf="@id/minus"
android:layout_toStartOf="@id/plus"
android:layout_centerVertical="true" />
</RelativeLayout>
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="end|center_vertical"
android:paddingStart="16dp"
android:orientation="vertical" />
</LinearLayout>

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/switch_bar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@drawable/switchbar_background"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:clickable="true"
android:gravity="center">
<TextView android:id="@+id/switch_text"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:paddingStart="48dp"
android:maxLines="2"
android:ellipsize="end"
android:textAppearance="@android:style/TextAppearance.Material.Title"
android:textColor="?android:attr/textColorPrimary"
android:textAlignment="viewStart"
android:text="@string/switch_bar_on" />
<Switch
android:id="@android:id/switch_widget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@null"
android:theme="@style/DeviceSettings.SwitchBar" />
</LinearLayout>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="batt_info_menu">
<item>@string/battery_max_capa</item>
<item>@string/battery_chrged_up_to</item>
<item>@string/battery_chrged_up_to_mah</item>
<item>@string/battery_current</item>
<item>@string/battery_status</item>
<item>@string/battery_temp</item>
</string-array>
</resources>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base attributes available to CustomSeekBarPreference. -->
<declare-styleable name="CustomSeekBarPreference">
<attr name="interval" format="integer" />
<attr name="showSign" format="boolean" />
<attr name="units" format="string|reference" />
<attr name="continuousUpdates" format="boolean" />
</declare-styleable>
</resources>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 Havoc-OS
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">
<color name="disabled_text_color">#66000000</color>
<color name="homepage_parts_background">#FFFF6700</color>
</resources>

View file

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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">Device specific tweaks</string>
<!-- Display category -->
<string name="display_category">Display</string>
<!-- Logs -->
<string name="quick_settings_log_tile_label">Logs</string>
<string name="quick_settings_log_tile_dialog_title">Options</string>
<string name="cannot_get_su">Action failed because of missing superuser access</string>
<!-- FPS Info -->
<string name="fps_info_title">FPS info overlay</string>
<string name="fps_info_summary">Show overlay with current frames per second</string>
<!-- Speaker category -->
<string name="speaker_category">Speaker</string>
<!-- Clear Speaker -->
<string name="clear_speaker_title">Clear speaker</string>
<string name="clear_speaker_summary">Play a 30-second audio to clear the speaker</string>
<string name="clear_speaker_description">Run this feature once or twice if you find that your speaker is lightly blocked by dust. Set media volume to maximum.\n\nIf the speaker is blocked heavily, run this feature 25 times while shaking your device with the speaker facing downwards.</string>
<!-- Eureka Kernel features category -->
<string name="eureka_kernel_features">Eureka Kernel Features</string>
<!-- FlashLight -->
<string name="flashlight_title">FlashLight Brightness</string>
<string name="flashlight_summary">Adjust FlashLight Brightness</string>
<string name="flashlight_description">Samsung\'s OneUI Has An Option to Adjust
Flashlight Brightness. AOSP doesn\'t have this feature.\n\n
Use this feature to adjust low or high flashlight brightness. Ranges from 0 to 10.</string>
<!-- GPU Category -->
<string name="gpu_category">GPU</string>
<!-- GPU TMU -->
<string name="gpuexynos_title">Exynos GPU (Mali) Throttling</string>
<string name="gpuexynos_summary">Disable/Enable GPU Throttling</string>
<!-- SELinux -->
<string name="selinux_title">SELinux Status</string>
<string name="selinux_summary">Click here to see current SELinux status</string>
<string name="info_category">Info</string>
<!-- Battery -->
<string name="fastcharge_category">Battery</string>
<string name="fastcharge_2nd_title">FastCharge Settings</string>
<string name="charge_title">Charging Settings</string>
<string name="charge_summary">Enable/Disable Charging here.</string>
<string name="fastcharge_title">Battery Info and Settings</string>
<string name="fastcharge_summary">Enable/Disable Fastcharge Feature</string>
<string name="fastcharge_description">Manage FastCharge 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">Battery Max Capacity (mAh)</string>
<string name="battery_status">Battery Status</string>
<string name="battery_chrged_up_to">Battery Charged Up To (%)</string>
<string name="battery_chrged_up_to_mah">Battery Charged Up To (mAh)</string>
<string name="battery_temp">Battery Current Temperature</string>
<string name="battery_current">Battery Current (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

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomOptionsTheme" parent="@android:style/Theme.DeviceDefault.Settings">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="preferenceTheme">@style/PreferenceTheme</item>
</style>
<style name="PreferenceTheme" parent="@style/PreferenceThemeOverlay.v14.Material">
<item name="preferenceCategoryTitleTextAppearance">@style/TextAppearance.CategoryTitle</item>
</style>
<style name="TextAppearance" parent="android:TextAppearance.DeviceDefault"/>
<style name="TextAppearance.CategoryTitle"
parent="@android:style/TextAppearance.DeviceDefault">
<item name="android:textAllCaps">true</item>
<item name="android:textSize">11sp</item>
<!-- 0.8 Spacing, 0.8/11 = 0.072727273 -->
<item name="android:letterSpacing">0.072727273</item>
</style>
<style name="Theme.Settings" parent="@android:style/Theme.Material.Settings">
<item name="android:actionBarStyle">@style/Theme.ActionBar</item>
<item name="android:colorAccent">#ff4285f4</item>
</style>
<style name="Theme.ActionBar" parent="@android:style/Widget.DeviceDefault.Light.ActionBar.Solid">
<item name="android:titleTextStyle">@style/Theme.Actionbar.Title</item>
</style>
<style name="Theme.Actionbar.Title" parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title">
<item name="android:textColor">#ff4285f4</item>
</style>
<style name="DeviceSettings.SwitchBar" parent="@android:style/ThemeOverlay.Material.ActionBar">
</style>
<style name="TextAppearance.Medium" parent="@android:style/TextAppearance.Material.Medium" />
</resources>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/fastcharge_title">
<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"/>
<ListPreference
android:key="battery_info"
android:title="@string/battery_info_title"
android:summary="@string/battery_info_summary"
android:icon="@drawable/ic_battery"
android:entries="@array/batt_info_menu"/>
<com.android.settingslib.widget.FooterPreference
android:key="footer_preference"
android:title="@string/fastcharge_description"
android:selectable="false" />
</PreferenceScreen>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/clear_speaker_title">
<SwitchPreference
android:key="clear_speaker_pref"
android:title="@string/clear_speaker_title"
android:icon="@drawable/ic_speaker_cleaner_icon"
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

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/flashlight_title">
<com.eurekateam.samsungextras.preferences.CustomSeekBarPreference
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

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<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_speaker_cleaner_icon" >
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.eurekateam.samsungextras.ClearSpeakerActivity"
android:targetPackage="com.eurekateam.samsungextras.speaker" />
</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.FlashLightActivity"
android:targetPackage="com.eurekateam.samsungextras.flashlight" />
</Preference>
</PreferenceCategory>
<PreferenceCategory
android:key="gpu"
android:title="@string/gpu_category">
<SwitchPreference
android:key="gpuexynos_settings"
android:title="@string/gpuexynos_title"
android:icon="@drawable/ic_gpu"
android:summary="@string/gpuexynos_summary"
android:persistent="true"/>
</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.FastChargeActivity"
android:targetPackage="com.eurekateam.samsungextras.fastcharge" />
</Preference>
</PreferenceCategory>
<PreferenceCategory
android:key="info"
android:title="@string/info_category">
<Preference
android:key="selinux_settings"
android:title="@string/selinux_title"
android:icon="@drawable/ic_qs_log"
android:summary="@string/selinux_summary"
android:persistent="true"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,43 @@
/*
* 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
*/
package com.eurekateam.samsungextras;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import androidx.preference.PreferenceManager;
import com.eurekateam.samsungextras.utils.FileUtilsWrapper;
public class BootReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean fpsenabled = sharedPrefs.getBoolean(DeviceSettings.PREF_KEY_FPS_INFO, false);
if (fpsenabled) {
context.startService(new Intent(context, FPSInfoService.class));
}
boolean gpuenabled = sharedPrefs.getBoolean(DeviceSettings.PREF_GPUEXYNOS, false);
if (!gpuenabled){
FileUtilsWrapper.writeLine(GlobalConstants.TMU_SYSFS, "0");
}
}
}

View file

@ -0,0 +1,133 @@
/*
* 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
*/
package com.eurekateam.samsungextras;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
import androidx.preference.PreferenceManager;
import androidx.preference.SwitchPreference;
import com.eurekateam.samsungextras.battery.BatteryActivity;
import com.eurekateam.samsungextras.flashlight.FlashLightActivity;
import com.eurekateam.samsungextras.speaker.ClearSpeakerActivity;
import com.eurekateam.samsungextras.utils.FileUtilsWrapper;
import com.eurekateam.samsungextras.utils.SystemProperties;
public class DeviceSettings extends PreferenceFragment implements
Preference.OnPreferenceChangeListener {
public static final String PREF_KEY_FPS_INFO = "fps_info";
private static final String PREF_CLEAR_SPEAKER = "clear_speaker_settings";
private static final String PREF_FLASHLIGHT = "flashlight_settings";
public static final String PREF_GPUEXYNOS = "gpuexynos_settings";
private static final String PREF_SELINUX = "selinux_settings";
public static final String PREF_BATTERY = "battery_settings";
public DeviceSettings() {
}
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.preferences_samsung_parts, rootKey);
Context mContext = this.getContext();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
Preference mClearSpeakerPref = findPreference(PREF_CLEAR_SPEAKER);
assert mClearSpeakerPref != null;
mClearSpeakerPref.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(getActivity().getApplicationContext(), ClearSpeakerActivity.class);
startActivity(intent);
return true;
});
SwitchPreference mFpsInfo = findPreference(PREF_KEY_FPS_INFO);
assert mFpsInfo != null;
mFpsInfo.setChecked(prefs.getBoolean(PREF_KEY_FPS_INFO, false));
mFpsInfo.setOnPreferenceChangeListener(this);
SwitchPreference mGPUExynos = findPreference(PREF_GPUEXYNOS);
assert mGPUExynos != null;
if (FileUtilsWrapper.isFileReadable(GlobalConstants.TMU_SYSFS)) {
Log.d(GlobalConstants.TAG, "onCreatePreferences: "
+ (GlobalConstants.TMU_SYSFS) + " readable, value " +
FileUtilsWrapper.readOneLine(GlobalConstants.TMU_SYSFS));
mGPUExynos.setChecked(
FileUtilsWrapper.readOneLine(GlobalConstants.TMU_SYSFS).equals("1"));
}else {
Log.w(GlobalConstants.TAG, "onCreatePreferences: "
+ (GlobalConstants.TMU_SYSFS) + " not readable");
mGPUExynos.setEnabled(false);
}
mGPUExynos.setOnPreferenceChangeListener(this);
Preference mSELinux = findPreference(PREF_SELINUX);
assert mSELinux != null;
mSELinux.setOnPreferenceClickListener(preference -> {
boolean selinux_enforcing = SystemProperties.getenforce();
Toast.makeText(getContext(), selinux_enforcing ?
"SELinux is in enforcing state." :
"SELinux is in permissive state.",
Toast.LENGTH_SHORT).show();
return true;
});
Preference mFlashLight = findPreference(PREF_FLASHLIGHT);
mFlashLight.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(getActivity().getApplicationContext(), FlashLightActivity.class);
startActivity(intent);
return true;
});
Preference mFastCharge = findPreference(PREF_BATTERY);
assert mFastCharge != null;
mFastCharge.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(getActivity().getApplicationContext(), BatteryActivity.class);
startActivity(intent);
return true;
});
}
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
final String key = preference.getKey();
switch (key) {
case PREF_KEY_FPS_INFO:
boolean fps_enabled = (Boolean) value;
Intent fpsinfo = new Intent(this.getContext(), FPSInfoService.class);
if (fps_enabled) {
this.getContext().startService(fpsinfo);
} else {
this.getContext().stopService(fpsinfo);
}
break;
case PREF_GPUEXYNOS:
boolean gpu_enabled = (Boolean) value;
Log.d(GlobalConstants.TAG, "onPreferenceChange: Writing " +
gpu_enabled + " to " + GlobalConstants.TMU_SYSFS);
FileUtilsWrapper.writeLine(GlobalConstants.TMU_SYSFS, gpu_enabled ? "1" : "0");
Toast.makeText(getContext(), gpu_enabled ? "GPU Throttling is now enabled."
: "GPU Throttling is now disabled.",
Toast.LENGTH_SHORT).show();
default:
break;
}
return true;
}
}

View file

@ -0,0 +1,50 @@
/*
* 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
*/
package com.eurekateam.samsungextras;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.MenuItem;
public class DeviceSettingsActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setDisplayHomeAsUpEnabled(true);
Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content);
DeviceSettings mDeviceSettingsFragment;
if (fragment == null) {
mDeviceSettingsFragment = new DeviceSettings();
getFragmentManager().beginTransaction()
.add(android.R.id.content, mDeviceSettingsFragment)
.commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View file

@ -0,0 +1,282 @@
/*
* 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.
*/
package com.eurekateam.samsungextras;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Typeface;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
public class FPSInfoService extends Service {
private View mView;
private Thread mCurFPSThread;
private static SurfaceFlingerFPS surfaceFlingerFPS;
private final String TAG = "FPSInfoService";
private String mFps = null;
private IDreamManager mDreamManager;
private class FPSView extends View {
private final Paint mOnlinePaint;
private final float mAscent;
private int mMaxWidth = 0;
private int mNeededWidth;
private int mNeededHeight;
private boolean mDataAvail;
private final Handler mCurFPSHandler = new Handler(Looper.getMainLooper()) {
public void handleMessage(Message msg) {
if (msg.obj == null || msg.what != 1) {
return;
}
String msgData = (String) msg.obj;
mFps = msgData + " FPS";
mDataAvail = true;
updateDisplay();
}
};
FPSView(Context c) {
super(c);
float density = c.getResources().getDisplayMetrics().density;
int paddingPx = Math.round(5 * density);
setPadding(paddingPx, paddingPx, paddingPx, paddingPx);
setBackgroundColor(Color.argb(0x60, 0, 0, 0));
final int textSize = Math.round(12 * density);
Typeface typeface = Typeface.create("monospace", Typeface.NORMAL);
mOnlinePaint = new Paint();
mOnlinePaint.setTypeface(typeface);
mOnlinePaint.setAntiAlias(true);
mOnlinePaint.setTextSize(textSize);
mOnlinePaint.setColor(Color.WHITE);
mOnlinePaint.setShadowLayer(5.0f, 0.0f, 0.0f, Color.BLACK);
mAscent = mOnlinePaint.ascent();
mOnlinePaint.descent();
updateDisplay();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mCurFPSHandler.removeMessages(1);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(resolveSize(mNeededWidth, widthMeasureSpec),
resolveSize(mNeededHeight, heightMeasureSpec));
}
private String getFPSInfoString() {
return mFps;
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!mDataAvail) {
return;
}
final int LEFT = getWidth() - 1;
int y = mPaddingTop - (int) mAscent;
String s = getFPSInfoString();
canvas.drawText(s, LEFT - mPaddingLeft - mMaxWidth,
y - 1, mOnlinePaint);
}
void updateDisplay() {
if (!mDataAvail) {
return;
}
if (mOnlinePaint != null) {
mMaxWidth = (int) mOnlinePaint.measureText(mFps);
}
int neededWidth = mPaddingLeft + mPaddingRight + mMaxWidth;
int neededHeight = mPaddingTop + mPaddingBottom + 40;
if (neededWidth != mNeededWidth || neededHeight != mNeededHeight) {
mNeededWidth = neededWidth;
mNeededHeight = neededHeight;
requestLayout();
} else {
invalidate();
}
}
public Handler getHandler() {
return mCurFPSHandler;
}
}
/**
* Thead to monitor fps
*/
protected static class CurFPSThread extends Thread {
private boolean mInterrupt = false;
private final Handler mHandler;
public CurFPSThread(Handler handler) {
mHandler = handler;
}
public void interrupt() {
mInterrupt = true;
}
@Override
public void run() {
try {
while (!mInterrupt) {
sleep(500);
new StringBuilder();
String fpsVal = String.valueOf(Math.round(surfaceFlingerFPS.getFps()));
mHandler.sendMessage(mHandler.obtainMessage(1, fpsVal));
}
} catch (InterruptedException ignored) {
}
}
}
@Override
public void onCreate() {
super.onCreate();
mView = new FPSView(this);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT);
params.y = 50;
params.gravity = Gravity.START | Gravity.TOP;
params.setTitle("FPS Info");
surfaceFlingerFPS = SurfaceFlingerFPS.getInstance();
startThread();
mDreamManager = IDreamManager.Stub.asInterface(
ServiceManager.checkService(DreamService.DREAM_SERVICE));
IntentFilter screenStateFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
screenStateFilter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(mScreenStateReceiver, screenStateFilter);
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.addView(mView, params);
}
@Override
public void onDestroy() {
super.onDestroy();
stopThread();
((WindowManager) getSystemService(WINDOW_SERVICE)).removeView(mView);
mView = null;
unregisterReceiver(mScreenStateReceiver);
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
private final BroadcastReceiver mScreenStateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
Log.d(TAG, "ACTION_SCREEN_ON " + isDozeMode());
if (!isDozeMode()) {
startThread();
mView.setVisibility(View.VISIBLE);
}
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
Log.d(TAG, "ACTION_SCREEN_OFF");
mView.setVisibility(View.GONE);
stopThread();
}
}
};
/**
* Find is the device is in doze mode
* @return true if device is in doze mode, else false
*/
private boolean isDozeMode() {
try {
if (mDreamManager != null && mDreamManager.isDreaming()) {
return true;
}
} catch (RemoteException e) {
return false;
}
return false;
}
private void startThread() {
Log.d(TAG, "started CurFPSThread");
mCurFPSThread = new CurFPSThread(mView.getHandler());
surfaceFlingerFPS.start();
mCurFPSThread.start();
}
private void stopThread() {
if (mCurFPSThread != null && mCurFPSThread.isAlive()) {
Log.d(TAG, "stopping CurFPSThread");
surfaceFlingerFPS.stop();
mCurFPSThread.interrupt();
try {
mCurFPSThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
mCurFPSThread = null;
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright (C) 2020 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.
*/
package com.eurekateam.samsungextras;
import android.app.ActivityManager;
import android.content.Intent;
import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;
// TODO: Add FPS drawables
public class FPSTileService extends TileService {
private boolean isShowing = false;
public FPSTileService() { }
@Override
public void onStartListening() {
super.onStartListening();
ActivityManager manager =
(ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service :
manager.getRunningServices(Integer.MAX_VALUE)) {
if (FPSInfoService.class.getName().equals(
service.service.getClassName())) {
isShowing = true;
}
}
updateTile();
}
@Override
public void onClick() {
Intent fpsinfo = new Intent(this, FPSInfoService.class);
if (!isShowing)
this.startService(fpsinfo);
else
this.stopService(fpsinfo);
isShowing = !isShowing;
updateTile();
}
/**
* Update tile
*/
private void updateTile() {
final Tile tile = getQsTile();
tile.setState(isShowing ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
tile.updateTile();
}
}

View file

@ -0,0 +1,26 @@
package com.eurekateam.samsungextras;
public class GlobalConstants {
/**
* Global Variables
*/
public static final String FLASHLIGHT_SYSFS = "/sys/class/camera/flash/" +
"torch_brightness_lvl";
public static final String FLASHLIGHT_SYSFS_ENABLE = "/sys/class/camera/" +
"flash/torch_brightness_lvl_enable";
public static final String TMU_SYSFS = "/sys/devices/platform/11500000.mali/tmu";
public static final String TAG = "SamsungExtras";
public static final String FASTCHARGE_SYSFS = "/sys/class/sec/switch/afc_disable";
public static final String CHARGE_DISABLE_SYSFS = "/sys/devices/platform/battery/" +
"power_supply/battery/batt_slate_mode";
public static final String BATTERY_CAPACITY_MAX_SYSFS = "/sys/devices/platform/battery/"
+ "power_supply/battery/charge_full";
public static final String BATTERY_TEMP_SYSFS = "/sys/devices/platform/battery/"
+ "power_supply/battery/batt_temp";
public static final String BATTERY_CAPACITY_CURRENT_SYSFS = "/sys/devices/platform/battery/"
+ "power_supply/battery/capacity";
public static final String BATTERY_CURRENT_SYSFS = "/sys/devices/platform/battery/"
+ "power_supply/battery/current_now";
public static final String BATTERY_TIME_TO_FULL_SYSFS = "/sys/devices/platform/battery/"
+ "power_supply/battery/time_to_full_now";
}

View file

@ -0,0 +1,20 @@
package com.eurekateam.samsungextras;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.service.quicksettings.TileService;
public class SamsungPartsTile extends TileService {
@Override
public void onClick() {
try {
Intent intent = new Intent(this, DeviceSettingsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityAndCollapse(intent);
} catch (ActivityNotFoundException ignored) {
// At this point, the app is most likely hidden and set to only open from Settings
Intent intent = new Intent(this, DeviceSettings.class);
startActivityAndCollapse(intent);
}
}
}

View file

@ -0,0 +1,39 @@
/*
* Copyright (C) 2013 The OmniROM Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.eurekateam.samsungextras;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import androidx.preference.PreferenceManager;
public class Startup extends BroadcastReceiver {
@Override
public void onReceive(final Context context, final Intent bootintent) {
boolean enabled;
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
enabled = sharedPrefs.getBoolean(DeviceSettings.PREF_KEY_FPS_INFO, false);
if (enabled) {
context.startService(new Intent(context, FPSInfoService.class));
}
}
}

View file

@ -0,0 +1,182 @@
package com.eurekateam.samsungextras;
import android.os.IBinder;
import android.os.Parcel;
import android.os.ServiceManager;
/*
* Copyright (C) 2020-2021 Samsung Electronics Co. Ltd
* This Class is based on Samsung's OneUI 3.1
* /system/frameworks/gamesdk.jar
*/
public class SurfaceFlingerFPS {
private double mFps;
private final Object mLock;
private long mPrevFPSCheckStartTime;
private int mPrevFlipCount;
private double mPrevFps;
public boolean running;
private long mPrevPrevCheckStartTime;
private int mPrevPrevFlipCount;
private volatile boolean mSkipUpdate;
private volatile boolean mStopThread;
private ThreadGetFlip mThread;
private SurfaceFlingerFPS() {
this.mThread = null;
this.mStopThread = false;
this.mSkipUpdate = false;
this.mLock = new Object();
this.mFps = 0.0d;
this.mPrevFps = 0.0d;
this.mPrevFlipCount = 0;
this.mPrevFPSCheckStartTime = 0;
this.mPrevPrevFlipCount = 0;
this.mPrevPrevCheckStartTime = 0;
}
/**
* Starts the thread
*/
public void start() {
synchronized (this) {
if (this.mThread == null || this.mStopThread) {
this.mStopThread = false;
ThreadGetFlip threadGetFlip = new ThreadGetFlip();
this.mThread = threadGetFlip;
threadGetFlip.start();
running = true;
}
}
}
/**
* Stops the thread
*/
public void stop() {
synchronized (this) {
this.mStopThread = true;
if (this.mThread != null) {
this.mThread.interrupt();
}
this.mThread = null;
running = false;
}
}
/**
* Check if the fps monitor is able to start
* @return true if able to start, else false
*/
private boolean isAvailable() {
return this.mStopThread || this.mThread == null;
}
private void updateCurrentFps() {
try {
synchronized (this.mLock) {
this.mSkipUpdate = true;
long curTime = System.currentTimeMillis();
int curFlipCount = getFlipCount();
if (curTime - this.mPrevFPSCheckStartTime < 200) {
this.mFps = ((double) (curFlipCount - this.mPrevPrevFlipCount)) / (((double) (curTime - this.mPrevPrevCheckStartTime)) / 1000.0d);
} else {
this.mFps = ((double) (curFlipCount - this.mPrevFlipCount)) / (((double) (curTime - this.mPrevFPSCheckStartTime)) / 1000.0d);
}
if (this.mFps < 1.0d) {
this.mFps = this.mPrevFps;
}
this.mPrevFlipCount = curFlipCount;
this.mPrevFPSCheckStartTime = curTime;
this.mPrevFps = this.mFps;
this.mSkipUpdate = false;
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Gets the fps value from internal thread
* @return fps value in Double
*/
public double getFps() {
if (isAvailable()) {
return -999.0d;
}
updateCurrentFps();
return this.mFps;
}
/**
* Gets the flip count from SurfaceFlinger Service
* @return flip count
*/
private int getFlipCount() {
int flipCount = -1;
try {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
IBinder surfaceFlinger = ServiceManager.getService("SurfaceFlinger");
data.writeInterfaceToken("android.ui.ISurfaceComposer");
if (surfaceFlinger != null && surfaceFlinger.transact(1013, data, reply, 0)) {
flipCount = reply.readInt();
}
} catch (Exception e) {
e.printStackTrace();
}
data.recycle();
reply.recycle();
} catch (Exception e2) {
e2.printStackTrace();
}
return flipCount;
}
/* access modifiers changed from: private */
public void updateFlipCountRecord() {
try {
synchronized (this.mLock) {
this.mPrevPrevCheckStartTime = this.mPrevFPSCheckStartTime;
this.mPrevPrevFlipCount = this.mPrevFlipCount;
this.mPrevFPSCheckStartTime = System.currentTimeMillis();
this.mPrevFlipCount = getFlipCount();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/* access modifiers changed from: private */
/* loaded from: classes.dex */
public class ThreadGetFlip extends Thread {
private ThreadGetFlip() {
}
@Override // java.lang.Thread, java.lang.Runnable
public void run() {
while (!SurfaceFlingerFPS.this.mStopThread) {
if (!SurfaceFlingerFPS.this.mSkipUpdate) {
SurfaceFlingerFPS.this.updateFlipCountRecord();
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
/**
* Gets an instance of this class
* @return new instance
*/
public static SurfaceFlingerFPS getInstance(){
return new SurfaceFlingerFPS();
}
}

View file

@ -0,0 +1,51 @@
/*
* Copyright (C) 2020 Paranoid Android
*
* 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.battery;
import android.app.Fragment;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.fragment.app.FragmentActivity;
public class BatteryActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setDisplayHomeAsUpEnabled(true);
Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content);
BatteryFragment batteryFragment;
if (fragment == null) {
batteryFragment = new BatteryFragment();
getFragmentManager().beginTransaction()
.add(android.R.id.content, batteryFragment)
.commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View file

@ -0,0 +1,117 @@
/*
* Copyright (C) 2020 Paranoid Android
*
* 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.battery;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.widget.Toast;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
import androidx.preference.SwitchPreference;
import com.eurekateam.samsungextras.GlobalConstants;
import com.eurekateam.samsungextras.R;
import com.eurekateam.samsungextras.utils.FileUtilsWrapper;
public class BatteryFragment extends PreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String PREF_FASTCHARGE = "fastcharge_pref";
private static final String PREF_CHARGE = "charge_pref";
private static final String BATTERY_INFO = "battery_info";
private SwitchPreference mFastChargePref;
private SwitchPreference mChargePref;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.battery_settings);
mFastChargePref = findPreference(PREF_FASTCHARGE);
assert mFastChargePref != null;
mFastChargePref.setOnPreferenceChangeListener(this);
mFastChargePref.setEnabled(FileUtilsWrapper.
fileExists(GlobalConstants.FASTCHARGE_SYSFS));
if (FileUtilsWrapper.isFileReadable(GlobalConstants.FLASHLIGHT_SYSFS)){
Log.d(GlobalConstants.TAG, "onCreatePreferences: " +
GlobalConstants.FASTCHARGE_SYSFS + " readable, value " +
FileUtilsWrapper.readOneLine(GlobalConstants.FASTCHARGE_SYSFS));
mFastChargePref.setChecked(FileUtilsWrapper.readOneLine
(GlobalConstants.FASTCHARGE_SYSFS).equals("0"));
}else{
Log.w(GlobalConstants.TAG, "onCreatePreferences: " +
GlobalConstants.FLASHLIGHT_SYSFS + " not readable");
mFastChargePref.setEnabled(false);
}
mChargePref = findPreference(PREF_CHARGE);
assert mChargePref != null;
mChargePref.setOnPreferenceChangeListener(this);
mChargePref.setEnabled(FileUtilsWrapper.
fileExists(GlobalConstants.CHARGE_DISABLE_SYSFS));
if (FileUtilsWrapper.isFileReadable(GlobalConstants.CHARGE_DISABLE_SYSFS)){
Log.d(GlobalConstants.TAG, "onCreatePreferences: " +
GlobalConstants.CHARGE_DISABLE_SYSFS + " readable, value " +
FileUtilsWrapper.readOneLine(GlobalConstants.CHARGE_DISABLE_SYSFS));
mChargePref.setChecked(FileUtilsWrapper.readOneLine
(GlobalConstants.CHARGE_DISABLE_SYSFS).equals("0"));
}else{
Log.w(GlobalConstants.TAG, "onCreatePreferences: " +
GlobalConstants.FLASHLIGHT_SYSFS + " not readable");
mFastChargePref.setEnabled(false);
}
ListPreference mBatteryInfo = findPreference(BATTERY_INFO);
CharSequence[] items = {
Integer.parseInt(FileUtilsWrapper.readOneLine(GlobalConstants.BATTERY_CAPACITY_MAX_SYSFS)) / 1000 + " mAh",
FileUtilsWrapper.readOneLine(GlobalConstants.BATTERY_CAPACITY_CURRENT_SYSFS) + " %",
Float.parseFloat(FileUtilsWrapper.readOneLine(GlobalConstants.BATTERY_CAPACITY_MAX_SYSFS)) *
Float.parseFloat(FileUtilsWrapper.readOneLine(GlobalConstants.BATTERY_CAPACITY_CURRENT_SYSFS)) / 100000 + " mAh" ,
FileUtilsWrapper.readOneLine(GlobalConstants.BATTERY_CURRENT_SYSFS) + " mAh",
Integer.parseInt(FileUtilsWrapper.readOneLine(GlobalConstants.BATTERY_CURRENT_SYSFS)) >= 0
? "Charging" : "Discharging",
Float.parseFloat(FileUtilsWrapper.readOneLine(GlobalConstants.BATTERY_TEMP_SYSFS)) / 10 + " \u2103",
};
assert mBatteryInfo != null;
mBatteryInfo.setEntryValues(items);
mBatteryInfo.setOnPreferenceChangeListener((preference, newValue) -> {
Toast.makeText(getContext(), (String) newValue, Toast.LENGTH_SHORT).show();
return true;
});
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mFastChargePref) {
Boolean value = (Boolean) newValue;
Log.d(GlobalConstants.TAG, "onPreferenceChange: writing " + value + " to " +
GlobalConstants.FASTCHARGE_SYSFS);
FileUtilsWrapper.writeLine(GlobalConstants.FASTCHARGE_SYSFS, value ? "0" : "1");
mFastChargePref.setChecked(FileUtilsWrapper.readOneLine
(GlobalConstants.FASTCHARGE_SYSFS).equals("0"));
return true;
}else if (preference == mChargePref){
Boolean value = (Boolean) newValue;
Log.d(GlobalConstants.TAG, "onPreferenceChange: writing " + value
+ " to " + GlobalConstants.CHARGE_DISABLE_SYSFS);
FileUtilsWrapper.writeLine(GlobalConstants.CHARGE_DISABLE_SYSFS, value ? "0" : "1");
mChargePref.setChecked(FileUtilsWrapper.readOneLine
(GlobalConstants.CHARGE_DISABLE_SYSFS).equals("0"));
return true;
}
return false;
}
}

View file

@ -0,0 +1,51 @@
/*
* Copyright (C) 2020 Paranoid Android
*
* 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.flashlight;
import android.app.Fragment;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.fragment.app.FragmentActivity;
public class FlashLightActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setDisplayHomeAsUpEnabled(true);
Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content);
FlashLightFragment flashLightFragment;
if (fragment == null) {
flashLightFragment = new FlashLightFragment();
getFragmentManager().beginTransaction()
.add(android.R.id.content, flashLightFragment)
.commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View file

@ -0,0 +1,81 @@
/*
* Copyright (C) 2020 Paranoid Android
*
* 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.flashlight;
import android.os.Bundle;
import android.util.Log;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
import com.eurekateam.samsungextras.GlobalConstants;
import com.eurekateam.samsungextras.R;
import com.eurekateam.samsungextras.preferences.CustomSeekBarPreference;
import com.eurekateam.samsungextras.utils.FileUtilsWrapper;
import com.eurekateam.samsungextras.utils.SystemProperties;
public class FlashLightFragment extends PreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static int divideprefix = 21;
private static final String PREF_FLASHLIGHT = "flashlight_pref";
private CustomSeekBarPreference mFlashLightPref;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.flashlight_settings);
if (SystemProperties.read("ro.product.device").contains("a10")){
divideprefix = 1;
}
mFlashLightPref = findPreference(PREF_FLASHLIGHT);
assert mFlashLightPref != null;
mFlashLightPref.setOnPreferenceChangeListener(this);
mFlashLightPref.setMax(10);
mFlashLightPref.setMin(0);
mFlashLightPref.setEnabled(FileUtilsWrapper.
fileExists(GlobalConstants.FLASHLIGHT_SYSFS));
if (FileUtilsWrapper.isFileReadable(GlobalConstants.FLASHLIGHT_SYSFS)){
Log.d(GlobalConstants.TAG, "onCreatePreferences: " +
GlobalConstants.FLASHLIGHT_SYSFS + " readable, value " +
Integer.parseInt(
FileUtilsWrapper.readOneLine(GlobalConstants.FLASHLIGHT_SYSFS)));
mFlashLightPref.setValue(Integer.parseInt(
FileUtilsWrapper.readOneLine(GlobalConstants.FLASHLIGHT_SYSFS))
/ divideprefix);
}else{
Log.w(GlobalConstants.TAG, "onCreatePreferences: " +
GlobalConstants.FLASHLIGHT_SYSFS + " not readable");
mFlashLightPref.setEnabled(false);
}
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mFlashLightPref) {
Integer value = (Integer) newValue;
Log.d(GlobalConstants.TAG, "onPreferenceChange: writing 1 to " +
GlobalConstants.FLASHLIGHT_SYSFS_ENABLE);
FileUtilsWrapper.writeLine(GlobalConstants.FLASHLIGHT_SYSFS_ENABLE, "1");
Log.d(GlobalConstants.TAG, "onPreferenceChange: writing " + value
+ " to " + GlobalConstants.FLASHLIGHT_SYSFS);
FileUtilsWrapper.writeLine(GlobalConstants.FLASHLIGHT_SYSFS, String.valueOf(value));
mFlashLightPref.setValue(value, true);
return true;
}
return false;
}
}

View file

@ -0,0 +1,328 @@
package com.eurekateam.samsungextras.preferences;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import androidx.core.content.res.TypedArrayUtils;
import androidx.preference.*;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import com.eurekateam.samsungextras.R;
public class CustomSeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener,
View.OnClickListener, View.OnLongClickListener {
protected final String TAG = getClass().getName();
private static final String APP_NS = "http://schemas.android.com/apk/res-auto";
protected static final String ANDROIDNS = "http://schemas.android.com/apk/res/android";
protected int mInterval = 1;
protected boolean mShowSign = false;
protected String mUnits = "";
protected boolean mContinuousUpdates = false;
protected int mMinValue = 1;
protected int mMaxValue = 256;
protected boolean mDefaultValueExists = false;
protected int mDefaultValue;
protected int mValue;
protected TextView mValueTextView;
protected ImageView mResetImageView;
protected ImageView mMinusImageView;
protected ImageView mPlusImageView;
protected SeekBar mSeekBar;
protected boolean mTrackingTouch = false;
protected int mTrackingValue;
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomSeekBarPreference);
try {
mShowSign = a.getBoolean(R.styleable.CustomSeekBarPreference_showSign, mShowSign);
String units = a.getString(R.styleable.CustomSeekBarPreference_units);
if (units != null)
mUnits = " " + units;
mContinuousUpdates = a.getBoolean(R.styleable.CustomSeekBarPreference_continuousUpdates, mContinuousUpdates);
} finally {
a.recycle();
}
try {
String newInterval = attrs.getAttributeValue(APP_NS, "interval");
if (newInterval != null)
mInterval = Integer.parseInt(newInterval);
} catch (Exception e) {
Log.e(TAG, "Invalid interval value", e);
}
mMinValue = attrs.getAttributeIntValue(APP_NS, "min", mMinValue);
mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", mMaxValue);
if (mMaxValue < mMinValue)
mMaxValue = mMinValue;
String defaultValue = attrs.getAttributeValue(ANDROIDNS, "defaultValue");
mDefaultValueExists = defaultValue != null && !defaultValue.isEmpty();
if (mDefaultValueExists) {
mDefaultValue = getLimitedValue(Integer.parseInt(defaultValue));
mValue = mDefaultValue;
} else {
mValue = mMinValue;
}
mSeekBar = new SeekBar(context, attrs);
setLayoutResource(R.layout.preference_custom_seekbar);
}
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public CustomSeekBarPreference(Context context, AttributeSet attrs) {
this(context, attrs, TypedArrayUtils.getAttr(context,
androidx.preference.R.attr.preferenceStyle,
android.R.attr.preferenceStyle));
}
public CustomSeekBarPreference(Context context) {
this(context, null);
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
try
{
// move our seekbar to the new view we've been given
ViewParent oldContainer = mSeekBar.getParent();
ViewGroup newContainer = (ViewGroup) holder.findViewById(R.id.seekbar);
if (oldContainer != newContainer) {
// remove the seekbar from the old view
if (oldContainer != null) {
((ViewGroup) oldContainer).removeView(mSeekBar);
}
// remove the existing seekbar (there may not be one) and add ours
newContainer.removeAllViews();
newContainer.addView(mSeekBar, ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
} catch (Exception ex) {
Log.e(TAG, "Error binding view: " + ex.toString());
}
mSeekBar.setMax(getSeekValue(mMaxValue));
mSeekBar.setProgress(getSeekValue(mValue));
mSeekBar.setEnabled(isEnabled());
mValueTextView = (TextView) holder.findViewById(R.id.value);
mResetImageView = (ImageView) holder.findViewById(R.id.reset);
mMinusImageView = (ImageView) holder.findViewById(R.id.minus);
mPlusImageView = (ImageView) holder.findViewById(R.id.plus);
updateValueViews();
mSeekBar.setOnSeekBarChangeListener(this);
mResetImageView.setOnClickListener(this);
mMinusImageView.setOnClickListener(this);
mPlusImageView.setOnClickListener(this);
mResetImageView.setOnLongClickListener(this);
mMinusImageView.setOnLongClickListener(this);
mPlusImageView.setOnLongClickListener(this);
}
protected int getLimitedValue(int v) {
return v < mMinValue ? mMinValue : (v > mMaxValue ? mMaxValue : v);
}
protected int getSeekValue(int v) {
return 0 - Math.floorDiv(mMinValue - v, mInterval);
}
protected String getTextValue(int v) {
return (mShowSign && v > 0 ? "+" : "") + String.valueOf(v) + mUnits;
}
protected void updateValueViews() {
if (mValueTextView != null) {
mValueTextView.setText(getContext().getString(R.string.custom_seekbar_value,
(!mTrackingTouch || mContinuousUpdates ? getTextValue(mValue) +
(mDefaultValueExists && mValue == mDefaultValue ? " (" +
getContext().getString(R.string.custom_seekbar_default_value) + ")" : "")
: getTextValue(mTrackingValue))));
}
if (mResetImageView != null) {
if (!mDefaultValueExists || mValue == mDefaultValue || mTrackingTouch)
mResetImageView.setVisibility(View.INVISIBLE);
else
mResetImageView.setVisibility(View.VISIBLE);
}
if (mMinusImageView != null) {
if (mValue == mMinValue || mTrackingTouch) {
mMinusImageView.setClickable(false);
mMinusImageView.setColorFilter(getContext().getColor(R.color.disabled_text_color),
PorterDuff.Mode.MULTIPLY);
} else {
mMinusImageView.setClickable(true);
mMinusImageView.clearColorFilter();
}
}
if (mPlusImageView != null) {
if (mValue == mMaxValue || mTrackingTouch) {
mPlusImageView.setClickable(false);
mPlusImageView.setColorFilter(getContext().getColor(R.color.disabled_text_color), PorterDuff.Mode.MULTIPLY);
} else {
mPlusImageView.setClickable(true);
mPlusImageView.clearColorFilter();
}
}
}
protected void changeValue(int newValue) {
// for subclasses
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int newValue = getLimitedValue(mMinValue + (progress * mInterval));
if (mTrackingTouch && !mContinuousUpdates) {
mTrackingValue = newValue;
updateValueViews();
} else if (mValue != newValue) {
// change rejected, revert to the previous value
if (!callChangeListener(newValue)) {
mSeekBar.setProgress(getSeekValue(mValue));
return;
}
// change accepted, store it
changeValue(newValue);
persistInt(newValue);
mValue = newValue;
updateValueViews();
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
mTrackingValue = mValue;
mTrackingTouch = true;
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
mTrackingTouch = false;
if (!mContinuousUpdates)
onProgressChanged(mSeekBar, getSeekValue(mTrackingValue), false);
notifyChanged();
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.reset) {
Toast.makeText(getContext(), getContext().getString(R.string.custom_seekbar_default_value_to_set, getTextValue(mDefaultValue)),
Toast.LENGTH_LONG).show();
} else if (id == R.id.minus) {
setValue(mValue - mInterval, true);
} else if (id == R.id.plus) {
setValue(mValue + mInterval, true);
}
}
@Override
public boolean onLongClick(View v) {
int id = v.getId();
if (id == R.id.reset) {
setValue(mDefaultValue, true);
//Toast.makeText(getContext(), getContext().getString(R.string.custom_seekbar_default_value_is_set),
// Toast.LENGTH_LONG).show();
} else if (id == R.id.minus) {
setValue(mMaxValue - mMinValue > mInterval * 2 && mMaxValue + mMinValue < mValue * 2 ? Math.floorDiv(mMaxValue + mMinValue, 2) : mMinValue, true);
} else if (id == R.id.plus) {
setValue(mMaxValue - mMinValue > mInterval * 2 && mMaxValue + mMinValue > mValue * 2 ? -1 * Math.floorDiv(-1 * (mMaxValue + mMinValue), 2) : mMaxValue, true);
}
return true;
}
// dont need too much shit about initial and default values
// its all done in constructor already
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
if (restoreValue)
mValue = getPersistedInt(mValue);
}
@Override
public void setDefaultValue(Object defaultValue) {
if (defaultValue instanceof Integer)
setDefaultValue((Integer) defaultValue, mSeekBar != null);
else
setDefaultValue(defaultValue == null ? (String) null : defaultValue.toString(), mSeekBar != null);
}
public void setDefaultValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (!mDefaultValueExists || mDefaultValue != newValue) {
mDefaultValueExists = true;
mDefaultValue = newValue;
if (update)
updateValueViews();
}
}
public void setDefaultValue(String newValue, boolean update) {
if (mDefaultValueExists && (newValue == null || newValue.isEmpty())) {
mDefaultValueExists = false;
if (update)
updateValueViews();
} else if (newValue != null && !newValue.isEmpty()) {
setDefaultValue(Integer.parseInt(newValue), update);
}
}
public void setMax(int max) {
mMaxValue = max;
mSeekBar.setMax(mMaxValue - mMinValue);
}
public void setMin(int min) {
mMinValue = min;
mSeekBar.setMax(mMaxValue - mMinValue);
}
public void setValue(int newValue) {
mValue = getLimitedValue(newValue);
if (mSeekBar != null) mSeekBar.setProgress(getSeekValue(mValue));
}
public void setValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (mValue != newValue) {
if (update)
mSeekBar.setProgress(getSeekValue(newValue));
else
mValue = newValue;
}
}
public int getValue() {
return mValue;
}
// need some methods here to set/get other attrs at runtime,
// but who really need this ...
public void refresh(int newValue) {
// this will ...
setValue(newValue, mSeekBar != null);
}
}

View file

@ -0,0 +1,29 @@
package com.eurekateam.samsungextras.preferences;
import android.content.Context;
import android.util.AttributeSet;
import com.eurekateam.samsungextras.preferences.SecureSettingsStore;
public class SecureSettingCustomSeekBarPreference extends com.eurekateam.samsungextras.preferences.CustomSeekBarPreference {
public SecureSettingCustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
public SecureSettingCustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
public SecureSettingCustomSeekBarPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
public SecureSettingCustomSeekBarPreference(Context context) {
super(context);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
}

View file

@ -0,0 +1,70 @@
/*
* Copyright (C) 2017 AICP
*
* 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;
import android.text.TextUtils;
import android.util.AttributeSet;
import androidx.preference.ListPreference;
public class SecureSettingListPreference extends ListPreference {
private boolean mAutoSummary = false;
public SecureSettingListPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
public SecureSettingListPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
public SecureSettingListPreference(Context context) {
super(context);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
@Override
public void setValue(String value) {
super.setValue(value);
if (mAutoSummary || TextUtils.isEmpty(getSummary())) {
setSummary(getEntry(), true);
}
}
@Override
public void setSummary(CharSequence summary) {
setSummary(summary, false);
}
private void setSummary(CharSequence summary, boolean autoSummary) {
mAutoSummary = autoSummary;
super.setSummary(summary);
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
// This is what default ListPreference implementation is doing without respecting
// real default value:
//setValue(restoreValue ? getPersistedString(mValue) : (String) defaultValue);
// Instead, we better do
setValue(restoreValue ? getPersistedString((String) defaultValue) : (String) defaultValue);
}
}

View file

@ -0,0 +1,68 @@
/*
* Copyright (C) 2014 The CyanogenMod 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.
*/
package com.eurekateam.samsungextras.preferences;
import android.content.Context;
import android.provider.Settings;
import android.util.AttributeSet;
import androidx.preference.SwitchPreference;
public class SecureSettingSwitchPreference extends SwitchPreference {
public SecureSettingSwitchPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
public SecureSettingSwitchPreference(Context context, AttributeSet attrs) {
super(context, attrs);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
public SecureSettingSwitchPreference(Context context) {
super(context);
setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
}
@Override
protected boolean persistBoolean(boolean value) {
if (shouldPersist()) {
if (value == getPersistedBoolean(!value)) {
// It's already there, so the same as persisting
return true;
}
Settings.Secure.putInt(getContext().getContentResolver(), getKey(), value ? 1 : 0);
return true;
}
return false;
}
@Override
protected boolean getPersistedBoolean(boolean defaultReturnValue) {
if (!shouldPersist()) {
return defaultReturnValue;
}
return Settings.Secure.getInt(getContext().getContentResolver(),
getKey(), defaultReturnValue ? 1 : 0) != 0;
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
setChecked(Settings.Secure.getString(getContext().getContentResolver(), getKey()) != null ? getPersistedBoolean(isChecked())
: (Boolean) defaultValue);
}
}

View file

@ -0,0 +1,74 @@
/*
* Copyright (C) 2017 AICP
* Copyright (C) 2018 CarbonROM
*
* 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.ContentResolver;
import android.preference.PreferenceDataStore;
import android.provider.Settings;
public class SecureSettingsStore extends androidx.preference.PreferenceDataStore
implements PreferenceDataStore {
private final ContentResolver mContentResolver;
public SecureSettingsStore(ContentResolver contentResolver) {
mContentResolver = contentResolver;
}
public boolean getBoolean(String key, boolean defValue) {
return getInt(key, defValue ? 1 : 0) != 0;
}
public float getFloat(String key, float defValue) {
return Settings.Secure.getFloat(mContentResolver, key, defValue);
}
public int getInt(String key, int defValue) {
return Settings.Secure.getInt(mContentResolver, key, defValue);
}
public long getLong(String key, long defValue) {
return Settings.Secure.getLong(mContentResolver, key, defValue);
}
public String getString(String key, String defValue) {
String result = Settings.Secure.getString(mContentResolver, key);
return result == null ? defValue : result;
}
public void putBoolean(String key, boolean value) {
putInt(key, value ? 1 : 0);
}
public void putFloat(String key, float value) {
Settings.Secure.putFloat(mContentResolver, key, value);
}
public void putInt(String key, int value) {
Settings.Secure.putInt(mContentResolver, key, value);
}
public void putLong(String key, long value) {
Settings.Secure.putLong(mContentResolver, key, value);
}
public void putString(String key, String value) {
Settings.Secure.putString(mContentResolver, key, value);
}
}

View file

@ -0,0 +1,51 @@
/*
* Copyright (C) 2020 Paranoid Android
*
* 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.speaker;
import androidx.fragment.app.FragmentActivity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.MenuItem;
public class ClearSpeakerActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setDisplayHomeAsUpEnabled(true);
Fragment fragment = getFragmentManager().findFragmentById(android.R.id.content);
ClearSpeakerFragment clearSpeakerFragment;
if (fragment == null) {
clearSpeakerFragment = new ClearSpeakerFragment();
getFragmentManager().beginTransaction()
.add(android.R.id.content, clearSpeakerFragment)
.commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
}

View file

@ -0,0 +1,117 @@
/*
* Copyright (C) 2020 Paranoid Android
*
* 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.speaker;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragment;
import androidx.preference.SwitchPreference;
import com.eurekateam.samsungextras.R;
import java.io.IOException;
public class ClearSpeakerFragment extends PreferenceFragment implements
Preference.OnPreferenceChangeListener {
private static final String TAG = ClearSpeakerFragment.class.getSimpleName();
private static final String PREF_CLEAR_SPEAKER = "clear_speaker_pref";
private AudioManager mAudioManager;
private Handler mHandler;
private MediaPlayer mMediaPlayer;
private SwitchPreference mClearSpeakerPref;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.clear_speaker_settings);
mClearSpeakerPref = findPreference(PREF_CLEAR_SPEAKER);
mClearSpeakerPref.setOnPreferenceChangeListener(this);
mHandler = new Handler();
mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mClearSpeakerPref) {
boolean value = (Boolean) newValue;
if (value) {
if (startPlaying()) {
mHandler.removeCallbacksAndMessages(null);
mHandler.postDelayed(this::stopPlaying, 30000);
return true;
}
}
}
return false;
}
@Override
public void onStop() {
stopPlaying();
super.onStop();
}
/**
* Start playing speaker-clearing audio
* @return true on success, else false
*/
public boolean startPlaying() {
mAudioManager.setParameters("status_earpiece_clean=on");
mMediaPlayer = new MediaPlayer();
getActivity().setVolumeControlStream(AudioManager.STREAM_MUSIC);
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.setLooping(true);
try {
try (AssetFileDescriptor file = getResources().openRawResourceFd(R.raw.clear_speaker_sound)) {
mMediaPlayer.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength());
}
mClearSpeakerPref.setEnabled(false);
mMediaPlayer.setVolume(1.0f, 1.0f);
mMediaPlayer.prepare();
mMediaPlayer.start();
} catch (IOException ioe) {
Log.e(TAG, "Failed to play speaker clean sound!", ioe);
return false;
}
return true;
}
/**
* Stops and invalidates
*/
public void stopPlaying() {
if (mMediaPlayer != null) {
mMediaPlayer.stop();
mMediaPlayer.reset();
mMediaPlayer.release();
}
mAudioManager.setParameters("status_earpiece_clean=off");
mClearSpeakerPref.setEnabled(true);
mClearSpeakerPref.setChecked(false);
}
}

View file

@ -0,0 +1,120 @@
package com.eurekateam.samsungextras.utils;
/*
* Copyright (C) 2016 The CyanogenMod 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.
*/
import android.os.FileUtils;
import android.util.Log;
import java.io.File;
import java.io.IOException;
public final class FileUtilsWrapper {
private static final String TAG = "FileUtils";
/**
* Reads the first line of text from the given file.
* Reference {@link FileUtils} for clarification on what a line is
*
*/
public static String readOneLine(String fileName){
try {
return FileUtils.readTextFile(new File(fileName),0,null)
.replaceAll("[\n]","");
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
/**
* Writes the given value into the given file
*
*/
public static void writeLine(String fileName, String value){
try {
FileUtils.stringToFile(fileName,value);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Checks whether the given file exists
*
* @return true if exists, false if not
*/
public static boolean fileExists(String fileName) {
final File file = new File(fileName);
return file.exists();
}
/**
* Checks whether the given file is readable
*
* @return true if readable, false if not
*/
public static boolean isFileReadable(String fileName) {
final File file = new File(fileName);
return file.exists() && file.canRead();
}
/**
* Checks whether the given file is writable
*
* @return true if writable, false if not
*/
public static boolean isFileWritable(String fileName) {
final File file = new File(fileName);
return file.exists() && file.canWrite();
}
/**
* Deletes an existing file
*
* @return true if the delete was successful, false if not
*/
public static boolean delete(String fileName) {
final File file = new File(fileName);
boolean ok = false;
try {
ok = file.delete();
} catch (SecurityException e) {
Log.w(TAG, "SecurityException trying to delete " + fileName, e);
}
return ok;
}
/**
* Renames an existing file
*
* @return true if the rename was successful, false if not
*/
public static boolean rename(String srcPath, String dstPath) {
final File srcFile = new File(srcPath);
final File dstFile = new File(dstPath);
boolean ok = false;
try {
ok = srcFile.renameTo(dstFile);
} catch (SecurityException e) {
Log.w(TAG, "SecurityException trying to rename " + srcPath + " to " + dstPath, e);
} catch (NullPointerException e) {
Log.e(TAG, "NullPointerException trying to rename " + srcPath + " to " + dstPath, e);
}
return ok;
}
}

View file

@ -0,0 +1,75 @@
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;
public class SystemProperties {
/**
* To read a prop using getprop
* @param propName the prop name to get
* @return the prop's value, empty string is not found
*/
public static String read(String propName) {
Process process = null;
BufferedReader bufferedReader = null;
String TAG = GlobalConstants.TAG;
try {
String GETPROP_EXECUTABLE_PATH = "/system/bin/getprop";
process = new ProcessBuilder().command(GETPROP_EXECUTABLE_PATH, propName).redirectErrorStream(true).start();
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = bufferedReader.readLine();
if (line == null){
line = ""; //prop not set
}
Log.i(TAG,"read System Property: " + propName + "=" + line);
return line;
} catch (Exception e) {
Log.e(TAG,"Failed to read System Property " + propName,e);
return "";
} finally{
if (bufferedReader != null){
try {
bufferedReader.close();
} catch (IOException ignored) {}
}
if (process != null){
process.destroy();
}
}
}
/**
* @return The status of SELinux on the device
* true: enforcing, false: permissive
*/
public static boolean getenforce() {
Process process = null;
BufferedReader bufferedReader;
String TAG = GlobalConstants.TAG;
try {
String GETENFORCE_EXECUTABLE_PATH = "/system/bin/getenforce";
process = new ProcessBuilder().command(GETENFORCE_EXECUTABLE_PATH).redirectErrorStream(true).start();
bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = bufferedReader.readLine();
if (line == null) {
line = ""; //prop not set
}
Log.i(TAG, "Getenforce: " + line);
return line.equals("Enforcing");
} catch (Exception e) {
Log.e(TAG, "Getenforce failed", e);
} finally {
if (process != null) {
process.destroy();
}
}
return false;
}
}

View file

@ -1,12 +0,0 @@
android_app {
name: "SamsungDAP",
srcs: ["src/**/*.kt"],
certificate: "platform",
platform_apis: true,
optimize: {
proguard_flags_files: ["proguard.flags"],
},
}

View file

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.lineageos.dap"
android:versionCode="1"
android:versionName="1.0"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:label="SamsungDAP"
android:persistent="true"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true">
<receiver android:name="org.lineageos.dap.BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

View file

@ -1,3 +0,0 @@
-keep class org.lineageos.dap.gef.* {
*;
}

View file

@ -1,58 +0,0 @@
/*
* Copyright (c) 2021 The LineageOS 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.
*/
package org.lineageos.dap
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.media.audiofx.AudioEffect
import android.util.Log
import java.util.UUID
class BootCompletedReceiver : BroadcastReceiver() {
private val audioEffect = AudioEffect(
EFFECT_TYPE_DAP, AudioEffect.EFFECT_TYPE_NULL, 0, 0
)
override fun onReceive(context: Context, intent: Intent) {
Log.d(TAG, "Starting")
audioEffect.setParameter(EFFECT_PARAM_EFF_ENAB, 1)
audioEffect.setParameter(EFFECT_PARAM_PROFILE, PROFILE_AUTO)
audioEffect.enabled = true
}
companion object {
private const val TAG = "SamsungDAP"
private val EFFECT_TYPE_DAP = UUID.fromString("46d279d9-9be7-453d-9d7c-ef937f675587")
private const val EFFECT_PARAM_PROFILE = 0
private const val EFFECT_PARAM_STEREO_WIDENING_DISTANCE = 1
private const val EFFECT_PARAM_EFF_ENAB = 19
private const val PROFILE_AUTO = 0
private const val PROFILE_MOVIE = 1
private const val PROFILE_MUSIC = 2
private const val PROFILE_VOICE = 3
private const val PROFILE_GAME = 4
private const val PROFILE_OFF = 5
private const val PROFILE_GAME_1 = 6
private const val PROFILE_GAME_2 = 7
private const val PROFILE_SPACIAL_AUDIO = 8
}
}

View file

@ -0,0 +1,4 @@
genfscon sysfs /devices/platform/11500000.mali/tmu u:object_r:sysfs_gpu_tmu:s0
genfscon sysfs /devices/virtual/camera/flash/torch_brightness_lvl u:object_r:sysfs_flashlight:s0
genfscon sysfs /devices/virtual/camera/flash/torch_brightness_lvl_enable u:object_r:sysfs_flashlight:s0

View file

@ -0,0 +1,4 @@
allow init sysfs_gpu_tmu:file { setattr };
allow init sysfs_flashlight:file { setattr };
allow init sysfs_sec_switch_writable { setattr };
allow init sysfs_battery_writeable { setattr };

View file

@ -0,0 +1,6 @@
allow system_app sysfs_gpu_tmu:file { read open write getattr };
allow system_app sysfs_flashlight:file { read open write getattr };
allow system_app selinuxfs:file rw_file_perms;
allow system_app sysfs_sec_switch:dir { search };
allow system_app sysfs_sec_switch_writable rw_file_perms;
allow system_app sysfs_battery_writeable rw_file_perms;

View file

@ -23,8 +23,7 @@ PRODUCT_PACKAGES += \
android.hardware.audio.effect@7.0-impl \
libtinycompress \
audio.r_submix.default \
audio.usb.default \
SamsungDAP
audio.usb.default
PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/a2dp_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_audio_policy_configuration.xml \

Binary file not shown.

View file

@ -8,7 +8,8 @@ git clone https://github.com/lineageos/android_hardware_samsung_slsi_libbt hardw
git clone https://github.com/lineageos/android_hardware_samsung_slsi_scsc_wifibt_wifi_hal hardware/samsung_slsi/scsc_wifibt/wifi_hal
git clone https://github.com/lineageos/android_hardware_samsung_slsi_scsc_wifibt_wpa_supplicant_lib hardware/samsung_slsi/scsc_wifibt/wpa_supplicant_lib
if ! test -f vendor_detect; then
clang++ device/samsung/universal7885-common/vendor_detect/main.cpp -o vendor_detect -std=c++17
#clang++ device/samsung/universal7885-common/vendor_detect/main.cpp -o vendor_detect -std=c++17
cp device/samsung/universal7885-common/vendor_detect/prebuilt vendor_detect
fi
if ! test -f device/samsung/universal7885-common/vendor_name; then
touch device/samsung/universal7885-common/vendor_name