ROM custom notes (1)

1. How to enable mass_storage

(5.1上的方法)当然首先得有调用系统API的权限,然后
UsbManager的setCurrentFunctions(UsbManager.USB_FUNCTION_MASS_STORAGE, true)
StorageManager的enableUsbMassStorage();

2. How to pre-install sogouInput

1. Put sougouinput.apk under the apps directory. Then you need to write a mk file so that the compilation system can recognize

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := SogouInput
LOCAL_MODULE_TAGS := optional
#兼容
LOCAL_MULTILIB :=32

LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
#apk文件用APPS, 并且 会检查 是否是apk文件,动态库so文件用SHARED_LIBRARIES ,bin文件用EXECUTABLES,其他文件 用ETC
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
#若有so,使用LOCAL_PREBUILT_JNI_LIBS列出所有so的路径,不要忘记使用@。@标识符会将apk中的so抽离出来build进apk同级目录下的lib文件夹中
LOCAL_PREBUILT_JNI_LIBS:= \
@lib/armeabi/libbutterfly.so \
@lib/armeabi/libNinepatch.so \
@lib/armeabi/libsogouupdcore.so \
@lib/armeabi/libweibosdkcore.so
#表示 这个apk已经签过名了,系统不需要再次 签名
LOCAL_CERTIFICATE := PRESIGNED

include $(BUILD_PREBUILT)

Of course, if you want to set Sogou as the default input method, you can refer to:
http://blog.csdn.net/wlwl0071986/article/details/47680807

3.keyguard

a. How to achieve the slide down only our own drop-down interface?

How does an interface pop up when the android default hand slides from the top of the screen? I remember Uncle Ge said that the status bar was clicked?
How shielded the system?

found it!
The height of status_bar_height in frameworks/base/core/res/res/values/dimens.xml
is set to zero.
That is to say, the original drop-down menu of Android comes out only after clicking the status bar. Now the height is set to 0, and it cannot be clicked, so it will not respond to any events, which is equivalent to blocking.

Our own is a service. It is constantly monitoring the sliding action.

Keyuard principle: http://blog.csdn.net/ocean2006/article/details/8079457

4. How to add your own application as a system application?

Basically similar to 2, but it should be noted that

LOCAL_CERTUFICATE := platform
LOCAL_PRIVILEGED_MODULE := true

Regarding LOCAL_CERTUFICATE
http://www.cnblogs.com/senior-engineer/p/4775316.html ,
the explanation is very good

The manifest corresponding to this needs to be set

android:sharedUserId="android.uid.system". With both of these, it can be called a system application. Various restricted-level APIs and hidden APIs can be called at will, and theoretically, any function can be realized.
LOCAL_PRIVILEGED_MODULE//declare that the app needs to be placed under /system/priv-app.

5. Realize the key points of your own lock screen application

See my post:
http://blog.csdn.net/bberdong/article/details/69257758

6. Add jar package to system application with source code

The situation I encountered was adding a gson.jar. android-support comes with the system and does not need to be processed, but gson is more troublesome.
Can use the following method to deal with.

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under,src) \
    src/com/android/content/pm/IPackageDataObserver.aidl \
    src/com/android/os/IPowerManager.aidl \
    src/com/btime/binder/ITrafficStateSync.aidl \
    src/com/btime/binder/ITrafficStateCallback.aidl
#step1
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 \
                               android-support-v13 \
                               gson-2.2.4
#only use in debug mode
#LOCAL_DEX_PREOPT := false

LOCAL_PROGUARD_ENABLED := disabled
LOCAL_PACKAGE_NAME := Settings

LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true

include $(BUILD_PACKAGE)
#step2
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
    gson-2.2.4:libs/gson-2.2.4.jar
include $(BUILD_MULTI_PREBUILT)

include $(call all-makefiles-under,$(LOCAL_PATH))

There must be a prebuilt process of step2, otherwise an error will still be reported. Also, this paragraph
cannot be placed in include $(BUILD_PACKAGE)the front , include $(CLEAR_VARS)and all the previous settings are cleared, and the final compiled result is only a gson jar package.

Guess you like

Origin blog.csdn.net/bberdong/article/details/62423026