1. Pre installed app
Generally, there are three situations: pre installation can not be uninstalled, pre installation can be uninstalled and restored, and pre installation can be uninstalled and restored, but not restored
Can refer to Built in apk
1.1 pre installed and non uninstallable
In this case, the app can finally be located in system/app or system / priv app. As a system application, it cannot be uninstalled
If the output path is not configured in Android.mk, it will be packaged to system/app by default
To package to system / priv app, configure LOCAL_PRIVILEGED_MODULE := true
1.2. Pre installed, removable and factory restored
This situation is quite special. Different manufacturers will have their own methods.
MTK still takes the app as the system app and adds a package name list to configure the system applications to be uninstalled,
This ensures that the system can be unloaded, restored to the factory, and the application can be restored automatically.
RK also takes the app as the system app, which can be unloaded by placing it in a special folder. During unloading, the package name will be written to the cache file,
After restoring the factory, the system will read the cache file to determine whether the corresponding app needs to be installed.
SQRD also has its own method. Package the app into system / vital app or system/preloadapp
The two directories differ as follows
The applications in the preloadapp directory are installed asynchronously during startup (which is conducive to accelerating startup speed). After startup, they are installed in the home interface,
The applications under this directory show phenomena one by one. If it is an application that is eager to use after startup,
For example, a folder is configured on the Launcher to store third-party applications. It is recommended to put it in the vital app directory. If it is not required to be used immediately after startup, it is recommended to store it in the preloadapp directory.
The applications in the vital app directory are installed synchronously during startup. After startup, the applications under preloadapp will not appear one by one,
However, the startup time will be longer. Generally, it is recommended to preset to this directory only for applications (such as input method applications) that need to be installed before starting up and entering standby.
Add configuration in Android.mk
LOCAL_MODULE_PATH := $(TARGET_OUT)/preloadapp
LOCAL_MODULE_PATH := $(TARGET_OUT)/vital-app
1.3. Pre installed can be unloaded and restored, but cannot be restored after leaving the factory
In this case, the app is usually packaged in the data/app directory
Add configuration in Android.mk
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
10.0 there is a bug. apk is placed in data / APP. After burning, the system cannot start normally. It will automatically enter the recovery interface, prompting the need to clear usedata data data
That is, apk under data/app. terms of settlement Android Q (10.0) preloads and integrates apk into the data partition
2. System theme style switching
There are many resource files in apk, including application icons and names. Domestic mobile phones do a good job in system theme switching. There are many online ideas. Here, a lazy method is used for stand-alone version.
aosp's app icon and name are very ugly, so we need to beautify it.
2.1. Obtain these app package names
Click one by one to enter these app s, and then execute adb shell dumpsys window | findstr mCurrentFocus to obtain the package name
2.2. Collect a set of exquisite icon s by yourself
2.3. Start the replacement journey
Replace Icon
copy the icon resource file to frameworks / base / core / RES / RES / drawable xhdpi/
Configure icon as drawable resource
frameworks/base/core/res/res/values/symbols.xml
+ <!-- //20210323 cczheng add for Chromium icon S --> + <java-symbol type="drawable" name="ic_app_deskclock" /> + <java-symbol type="drawable" name="ic_app_settings" /> + <java-symbol type="drawable" name="ic_app_calendar" /> + <java-symbol type="drawable" name="ic_app_email" /> + <java-symbol type="drawable" name="ic_app_music" /> + <java-symbol type="drawable" name="ic_app_camera" /> + <java-symbol type="drawable" name="ic_app_fmradio" /> + <java-symbol type="drawable" name="ic_app_calculator2" /> + <java-symbol type="drawable" name="ic_app_download" /> + <java-symbol type="drawable" name="ic_app_sounder" /> + <java-symbol type="drawable" name="ic_app_gallery" /> + <java-symbol type="drawable" name="ic_app_filemanager" /> + <java-symbol type="drawable" name="ic_app_mms" /> + <java-symbol type="drawable" name="ic_app_browser" /> + <java-symbol type="drawable" name="ic_app_dialer" /> + <java-symbol type="drawable" name="ic_app_contacts" /> + <java-symbol type="drawable" name="ic_app_stk" /> + <java-symbol type="drawable" name="ic_app_quicksearchbox" /> + <java-symbol type="drawable" name="ic_app_map" /> + <java-symbol type="drawable" name="ic_app_store" /> + <java-symbol type="drawable" name="ic_app_vedio" /> + <java-symbol type="drawable" name="ic_app_email" /> + <!-- end --> <java-symbol type="drawable" name="default_wallpaper" />
Replace the corresponding drawable resource according to the package name
frameworks/base/core/java/android/app/ApplicationPackageManager.java
@@ -114,6 +114,11 @@ import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.HashMap; +import java.util.HashSet; +import android.graphics.BitmapFactory; +import com.android.internal.R; + /** @hide */ public class ApplicationPackageManager extends PackageManager { private static final String TAG = "ApplicationPackageManager"; @@ -123,6 +128,10 @@ public class ApplicationPackageManager extends PackageManager { // Default flags to use with PackageManager when no flags are given. private final static int sDefaultFlags = PackageManager.GET_SHARED_LIBRARY_FILES; + //20210323 cczheng add for Chromium icon S + private static HashMap<String,Integer> appMaps = new HashMap<>(); + private static String[] appName={"com.android.deskclock","com.android.settings", + "com.android.calendar","com.android.email", + "com.android.music","com.mediatek.camera", + "com.android.fmradio","com.android.calculator2", + "com.android.documentsui", "com.android.soundrecorder", + "com.android.gallery3d","com.mediatek.filemanager", + "com.android.browser","com.android.mms", + "com.android.dialer","com.android.contacts", + "com.android.stk","com.android.quicksearchbox","com.google.android.apps.maps", + "com.android.vending","com.google.android.videos","com.google.android.calendar", + "com.google.android.gm","com.google.android.music","com.google.android.apps.photos", + "com.google.android.googlequicksearchbox"}; + + private static int[] appImg={R.drawable.ic_app_deskclock,R.drawable.ic_app_settings, + R.drawable.ic_app_calendar,R.drawable.ic_app_email, + R.drawable.ic_app_music,R.drawable.ic_app_camera, + R.drawable.ic_app_fmradio,R.drawable.ic_app_calculator2, + R.drawable.ic_app_download, R.drawable.ic_app_sounder, + R.drawable.ic_app_gallery,R.drawable.ic_app_filemanager, + R.drawable.ic_app_browser, R.drawable.ic_app_mms, + R.drawable.ic_app_dialer, R.drawable.ic_app_contacts, + R.drawable.ic_app_stk,R.drawable.ic_app_quicksearchbox,R.drawable.ic_app_map, + R.drawable.ic_app_store,R.drawable.ic_app_vedio,R.drawable.ic_app_calendar, + R.drawable.ic_app_email,R.drawable.ic_app_music,R.drawable.ic_app_gallery, + R.drawable.ic_app_quicksearchbox};//E private final Object mLock = new Object(); @@ -1656,6 +1665,10 @@ public class ApplicationPackageManager extends PackageManager { IPackageManager pm) { mContext = context; mPM = pm; + 20210323 cczheng add for Chromium icon S + for(int i=0;i<appName.length;i++){ + appMaps.put(appName[i],new Integer(appImg[i])); + }//E } @Override @@ -2832,6 +2848,10 @@ public class ApplicationPackageManager extends PackageManager { if (dr == null) { dr = itemInfo.loadDefaultIcon(this); } + //20210323 cczheng add for Chromium icon S + if(appMaps.containsKey(itemInfo.packageName)){ + dr =mContext.getResources().getDrawable(appMaps.get(itemInfo.packageName).intValue()); + }//E return dr; }
frameworks/base/core/java/android/content/pm/LauncherActivityInfo.java
+import java.util.HashMap; +import java.util.HashSet; +import android.os.SystemProperties; +import android.graphics.BitmapFactory; +import com.android.internal.R; + /** * A representation of an activity that can belong to this user or a managed * profile associated with this user. It can be used to query the label, icon @@ -40,6 +46,10 @@ public class LauncherActivityInfo { private ActivityInfo mActivityInfo; private ComponentName mComponentName; private UserHandle mUser; + //20210323 cczheng add for Chromium icon S + private static HashMap<String,Integer> appMaps = new HashMap<>(); + private static String[] appName={"com.android.deskclock","com.android.settings", + "com.android.calendar","com.android.email", + "com.android.music","com.mediatek.camera", + "com.android.fmradio","com.android.calculator2", + "com.android.documentsui", "com.android.soundrecorder", + "com.android.gallery3d","com.mediatek.filemanager", + "com.android.browser","com.android.mms", + "com.android.dialer","com.android.contacts", + "com.android.stk","com.android.quicksearchbox","com.google.android.apps.maps", + "com.android.vending","com.google.android.videos","com.google.android.calendar", + "com.google.android.gm","com.google.android.music","com.google.android.apps.photos", + "com.google.android.googlequicksearchbox"}; + + private static int[] appImg={R.drawable.ic_app_deskclock,R.drawable.ic_app_settings, + R.drawable.ic_app_calendar,R.drawable.ic_app_email, + R.drawable.ic_app_music,R.drawable.ic_app_camera, + R.drawable.ic_app_fmradio,R.drawable.ic_app_calculator2, + R.drawable.ic_app_download, R.drawable.ic_app_sounder, + R.drawable.ic_app_gallery,R.drawable.ic_app_filemanager, + R.drawable.ic_app_browser, R.drawable.ic_app_mms, + R.drawable.ic_app_dialer, R.drawable.ic_app_contacts, + R.drawable.ic_app_stk,R.drawable.ic_app_quicksearchbox,R.drawable.ic_app_map, + R.drawable.ic_app_store,R.drawable.ic_app_vedio,R.drawable.ic_app_calendar, + R.drawable.ic_app_email,R.drawable.ic_app_music,R.drawable.ic_app_gallery, + R.drawable.ic_app_quicksearchbox};//E /** * Create a launchable activity object for a given ResolveInfo and user. @@ -57,6 +67,10 @@ public class LauncherActivityInfo { LauncherActivityInfo(Context context) { mPm = context.getPackageManager(); + 20210323 cczheng add for Chromium icon S + for(int i=0;i<appName.length;i++){ + appMaps.put(appName[i],new Integer(appImg[i])); + }//E } /** @@ -118,6 +132,13 @@ public class LauncherActivityInfo { if (icon == null) { icon = mActivityInfo.loadIcon(mPm); } + 20210323 cczheng add for Chromium icon S + if(appMaps.containsKey(mActivityInfo.packageName)){ + try { + icon = mPm.getResourcesForApplication(mActivityInfo.applicationInfo).getDrawable(appMaps.get(mActivityInfo.packageName).intValue()); + } catch (NameNotFoundException | Resources.NotFoundException exc) { + } + }//E return icon; }
Remove the white edge added by default
Android 8~Android 11 remove the white edge added to the icon by default by Launcher3
Replace name
launcher3 desktop name
packages/apps/Launcher3/src/com/android/launcher3/BubbleTextView.java
@@ -291,7 +291,14 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mDotParams.color = IconPalette.getMutedColor(info.iconColor, 0.54f); setIcon(iconDrawable); - setText(info.title); + //20210323 cczheng add for Chromium name S + if ("Chromium".equals(info.title)) { + String appName = getContext().getResources().getString(com.android.internal.R.string.browserName); + setText(appName); + android.util.Log.d("Launcher3","appName="+appName); + }else {//E + setText(info.title); + } if (info.contentDescription != null) { setContentDescription(info.isDisabled() ? getContext().getString(R.string.disabled_app_label, info.contentDescription)
Settings application details name
frameworks/base/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
@@ -1590,6 +1590,10 @@ public class ApplicationsState { this.mounted = true; CharSequence label = info.loadLabel(context.getPackageManager()); this.label = label != null ? label.toString() : info.packageName; + //20210323 cczheng add for Chromium name S + if ("org.chromium.chrome".equals(info.packageName)) { + this.label = context.getResources().getString(com.android.internal.R.string.browserName); + }//E } } }
3. On off animation, ringtone
Boot animation resource bootanimation.zip
Shutdown animation resource shutdown animation.zip
Boot ring resource bootsound.mp3
Note: the name cannot be changed. Preset the above three resources to the system/media directory
Shutdown animation cannot play normally bug
frameworks/base/cmds/bootanimation/BootAnimation.cpp
@@ -1088,6 +1088,14 @@ bool BootAnimation::playAnimation(const Animation& animation) continue; //to next part } + +#ifdef BOOTANIMATION_EXT + if (mShuttingDown && mfd == -1 && mWaitForComplete && (i==(pcount-1))) { + ALOGD("shutdown animation finished, quit"); + property_set("service.bootanim.end", "1"); + } +#endif + for (int r=0 ; !part.count || r<part.count ; r++) { // Exit any non playuntil complete parts immediately if(exitPending() && !part.playUntilComplete) @@ -1172,12 +1180,12 @@ bool BootAnimation::playAnimation(const Animation& animation) if(exitPending() && !part.count && mCurrentInset >= mTargetInset) break; } -#ifdef BOOTANIMATION_EXT - if (mShuttingDown && mfd == -1 && mWaitForComplete) { - ALOGD("shutdown animation part1 finished, quit"); - property_set("service.bootanim.end", "1"); - } -#endif
frameworks/base/services/core/java/com/android/server/power/ShutdownAnimation.java
@@ -38,6 +38,7 @@ public class ShutdownAnimation { try { mPlayAnim = true; Slog.i(TAG, "exec the bootanimation "); + SystemProperties.set("service.wait_for_bootanim", "1"); SystemProperties.set("service.bootanim.exit", "0"); SystemProperties.set("service.bootanim.end", "0"); SystemProperties.set("service.bootanim.shutdown", "1");
4. Dual card to single card configuration
Please click device / SPRD / sharkl3 / s9863a1h10 / s9863a1h10_ Add the following code at the bottom of natv.mk (specific engineering file corresponding to the project).
SIM_COUNT := 1
PRODUCT_PROPERTY_OVERRIDES :=
persist.vendor.radio.phone_count=1
persist.radio.multisim.config=ssss
$(PRODUCT_PROPERTY_OVERRIDES)
5. OTA related
General packaging instruction, general verification method, general upgrade method
RecoverySystem.verifyPackage() verifies the ota upgrade package, and the error log is as follows
libvintf: Could not open /proc/config.gz: 13 2021-03-26 11:27:14.981 2495-2758/com.wxtx.systemupdate W/libvintf: Cannot fetch or parse /proc/config.gz: Permission denied 2021-03-26 11:27:14.981 2495-2758/com.wxtx.systemupdate W/libvintf: Cannot fetch or parse kernel sepolicy version: Operation not permitted 2021-03-26 11:27:14.992 2495-2758/com.wxtx.systemupdate W/VintfObject: VintfObject.verify() returns 1: Runtime info and framework compatibility matrix are incompatible: kernelSepolicyVersion = 0 but required >= 30 2021-03-26 11:27:15.002 2495-2758/com.wxtx.systemupdate W/System.err: java.security.SignatureException: package compatibility verification failed 2021-03-26 11:27:15.003 2495-2758/com.wxtx.systemupdate W/System.err: at android.os.RecoverySystem.verifyPackage(RecoverySystem.java:350) 2021-03-26 11:27:15.003 2495-2758/com.wxtx.systemupdate W/System.err: at com.wxtx.systemdownload.helper.SystemUpgrade$2.onConfirmUpdate(SystemUpgrade.java:141) 2021-03-26 11:27:15.003 2495-2758/com.wxtx.systemupdate W/System.err: at com.wxtx.systemdownload.helper.SystemUpgrade$2.run(SystemUpgrade.java:129)
The solution is as follows
system/sepolicy/private/system_app.te
system/sepolicy/prebuilts/api/29.0/private/system_app.te
allow system_app config_gz:file { read open }; allow system_app selinuxfs:file { read open };
device/sprd/sharkle/common/sepolicy/uncrypt.te
allow uncrypt mmcblk_device:blk_file { open write }; allow uncrypt userdata_block_device:blk_file { open write }; allow uncrypt system_app_data_file:dir {read}; allow uncrypt system_app_data_file:file {read}; # For GOTA allow uncrypt self:capability { fowner sys_admin }; allow uncrypt ota_package_file:file { write }; # For inner local ota update in /data/meida/0 allow uncrypt media_rw_data_file:file { open getattr read ioctl write }; allow uncrypt media_rw_data_file:dir { open getattr read search }; allow uncrypt metadata_file:dir { search };
https://blog.csdn.net/u010867436/article/details/107206349/
https://blog.csdn.net/m1126125223/article/details/101015976