Reputation: 83
I am building AOSP 11 for emulator x86_64 and want to remove Status bar and Navigation bar.
I have found frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarInflaterView.java file where navigation buttons are placed.
By putting following 3 lines in comment, I was able to disable navigation button.
private View createView(String buttonSpec, ViewGroup parent, LayoutInflater inflater) {
View v = null;
String button = extractButton(buttonSpec);
if (LEFT.equals(button)) {
button = extractButton(NAVSPACE);
} else if (RIGHT.equals(button)) {
button = extractButton(MENU_IME_ROTATE);
}
if (HOME.equals(button)) {
// v = inflater.inflate(R.layout.home, parent, false);
} else if (BACK.equals(button)) {
// v = inflater.inflate(R.layout.back, parent, false);
} else if (RECENT.equals(button)) {
// v = inflater.inflate(R.layout.recent_apps, parent, true);
} else if (MENU_IME_ROTATE.equals(button)) {
v = inflater.inflate(R.layout.menu_ime, parent, false);
} else if (NAVSPACE.equals(button)) {
But space is reversed by system, means if I run any application it is not use navigation bar's space.
Also to disable status bar I have Added android:visibility="gone" in frameworks/base/packages/SystemUI/res/layout/status_bar.xml
<com.android.systemui.statusbar.phone.PhoneStatusBarView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
android:layout_width="match_parent"
android:layout_height="@dimen/status_bar_height"
android:id="@+id/status_bar"
android:orientation="vertical"
android:focusable="false"
android:descendantFocusability="afterDescendants"
android:accessibilityPaneTitle="@string/status_bar"
android:visibility="gone"
>
But also in this status bar disabled. but space is reserved by system.
can any one please help in this ?
Upvotes: 2
Views: 2140
Reputation: 4178
You may consider lock task mode
https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode#customize-ui to make a solution within Google's concept for such tasks.
Upvotes: 0
Reputation: 1825
Have you tried this in your device mk file?
PRODUCT_PROPERTY_OVERRIDES += \
qemu.hw.mainkeys=1
This is how we remove the navigation bar on Android 11.
It works because if you look in DisplayLayout.java under SystemUI/src/.../wm, you'll see it checks this property and if it's 1, hasNavigationBar(...) will return false. You could also just edit this method to always return false and you would likely see the same effect.
static boolean hasNavigationBar(DisplayInfo info, Context context, int displayId) {
if (displayId == Display.DEFAULT_DISPLAY) {
// Allow a system property to override this. Used by the emulator.
final String navBarOverride = SystemProperties.get("qemu.hw.mainkeys");
if ("1".equals(navBarOverride)) {
return false;
...
For the status bar, in the past I've added a resource overlay to the device and it has worked. I'm not sure about Android 11 though. The basic idea is you create a file in your device directory with the path overlay/frameworks/base/core/res/res/values/dimens.xml and it would contain:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Height of the status bar -->
<dimen name="status_bar_height">0dip</dimen>
</resources>
If you don't want to deal with an overlay, you could also edit the value in frameworks/base/core/res/res/values/config.xml directly:
<!-- Height of the status bar -->
<dimen name="status_bar_height">@dimen/status_bar_height_portrait</dimen>
Change this value to 0dip and the status bar should be gone.
Upvotes: 3