Android q Launcher taskbar recent transplant

 

I. INTRODUCTION

Because put recent taskbar features ported from android p begin google to the Launcher application module, so Launcher application upgrade to android q biggest migration tasks or recent taskbar features, recently taskbar and system applications system ui has event interactions, such as slide relevant issues related to the navigation bar to be delivered to the nearest taskbar as an event triggering the recent taskbar. When this migration is migration from android p to android q version, the native launcher has a separate directory quickstep this is the nearest task bar module code when androd p version, which relies on system ui relevant code android p google has the relevant code packaged into sysui-shared.jar package and built-in to the next quickstep / libs directory, so do not consider this code depends on when we are doing android p. R & D in order to facilitate debugging compiler will use the android studio to compile the entire project so it is best to rely on the system without an independent association under normal circumstances, of course, when the compiled version of this code is compiled by writing scripts make use of the code also android p sysui-shared.jar package. But android q Launcher recent taskbar code-dependent system ui code does not like p as the relevant code packaged into a jar package and there are a lot of code logic changes, in order to ensure the latter through android studio independent compiler to facilitate debugging does not depend on the whole project code, we need to rely on the relevant codes again packaged into separate jar package and the same structure p. Also compared the quickstep relevant code found a lot of things have changed, if only the replacement jar package can not be used.

Second, the program selected

There are two transplant program:

First, the Android q recently transplanted to the Taskbar Launcher and then transplanted to the previous functionality on existing code

Second, modify the code in the Android p recently taskbar code to do the adaptation

Integrated two options I chose the first for several reasons:

1.android q native code for the entire taskbar by most transplant can avoid a lot of problems baffling

2. We do taskbar recent advances are making changes will not change the whole framework on migration is more convenient interface

3.google frame adjustment native certainly has a lot of optimization, but we can not see it

4. If this is not the whole transplant later versions of updates and google code that gap is growing more difficult to maintain

Third, the migration steps

1. striking wrapped sysui-shared.jar

2. transplant quickstep Catalog code all over again transplanted to Launcher

3. transplant treatment of various compiler issues

4. Compile script writing make realize android studio and make two ways can be compiled by

The smooth running of Android q recently taskbar to ensure that the normal use of the native function

6. The original function to the latest transplant recently taskbar

7. replace the native Launcher

 

1. Kawa换 sysui-shared.jar

Start the migration process took some time to find sysui-shared.jar

Native Launcher introduced sysui-shared. Scripted

ifneq (,$(wildcard frameworks/base))
  LOCAL_STATIC_JAVA_LIBRARIES := SystemUISharedLib launcherprotosnano
  LOCAL_PRIVATE_PLATFORM_APIS := true
else
  LOCAL_STATIC_JAVA_LIBRARIES := libSharedSystemUI libLauncherProtos
  LOCAL_SDK_VERSION := system_current

According to the above script to find out \ target \ common \ obj \ relevant jar package under JAVA_LIBRARIES \ SystemUISharedLib_intermediates directory

Recently taskbar and system ui related code \ \ packages \ SystemUI shared and frameworks \ packages \ SystemUI under frameworks base \ \ base \ plugin_core directory before have considered directly to the code are copied to the quickstep directory to use, but then think of the late It may be bad maintenance

Sysui-shared.jar replace the original package to the top of the jar package taken after

android q sysui-shared.jar Download: https://download.csdn.net/download/zhuxingchong/12060385

2. Catalog code transplant quickstep

Transplant quickstep Catalog code all over again transplanted to Launcher This process is very painful but in order to better safeguard the latter I put up, of course, after the migration is complete compilation error is to solve problems, to ensure android studio compile, because the signature issue android studio can not be compiled apk direct installation can only be compiled compiled with make way through the system to install apk (Signed way system to replace the existing signature android studio which can advance).

After this process of discovery make scripting android p being given contrast native Launcher notice a few differences found in verification include $ (CLEAR_VARS) add back
LOCAL_USE_AAPT2: = to true
LOCAL_AAPT2_ONLY: = to true

3. Run apk ensure native recently taskbar features available

