1

I used Texdroider DPI to change the dpi from 320 to 300 and after the reboot it gets stuck at the lenovo logo. I could just flash it again but i don't have the rom on this pc, and it will take 10h to download it.

Is there any faster way to reset the dpi? I have TWRP installed. With android 5.0.1.

Edit: Output of cat /system/build.prop | grep density is ro.sf.lcd_density=300 Tried editing build.prop back to 320 with Sublime Text. Now the command returns ro.sf.lcd_density=320 but it still gets stuck.

  • 1
    Your Android version and device? Is the USB debugging enabled? Which app did you use? Link it. Boot into TWRP, mount data partition, go to /data/property and confirm us whether persist.sys.lcd_density exists? If it exists, what does it contain? – Firelord Dec 12 '15 at 14:19
  • It's not there. – user1824034 Dec 12 '15 at 14:32
  • Alright, but that does not tell us the Android version you're using. Now, when booted into TWRP, mount system partition, open TWRP's command line and do cat /system/build.prop | grep density. Tell us the result. – Firelord Dec 12 '15 at 14:34
  • # Lenovo-sw wuzb1 2014-10-08 set default density ro.sf.lcd_dencity=300 – user1824034 Dec 12 '15 at 14:42
  • 1
    Thank you so much for trying to help, but I ended up flashing it. – user1824034 Dec 14 '15 at 14:28
1

Note:

  • Parts of this answer didn't work for OP, but nevertheless, they worked in all of my test cases with different ROMs, hence, the answer would certainly prove to be useful for some users.
  • Device should have a custom recovery installed.
  • should be setup in PC and USB debugging be enabled and authorized in the device.
  • Anything mentioned next to # anywhere in a line is a comment.

More or less, the changed DPI value would either be in settings.db, /data/property/persist.sys.lcd_density, /system/build.prop or in memory only. I've covered instructions for all of these cases and they should prove to be helpful when the device gets stuck at boot animation.

  • If it is an Xposed module which changed the DPI and caused boot issue, then try disabling the module or the framework, or, remove the former or both. See my answer here for more info on that.

  • If you used command-line to change DPI (am/wm), then when the device gets stuck at boot animation (past the OEM logo), execute

    adb shell am display-density reset    # For Android 4.2.x
    adb shell wm density reset            # For Android 4.3.x and above
    adb reboot
    
  • In my Android 4.2.1, custom display density is saved as a value for the key display_density_forced in the table global of /data/data/com.android.providers.settings/databases/settings.db. If you've used command-line (am) or an app used this key, follow these steps:

    • When booted into recovery, mount data partition, pull the said file into PC and use an sqlite editor to either remove the key or change the value to a better or default DPI. After that, push the file back to its place.

      adb pull /data/data/com.android.providers.settings/databases/settings.db LOCAL_PATH     # to pull the file into PC
      adb push LOCAL_PATH/settings.db /data/data/com.android.providers.settings/databases/    # to push the file into Android
      adb reboot 
      

      Replace LOCAL_PATH with the directory under which settings.db is to be saved and is saved, respectively.

    In Android 4.3 and above, custom display density can be found under /data/property/persist.sys.lcd_density or by executing adb shell "getprop | grep density". If you used command line (wm) or an app used that property to change DPI then follow these steps:

    • When booted into recovery, mount data partition and do

      adb shell rm /data/property/persist.sys.lcd_density                      # this will cause Android to fall back to default DPI
      adb shell busybox printf "DPI" > /data/property/persist.sys.lcd_density  # change DPI with your custom DPI value
      adb reboot
      
  • Finally, the easiest but a dangerous and extreme approach you or an app would take is to change the DPI for the key ro.sf.lcd_density inside /system/build.prop. The DPI in the said file is considered the stock DPI of that ROM.

    When booted into recovery with data partition mounted,

    • You can choose to override the stock DPI by doing

      # replace DPI with your custom DPI
      adb shell am display-density DPI   # For Android 4.2.x only 
      adb shell wm density DPI           # For Android 4.3.x and above only 
      adb reboot
      
    • If that doesn't work for some reason, do

      adb shell sed -i 's/.*ro.sf.lcd_density.*/ro.sf.lcd_density=DPI/g' /system/build.prop      # sed is replacing the DPI with your custom DPI value
      adb reboot
      
    • If none of the solutions work then your only option is to replace build.prop. If you've a clean backup of system partition or build.prop then use it to replace original file, else flash the ROM as OP did.

Note: I personally did not test, but it has come to my notice to not edit any file of Android using any native text editor of Microsoft Windows OS. Instead, use Notepad++ or altogether do all the editing using command line in recovery.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.