Move persistent data to /data/vendor.
Widevine persistent data is stored in /data/mediadrm, HALs are not allowed to access files in /data. Move persistent data to /data/vendor/mediadrm/widevine for older devices, and persistent data will not be saved under /data/vendor. Test: Play Movies & Tv, Netflix bug: 36601695 Change-Id: I31fdd43b7db327bf6d8343dc95e9883ae6bce70d
This commit is contained in:
@@ -3,6 +3,24 @@
|
||||
#
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Copies move script to /system/bin.
|
||||
# The mv command preserves SELinux labels(i.e. media_data_file).
|
||||
# We need to run restorecon to put the correct context after the move.
|
||||
# However, restorecon is not implemented for /vendor/bin, so we put
|
||||
# the script in /system/bin.
|
||||
#
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := move_widevine_data.sh
|
||||
LOCAL_MODULE_CLASS := EXECUTABLES
|
||||
LOCAL_MODULE := $(LOCAL_SRC_FILES)
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_OWNER := widevine
|
||||
|
||||
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Builds android.hardware.drm@1.0-service.widevine
|
||||
#
|
||||
@@ -30,6 +48,7 @@ LOCAL_HEADER_LIBRARIES := \
|
||||
|
||||
LOCAL_MODULE := android.hardware.drm@1.0-service.widevine
|
||||
LOCAL_INIT_RC := src_hidl/android.hardware.drm@1.0-service.widevine.rc
|
||||
LOCAL_REQUIRED_MODULES := move_widevine_data.sh
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/bin/hw
|
||||
LOCAL_PROPRIETARY_MODULE := true
|
||||
LOCAL_MODULE_OWNER := widevine
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
const char kBasePathPrefix[] = "/data/mediadrm/IDM";
|
||||
const char kBasePathPrefix[] = "/data/vendor/mediadrm/IDM";
|
||||
const char kL1Dir[] = "/L1/";
|
||||
const char kL2Dir[] = "/L2/";
|
||||
const char kL3Dir[] = "/L3/";
|
||||
|
||||
@@ -12,7 +12,7 @@ static const std::string kExistentFile = "/system/bin/sh";
|
||||
static const std::string kExistentDir = "/system/bin";
|
||||
static const std::string kNonExistentFile = "/system/bin/enoext";
|
||||
static const std::string kNonExistentDir = "/system/bin_enoext";
|
||||
static const std::string kTestDir = "/data/mediadrm/IDM0/";
|
||||
static const std::string kTestDir = "/data/vendor/mediadrm/IDM0/";
|
||||
|
||||
} // namespace test_vectors
|
||||
} // namespace wvcdm
|
||||
|
||||
21
libwvdrmengine/move_widevine_data.sh
Executable file
21
libwvdrmengine/move_widevine_data.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/system/bin/sh
|
||||
|
||||
DEST_PATH="/data/vendor/mediadrm"
|
||||
FILES_MOVED="/data/vendor/mediadrm/files_moved"
|
||||
SRC_PATH="/data/mediadrm"
|
||||
|
||||
if [ ! -f "$FILES_MOVED" ]; then
|
||||
for i in "$SRC_PATH/IDM"*; do
|
||||
dest_path=$DEST_PATH/"${i#$SRC_PATH/}"
|
||||
if [ -d "$i" ]; then
|
||||
mkdir -p $dest_path -m 700
|
||||
mv $i "$DEST_PATH"
|
||||
find $dest_path -print0 | while IFS= read -r -d '' file
|
||||
do
|
||||
chgrp media "$file"
|
||||
done
|
||||
fi
|
||||
done
|
||||
restorecon -R "$DEST_PATH"
|
||||
echo 1 > "$FILES_MOVED"
|
||||
fi
|
||||
@@ -1,6 +1,17 @@
|
||||
on property:init.svc.mediadrm=running
|
||||
mkdir /data/vendor/mediadrm 0770 media mediadrm
|
||||
start vendor.move_data_sh
|
||||
|
||||
service vendor.move_data_sh /system/bin/move_widevine_data.sh
|
||||
class late_start
|
||||
user media
|
||||
group media mediadrm system
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service vendor.drm-widevine-hal-1-0 /vendor/bin/hw/android.hardware.drm@1.0-service.widevine
|
||||
class hal
|
||||
user media
|
||||
group mediadrm drmrpc
|
||||
group media mediadrm drmrpc
|
||||
ioprio rt 4
|
||||
writepid /dev/cpuset/foreground/tasks
|
||||
|
||||
Reference in New Issue
Block a user