This step is important, because if we have not the premise of ensuring the taskbar native recently has been available since the inquiry function can lead to a lot of strange problems difficult to rule out, the need to pay attention to verify the following:

1. Pull up on the desktop taskbar recently, kill processes and other functions

2. Third-party application interface recently pulled the taskbar

3. Third-party laucnher recently pulled the taskbar

4. The switch between different navigation validates the above circumstances

Note; the various horizontal and vertical screen, task switching animation and other details of the content display

4. transplant recently taskbar own changes

The above features ensure that no problems after transplant our own function, which is a more painful process, we can compare this Android p graft function, it is best to do a certain function after transplantation submit questions to facilitate comparison of code for one version appears to exclude, in some cases under identify problems difficult to rule out what code caused when if we modify a lot of code.

5.make written script compiler

Because I only need to compile with recent taskbar Launcher so streamlined document also convenient to make everyone learn

LOCAL_PATH := $(call my-dir)

#
# Build rule for Launcher3 Go app with quickstep and Go-specific
# version of recents for Android Go devices.
#
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := optional

#
# Build rule for Quickstep library.
#
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_AAPT2_ONLY := true
LOCAL_MODULE_TAGS := optional

#这里是对一些jar和so等库文件引入
include $(CLEAR_VARS)
LOCAL_MODULE := gson3
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_SRC_FILES := libs/gson-2.8.0.jar
LOCAL_UNINSTALLABLE_MODULE := true
#LOCAL_SDK_VERSION := current
LOCAL_PRIVATE_PLATFORM_APIS:=true
include $(BUILD_PREBUILT)


include $(CLEAR_VARS)
LOCAL_MODULE := libxypatch3
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES_32 := libs/armeabi/libxypatch.so
LOCAL_SRC_FILES_64 := libs/arm64-v8a/libxypatch.so
LOCAL_MULTILIB := both
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_SUFFIX := .so
include $(BUILD_PREBUILT)


#
# Build rule for plugin lib (needed to write a plugin).
#
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_AAPT2_ONLY := true
LOCAL_MODULE_TAGS := optional

ifneq (,$(wildcard frameworks/base))
    LOCAL_STATIC_JAVA_LIBRARIES:= PluginCoreLib
else
    LOCAL_STATIC_JAVA_LIBRARIES:= libPluginCore
endif

LOCAL_SRC_FILES := \
    $(call all-java-files-under, src_plugins)

LOCAL_SDK_VERSION := current
LOCAL_MIN_SDK_VERSION := 28
LOCAL_MODULE := LauncherPluginLib

include $(BUILD_STATIC_JAVA_LIBRARY)

#
# Build rule for Launcher3 dependencies lib.
#
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_AAPT2_ONLY := true
LOCAL_MODULE_TAGS := optional

LOCAL_STATIC_ANDROID_LIBRARIES := \
    android-support-compat \
    android-support-media-compat \
    android-support-core-utils \
    android-support-core-ui \
    android-support-fragment \
    android-support-v7-recyclerview \
    android-support-dynamic-animation \
    android-support-design \
	#iconloader_base

LOCAL_STATIC_JAVA_LIBRARIES := LauncherPluginLib

LOCAL_SRC_FILES := \
    $(call all-proto-files-under, protos) \
    $(call all-proto-files-under, proto_overrides) \
    $(call all-java-files-under, src_build_config) \

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res

LOCAL_PROGUARD_ENABLED := disabled



LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/ --proto_path=$(LOCAL_PATH)/proto_overrides/
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java

LOCAL_SDK_VERSION := current
LOCAL_MIN_SDK_VERSION := 21
LOCAL_MODULE := Launcher3CommonDepsLib
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MANIFEST_FILE := AndroidManifest-common.xml

include $(BUILD_STATIC_JAVA_LIBRARY)


#
# Build rule for Quickstep library.
#
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_AAPT2_ONLY := true
LOCAL_MODULE_TAGS := optional

