Move the creation of the staging directory to odrefresh.

Historically, the creation of the odrefresh staging directory was done
by libartpalette. This was because the operation needs to call
setfilecon. However, setfilecon is actually a system API since R, so
odrefresh can directly call it.

Regarding SELinux policy, the path to the staging directory is not
hardcoded in file context. SELinux allows odrefresh to create
directories in apex_art_data_file (/data/misc/apexdata/com.android.art)
and relabeling any directory from apex_art_data_file to
apex_art_staging_data_file. Therefore, odrefresh has sufficient
permissions to create the staging directory at
/data/misc/apexdata/com.android.art/staging, regardless of what the
staging directory path was in libartpalette.

This change allows us to perform rename(2) to move a file from the
staging directory to the output direcory when odrefresh runs on boot.
CompOS changes need to follow to allow the same when odrefresh runs in
CompOS.

Test: atest odsign_e2e_tests_full
Change-Id: Ic9954af2929b2fc5c6bc4258ddf41d3a606387c0
2 files changed