Force tablet UI on a non-tablet device? I own a large screen phone and am wondering if I could make it recognize itself as a tablet, as in:


The navbar should stay at the bottom instead of rotating to the sides
Notification shade doesn't occupy the whole screen width in portrait / doesn't stay in the middle in landscape
Apps that support tablet layout will use it


AFAIK, a sufficiently small DPI (LCD density) value will trigger the change, but naturally I want the UI elements to stay at a visible, comfortable size. There's supposed to be a trigger (an if-else condition?) that calculates whether tablet UI should be activated based on device metrics and the above DPI value, however I don't know where the actual trigger is or how should I change it to make it always say "tablet". I've seen similar things done to Android versions below 5.0 via Xposed modules, but those are quite outdated by now.

The answer could be using Xposed (not preferred but still alright, since I still need to stay on Nougat for a while), modifying SystemUI, or even modifying the Android source code and building (I have the know-how for that) - one just have to tell me where and how.

Any ideas?
After some digging I am able to sort out a relatively easy solution for the first and most important requirement, that is, keeping the navbar at the bottom. Requires root (of course - to pull and push files) and basic skill of using apktool.

For pre-compiled ROMs:


  
  Install apktool.
  Install your framework-res.apk by executing apktool if /path/to/framework-res.apk.
  Decompile your services.jar by executing apktool d /path/to/services.jar.
  Go to the decompiled services.jar.out folder and open smali/com/android/server/policy/PhoneWindowManager.smali.
  Search for 0x258 and replace the only occurrence of it with 0x0.
  Rebuild services.jar (preserve its signature) by executing apktool b -c services.jar.out.
  Decompile your SystemUI.apk by executing apktool d /path/to/SystemUI.apk.
  Go to the decompiled SystemUI folder, then go to res/layout/.
  Remove navigation_layout_rot90.xml.
  Make a copy of navigation_layout.xml and rename it to navigation_layout_rot90.xml.
  Rebuild SystemUI (preserve its signature) by executing apktool b -c SystemUI.
  Push the finished services.jar and SystemUI.apk back to where they were using a method of your choice, set correct permissions, then reboot.
  


For ROM makers:


  
  Open *build-folder*/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java.
  Search for shortSizeDp &lt; 600 and replace the only occurrence of it with shortSizeDp &lt; 0.
  Find the SystemUI layout files in *build-folder*/frameworks/base/packages/SystemUI/res/layout/ and replace, similar to the method for pre-compiled ROMs.
  Build the ROM.
  


Note that the default button layout doesn't look good under landscape mode, but one can always use the built-in navbar tuner in Android 7.0+ to tweak it to his desire.



As of Android 10, this has been simplified to a single boolean config config_navBarCanMove, which can either be set directly in the framework or separately in an overlay (recommended).