#最近任务栏sysui_shared相关代码引用
ifneq (,$(wildcard frameworks/base))
  LOCAL_STATIC_JAVA_LIBRARIES := SystemUISharedLib launcherprotosnano
  LOCAL_PRIVATE_PLATFORM_APIS := true
else
  LOCAL_STATIC_JAVA_LIBRARIES := libSharedSystemUI libLauncherProtos
  LOCAL_SDK_VERSION := system_current
  LOCAL_MIN_SDK_VERSION := 26
endif

#静态库引入有些重复地方省略
LOCAL_STATIC_JAVA_LIBRARIES += mplus ... objenesis2.13 gson3
LOCAL_JNI_SHARED_LIBRARIES += libxypatch3

#模块名
LOCAL_MODULE := Launcher3QuickStepLib
LOCAL_PRIVILEGED_MODULE := true
LOCAL_STATIC_ANDROID_LIBRARIES := \
    Launcher3CommonDepsLib 

#编译代码路径
LOCAL_SRC_FILES := \
    $(call all-java-files-under, src) \
    $(call all-java-files-under, quickstep/src) \
    $(call all-java-files-under, quickstep/recents_ui_overrides/src) \
	$(call all-java-files-under, iconloaderlib/src) \
	$(call all-java-files-under, iconloaderlib/src_full_lib) \
    $(call all-java-files-under, src_flags) \
    $(call all-java-files-under, src_ui_overrides)

#编译资源路径
LOCAL_RESOURCE_DIR := \
    $(LOCAL_PATH)/quickstep/res \
	$(LOCAL_PATH)/iconloaderlib/res \
    $(LOCAL_PATH)/quickstep/recents_ui_overrides/res
LOCAL_PROGUARD_ENABLED := disabled

#编译AndroidManifest.xml路径
LOCAL_MANIFEST_FILE := quickstep/AndroidManifest.xml
include $(BUILD_STATIC_JAVA_LIBRARY)


#
# Build rule for Quickstep app.
#
include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := optional

LOCAL_STATIC_ANDROID_LIBRARIES := Launcher3QuickStepLib
LOCAL_PROGUARD_ENABLED := disabled

ifneq (,$(wildcard frameworks/base))
  LOCAL_PRIVATE_PLATFORM_APIS := true
else
  LOCAL_SDK_VERSION := system_current
  LOCAL_MIN_SDK_VERSION := 26
endif

#最终Launcher编译名
LOCAL_PACKAGE_NAME := Launcher3QuickStep
LOCAL_PRIVILEGED_MODULE := true
LOCAL_PRODUCT_MODULE := true
LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3
LOCAL_REQUIRED_MODULES := privapp_whitelist_com.android.launcher3

#签名方式
LOCAL_CERTIFICATE := platform


LOCAL_RESOURCE_DIR := \
    $(LOCAL_PATH)/quickstep/res \
    $(LOCAL_PATH)/quickstep/recents_ui_overrides/res

LOCAL_FULL_LIBS_MANIFEST_FILES := \
    $(LOCAL_PATH)/AndroidManifest.xml \
    $(LOCAL_PATH)/AndroidManifest-common.xml

LOCAL_MANIFEST_FILE := quickstep/AndroidManifest.xml
LOCAL_JACK_COVERAGE_INCLUDE_FILTER := com.android.launcher3.*

include $(BUILD_PACKAGE)


include $(CLEAR_VARS)
LOCAL_USE_AAPT2 := true
# ==================================================
include $(call all-makefiles-under,$(LOCAL_PATH))

6.Android studio script compiler build.gradle

This basically no modifications, mainly transplant recently taskbar need to introduce several new directory

to sum up:

android p androd q Launcher transplanted into a person spent a total of about 10 working days, including a deal with the problems and find the original function transplant. Every transplant is a sort of overall structure can help us to a deeper understanding of the project. The whole process needs to pay attention to ways and method steps if there is no way the East 1 West is very easy to mistake the problems cause people to lose patience, summarized above, but also to let other people be able to see how many have a clue, save time.

 

 

 

Published 92 original articles · won praise 27 · views 90000 +

Guess you like

Origin blog.csdn.net/zhuxingchong/article/details/103743848