Post [GUIDE][MOD][CM9-11] LCD Density Changer

Hello guys, i want to share to you this guide. I took code and smalis from @Adi Aisiteru Reborn. So special thanks to him

by using this mod guide, you'll be able to change LCD Density whatever you want via Settings.apk

Ok lets go to Guide:
first of all need some requirement for this MOD-GUIDE
REQUIREMENT:
- BRAIN
- Patient
- experience
- Know how to decompile/recompiling Apk
- notepad++
- Tool for decompiling, : APKTOOL 2.0.0 beta 9 or latest version
- Tool for Sign apk, : CM Signer

STEP 1
Decompile your settings.apk
- Download attached file and merge it to your decompiled Settings.apk
- Settings.apk\res\values\arrays.xml
add this lines to end of it before </resources>
Code:
    <string-array name="entries_lcd_density">
        <item>240</item>
        <item>242</item>
        <item>244</item>
        <item>246</item>
        <item>248</item>
        <item>250</item>
        <item>252</item>
        <item>254</item>
        <item>256</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>274</item>
        <item>276</item>
        <item>278</item>
        <item>280</item>
        <item>282</item>
        <item>284</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>302</item>
        <item>304</item>
        <item>306</item>
        <item>308</item>
        <item>310</item>
        <item>312</item>
        <item>314</item>
        <item>316</item>
        <item>318</item>
        <item>320</item>
        <item>322</item>
        <item>324</item>
        <item>326</item>
        <item>328</item>
        <item>330</item>
        <item>332</item>
        <item>334</item>
        <item>336</item>
        <item>338</item>
        <item>340</item>
        <item>342</item>
        <item>344</item>
        <item>346</item>
        <item>348</item>
        <item>350</item>
        <item>352</item>
        <item>354</item>
        <item>356</item>
        <item>358</item>
        <item>360</item>
    </string-array>
    <string-array name="lcd_density_entries">
        <item>160</item>
        <item>182</item>
        <item>200</item>
        <item>220</item>
        <item>240</item>
        <item>245</item>
        <item>268</item>
        <item>280</item>
        <item>300</item>
        <item>320</item>
        <item>340</item>
        <item>361</item>
        <item>420</item>
        <item>480</item>
        <item>@string/custom_density</item>
    </string-array>
    <string-array name="lcd_density_stock_entries">
        <item>213 -- nexus7</item>
        <item>240 -- hdpi</item>
        <item>320 -- xhdpi</item>
        <item>480 -- xxhdpi</item>
    </string-array>
    <string-array name="lcd_density_stock_values">
        <item>213</item>
        <item>240</item>
        <item>320</item>
        <item>480</item>
    </string-array>
</resources>
- Settings.apk\res\values\ids.xml
add this lines to end of it before </resources>
Code:
    <item type="id" name="dpi">false</item>
    <item type="id" name="dpi_edit">false</item>
</resources>
- Settings.apk\res\values\strings.xml
add this lines to end of it before </resources>
Code:
    <string name="title_ui">General UI</string>
    <string name="title_ui_summary">Change the LCD Density</string>
    <string name="dpi">DPI</string>
    <string name="lcd_density_title">LCD Density</string>
    <string name="lcd_density_summary">unknown</string>
    <string name="current_lcd_density">"Current LCD Density: "</string>
    <string name="lcd_density_wizard">LCD Density Wizard</string>
    <string name="follow_through_title">Follow through!</string>
    <string name="follow_through_summary">Make sure you follow the steps one-by-one and complete each one before proceeding to the next.</string>
    <string name="stock_density_title">Change to preset values</string>
    <string name="stock_density_summary">Tablets and older phones use 160. Most phones use 240.</string>
    <string name="stock_density_changed_summary">"Density set to: "</string>
    <string name="reboot_title">Reboot NOW!</string>
    <string name="reboot_summary">Come back here after the reboot and complete the rest of the steps!</string>
    <string name="clear_market_data_title">3. Clear all relevant market data.</string>
    <string name="clear_market_data_summary">This step clears data from market, google play services and google services framework.</string>
    <string name="clear_market_data_cleared">Data successfully cleared</string>
    <string name="clear_market_data_donot_cleared">"Data couldn't be cleared, please clear it yourself!"</string>
    <string name="reboot_cleardata_title">4. Reboot!</string>
    <string name="reboot_cleardata_summary">Come back here after the reboot and complete the rest of the steps!</string>
    <string name="open_market_title">5. Open Market and hit accept</string>
    <string name="open_market_summary">Press back when done to return here.</string>
    <string name="open_market_summary_could_not_open">"Couldn't open the market! If you're sure it's installed, open it yourself from the launcher."</string>
    <string name="custom_density_title">Change density to whatever you like!</string>
    <string name="custom_density_summary">Some values may cause compatibility issues with apps and the playstore, use at your own RISK!</string>
    <string name="custom_density_summary_invalid">INVALID DENSITY!</string>
    <string name="stock_density">320 stock</string>
    <string name="custom_density">custom</string>
    <string name="set_custom_density_title">Set custom density</string>
    <string name="set_custom_density_set">Set</string>
    <string name="custom_density_dialog_title">WARNING!</string>
    <string name="custom_density_dialog_summary">Changing your LCD density can cause unexpected app behavior. If you encounter market app incompatibility please return here and restart the process from step 1.</string>
    <string name="custom_density_dialog_button_got">Got it!</string>
    <string name="custom_density_dialog_button_reboot">Reboot now</string>
    <string name="su_dialog_error_title">Warning</string>
    <string name="su_dialog_error_message">"An error occurred.

