Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c778551a authored by Victor Hsieh's avatar Victor Hsieh
Browse files

Move VerityUtils from services.jar to core.jar

There is a demand to use VerityUtils outside of services from core. This
allows the class to be used from both places.

Bug: 180414192
Test: m

Change-Id: I8da2e3df218547208799a238eab2d54545194d00
parent 60ec82fc
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
# Bug component: 36824

per-file VerityUtils.java = victorhsieh@google.com
+10 −4
Original line number Original line Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


package com.android.server.security;
package com.android.internal.security;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.os.Build;
import android.os.Build;
@@ -42,7 +42,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Arrays;


/** Provides fsverity related operations. */
/** Provides fsverity related operations. */
abstract public class VerityUtils {
public abstract class VerityUtils {
    private static final String TAG = "VerityUtils";
    private static final String TAG = "VerityUtils";


    /**
    /**
@@ -156,8 +156,8 @@ abstract public class VerityUtils {
                return SetupResult.failed();
                return SetupResult.failed();
            }
            }
            return SetupResult.ok(Os.dup(rfd), contentSize);
            return SetupResult.ok(Os.dup(rfd), contentSize);
        } catch (IOException | SecurityException | DigestException | NoSuchAlgorithmException |
        } catch (IOException | SecurityException | DigestException | NoSuchAlgorithmException
                SignatureNotFoundException | ErrnoException e) {
                | SignatureNotFoundException | ErrnoException e) {
            Slog.e(TAG, "Failed to set up apk verity: ", e);
            Slog.e(TAG, "Failed to set up apk verity: ", e);
            return SetupResult.failed();
            return SetupResult.failed();
        } finally {
        } finally {
@@ -243,14 +243,20 @@ abstract public class VerityUtils {
        private final FileDescriptor mFileDescriptor;
        private final FileDescriptor mFileDescriptor;
        private final int mContentSize;
        private final int mContentSize;


        /** @deprecated */
        @Deprecated
        public static SetupResult ok(@NonNull FileDescriptor fileDescriptor, int contentSize) {
        public static SetupResult ok(@NonNull FileDescriptor fileDescriptor, int contentSize) {
            return new SetupResult(RESULT_OK, fileDescriptor, contentSize);
            return new SetupResult(RESULT_OK, fileDescriptor, contentSize);
        }
        }


        /** @deprecated */
        @Deprecated
        public static SetupResult skipped() {
        public static SetupResult skipped() {
            return new SetupResult(RESULT_SKIPPED, null, -1);
            return new SetupResult(RESULT_SKIPPED, null, -1);
        }
        }


        /** @deprecated */
        @Deprecated
        public static SetupResult failed() {
        public static SetupResult failed() {
            return new SetupResult(RESULT_FAILED, null, -1);
            return new SetupResult(RESULT_FAILED, null, -1);
        }
        }
+1 −0
Original line number Original line Diff line number Diff line
@@ -210,6 +210,7 @@ cc_library_shared {
                "com_android_internal_os_KernelSingleUidTimeReader.cpp",
                "com_android_internal_os_KernelSingleUidTimeReader.cpp",
                "com_android_internal_os_Zygote.cpp",
                "com_android_internal_os_Zygote.cpp",
                "com_android_internal_os_ZygoteInit.cpp",
                "com_android_internal_os_ZygoteInit.cpp",
                "com_android_internal_security_VerityUtils.cpp",
                "hwbinder/EphemeralStorage.cpp",
                "hwbinder/EphemeralStorage.cpp",
                "fd_utils.cpp",
                "fd_utils.cpp",
                "android_hardware_input_InputWindowHandle.cpp",
                "android_hardware_input_InputWindowHandle.cpp",
+2 −0
Original line number Original line Diff line number Diff line
@@ -197,6 +197,7 @@ extern int register_com_android_internal_os_KernelSingleProcessCpuThreadReader(J
extern int register_com_android_internal_os_KernelSingleUidTimeReader(JNIEnv *env);
extern int register_com_android_internal_os_KernelSingleUidTimeReader(JNIEnv *env);
extern int register_com_android_internal_os_Zygote(JNIEnv *env);
extern int register_com_android_internal_os_Zygote(JNIEnv *env);
extern int register_com_android_internal_os_ZygoteInit(JNIEnv *env);
extern int register_com_android_internal_os_ZygoteInit(JNIEnv *env);
extern int register_com_android_internal_security_VerityUtils(JNIEnv* env);
extern int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv *env);
extern int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv *env);


// Namespace for Android Runtime flags applied during boot time.
// Namespace for Android Runtime flags applied during boot time.
@@ -1529,6 +1530,7 @@ static const RegJNIRec gRegJNI[] = {
        REG_JNI(register_com_android_internal_os_ClassLoaderFactory),
        REG_JNI(register_com_android_internal_os_ClassLoaderFactory),
        REG_JNI(register_com_android_internal_os_Zygote),
        REG_JNI(register_com_android_internal_os_Zygote),
        REG_JNI(register_com_android_internal_os_ZygoteInit),
        REG_JNI(register_com_android_internal_os_ZygoteInit),
        REG_JNI(register_com_android_internal_security_VerityUtils),
        REG_JNI(register_com_android_internal_util_VirtualRefBasePtr),
        REG_JNI(register_com_android_internal_util_VirtualRefBasePtr),
        REG_JNI(register_android_hardware_Camera),
        REG_JNI(register_android_hardware_Camera),
        REG_JNI(register_android_hardware_camera2_CameraMetadata),
        REG_JNI(register_android_hardware_camera2_CameraMetadata),
Loading