Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,743 Members 43,837 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
K_TECH
Old
(Last edited by K_TECH; 23rd March 2014 at 10:21 PM.)
#1  
K_TECH's Avatar
Senior Member - OP
Thanks Meter 535
Posts: 402
Join Date: Feb 2013
Location: Sidoarjo
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:
Select 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:
Select 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:
Select 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:
Select 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:
Select 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:
Select 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, 75 views)
File Type: zip Settings.zip - [Click for QR Code] (22.1 KB, 149 views)
The Following 9 Users Say Thank You to K_TECH For This Useful Post: [ Click to Expand ]
 
K_TECH
Old
(Last edited by K_TECH; 22nd March 2014 at 11:37 PM.)
#2  
K_TECH's Avatar
Senior Member - OP
Thanks Meter 535
Posts: 402
Join Date: Feb 2013
Location: Sidoarjo
Somes screenshoot



The Following User Says Thank You to K_TECH For This Useful Post: [ Click to Expand ]
 
D2Y aka E
Old
(Last edited by D2Y aka E; 5th April 2014 at 05:16 PM.)
#3  
D2Y aka E's Avatar
Senior Member
Thanks Meter 49
Posts: 225
Join Date: Feb 2014
Location: muara wahau (borneo)
successfully implemented in a custom rom galaxy mini device cm10.1 2 ... thank you for the tutorial mastah ...
 
sitifire
Old
#4  
Senior Member
Thanks Meter 46
Posts: 106
Join Date: Apr 2013
Location: Tanjungpandan
try on stockrom 4.2.2 ...got error in smali/com/android/settings/adi/fragment when recompile it bro...
param 1... I don't know about smali bro... any solution for me...
 
lacoursiere18
Old
#5  
lacoursiere18's Avatar
Recognized Themer
Thanks Meter 3690
Posts: 2,723
Join Date: Jan 2013
Location: Boca Raton

 
DONATE TO ME
Quote:
Originally Posted by sitifire View Post
try on stockrom 4.2.2 ...got error in smali/com/android/settings/adi/fragment when recompile it bro...
param 1... I don't know about smali bro... any solution for me...
Post the error here.. You'll prob have to go through all the smali you added and delete those line it states..
 
sitifire
Old
#6  
Senior Member
Thanks Meter 46
Posts: 106
Join Date: Apr 2013
Location: Tanjungpandan
Quote:
Originally Posted by lacoursiere18 View Post
Post the error here.. You'll prob have to go through all the smali you added and delete those line it states..
it solved bro...thanks for your reply...
I replace all smali in fragments folder with bean ning rom from Adi. I place it in root of Adi's folder,edit display_setting.xml just in last words to replace fragments.DensityChanger with .DensityChanger & don't need to edit AndroidManifest...
I attach my screenshot after I change density to nexus7 213dpi
Click image for larger version

Name:	uploadfromtaptalk1395591106885.jpg
Views:	140
Size:	81.4 KB
ID:	2645867
thanks...

Sent from my GT-I9152 using Tapatalk
 
budi78
Old
#7  
Junior Member
Thanks Meter 1
Posts: 13
Join Date: May 2011
Location: Jakarta
Default work

 
Kameirus
Old
(Last edited by Kameirus; 23rd March 2014 at 07:26 PM.)
#8  
Kameirus's Avatar
Senior Member
Thanks Meter 2134
Posts: 5,698
Join Date: Feb 2010
Location: Red Bluff, California

 
DONATE TO ME
or just use rom toolbox and avoid all the editing of the apk
especially if you flash alot of roms
Current Phones
AT&T LG G2///06/28/2014[LG G2 D800● KK 4.4.4][SOKP》》SONIC OPEN KANG PROJECT][AIO][Weekly Builds]
AT&T Pantech Flex///


Tablet
Nexus 7 (2012) 32gb///06/26/2014[ROM] [4.4.4] [OFFICIAL] LiquidSmooth v3.1 Beta - Grouper


Retired Phones for modding or get rid of
2 HTC HD2s
AT&T Samsung Galaxy S4 Active/sold
 
K_TECH
Old
#9  
K_TECH's Avatar
Senior Member - OP
Thanks Meter 535
Posts: 402
Join Date: Feb 2013
Location: Sidoarjo
NOTE!! IMPORTANT!!
Use APKTOOL V2.0.0 beta 9(latest version) to compile apk, or you'll get error when Recompiling
 
chepay007
Old
#10  
Junior Member
Thanks Meter 6
Posts: 18
Join Date: Jun 2012
Quote:
Originally Posted by sitifire View Post
it solved bro...thanks for your reply...
I replace all smali in fragments folder with bean ning rom from Adi. I place it in root of Adi's folder,edit display_setting.xml just in last words to replace fragments.DensityChanger with .DensityChanger & don't need to edit AndroidManifest...
I attach my screenshot after I change density to nexus7 213dpi
Attachment 2645867
thanks...

Sent from my GT-I9152 using Tapatalk
can u teach me how coz i've got an error too in jb 4.2.2 or can you give me your settings....thx before...


KEEP RESPECT, KEEP LEARNING, KEEP TOGETHER


.::::XPERIENCE TEAM::::.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Enjoy Wallpaper Overload with PhotoPhase

We don’t usually feature live wallpapers on the XDA Portal unless they are somewhat innovative … more

Monitor What Your Phone’s Camera Sees with Android Wear

Having a smart device strapped to your wrist certainly has its merits. A … more

Mod Lets You Have Stereo Speakers on Your Sony Xperia Z1 (Sort Of)

The stereo speakers onthe Sony Xperia Z2areprobably a relatively large … more

Give Your Screen Some Color with HexaTime Live Wallpaper

We don’t often cover very many live wallpapers here on the XDA Portal. You may … more