完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
25.编译错误 UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 47-50: ordinal not in range(128)
错误日志提示的很明显,存在中文字符 Traceback (most recent call last): File "build/make/tools/fileslist_util.py", line 68, in main(sys.argv) File "build/make/tools/fileslist_util.py", line 62, in main PrintCanonicalList(args[0]) File "build/make/tools/fileslist_util.py", line 30, in PrintCanonicalList print "{0:12d} {1}".format(line["Size"], line["Name"]) UnicodeEncodeError: 'ascii' codec can't encode characters in position 47-50: ordinal not in range(128) 检查FAILED得命令,包含如下 build/make/tools/fileslist_util.py -c out/target/product/xxxx/installed-files.json out/target/product/xxxx/installed-files.txt 这个fileslist_util.py是将json数据转换为txt文件的。我们运行该命令,发现在 1416 /system/usr/keylayout/Vendor_xxxx_Product_xxxx.kl 处停止。打开out/target/product/xxxx/installed-files.json,发现Vendor_xxxx_Product_xxxx.kl后面的modulename存在中文字符, 进入对应目录下查找到该文件重命名或者删除即可。我这里是使用删除的方式,因为我是不小心复制了个快捷方式出来。 24.修改系统设置Preference主题样式 自定义主题要看是在哪里用得 23.新增可以导入的jar包 Android.mk //开始 include $(CLEAR_VARS) sdk_src_dir = sdk/src/main/java LOCAL_MODULE := myjar LOCAL_MODULE_TAGS := optional LOCAL_JACK_ENABLED = disabled LOCAL_PROGUARD_ENABLED := full obfuscation LOCAL_PROGUARD_FLAG_FILES := proguard.cfg LOCAL_SRC_FILES := $(call all-java-files-under,src LOCAL_AIDL_INCLUDES := $(call all-Iaidl-files-under, $(sdk_src_dir)) $(LOCAL_PATH)/$(sdk_src_dir) LOCAL_JAVACFLAGS := -Xlint:all include $(BUILD_STATIC_JAVA_LIBRARY) ## copy jar intermediates.COMMON := $(call local-intermediates-dir,COMMON) full_classes_jar := $(intermediates.COMMON)/classes-full-debug.jar $(shell cp -rf $(full_classes_jar) $(LOCAL_PATH)/myjar.jar) full_classes_jar := $(intermediates.COMMON)/classes-proguard.jar $(shell cp -rf $(full_classes_jar) $(LOCAL_PATH)/myjar-proguard.jar) //结束,这一段是开始编译出jar包,并复制到当前目录下来 //这一段使用别名。使得在其他LOCAL_STATIC_JAVA_LIBRARIES中可以使用 LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := myjarAlias:myjar.jar include $(BUILD_MULTI_PREBUILT) 22.Android Q 默认选择launcher主入口 frameworks/base/services/core/java/com/android/server/wm/RootActivityContainer.java diff --git a/frameworks/base/services/core/java/com/android/server/wm/RootActivityContainer.java b/frameworks/base/services/core/java/com/android/server/wm/RootActivityContainer.java index ffbf68813d..b047cab83e 100644 --- a/frameworks/base/services/core/java/com/android/server/wm/RootActivityContainer.java +++ b/frameworks/base/services/core/java/com/android/server/wm/RootActivityContainer.java @@ -78,13 +78,18 @@ import android.app.ActivityManager; import android.app.ActivityOptions; import android.app.AppGlobals; import android.app.WindowConfiguration; +import android.app.ActivityThread; import android.content.ComponentName; import android.content.Intent; +import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ResolveInfo; +import android.content.pm.IPackageManager; +import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; +import android.text.TextUtils; import android.graphics.Rect; import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManagerInternal; @@ -373,6 +378,31 @@ class RootActivityContainer extends ConfigurationContainer Intent homeIntent = null; ActivityInfo aInfo = null; + //A:@tuliyuan set default launcher info + String pkgName = "com.vtech.projector.launcher"; + String activityName = "com.vtech.projector.launcher.activity.HomeActivity"; + boolean isCNVersion = android.os.SystemProperties.get("vtech.prop.china_version").equals("true"); + //We're going to set a default value for the Chinese version + if(isCNVersion){ + pkgName = "com.vtech.projector.launcher"; + activityName = "com.vtech.projector.launcher.activity.HomeActivity"; + }else{ + pkgName = "com.vtech.projector.launcher"; + activityName = "com.vtech.projector.launcher.Launcher"; + } + //However, if we also have custom prop fields, we prefer to use the custom fields + //NIT: com.vtech.projector.launcher/.activity.HomeActivity + if(!TextUtils.isEmpty(android.os.SystemProperties.get("vtech.prop.default.launcher"))){ + String[] defaultLauncher = android.os.SystemProperties.get("vtech.prop.default.launcher").split("/"); + if(defaultLauncher.length == 2 ){ + pkgName = defaultLauncher[0]; + activityName = pkgName+defaultLauncher[1]; + } + } + + Slog.d(TAG," tuliyuan add set default launcher packageName is "+pkgName +" activityName "+activityName); + setDefaultLauncher(pkgName,activityName,userId); + //A:@tuliyuan set default launcher info --end if (displayId == DEFAULT_DISPLAY) { homeIntent = mService.getHomeIntent(); aInfo = resolveHomeActivity(userId, homeIntent); @@ -404,7 +434,78 @@ class RootActivityContainer extends ConfigurationContainer displayId); return true; } + //A:@tuliyuan add for set perfered launcher activity --start + private void setDefaultLauncher(String packageName,String className,int userId) { + //String packageName = "com.vtech.projector.launcher";//默认launcher包名 + //String className = "com.vtech.projector.launcher.activity.HomeActivity"; + IPackageManager pm = ActivityThread.getPackageManager(); + + if (hasApkInstalled(packageName)) { + Slog.i(TAG, "defautl packageName = " + packageName + ", default className = " + className); + ArrayList + ArrayList + mService.mContext.getPackageManager().getPreferredActivities(intentList, cnList, null); + + IntentFilter dhIF = null; + for (int i = 0; i < cnList.size(); i++) { + dhIF = intentList.get(i); + if (dhIF.hasAction(Intent.ACTION_MAIN) && dhIF.hasCategory(Intent.CATEGORY_HOME)) { + mService.mContext.getPackageManager().clearPackagePreferredActivities(cnList.get(i).getPackageName()); + } + } + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.addCategory(Intent.CATEGORY_HOME); + List + try { + list = pm.queryIntentActivities(intent, + intent.resolveTypeIfNeeded(mService.mContext.getContentResolver()), + PackageManager.MATCH_DEFAULT_ONLY, userId).getList(); + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + + } + +// get all components and the best match + IntentFilter filter = new IntentFilter(); + filter.addAction(Intent.ACTION_MAIN); + filter.addCategory(Intent.CATEGORY_HOME); + filter.addCategory(Intent.CATEGORY_DEFAULT); + final int N = list.size(); + + ComponentName launcher = new ComponentName(packageName, className); + ComponentName[] set = new ComponentName[N]; + int defaultMatch = 0; + for (int i = 0; i < N; i++) { + ResolveInfo r = list.get(i); + set = new ComponentName(r.activityInfo.packageName, r.activityInfo.name); + Slog.d(TAG, "r.activityInfo.packageName======= " + r.activityInfo.packageName); + + Slog.d(TAG, "r.activityInfo.name========= " + r.activityInfo.name); + if (launcher.getClassName().equals(r.activityInfo.name)) { + defaultMatch = r.match; + } + } + try { + pm.addPreferredActivity(filter, defaultMatch, set, launcher, userId); + } catch (RemoteException e) { + throw new RuntimeException("Package manager has died", e); + } + } + } + + private boolean hasApkInstalled(String packageName) { + if (packageName == null || "".equals(packageName)) + return false; + android.content.pm.ApplicationInfo info = null; + try { + info = mService.mContext.getPackageManager().getApplicationInfo(packageName, 0); + return info != null; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + //A:@tuliyuan add for set perfered launcher activity --end |
|
|
|
21.AUTO_LOG Android Q 后台使用logcat打印LOG
#####–> device/rockchip/common/sepolicy/vendor/logpersist.te #============= logpersist ============== 该作用域对需要操作的文件作用域的权限过滤 allow logpersist vtechfs:dir { open read search getattr write add_name rw_dir_perms }; allow logpersist vtechfs:file { append create getattr open }; allow logpersist vtechfs:file create_file_perms; allow logpersist self:capability { dac_read_search dac_override }; r_dir_file(logpersist, cgroup) allow logpersist self:global_capability_class_set sys_nice; allow logpersist pstorefs:dir search; allow logpersist pstorefs:file r_file_perms; control_logd(logpersist) unix_socket_connect(logpersist, logdr, logd) read_runtime_log_tags(logpersist) #####–> system/sepolicy/prebuilts/api/29.0/private/logpersist.te typeattribute logpersist coredomain; # android debug log storage in logpersist domains (eng and userdebug only) userdebug_or_eng(` r_dir_file(logpersist, cgroup) allow logpersist misc_logd_file:file create_file_perms; allow logpersist misc_logd_file:dir rw_dir_perms; allow logpersist self:global_capability_class_set sys_nice; allow logpersist pstorefs:dir search; allow logpersist pstorefs:file r_file_perms; control_logd(logpersist) unix_socket_connect(logpersist, logdr, logd) read_runtime_log_tags(logpersist) ') # logpersist is allowed to write to /data/misc/log for userdebug and eng builds neverallow logpersist { file_type -data_file_type userdebug_or_eng(`-misc_logd_file -coredump_file') with_native_coverage(`-method_trace_data_file') }:file { create write append }; neverallow { domain -init userdebug_or_eng(`-logpersist -logd -dumpstate') } misc_logd_file:file no_rw_file_perms; neverallow { domain -init userdebug_or_eng(`-logpersist -logd') } misc_logd_file:dir { add_name link relabelfrom remove_name rename reparent rmdir write }; init.rc中开启和关闭AUTOLOG的方式 #####–> device/rockchip/common/init.rk30board.rc b/device/rockchip/common/init.rk30board.rc init.rc中开启和关闭AUTOLOG的方式 **#####--> device/rockchip/common/init.rk30board.rc b/device/rockchip/common/init.rk30board.rc** on property:vtech.prop.logcat.enable=true start vtechlogcat on property:vtech.prop.logcat.enable=false stop vtechlogcat chmod 777 /vtech/log.txt chown system system /vtech/log.txt setprop vtech.prop.logcat.enable "" service vtechlogcat /system/bin/logcat -v threadtime -v usec -v printable -D -f /vtech/log.txt -r 1024 class main disabled user root group root shell #####–> device/rockchip/common/sepolicy/vendor/init.te ## init.te中需要一个自动转换作用与 domain_auto_trans 即:在init域中执行logcat_exec域的相关操作时,我们将他切换到logpersist域中去 /system/bin/logcat是属于u:object_r:logcat_exec:s0 但是在init进程中他的执行是以logpersist的域的方式执行的,所以相关权限需要添加到logpersist.te中去 device/rockchip/common/sepolicy/vendor/init.te domain_auto_trans(init, logcat_exec, logpersist) #####–> 如下部分是解决logpersist.te的neverallow规则限制 ***#####--> system/sepolicy/prebuilts/api/29.0/private/domain.te*** index 209eeb0dd0..68942a5257 100644 --- a/system/sepolicy/prebuilts/api/29.0/private/domain.te +++ b/system/sepolicy/prebuilts/api/29.0/private/domain.te @@ -272,7 +272,7 @@ define(`dac_override_allowed', `{ vold_prepare_subdirs zygote }') -neverallow ~dac_override_allowed self:global_capability_class_set dac_override; +neverallow ~{ dac_override_allowed logpersist } self:global_capability_class_set dac_override; # Since the kernel checks dac_read_search before dac_override, domains that # have dac_override should also have dac_read_search to eliminate spurious # denials. Some domains have dac_read_search without having dac_override, so @@ -281,6 +281,7 @@ neverallow ~{ dac_override_allowed traced_probes userdebug_or_eng(`heapprofd') + logpersist } self:global_capability_class_set dac_read_search; # Limit what domains can mount filesystems or change their mount flags. diff --git a/system/sepolicy/prebuilts/api/29.0/private/logd.te b/system/sepolicy/prebuilts/api/29.0/private/logd.te index ca92e2061b..6927b2ff9b 100644 --- a/system/sepolicy/prebuilts/api/29.0/private/logd.te +++ b/system/sepolicy/prebuilts/api/29.0/private/logd.te @@ -19,6 +19,7 @@ neverallow { -dumpstate -init -logd + -logpersist userdebug_or_eng(`-logpersist') -servicemanager -system_server diff --git a/system/sepolicy/private/domain.te b/system/sepolicy/private/domain.te index 209eeb0dd0..68942a5257 100644 --- a/system/sepolicy/private/domain.te +++ b/system/sepolicy/private/domain.te @@ -272,7 +272,7 @@ define(`dac_override_allowed', `{ vold_prepare_subdirs zygote }') -neverallow ~dac_override_allowed self:global_capability_class_set dac_override; +neverallow ~{ dac_override_allowed logpersist } self:global_capability_class_set dac_override; # Since the kernel checks dac_read_search before dac_override, domains that # have dac_override should also have dac_read_search to eliminate spurious # denials. Some domains have dac_read_search without having dac_override, so @@ -281,6 +281,7 @@ neverallow ~{ dac_override_allowed traced_probes userdebug_or_eng(`heapprofd') + logpersist } self:global_capability_class_set dac_read_search; # Limit what domains can mount filesystems or change their mount flags. diff --git a/system/sepolicy/private/logd.te b/system/sepolicy/private/logd.te index ca92e2061b..6927b2ff9b 100644 --- a/system/sepolicy/private/logd.te +++ b/system/sepolicy/private/logd.te @@ -19,6 +19,7 @@ neverallow { -dumpstate -init -logd + -logpersist userdebug_or_eng(`-logpersist') -servicemanager -system_server 20.新增自定义分区 From ad112446914b3b8437bb0641cd1f5f01e2372f1d Mon Sep 17 00:00:00 2001 From: "liyuan.tu" <975150240@qq.com> Date: Fri, 22 Jan 2021 17:55:54 +0800 Subject: [PATCH] =?UTF-8?q?[VTECH=5FVCS800]=20[Parition]=201.=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=87=AA=E5=AE=9A=E4=B9=89vtech=E5=88=86=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit diff --git a/build/make/core/Makefile b/build/make/core/Makefile index bac49d186e..026a82116d 100755 --- a/build/make/core/Makefile +++ b/build/make/core/Makefile @@ -1386,6 +1386,11 @@ $(if $(filter $(2),cache), $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1)) ) +$(if $(filter $(2),vtech), + $(if $(BOARD_VTECHIMAGE_PARTITION_SIZE),$(hide) echo "vtech_size=$(BOARD_VTECHIMAGE_PARTITION_SIZE)" >> $(1)) + $(if $(BOARD_VTECHIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vtech_fs_type=$(BOARD_VTECHIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) +) + $(if $(filter $(2),vendor), $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1)) @@ -1443,6 +1448,8 @@ $(if $(filter $(2),oem), $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1)) $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1)) ) + + $(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1) $(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1)) @@ -2641,6 +2648,42 @@ else # BUILDING_CACHE_IMAGE IGNORE_CACHE_LINK := --exclude=cache endif # BUILDING_CACHE_IMAGE +#add for vtech fs +BOARD_VTECHIMAGE_FILE_SYSTEM_TYPE := ext4 +ifdef BOARD_VTECHIMAGE_FILE_SYSTEM_TYPE +INTERNAL_VTECHIMAGE_FILES := + $(filter $(TARGET_OUT_VTECH)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) + +vtechimage_intermediates := + $(call intermediates-dir-for,PACKAGING,vtech) +BUILT_VTECHIMAGE_TARGET := $(PRODUCT_OUT)/vtech.img + +define build-vtechimage-target + $(call pretty,"Target vtech fs image: $(INSTALLED_VTECHIMAGE_TARGET)") + @mkdir -p $(TARGET_OUT_VTECH) + @mkdir -p $(vtechimage_intermediates) && rm -rf $(vtechimage_intermediates)/vtech_image_info.txt + $(call generate-image-prop-dictionary, $(vtechimage_intermediates)/vtech_image_info.txt,vtech,skip_fsck=true) + $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH + build/make/tools/releasetools/build_image.py + $(TARGET_OUT_VTECH) $(vtechimage_intermediates)/vtech_image_info.txt $(INSTALLED_VTECHIMAGE_TARGET) $(TARGET_OUT) + $(hide) $(call assert-max-image-size,$(INSTALLED_VTECHIMAGE_TARGET),$(BOARD_VTECHIMAGE_PARTITION_SIZE)) +endef + +# We just build this directly to the install location. +INSTALLED_VTECHIMAGE_TARGET := $(BUILT_VTECHIMAGE_TARGET) +$(INSTALLED_VTECHIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VTECHIMAGE_FILES) $(BUILD_IMAGE_SRCS) + $(build-vtechimage-target) + +.PHONY: vtechimage-nodeps +vtechimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) + $(build-vtechimage-target) + +else # BOARD_VTECHIMAGE_FILE_SYSTEM_TYPE +# we need to ignore the broken vtech link when doing the rsync +IGNORE_VTECH_LINK := --exclude=vtech + +endif + # ----------------------------------------------------------------- # system_other partition image ifdef BUILDING_SYSTEM_OTHER_IMAGE @@ -3838,6 +3881,7 @@ $(BUILT_TARGET_FILES_PACKAGE): $(INSTALLED_USERDATAIMAGE_TARGET) $(INSTALLED_CACHEIMAGE_TARGET) $(INSTALLED_VENDORIMAGE_TARGET) + $(INSTALLED_VTECHIMAGE_TARGET) $(INSTALLED_PRODUCTIMAGE_TARGET) $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(INSTALLED_VBMETAIMAGE_TARGET) diff --git a/build/make/core/config.mk b/build/make/core/config.mk index b59862ee2a..44ff422d3a 100644 --- a/build/make/core/config.mk +++ b/build/make/core/config.mk @@ -1156,6 +1156,7 @@ dont_bother_goals := out psnod productservicesimage-nodeps onod odmimage-nodeps systemotherimage-nodeps + vtechimage-nodeps ramdisk-nodeps ramdisk_debug-nodeps bootimage-nodeps |
|
|
|
diff --git a/build/make/core/envsetup.mk b/build/make/core/envsetup.mk
index 5131598a94..30a82665e0 100644 --- a/build/make/core/envsetup.mk +++ b/build/make/core/envsetup.mk @@ -599,6 +599,8 @@ endif TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache .KATI_READONLY := TARGET_OUT_CACHE +TARGET_OUT_VTECH := $(PRODUCT_OUT)/vtech + TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR) .KATI_READONLY := TARGET_OUT_VENDOR ifneq ($(filter address,$(SANITIZE_TARGET)),) diff --git a/build/make/core/main.mk b/build/make/core/main.mk index 7465743d88..6a53fd7097 100644 --- a/build/make/core/main.mk +++ b/build/make/core/main.mk @@ -1587,6 +1587,9 @@ bptimage: $(INSTALLED_BPTIMAGE_TARGET) .PHONY: vendorimage vendorimage: $(INSTALLED_VENDORIMAGE_TARGET) +.PHONY: vtechimage +vtechimage: $(INSTALLED_VTECHIMAGE_TARGET) + .PHONY: productimage productimage: $(INSTALLED_PRODUCTIMAGE_TARGET) @@ -1628,6 +1631,7 @@ droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) $(INSTALLED_CACHEIMAGE_TARGET) $(INSTALLED_BPTIMAGE_TARGET) $(INSTALLED_VENDORIMAGE_TARGET) + $(INSTALLED_VTECHIMAGE_TARGET) $(INSTALLED_ODMIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET) $(INSTALLED_PRODUCTIMAGE_TARGET) diff --git a/build/make/tools/releasetools/build_image.py b/build/make/tools/releasetools/build_image.py index 4136ed432e..428769ba44 100755 --- a/build/make/tools/releasetools/build_image.py +++ b/build/make/tools/releasetools/build_image.py @@ -597,6 +597,9 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): elif mount_point == "cache": copy_prop("cache_fs_type", "fs_type") copy_prop("cache_size", "partition_size") + elif mount_point == "vtech": + copy_prop("vtech_fs_type", "fs_type") + copy_prop("vtech_size", "partition_size") elif mount_point == "vendor": copy_prop("avb_vendor_hashtree_enable", "avb_hashtree_enable") copy_prop("avb_vendor_add_hashtree_footer_args", @@ -769,6 +772,8 @@ def main(argv): mount_point = "oem" elif image_filename == "product.img": mount_point = "product" + elif image_filename == "vtech.img": + mount_point = "vtech" elif image_filename == "product_services.img": mount_point = "product_services" else: diff --git a/device/rockchip/common/BoardConfig.mk b/device/rockchip/common/BoardConfig.mk index 7006707622..c760df33a8 100755 --- a/device/rockchip/common/BoardConfig.mk +++ b/device/rockchip/common/BoardConfig.mk @@ -119,7 +119,7 @@ ifeq ($(strip $(USE_DEFAULT_PARAMETER)), true) BOARD_BOOTIMAGE_PARTITION_SIZE := $(shell python device/rockchip/common/get_partition_size.py $(TARGET_DEVICE_DIR)/parameter.txt boot) BOARD_DTBOIMG_PARTITION_SIZE := $(shell python device/rockchip/common/get_partition_size.py $(TARGET_DEVICE_DIR)/parameter.txt dtbo) BOARD_RECOVERYIMAGE_PARTITION_SIZE := $(shell python device/rockchip/common/get_partition_size.py $(TARGET_DEVICE_DIR)/parameter.txt recovery) - + BOARD_VTECHIMAGE_PARTITION_SIZE := $(shell python device/rockchip/common/get_partition_size.py $(TARGET_DEVICE_DIR)/parameter.txt vtech) #$(info Calculated BOARD_SYSTEMIMAGE_PARTITION_SIZE=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE) use $(TARGET_DEVICE_DIR)/parameter.txt) else ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS), true) @@ -138,6 +138,7 @@ else endif endif + # GPU configration TARGET_BOARD_PLATFORM_GPU ?= mali-t760 BOARD_USE_LCDC_COMPOSER ?= false @@ -248,7 +249,7 @@ TARGET_ROCHCHIP_RECOVERY ?= true BOARD_HAS_FLIPPED_SCREEN ?= false # Auto update package from USB -RECOVERY_AUTO_USB_UPDATE ?= false +RECOVERY_AUTO_USB_UPDATE ?= true # To use bmp as kernel logo, uncomment the line below to use bgra 8888 in recovery TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888" diff --git a/device/rockchip/common/init.rk30board.rc b/device/rockchip/common/init.rk30board.rc index 2d1b7ac1e1..3772d2035f 100755 --- a/device/rockchip/common/init.rk30board.rc +++ b/device/rockchip/common/init.rk30board.rc @@ -6,9 +6,11 @@ import /vendor/etc/init/hw/init.${ro.target.product}.rc import /vendor/etc/init/hw/init.car.rc import /vendor/etc/init/hw/init.optee.rc + on post-fs restorecon_recursive /mnt/vendor/metadata + on post-fs-data # AP6476 GPS permission chmod 755 /system/bin/glgps @@ -25,7 +27,10 @@ on post-fs-data mkdir /data/vendor/logs 0755 root shell mkdir /data/vendor/audio 0755 system system - + # mount ext4 /dev/block/by-name/vtech /vtech wait noatime nodiratime nosuid nodev noauto_da_alloc + chown system system /vtech + chmod 0771 /vtech + on early-init setprop ro.hardware.egl mali write /sys/devices/system/cpu/cpufreq/policy0/scaling_governor performance @@ -39,9 +44,12 @@ on init chmod 0666 /dev/teepriv0 chown system system /sys/system_monitor/system_status chmod 0666 /sys/system_monitor/system_status - + + + on boot + chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_slack diff --git a/device/rockchip/common/scripts/fstab_tools/fstab.in b/device/rockchip/common/scripts/fstab_tools/fstab.in index 266531ac72..82d4fe11fa 100755 --- a/device/rockchip/common/scripts/fstab_tools/fstab.in +++ b/device/rockchip/common/scripts/fstab_tools/fstab.in @@ -19,3 +19,5 @@ ${_block_prefix}product /product ext4 ro,barrier=1 ${_flags},first_stage_mount /dev/block/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier latemount,wait,check,fileencryption=software,quota,formattable,reservedsize=128M,checkpoint=fs # for ext4 #/dev/block/by-name/userdata /data ext4 discard,noatime,nosuid,nodev,noauto_da_alloc,data=ordered,user_xattr,barrier=1 wait,formattable,check,fileencryption=software,quota,reservedsize=128M +#add by tuliyuan +/dev/block/by-name/vtech /vtech ext4 noatime,nodiratime,nosuid,nodev,noauto_da_alloc,discard wait,check diff --git a/device/rockchip/common/sepolicy/vendor/device.te b/device/rockchip/common/sepolicy/vendor/device.te index bfc7713c55..231e24daa8 100755 --- a/device/rockchip/common/sepolicy/vendor/device.te +++ b/device/rockchip/common/sepolicy/vendor/device.te @@ -32,3 +32,5 @@ type cec_device, dev_type; #for hid audio type hidraw_device, dev_type; +#for vtech fs +type vtech_block_device, dev_type; diff --git a/device/rockchip/common/sepolicy/vendor/file.te b/device/rockchip/common/sepolicy/vendor/file.te index b3b5b5b14f..78dbc3f30c 100755 --- a/device/rockchip/common/sepolicy/vendor/file.te +++ b/device/rockchip/common/sepolicy/vendor/file.te @@ -50,3 +50,4 @@ type sysfs_mmc, fs_type, sysfs_type; # input files type idc_file, file_type, vendor_file_type; type keylayout_file, file_type, vendor_file_type; +type vtechfs, file_type, data_file_type; diff --git a/device/rockchip/common/sepolicy/vendor/file_contexts b/device/rockchip/common/sepolicy/vendor/file_contexts index 4a35a7638d..0f029833ae 100644 --- a/device/rockchip/common/sepolicy/vendor/file_contexts +++ b/device/rockchip/common/sepolicy/vendor/file_contexts @@ -71,7 +71,7 @@ /dev/block/by-name/security u:object_r:security_block_device:s0 /dev/block/by-name/baseparameter u:object_r:baseparameter_block_device:s0 /dev/block/by-name/super u:object_r:super_block_device:s0 - +/dev/block/by-name/vtech u:object_r:vtech_block_device:s0 /sys/devices/platform/fb/graphics/fb[0-9]/cabc u:object_r:sysfs_fb:s0 /sys/kernel/debug/mali/gpu_memory u:object_r:sys_mali:s0 @@ -176,3 +176,4 @@ #flash_img /system/bin/flash_img.sh u:object_r:install_recovery_exec:s0 +/vtech(/.*)? u:object_r:vtechfs:s0 diff --git a/device/rockchip/common/sepolicy/vendor/fsck.te b/device/rockchip/common/sepolicy/vendor/fsck.te index 9322f9e2c0..4d461d31f5 100644 --- a/device/rockchip/common/sepolicy/vendor/fsck.te +++ b/device/rockchip/common/sepolicy/vendor/fsck.te @@ -1,3 +1,4 @@ allow fsck e2fsck_oem_block_device:blk_file rw_file_perms; allow fsck e2fsck_cache_block_device:blk_file rw_file_perms; allow fsck e2fsck_frp_block_device:blk_file rw_file_perms; +allow fsck vtech_block_device:blk_file rw_file_perms; diff --git a/device/rockchip/common/sepolicy/vendor/init.te b/device/rockchip/common/sepolicy/vendor/init.te index fadab5af8c..235c32f9bc 100755 --- a/device/rockchip/common/sepolicy/vendor/init.te +++ b/device/rockchip/common/sepolicy/vendor/init.te @@ -55,4 +55,7 @@ allow init baseparameter_block_device:lnk_file { relabelto setattr }; allow init vendor_file:file { execute open}; allow init oemfs:dir { mounton }; allow init mnt_vendor_file:dir { mounton }; +allow init vtech_block_device:lnk_file { relabelto }; +allow init vtech_block_device:blk_file { write }; +allow init vtechfs:dir { create setattr getattr mounton }; dontaudit init proc:file { write setattr }; |
|
|
|
diff --git a/device/rockchip/common/sepolicy/vendor/system_app.te b/device/rockchip/common/sepolicy/vendor/system_app.te
index ede1d64c4b..0bdd3ae68d 100644 --- a/device/rockchip/common/sepolicy/vendor/system_app.te +++ b/device/rockchip/common/sepolicy/vendor/system_app.te @@ -52,3 +52,5 @@ allow system_app proc_net:file { getattr open read }; get_prop(system_app,serialno_prop) get_prop(system_app, vtech_prop) set_prop(system_app, vtech_prop) +allow system_app vtechfs:dir rw_file_perms; +allow system_app vtechfs:file rw_file_perms; diff --git a/device/rockchip/common/sepolicy/vendor/vendor_init.te b/device/rockchip/common/sepolicy/vendor/vendor_init.te index 3712d5d4e5..56b18df594 100644 --- a/device/rockchip/common/sepolicy/vendor/vendor_init.te +++ b/device/rockchip/common/sepolicy/vendor/vendor_init.te @@ -38,3 +38,9 @@ set_prop(vendor_init, dalvik_prop) set_prop(vendor_init, vendor_drm_prop) set_prop(vendor_init, public_vendor_system_prop) set_prop(vendor_init, public_vendor_default_prop) + +allow vendor_init vtechfs:dir rw_dir_perms; +allow vendor_init vtech_block_device:lnk_file { relabelto }; +#============= vendor_init ============== +allow vendor_init vtechfs:dir { create setattr getattr mounton }; +allow vendor_init sysfs:lnk_file { setattr getattr read open }; diff --git a/device/rockchip/common/sepolicy/vendor/vold.te b/device/rockchip/common/sepolicy/vendor/vold.te index 53562ff34a..c1b81a0c8b 100644 --- a/device/rockchip/common/sepolicy/vendor/vold.te +++ b/device/rockchip/common/sepolicy/vendor/vold.te @@ -10,3 +10,5 @@ allow vold self:capability { setgid setuid }; allow vold vold_device:blk_file ioctl; allow vold vold_exec:file execute_no_trans; allow vold self:capability { dac_override dac_read_search }; +allow vold vtechfs:dir { read open write getattr setattr }; +#allow vold vtechfs:dir ioctl; diff --git a/device/rockchip/rk3326/VTECH_VP02/BoardConfig.mk b/device/rockchip/rk3326/VTECH_VP02/BoardConfig.mk index 817f37284e..f552e2086a 100755 --- a/device/rockchip/rk3326/VTECH_VP02/BoardConfig.mk +++ b/device/rockchip/rk3326/VTECH_VP02/BoardConfig.mk @@ -24,3 +24,5 @@ TARGET_CPU_VARIANT := cortex-a53 TARGET_CPU_SMP := true PRODUCT_KERNEL_CONFIG := rockchip_defconfig android-10-go.config rk3326.config +#add by tuliyuan for default vtech parition +#BOARD_VTECHIMAGE_PARTITION_SIZE := 52428800 diff --git a/device/rockchip/rk3326/VTECH_VP02/parameter.txt b/device/rockchip/rk3326/VTECH_VP02/parameter.txt index 494598e87d..888983bcb0 100755 --- a/device/rockchip/rk3326/VTECH_VP02/parameter.txt +++ b/device/rockchip/rk3326/VTECH_VP02/parameter.txt @@ -8,4 +8,4 @@ MACHINE: 3326 CHECK_MASK: 0x80 PWR_HLD: 0,0,A,0,1 TYPE: GPT -CMDLINE:mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(trust),0x00002000@0x00008000(misc),0x00002000@0x0000a000(dtb),0x00002000@0x0000c000(dtbo),0x00000800@0x0000e000(vbmeta),0x00010000@0x0000e800(boot),0x00030000@0x0001e800(recovery),0x00038000@0x0004e800(backup),0x00002000@0x00086800(security),0x000c0000@0x00088800(cache),0x00008000@0x00148800(metadata),0x00000400@0x00150800(frp),0x004fe000@0x00150c00(super),-@0x0064ec00(userdata:grow) +CMDLINE:mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(trust),0x00002000@0x00008000(misc),0x00002000@0x0000a000(dtb),0x00002000@0x0000c000(dtbo),0x00000800@0x0000e000(vbmeta),0x00010000@0x0000e800(boot),0x00030000@0x0001e800(recovery),0x00038000@0x0004e800(backup),0x00002000@0x00086800(security),0x000c0000@0x00088800(cache),0x00008000@0x00148800(metadata),0x00000400@0x00150800(frp),0x004fe000@0x00150c00(super),0x00010000@0x0064ec00(vtech),-@0x0065ec00(userdata:grow) diff --git a/device/rockchip/rk3326/VTECH_VP02/recovery.fstab b/device/rockchip/rk3326/VTECH_VP02/recovery.fstab index d66d0905b8..cb3d950cde 100755 --- a/device/rockchip/rk3326/VTECH_VP02/recovery.fstab +++ b/device/rockchip/rk3326/VTECH_VP02/recovery.fstab @@ -24,3 +24,4 @@ /dev/block/by-name/baseparamer /baseparamer emmc defaults defaults /dev/block/by-name/vbmeta /vbmeta emmc defaults defaults /dev/block/by-name/dtbo /dtbo emmc defaults defaults +/dev/block/by-name/vtech /vtech ext4 defaults defaults diff --git a/mkimage.sh b/mkimage.sh index 134a836cc5..3ffd5a82e9 100755 --- a/mkimage.sh +++ b/mkimage.sh @@ -82,6 +82,9 @@ BOARD_DTBO_IMG=$OUT/dtbo.img fi cp -a $BOARD_DTBO_IMG $IMAGE_PATH/dtbo.img echo "done." +# add by tuliyuan for vtech.img +echo -n "create vtech.img.... " +cp -av $OUT/vtech.img $IMAGE_PATH/vtech.img echo "create boot.img.... " if [ "$BOARD_AVB_ENABLE" = "true" ]; then diff --git a/system/core/rootdir/Android.mk b/system/core/rootdir/Android.mk index 7ff1588b23..e1c24e5b5e 100644 --- a/system/core/rootdir/Android.mk +++ b/system/core/rootdir/Android.mk @@ -121,7 +121,7 @@ endif ifdef BOARD_USES_METADATA_PARTITION LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/metadata endif - +LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/vtech # For /odm partition. LOCAL_POST_INSTALL_CMD += ; mkdir -p $(TARGET_ROOT_OUT)/odm # For Treble Generic System Image (GSI), system-as-root GSI needs to work on diff --git a/system/sepolicy/prebuilts/api/29.0/public/domain.te b/system/sepolicy/prebuilts/api/29.0/public/domain.te index 5f2b8ba694..7ed1ddb5df 100755 --- a/system/sepolicy/prebuilts/api/29.0/public/domain.te +++ b/system/sepolicy/prebuilts/api/29.0/public/domain.te @@ -838,6 +838,7 @@ full_treble_only(` -appdomain # TODO(b/34980020) remove exemption for appdomain -data_between_core_and_vendor_violators -init + -vold -vold_prepare_subdirs } { data_file_type diff --git a/system/sepolicy/public/domain.te b/system/sepolicy/public/domain.te index 5f2b8ba694..7ed1ddb5df 100755 --- a/system/sepolicy/public/domain.te +++ b/system/sepolicy/public/domain.te @@ -838,6 +838,7 @@ full_treble_only(` -appdomain # TODO(b/34980020) remove exemption for appdomain -data_between_core_and_vendor_violators -init + -vold -vold_prepare_subdirs } { data_file_type -- 2.17.1 19.手动选择音频输入设备 audio_policy_configuration.xml 中定义设备名称 画个重点。。。在录音过程中,不要进行通路切换,要先切换了才能去录音 //定义设备端口名称 这是一个名为Built-In Mic的板载mic channelMasks="AUDIO_CHANNEL_IN_MONO"/> //这是一个名字为ble_audio的无线头戴式设备 / channelMasks="AUDIO_CHANNEL_IN_MONO"/> 切换通路 需要结合dumpsys media.audio_policy中的HW Module去设置设备名称和类型 //选择头戴式设备输入 mAudioManager.setWiredDeviceConnectionState( AudioSystem.DEVICE_IN_WIRED_HEADSET, 1, "", "ble_audio"); AudioSystem.setDeviceConnectionState( AudioSystem.DEVICE_IN_BUILTIN_MIC, 1, "bottom", "",AudioSystem.AUDIO_FORMAT_DEFAULT); //取消选择头戴式设备输入 mAudioManager.setWiredDeviceConnectionState( AudioSystem.DEVICE_IN_WIRED_HEADSET, 0, "", "ble_audio"); AudioSystem.setDeviceConnectionState( AudioSystem.DEVICE_IN_BUILTIN_MIC,0, "bottom", "",AudioSystem.AUDIO_FORMAT_DEFAULT); 18.低版本APK运行在高版本平台时的权限申请默认过滤 platform/packages/apps/PackageInstaller/src/com/android/packageinstaller/permission/ui/ReviewPermissionsActivity.java //首先不让弹出权限申请框 diff --git a/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java b/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java index be7025b451..e2b3a589e0 100644 --- a/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java @@ -24611,6 +24611,10 @@ public class PackageManagerService extends IPackageManager.Stub if (pkg == null) { return false; } + if(packageName.equals("com.sohu.inputmethod.sogouoem")){ + Log.d(TAG,"isPermissionsReviewRequired: is SogouInput allow ...."); + return false; + } return mPermissionManager.isPermissionsReviewRequired(pkg, userId); } //新增方法进行默认过滤 diff --git a/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java index fae189a2c7..a519516a67 100644 --- a/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java +++ b/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java @@ -748,11 +748,15 @@ public final class DefaultPermissionGrantPolicy { grantPermissionsToSystemPackage("com.vtech.projector.launcher", userId, ALWAYS_LOCATION_PERMISSIONS, SENSORS_PERMISSIONS, STORAGE_PERMISSIONS); - |
|
|
|
grantPermissionsToSystemPackage("com.sohu.inputmethod.sogouoem", userId,
+ /**grantPermissionsToSystemPackage("com.sohu.inputmethod.sogouoem", userId, PHONE_PERMISSIONS, CAMERA_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS, - MICROPHONE_PERMISSIONS, STORAGE_PERMISSIONS); + MICROPHONE_PERMISSIONS, STORAGE_PERMISSIONS);**/ + grantPermissionForOlderVersion("com.sohu.inputmethod.sogouoem",STORAGE_PERMISSIONS,userId); + grantPermissionForOlderVersion("com.sohu.inputmethod.sogouoem",PHONE_PERMISSIONS,userId); + grantPermissionForOlderVersion("com.sohu.inputmethod.sogouoem",CAMERA_PERMISSIONS,userId); + grantPermissionForOlderVersion("com.sohu.inputmethod.sogouoem",ALWAYS_LOCATION_PERMISSIONS,userId); //A:@tuliyuan add end @} } @@ -1033,7 +1037,25 @@ public final class DefaultPermissionGrantPolicy { PackageManager.FLAG_PERMISSION_GRANTED_BY_DEFAULT, 0, user); } } - + + //A:@tuliyuan add by tuliyuan + private void grantPermissionForOlderVersion(String packageName, Set + // UserHandle user = UserHandle.of(userId); + + Log.d(TAG,"tuliyuan--- grantPermissionForOlderVersion : pkg "+packageName); + + PackageInfo pkg = getPackageInfo(packageName); + UserHandle user = UserHandle.getUserHandleForUid(pkg.applicationInfo.uid); + if (pkg !=null && ArrayUtils.isEmpty(pkg.requestedPermissions)) { + return; + } + for (String permission : permissions) { + mContext.getPackageManager().updatePermissionFlags(permission, packageName, + PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED, 0, user); + } + + } + //A:@tuliyuan add end /** * Check if a permission is already fixed or is set by the user. * 17.恢复出厂设置不会被删除的文件 存放地址是cache/recovery目录下,需要加上对应的访问权限 注意 只有Priv-app可以访问 而且需要加上 android:sharedUserId=“android.uid.system” diff --git a/bootable/recovery/otautil/logging.cpp b/bootable/recovery/otautil/logging.cpp index eee8cf82fc..8b5aa7129d 100644 --- a/bootable/recovery/otautil/logging.cpp +++ b/bootable/recovery/otautil/logging.cpp @@ -271,7 +271,7 @@ std::vector std::vector while ((de = readdir(d.get())) != nullptr) { - if (strncmp(de->d_name, "last_", 5) == 0 || strcmp(de->d_name, "log") == 0 || strncmp(de->d_name, "Recovery_", 9) == 0) { + if (strncmp(de->d_name, "last_", 5) == 0 || strcmp(de->d_name, "log") == 0 || strncmp(de->d_name, "Recovery_", 9) == 0 || strcmp(de->d_name, "factory.txt") == 0 ) { std::string path = android::base::StringPrintf("%s/%s", CACHE_LOG_DIR, de->d_name); struct stat ***; diff --git a/frameworks/base/core/java/android/os/RecoverySystem.java b/frameworks/base/core/java/android/os/RecoverySystem.java index 3b4171fd29..92e6cf3980 100644 --- a/frameworks/base/core/java/android/os/RecoverySystem.java +++ b/frameworks/base/core/java/android/os/RecoverySystem.java @@ -1135,8 +1135,9 @@ public class RecoverySystem { if (names.equals(RECOVERY_TEST_STATE)) continue; if (reservePackage && names.equals(BLOCK_MAP_FILE.getName())) continue; if (reservePackage && names.equals(UNCRYPT_PACKAGE_FILE.getName())) continue; + if (names.equals("factory.txt")) continue; Log.i(TAG,"names:" + names); - + recursiveDelete(new File(RECOVERY_DIR, names)); } 16 . Gallery2焦点事件背景阴影 Gallery2列表是使用的surfaceview 所以去除焦点事件的高亮背景方法如下 packages/apps/Gallery2/res/layout/gl_root_group.xml diff --git a/packages/apps/Gallery2/res/layout/gl_root_group.xml b/packages/apps/Gallery2/res/layout/gl_root_group.xml index 76ff33b730..d69917659b 100644 --- a/packages/apps/Gallery2/res/layout/gl_root_group.xml +++ b/packages/apps/Gallery2/res/layout/gl_root_group.xml @@ -16,7 +16,8 @@ + android:id="@+id/gl_root_view" + android:defaultFocusHighlightEnabled="false" android:layout_width="match_parent" android:layout_height="match_parent"/> 关键字 FileProvider android:sharedUserId=“android.uid.system” UID 1000 frameworks/base/services/core/java/com/android/server/uri/UriGrantsManagerService.java int checkGrantUriPermission 函数中 diff --git a/frameworks/base/services/core/java/com/android/server/uri/UriGrantsManagerService.java b/frameworks/base/services/core/java/com/android/server/uri/UriGrantsManagerService.java index 38b1a768e4..57976249e7 100644 --- a/frameworks/base/services/core/java/com/android/server/uri/UriGrantsManagerService.java +++ b/frameworks/base/services/core/java/com/android/server/uri/UriGrantsManagerService.java @@ -1034,8 +1034,9 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub { if ((callingAppId == SYSTEM_UID) || (callingAppId == ROOT_UID)) { if ("com.android.settings.files".equals(grantUri.uri.getAuthority()) || "com.android.rk.fileprovider".equals(grantUri.uri.getAuthority()) + || "com.android.rk.fileprovider".equals(grantUri.uri.getAuthority()) || "com.rockchips.mediacenter.fileprovider".equals(grantUri.uri.getAuthority()) - || "com.android.settings.module_licenses".equals(grantUri.uri.getAuthority())) { + || "你的filrprovidername".equals(grantUri.uri.getAuthority())) { //A:@tuliyuan add for Projector Launcher file manager // Exempted authority for // 1. cropping user photos and sharing a generated license html // file in Settings app 14.WifiDisplay 无线投屏 SurfaceComposerClient的使用参考 frameworks/av/cmds/stagefright/ 13.sendStickyBroadcast的作用和可能发生的情况 自己菜写了一个BUG出来,害得我多加了一个小时的班,这里记录一下 sendStickyBroadcast的作用是 只保留最后一条广播,并且一直保留下去,这样即使已经处理了这条广播但当再一次注册这条广播后依然可以收到它。 所以你注册多少次就可以收到多少次。 我在基类activity中写了一个abstract getViewmodel 方法子类继承的时候走了两次 //mModel = getViewModel(); if (getViewModel()!= null) { setViewModel(getViewModel()); //就这里viewmodel的初始化的时候会register receiver。。 //然后就发现我收到了两个重复的广播 } mModel = getViewModel(); if (mModel!= null) { setViewModel(mModel); } WifiManager.WIFI_STATE_CHANGED_ACTION 这个广播的发送是采用的 sendStickyBroadcastAsUser的 。所以才会有我收到两次的原因 12.记一次Anr log问题分析结局 日常重启时发现一个经常系统起不来.所以pull了一下/data/anr/下的log出来自己分析了一下,发现是自己的修改的问题引起的。特此记录一下 Log关键字如下 "main" prio=5 tid=1 Blocked | group="main" sCount=1 dsCount=0 flags=1 obj=0x7155d1f0 self=0xeb63de00 | sysTid=776 nice=-2 cgrp=default sched=0/0 handle=0xebba6dc0 | state=S schedstat=( 4242498727 1067016109 3873 ) utm=351 stm=72 core=1 HZ=100 | stack=0xff27b000-0xff27d000 stackSize=8192KB | held mutexes= at com.android.server.am.ActivityManagerService.serviceDoneExecuting(ActivityManagerService.java:14107) //这一段可以看到是因为一个死锁引起的!锁所占用的内存是 <0x0477b764> 阻塞的线程id是25 - waiting to lock <0x0477b764> (a com.android.server.am.ActivityManagerService) held by thread 25 at android.app.ActivityThread.handleCreateService(ActivityThread.java:3956) at android.app.ActivityThread.access$1500(ActivityThread.java:219) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1875) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at com.android.server.SystemServer.run(SystemServer.java:543) at com.android.server.SystemServer.main(SystemServer.java:351) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:908) 继续向下分析 我们查找tid=25 "ActivityManager:procStart" prio=5 tid=25 Blocked | group="main" sCount=1 dsCount=0 flags=1 obj=0x12dc0e00 self=0xd5eda400 | sysTid=807 nice=-2 cgrp=default sched=0/0 handle=0xc012e230 | state=S schedstat=( 20970539 22614083 68 ) utm=2 stm=0 core=0 HZ=100 | stack=0xc002b000-0xc002d000 stackSize=1040KB | held mutexes= at com.android.server.wm.ActivityTaskManagerService$LocalService.onProcessMapped(ActivityTaskManagerService.java:6570) - waiting to lock <0x0fc9987a> (a com.android.server.wm.WindowManagerGlobalLock) held by thread 18 at com.android.server.am.ActivityManagerService$PidMap.put(ActivityManagerService.java:746) at com.android.server.am.ProcessList.handleProcessStartedLocked(ProcessList.java:2068) at com.android.server.am.ProcessList.handleProcessStartedLocked(ProcessList.java:1991) at com.android.server.am.ProcessList.lambda$startProcessLocked$0$ProcessList(ProcessList.java:1672) - locked <0x0477b764> (a com.android.server.am.ActivityManagerService) at com.android.server.am.-$$Lambda$ProcessList$vtq7LF5jIHO4t5NE03c8g7BT7Jc.run(lambda:-1) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.os.HandlerThread.run(HandlerThread.java:67) at com.android.server.ServiceThread.run(ServiceThread.java:44) 发现这个tid这个也被锁住了 于是我看这个内存地址<0x0477b764> 发现在 "ActivityManager:procStart" prio=5 tid=25 Blocked | group="main" sCount=1 dsCount=0 flags=1 obj=0x12dc0e00 self=0xd5eda400 | sysTid=807 nice=-2 cgrp=default sched=0/0 handle=0xc012e230 | state=S schedstat=( 20970539 22614083 68 ) utm=2 stm=0 core=0 HZ=100 | stack=0xc002b000-0xc002d000 stackSize=1040KB | held mutexes= at com.android.server.wm.ActivityTaskManagerService$LocalService.onProcessMapped(ActivityTaskManagerService.java:6570) - waiting to lock <0x0fc9987a> (a com.android.server.wm.WindowManagerGlobalLock) held by thread 18 at com.android.server.am.ActivityManagerService$PidMap.put(ActivityManagerService.java:746) at com.android.server.am.ProcessList.handleProcessStartedLocked(ProcessList.java:2068) at com.android.server.am.ProcessList.handleProcessStartedLocked(ProcessList.java:1991) at com.android.server.am.ProcessList.lambda$startProcessLocked$0$ProcessList(ProcessList.java:1672) //这里已经lock掉的,但是上面也报错了!这个是在等thread id 18的去释放锁 - locked <0x0477b764> (a com.android.server.am.ActivityManagerService) at com.android.server.am.-$$Lambda$ProcessList$vtq7LF5jIHO4t5NE03c8g7BT7Jc.run(lambda:-1) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.os.HandlerThread.run(HandlerThread.java:67) at com.android.server.ServiceThread.run(ServiceThread.java:44) 于是搜索tid=18 "android.display" prio=5 tid=18 Blocked | group="main" sCount=1 dsCount=0 flags=1 obj=0x12dc0778 self=0xd5e98200 | sysTid=800 nice=-4 cgrp=default sched=0/0 handle=0xc086d230 | state=S schedstat=( 75502572 82093379 210 ) utm=6 stm=1 core=0 HZ=100 | stack=0xc076a000-0xc076c000 stackSize=1040KB | held mutexes= at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:15558) - waiting to lock <0x0477b764> (a com.android.server.am.ActivityManagerService) held by thread 25 at android.app.ContextImpl.sendBroadcast(ContextImpl.java:1049) //就是这里面了。。。因为tid25我们刚才看过了,所以确定就是锁在这里了。。。。。我写的一个广播引起的问题。哎... at com.android.server.policy.PhoneWindowManager.systemBooted(PhoneWindowManager.java:5101) at com.android.server.wm.WindowManagerService.enableScreenAfterBoot(WindowManagerService.java:3243) at com.android.server.wm.ActivityTaskManagerService$LocalService.enableScreenAfterBoot(ActivityTaskManagerService.java:6513) - locked <0x0fc9987a> (a com.android.server.wm.WindowManagerGlobalLock) at com.android.server.wm.ActivityTaskManagerService.lambda$postFinishBooting$6$ActivityTaskManagerService(ActivityTaskManagerService.java:5709) at com.android.server.wm.-$$Lambda$ActivityTaskManagerService$oP6xxIfnD4kb4JN7aSJU073ULR4.run(lambda:-1) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.os.HandlerThread.run(HandlerThread.java:67) at com.android.server.ServiceThread.run(ServiceThread.java:44) |
|
|
|
11.OTA升级问题Error: 20
最近调试FOTA升级时发现一个问题。OTA升级和FOTA升级总是有时候可以有时候不行, 网上找了很多答案没找到,分析log得出是电量不足的原因导致的,在此记录一下! battery capacity is not enough for installing packhage: 15% needed error: 20 取消限制在 static bool is_battery_ok(int* required_battery_level) { using android::hardware::health::V1_0::BatteryStatus; using android::hardware::health::V2_0::get_health_service; using android::hardware::health::V2_0::IHealth; using android::hardware::health::V2_0::Result; using android::hardware::health::V2_0::toString; android::sp static constexpr int BATTERY_READ_TIMEOUT_IN_SEC = 10; int wait_second = 0; while (true) { auto charge_status = BatteryStatus::UNKNOWN; if (health == nullptr) { LOG(WARNING) << "no health implementation is found, assuming defaults"; } else { health ->getChargeStatus([&charge_status](auto res, auto out_status) { if (res == Result::SUCCESS) { charge_status = out_status; } }) .isOk(); // should not have transport error } // Treat unknown status as charged. bool charged = (charge_status != BatteryStatus::DISCHARGING && charge_status != BatteryStatus::NOT_CHARGING); Result res = Result::UNKNOWN; int32_t capacity = INT32_MIN; if (health != nullptr) { health ->getCapacity([&res, &capacity](auto out_res, auto out_capacity) { res = out_res; capacity = out_capacity; }) .isOk(); // should not have transport error } LOG(INFO) << "charge_status " << toString(charge_status) << ", charged " << charged << ", status " << toString(res) << ", capacity " << capacity; // At startup, the battery drivers in devices like N5X/N6P take some time to load // the battery profile. Before the load finishes, it reports value 50 as a fake // capacity. BATTERY_READ_TIMEOUT_IN_SEC is set that the battery drivers are expected // to finish loading the battery profile earlier than 10 seconds after kernel startup. if (res == Result::SUCCESS && capacity == 50) { if (wait_second < BATTERY_READ_TIMEOUT_IN_SEC) { sleep(1); wait_second++; continue; } } // If we can't read battery percentage, it may be a device without battery. In this // situation, use 100 as a fake battery percentage. if (res != Result::SUCCESS) { capacity = 100; } // GmsCore enters recovery mode to install package when having enough battery percentage. // Normally, the threshold is 40% without charger and 20% with charger. So we should check // battery with a slightly lower limitation. static constexpr int BATTERY_OK_PERCENTAGE = 20; static constexpr int BATTERY_WITH_CHARGER_OK_PERCENTAGE = 15; *required_battery_level = charged ? BATTERY_WITH_CHARGER_OK_PERCENTAGE : BATTERY_OK_PERCENTAGE; ///这里 如果处于充电状态,且电量百分比大于15。才可以进行安装 ///如果不是充电状态 百分比应该大于20才可以进行安装 return capacity >= *required_battery_level; } } 10. USB OTG储存设备第三方应用读取权限 app修改区 AndroidManifest.xml package="com.vtech.projector.launcher"> ......... android:authorities="com.vtech.projector.launcher.fileprovider" android:exported="false" android:grantUriPermissions="true" android:permission="android.permission.MANAGE_DOCUMENTS"> android:resource="@xml/file_path" /> ......... res/xml/file_path.xml 系统层修改区 diff --git a/device/rockchip/common/sepolicy/vendor/platform_app.te b/device/rockchip/common/sepolicy/vendor/platform_app.te index d6fdcd024e..52f82cff59 100644 --- a/device/rockchip/common/sepolicy/vendor/platform_app.te +++ b/device/rockchip/common/sepolicy/vendor/platform_app.te @@ -6,3 +6,4 @@ allow platform_app vendor_metadata:dir { search }; #allow platform_app vendor_file:file { getattr open read }; get_prop(platform_app,vendor_default_prop) allow platform_app vendor_file:file { read open getattr map }; +allow platform_app rootfs:dir { create search read open getattr write }; diff --git a/frameworks/base/data/etc/platform.xml b/frameworks/base/data/etc/platform.xml index bf81552dec..599c4c924a 100644 --- a/frameworks/base/data/etc/platform.xml +++ b/frameworks/base/data/etc/platform.xml @@ -62,6 +62,7 @@ + diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/u***/StorageNotification.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/u***/StorageNotification.java index ff5bd03740..12d41a867f 100644 --- a/frameworks/base/packages/SystemUI/src/com/android/systemui/u***/StorageNotification.java +++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/u***/StorageNotification.java @@ -288,10 +288,18 @@ public class StorageNotification extends SystemUI { private void onPublicVolumeStateChangedInternal(VolumeInfo vol) { Log.d(TAG, "Notifying about public volume: " + vol.toString()); - + //A:@tuliyuan add by tuliyuan to notify vlanuncher to update filemanager activity --start + Intent mIntent = new Intent(); + //A:@tuliyuan add by tuliyuan to notify vlanuncher to update filemanager activity --end final Notification notif; switch (vol.getState()) { case VolumeInfo.STATE_UNMOUNTED: + //A:@tuliyuan add by tuliyuan to notify vlanuncher to update filemanager activity --start + + mIntent.setAction("com.vtech.otg_unmounted"); + mContext.sendBroadcast(mIntent); + //A:@tuliyuan add by tuliyuan to notify vlanuncher to update filemanager activity --end notif = onVolumeUnmounted(vol); break; case VolumeInfo.STATE_CHECKING: @@ -299,6 +307,11 @@ public class StorageNotification extends SystemUI { break; case VolumeInfo.STATE_MOUNTED: case VolumeInfo.STATE_MOUNTED_READ_ONLY: + //A:@tuliyuan add by tuliyuan to notify vlanuncher to update filemanager activity --start + mIntent.setAction("com.vtech.otg_mounted"); + mIntent.putExtra("path",vol.getPath().getAbsolutePath()); + mContext.sendBroadcast(mIntent); + //A:@tuliyuan add by tuliyuan to notify vlanuncher to update filemanager activity --end notif = onVolumeMounted(vol); break; case VolumeInfo.STATE_FORMATTING: @@ -311,6 +324,11 @@ public class StorageNotification extends SystemUI { notif = onVolumeUnmountable(vol); break; case VolumeInfo.STATE_REMOVED: + //A:@tuliyuan add by tuliyuan to notify vlanuncher to update filemanager activity --start + mIntent.setAction("com.vtech.otg_removed"); + mContext.sendBroadcast(mIntent); + //A:@tuliyuan add by tuliyuan to notify vlanuncher to update filemanager activity --end notif = onVolumeRemoved(vol); break; case VolumeInfo.STATE_BAD_REMOVAL: diff --git a/system/core/sdcard/sdcard.cpp b/system/core/sdcard/sdcard.cpp index 2b358197ac..47397d896e 100644 --- a/system/core/sdcard/sdcard.cpp +++ b/system/core/sdcard/sdcard.cpp @@ -200,7 +200,7 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe multi_user, userid, AID_EVERYBODY, full_write ? 0027 : 0022, derive_gid, default_normal, unshared_obb, use_esdfs) || !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_write, uid, gid, - multi_user, userid, AID_EVERYBODY, full_write ? 0007 : 0022, + multi_user, userid, AID_EVERYBODY, full_write ? 0007 : 0007, derive_gid, default_normal, unshared_obb, use_esdfs) || !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_full, uid, gid, multi_user, userid, AID_EVERYBODY, 0007, derive_gid, diff --git a/system/sepolicy/prebuilts/api/29.0/public/app.te b/system/sepolicy/prebuilts/api/29.0/public/app.te index 5c48e71f5c..ebae2d1b6c 100644 --- a/system/sepolicy/prebuilts/api/29.0/public/app.te +++ b/system/sepolicy/prebuilts/api/29.0/public/app.te @@ -446,7 +446,7 @@ neverallow appdomain { domain -appdomain -perfetto }:process { sigkill sigstop signal }; # Write to rootfs. -neverallow appdomain rootfs:dir_file_class_set +neverallow { appdomain -platform_app } rootfs:dir_file_class_set { create write setattr relabelfrom relabelto append unlink link rename }; # Write to /system. diff --git a/system/sepolicy/public/app.te b/system/sepolicy/public/app.te index 5c48e71f5c..ebae2d1b6c 100644 --- a/system/sepolicy/public/app.te +++ b/system/sepolicy/public/app.te @@ -446,7 +446,7 @@ neverallow appdomain { domain -appdomain -perfetto }:process { sigkill sigstop signal }; # Write to rootfs. -neverallow appdomain rootfs:dir_file_class_set +neverallow { appdomain -platform_app } rootfs:dir_file_class_set { create write setattr relabelfrom relabelto append unlink link rename }; # Write to /system. -- 2.17.1 9. KL映射关系 驱动定义键值位置… kernel/include/uapi/linux/input-event-codes.h KEY 183 F13 底层键值 上层键值 8.生成系统签名的platform.jks 生成系统签名的platfrom.jks vtechsz是密码 androiddebugkey 是alias cp build/target/product/security/platform.pk8 ./temp cp build/target/product/security/platform.x509.pem ./temp cp prebuilts/sdk/tools/lib/signapk.jar ./temp cp prebuilts/sdk/tools/linux/lib64/libconscrypt_openjdk_jni.so ./temp cd ./temp java -jar -Djava.library.path=. signapk.jar platform.x509.pem platform.pk8 launcher.apk output.apk openssl pkcs8 -inform DER -nocrypt -in platform.pk8 -out platform.pem openssl pkcs12 -export -in platform.x509.pem -out platform.p12 -inkey platform.pem -password pass:vtechsz -name androiddebugkey keytool -importkeystore -deststorepass vtechsz -destkeystore ./platform.jks -srckeystore ./platform.p12 -srcstoretype PKCS12 -srcstorepass vtechsz //密码需要和上面保持一致 7.电源键使用的GlobalAction. 使用的不是/policy/LegacyGlobalActions.java 而是 frameworks/base/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java 6.设置默认不休眠。 设置-1是莫的用的,注意overlay的使用 frameworks/base/packages/SettingsProvider/res/values/defaults.xml 5.关机广播 private void shutDown() { Intent shutDown = new Intent(Intent.ACTION_REQUEST_SHUTDOWN); shutDown.putExtra(Intent.EXTRA_KEY_CONFIRM, false); shutDown.putExtra(Intent.EXTRA_REASON, PowerManager.SHUTDOWN_REASON_SHUTDOWN); shutDown.putExtra(Intent.EXTRA_USER_REQUESTED_SHUTDOWN, false); shutDown.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivityAsUser(shutDown, UserHandle.CURRENT); } |
|
|
|
4.预安装preinstall
把APK放到device/rockchip/rk3326/[project]/preinstall preinstall是安装不可卸载 -->指向odm/bundled_persist-app --> preinstall_del是可以卸载 恢复出厂可以恢复 -->odm/bundled_uninstall_back-app preinstall_del_forever是可卸载恢复出厂设置不可以恢复的 -->odm/bundled_uninstall_gone-app 安装方式是在PKMS里面扫描进行installd安装的 预置到的目录是在Enviroments.java 里面有定义 PackageManagerService.java new File(BUNDLED_PERSIST_DIR) Environment.getPrebundledUninstallBackDirectory(), Environment.getPrebundledUninstallGoneDirectory(), 扫描的是这三个目录 可能遇到的问题如下 1.APK未在相应的目录下安装生成 如果放入device/rockchip/rk3326/[project]/preinstall中没有生成对应的apk 请检测device/rockchip/rk3326/device-common.mk中 ifneq ($(strip $(TARGET_PRODUCT)), ) #TARGET_DEVICE_DIR=$(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_PRODUCT)/BoardConfig.mk') #TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(TARGET_DEVICE_DIR))) #$(info device-rockchip-common TARGET_DEVICE_DIR: $(TARGET_DEVICE_DIR)) $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall bundled_persist-app) $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall_del bundled_uninstall_back-app) $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall_del_forever bundled_uninstall_gone-app) -include $(TARGET_DEVICE_DIR)/preinstall/preinstall.mk -include $(TARGET_DEVICE_DIR)/preinstall_del/preinstall.mk -include $(TARGET_DEVICE_DIR)/preinstall_del_forever/preinstall.mk endif 这段代码是否已被注释 ,如果注释,打开就行。TAGRGET_DEVICE_DIR没必要在打开。会报重复定义的错误 2.生成到img中了开机却无法自动安装 device/rockchip/common/sepolicy/vendor/system_server.te +#add by tuliyuan +#============= system_server ============== +allow system_server vendor_file:dir { read open }; +allow system_server vendor_file:file { read open map getattr }; system/sepolicy/public/domain.te neverallow { coredomain + -system_server -appdomain -bootanim -crash_dump .... } vendor_file system/sepolicy/prebuilts/api/29.0/public/domain.te 和上面的domain.te一样的 neverallow { coredomain + -system_server -appdomain -bootanim -crash_dump .... } vendor_file 3。APK安装时使用的lib库明明符合系统架构却无法使用 device目录修改项**************************************** diff --git a/device/rockchip/common/sepolicy/private/installd.te b/device/rockchip/common/sepolicy/private/installd.te new file mode 100644 index 0000000000..a1997b43db --- /dev/null +++ b/device/rockchip/common/sepolicy/private/installd.te @@ -0,0 +1,3 @@ +#============= installd ============== +allow installd vendor_file:dir { read open }; +allow installd vendor_file:file { read open }; diff --git a/device/rockchip/common/sepolicy/private/system_app.te b/device/rockchip/common/sepolicy/private/system_app.te index 697d86c8b2..d0e022cbf6 100644 --- a/device/rockchip/common/sepolicy/private/system_app.te +++ b/device/rockchip/common/sepolicy/private/system_app.te @@ -2,3 +2,5 @@ #for ota allow system_app config_gz:file { open read getattr }; allow system_app device:chr_file { read write ioctl open }; +#============= system_app ============== +allow system_app vendor_file:file { read open }; diff --git a/device/rockchip/common/sepolicy/vendor/platform_app.te b/device/rockchip/common/sepolicy/vendor/platform_app.te index 8f2a746027..d6fdcd024e 100644 --- a/device/rockchip/common/sepolicy/vendor/platform_app.te +++ b/device/rockchip/common/sepolicy/vendor/platform_app.te @@ -5,3 +5,4 @@ allow platform_app vendor_metadata:dir { search }; #TODO removed for Q #allow platform_app vendor_file:file { getattr open read }; get_prop(platform_app,vendor_default_prop) +allow platform_app vendor_file:file { read open getattr map }; diff --git a/device/rockchip/common/sepolicy/vendor/system_app.te b/device/rockchip/common/sepolicy/vendor/system_app.te index 0ca1337511..36757d436f 100644 --- a/device/rockchip/common/sepolicy/vendor/system_app.te +++ b/device/rockchip/common/sepolicy/vendor/system_app.te @@ -44,3 +44,4 @@ set_prop(system_app,debug_prop) allow system_app block_device:dir { search read open getattr }; allow system_app mnt_media_rw_file:dir { search read open getattr }; allow system_app asec_apk_file:dir { search read open getattr }; +allow system_app vendor_file:file { map }; diff --git a/device/rockchip/common/sepolicy/vendor/system_server.te b/device/rockchip/common/sepolicy/vendor/system_server.te index f6b9060046..f0faedb5f5 100644 --- a/device/rockchip/common/sepolicy/vendor/system_server.te +++ b/device/rockchip/common/sepolicy/vendor/system_server.te @@ -25,3 +25,7 @@ get_prop(system_server,vendor_default_prop) #rk_audio_setting_hal allow system_server rk_audio_setting_hal_service:hwservice_manager find; binder_call(system_server, rk_audio_setting_hal) +#add by tuliyuan +#============= system_server ============== +allow system_server vendor_file:dir { read open }; +allow system_server vendor_file:file { read open map getattr }; diff --git a/device/rockchip/common/sepolicy/vendor/untrusted_app.te b/device/rockchip/common/sepolicy/vendor/untrusted_app.te index dc928093c4..777275f0ab 100644 --- a/device/rockchip/common/sepolicy/vendor/untrusted_app.te +++ b/device/rockchip/common/sepolicy/vendor/untrusted_app.te @@ -10,3 +10,5 @@ allow untrusted_app oemfs:file {execmod}; dontaudit untrusted_app mnt_vendor_file:dir { search }; get_prop(untrusted_app,public_vendor_system_prop) get_prop(untrusted_app,vendor_default_prop) +#============= untrusted_app ============== +allow untrusted_app vendor_file:file { getattr open read map execute }; diff --git a/device/rockchip/common/sepolicy/vendor/untrusted_app_27.te b/device/rockchip/common/sepolicy/vendor/untrusted_app_27.te index be71d01a64..297546d6d6 100644 --- a/device/rockchip/common/sepolicy/vendor/untrusted_app_27.te +++ b/device/rockchip/common/sepolicy/vendor/untrusted_app_27.te @@ -13,3 +13,6 @@ allow untrusted_app_27 ota_data_file:dir rw_dir_perms; allow untrusted_app_27 ota_data_file:file rw_file_perms; allow untrusted_app_27 oemfs:file {execmod}; get_prop(untrusted_app_27,vendor_default_prop) + +#============= untrusted_app_27 ============== +allow untrusted_app_27 vendor_file:file { read open getattr map execute }; system目录修改项**************************************** diff --git a/system/sepolicy/prebuilts/api/29.0/public/domain.te b/system/sepolicy/prebuilts/api/29.0/public/domain.te index ff4e66ead2..85f9b6c1a5 100755 --- a/system/sepolicy/prebuilts/api/29.0/public/domain.te +++ b/system/sepolicy/prebuilts/api/29.0/public/domain.te @@ -973,6 +973,8 @@ full_treble_only(` # except for the ones whitelisted here. neverallow { coredomain + -untrusted_app + -untrusted_app_27 -init -shell -system_executes_vendor_violators @@ -1002,6 +1004,12 @@ full_treble_only(` neverallow { coredomain # TODO(b/37168747): clean up fwk access to /vendor + -system_server + -untrusted_app_27 + -untrusted_app + -system_app + -platform_app + -installd -crash_dump -init # starts vendor executables -kernel # loads /vendor/firmware @@ -1325,6 +1333,11 @@ neverallow * same_process_hwservice:hwservice_manager add; full_treble_only(` neverallow { coredomain + -system_server + -untrusted_app_27 + -untrusted_app + -system_app + -installd -appdomain -bootanim -crash_dump diff --git a/system/sepolicy/public/domain.te b/system/sepolicy/public/domain.te old mode 100644 new mode 100755 index ff4e66ead2..85f9b6c1a5 --- a/system/sepolicy/public/domain.te +++ b/system/sepolicy/public/domain.te @@ -973,6 +973,8 @@ full_treble_only(` # except for the ones whitelisted here. neverallow { coredomain + -untrusted_app + -untrusted_app_27 -init -shell -system_executes_vendor_violators @@ -1002,6 +1004,12 @@ full_treble_only(` neverallow { coredomain # TODO(b/37168747): clean up fwk access to /vendor + -system_server + -untrusted_app_27 + -untrusted_app + -system_app + -platform_app + -installd -crash_dump -init # starts vendor executables -kernel # loads /vendor/firmware @@ -1325,6 +1333,11 @@ neverallow * same_process_hwservice:hwservice_manager add; full_treble_only(` neverallow { coredomain + -system_server + -untrusted_app_27 + -untrusted_app + -system_app + -installd -appdomain -bootanim -crash_dump |
|
|
|
3.BOOTLOGO和bootanimation
开机LOGO位置是在kernel/logo.bmp 和logo_kernel.bmp 开机动画是device/rockchip/common/bootshutdown/中 2.ioctl代码 部分。 /* DO NOT EDIT THIS FILE - it is machine generated */ #include #include #include #include #include #include #include #include #include /* Header for class com_android_settings_projection_ProjectionIOCTL */ //#ifndef _Included_com_android_settings_projection_ProjectionIOCTL //#define _Included_com_android_settings_projection_ProjectionIOCTL #include #define LOG_TAG "C900_PROJECTION" // 这个是自定义的LOG的标识 #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) #define LOGD(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) #define LOGW(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) //************************** #define DEV_PROJECTION "/dev/projector" struct motorstep { int dir; int counter; }; motorstep step_info; #define PROJECTOR 0x8A #define PROJECTOR_WRITE_LIGHT _IOW(PROJECTOR, 0x01, int) // 设置亮度 #define PROJECTOR_READ_LIGHT _IOR(PROJECTOR, 0x01, int) // 读取亮度值 #define PROJECTOR_WRITE_T_DRGREE _IOW(PROJECTOR, 0x02, int) // 设置T形角度度数 #define PROJECTOR_READ_T_DRGREE _IOR(PROJECTOR, 0X02, int) // 读取当前角度数 #define PROJECTOR_START_MOTOR _IOW(PROJECTOR, 0x03, int) // 开启马达 #define PROJECTOR_STOP_MOTOR _IOW(PROJECTOR, 0X04, int) // 停止马达 #define PROJECTOR_SET_MOTOR_STEP _IOW(PROJECTOR, 0X05, int) // 移动马达多少步 int fd = -1; /* * Class: com_android_settings_projection_ProjectionIOCTL * Method: initDevice * Signature: ()I */ extern "C" JNIEXPORT jint JNICALL Java_com_android_settings_projection_ProjectionIOCTL_initDevice (JNIEnv *, jclass thiz __unused,jobject ){ LOGI(" Device init ....."); fd = open(DEV_PROJECTION,O_RDWR); if(fd < 0){ LOGI(" Device init Failed ....."); return 0; }else { LOGI(" Device init Success....."); return 1; } } /* * Class: com_android_settings_projection_ProjectionIOCTL * Method: AdjustLight * Signature: (I)I */ extern "C" JNIEXPORT jint JNICALL Java_com_android_settings_projection_ProjectionIOCTL_AdjustLight (JNIEnv *, jclass thiz __unused, jint val){ if(fd > 0){ int result = ioctl(fd,PROJECTOR_WRITE_LIGHT, &val); LOGW(" Write Light value is %d and result is %d",val,result); return result; }else { return -1; } } /* * Class: com_android_settings_projection_ProjectionIOCTL * Method: readLight * Signature: ()I */ extern "C" JNIEXPORT jint JNICALL Java_com_android_settings_projection_ProjectionIOCTL_readLight (JNIEnv *, jclass thiz __unused, jobject obj __unused){ int result_val = -1; if(fd > 0){ int result = ioctl(fd, PROJECTOR_READ_LIGHT, &result_val); LOGW(" READ Light value ioctl result is %d and value is %d",result,result_val); return result_val; } return -1; } /* * Class: com_android_settings_projection_ProjectionIOCTL * Method: startMotor * Signature: ()I */ extern "C" JNIEXPORT jint JNICALL Java_com_android_settings_projection_ProjectionIOCTL_startMotor (JNIEnv *, jclass thiz __unused,jobject obj __unused); /* * Class: com_android_settings_projection_ProjectionIOCTL * Method: AdjustMotorFoucs * Signature: (I)I */ extern "C" JNIEXPORT jint JNICALL Java_com_android_settings_projection_ProjectionIOCTL_AdjustMotorFoucs (JNIEnv *, jclass thiz __unused, jint direct, jint steps){ if(fd > 0){ //LOGW("AdjustMotorFoucs...."); LOGW("AdjustMotorFoucs .... direct is%d , step is %d",direct ,steps); //Backward step_info.dir = direct; step_info.counter = steps; int result = ioctl(fd,PROJECTOR_SET_MOTOR_STEP, &step_info); LOGW("AdjustMotorFoucs .... direct is%d , step is %d",direct ,steps); return result; }else { return -1; } } 1. RK3326分区 使用的是/device/rockchip/rk3326/[project]/parameter.txt Q版本super.img包含了好几个分区的信息,是基于预留大小动态调整整个分区大小的 Android Q 默认打开了动态分区 PRODUCT_USE_DYNAMIC_PARTITIONS := true //是否打开动态分区 PRODUCT_BUILD_PRODUCT_IMAGE := true //是否编译动态分区img TARGET_COPY_OUT_PRODUCT := product BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE ?= ext4 //img格式 BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT := true //是否编译super.img BOARD_SUPER_PARTITION_GROUPS := rockchip_dynamic_partitions BOARD_ROCKCHIP_DYNAMIC_PARTITIONS_SIZE ?= 3263168512 //动态分区大小。没什么用 BOARD_ROCKCHIP_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor product odm //动态分区包含分区 BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 52428800 //预留分区 BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE := 52428800 //预留分区 BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE := 209715200 //预留分区 BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE := 52428800 //预留分区 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
基于米尔瑞芯微RK3576核心板/开发板的人脸疲劳检测应用方案
533 浏览 0 评论
803 浏览 1 评论
700 浏览 1 评论
1926 浏览 1 评论
3171 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 10:27 , Processed in 0.540191 second(s), Total 54, Slave 48 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号