2

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?

  • I've been told before that apps and web browsers detect the size of the screen in inches. If you can fool that then it should work. I'm posting this as a comment because I have no idea if this is true or how to even research how to do this. I'm very interested in this question so I'm leaving this for someone else to look into. – LateralTerminal Oct 30 '17 at 17:11
1

You could try changing the DPI via this method: http://phandroid.com/2016/05/24/how-to-change-dpi-settings-on-android-n-nexus-no-root/

  1. Open the Settings app
  2. Scroll down to About phone
  3. Tap Build number 7 times (you’ll see a prompt counting down taps to unlock)
  4. Press back to go back into main Settings menu
  5. Select Developer options which now appears at the bottom of Settings
  6. Scroll down and select Smallest width (under the Drawing category)
  7. Your current DPI setting will be displayed — write that down somewhere
  8. Change the value to whatever you like (the bigger the number, the smaller the UI)

and then increasing the font/display size to compensate for the changed UI size. https://www.thurrott.com/mobile/android/77447/android-7-0-nougat-tip-customize-display-font-sizes

Settings > Display > Display size

Settings > Display > Font size

  • As I said, I want all the UI elements to stay at the size they should - that includes navbar buttons, various icons, etc. Increasing font size only introduces cutoff when the element can't fit the font. – Andy Yan Oct 24 '17 at 0:40
  • Doesn't adjusting the 'display size' affect UI elements? – pebd Oct 24 '17 at 14:03
  • Didn't notice that, so I just tried it out - unfortunately any tweaks to the Display Size cancels out the Smallest Width filled in Developer Options (these two actually seems to be tied together). Also, same as setting the DPI alone, only a sufficiently small Smallest Width triggers Tablet UI. – Andy Yan Oct 24 '17 at 14:12
1

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:

  1. Install apktool.
  2. Install your framework-res.apk by executing apktool if /path/to/framework-res.apk.
  3. Decompile your services.jar by executing apktool d /path/to/services.jar.
  4. Go to the decompiled services.jar.out folder and open smali/com/android/server/policy/PhoneWindowManager.smali.
  5. Search for 0x258 and replace the only occurrence of it with 0x0.
  6. Rebuild services.jar (preserve its signature) by executing apktool b -c services.jar.out.
  7. Decompile your SystemUI.apk by executing apktool d /path/to/SystemUI.apk.
  8. Go to the decompiled SystemUI folder, then go to res/layout/.
  9. Remove navigation_layout_rot90.xml.
  10. Make a copy of navigation_layout.xml and rename it to navigation_layout_rot90.xml.
  11. Rebuild SystemUI (preserve its signature) by executing apktool b -c SystemUI.
  12. 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:

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

Tested working on LineageOS 14.1 - the end result is pictured below.

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.

-1

You can download the Apex Launcher and in the settings set "Use tablet UI mode" to true. It is possible that this only applies to the homescreen and the like, but I don't know any app to test it, but you could give it a go.

  • That at best affects home screen (not even the navbar, which frankly is the most important requirement). I use it on a bunch of my old devices (Jelly Bean-era) since they have Tablet UI to match, but yeah this does not bring Tablet UI with it, – Andy Yan Oct 25 '17 at 23:59
  • Ok my bad, sorry! – Luca H Oct 26 '17 at 6:10

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.