Please check for root access. To activate go into superuser settings and enable root access."</string>
    <string name="lcd_warning_title">LCD Density Warning</string>
    <string name="lcd_warning">Be Advised that it is recommended to use a Multi-DPI Play Store to avoid any issues with apps after changing your system density. Do you understand?</string>
    <string name="lcd_warning_yes">YES</string>
    <string name="lcd_warning_no">NO</string>
</resources>
- Settings.apk\res\xml\display_settings.xml *you can put the line below whereever you like, system_settings.xml/system_ui_settings,etc
add this line to end of it before </PreferenceScreen>
Code:
    <PreferenceScreen android:title="@string/lcd_density_title" android:key="lcd_density_setup" android:fragment="com.android.settings.adi.fragments.DensityChanger" />
</PreferenceScreen>
- Settings.apk\AndroidManifest.xml
add this line
Code:
        <activity android:label="@string/lcd_density_wizard" android:name=".fragments.DensityChanger">
            <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
- Decompile Settings.apk
- Sign Settings.apk
- then Recompile again

STEP 2
Compare the code below with your public

- Settings\smali\com\android\settings\adi\fragments
Code:
DensityChanger$1.smali
	#56		0x7f07083b	type="string" name="clear_market_data_cleared"

DensityChanger$4.smali
	#52		0x7f0a023b	type="id" name="dpi_edit"
	#120	0x7f070844	type="string" name="custom_density_summary_invalid"
	
DensityChanger$ClearMarketDataTask.smali
	#582	0x7f07083b	type="string" name="clear_market_data_cleared"
	
DensityChanger.smali
	#199	0x7f07084d	type="string" name="su_dialog_error_title"
	#204	0x7f07084e	type="string" name="su_dialog_error_message"
	#209	0x7f070487	type="string" name="ok"
	#239	0x7f050058	type="xml" name="adi_lcd_density_setup"
	#277	0x7f07084f	type="string" name="lcd_warning_title"
	#283	0x7f070850	type="string" name="lcd_warning"
	#289	0x7f070852	type="string" name="lcd_warning_no"
	#299	0x7f070851	type="string" name="lcd_warning_yes"
	#388	0x7f070486	type="string" name="cancel"
	#407	0x7f040095	type="layout" name="adi_alert_dialog_text_entry"
	#427	0x7f070847	type="string" name="set_custom_density_title"
	#445	0x7f070848	type="string" name="set_custom_density_set"
	#496	0x7f070849	type="string" name="custom_density_dialog_title"
	#510	0x7f07084a	type="string" name="custom_density_dialog_summary"
	#530	0x7f07084b	type="string" name="custom_density_dialog_button_got"
	#548	0x7f07084c	type="string" name="custom_density_dialog_button_reboot"
	#627	0x7f070846	type="string" name="custom_density"
	#709	0x7f070836	type="string" name="stock_density_changed_summary"
	#887	0x7f070841	type="string" name="open_market_summary_could_not_open"

NOTE!
DensityChanger$1.smali
#56 0x7f07083b type="string" name="clear_market_data_cleared"
blue = line in smali
red = code in smali and public
green = public
- Decompile Settings.apk
- Sign Settings.apk
- Push Settings.apk in system/app

done ,
have a nice Moding
Good luck
Attached Files
File Type: zip ApkMultitools_CM_signer.zip - [Click for QR Code] (5.4 KB, 74 views)
File Type: zip Settings.zip - [Click for QR Code] (22.1 KB, 148 views)