Reputation: 3875
The SysUI in AOSP is just an app. Very tight to the Android framework though. Is there a recommended way to disable the vanilla SysUI and replace this functionality with a fully independent custom apk? I believe it should be doable since Wear OS seems to do something similar.
Upvotes: 1
Views: 5027
Reputation: 1
for the impatient:
let use LOCAL_OVERRIDES_PACKAGES
LOCAL_SRC_FILES := new_system_ui.apk
LOCAL_OVERRIDES_PACKAGES := SystemUI
inside your Android.mk file
Details: Let use this Android.mk file as an example from here How to Add Pre-built App (System App) in AOSP source code
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := Signal
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := Signal-website-universal-release-4.55.8.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
and let say you have a new_system_ui.apk ( could be a fork of the system_ui with your custom code)
create your custom Android.mk to overwrite the default "system_ui.apk" with the "new_system_ui.apk"
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := Signal
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := new_system_ui.apk <-------YOUR APK---->
LOCAL_OVERRIDES_PACKAGES := SystemUI <-------HERE-------->
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
Extra notes: how you know all is right:
adb shell pm list packages
before you decide to use the LOCAL_OVERRIDES_PACKAGES := SystemUI
LOCAL_OVERRIDES_PACKAGES := SystemUI
and you build/flash the image, there is not going to be any more "com.android.systemui"Upvotes: 0
Reputation: 2008
Yes. You can replace it with a custom one.
The SysUI implement IStatusBar and register it to the framework by IStatusBarService#registerStatusBar, and it create an StatusBarView and add it to WindowManager with type WindowManager.LayoutParams.TYPE_STATUS_BAR. If you do the same logic as the SysUI, and you can replace it.
WearOS only implement two features of SysUI:
So you can implement a full feature SystemUI like the AOSP, and it will be a litte tight to the framework. If the IStatusBar has changed, you should change your app too. Or you can implement a small feature SystemUI like WearOS. NotificationListenerService is stable.
Upvotes: 2