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

Commit 021f656c authored by Leandro Gracia Gil's avatar Leandro Gracia Gil Committed by Alex Vakulenko
Browse files

Update the GVR platform library.

This CL renames the target for the GVR platform library and introduces
a new method in it to determine if this is an all-in-one device or a
Daydream-ready smartphone.

Bug: 34713987
Change-Id: I38067cb02fd805f3fbe1925250bddebfe82cce55
(cherry picked from commit 904762bdddd2ea5d386b1cf5fb7a35899fbc7a1e)
parent ca38a145
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -19,10 +19,9 @@ include_dirs := \

# Java platform library for the system implementation of the GVR API.
include $(CLEAR_VARS)
LOCAL_MODULE := gvr_platform
LOCAL_MODULE_STEM := com.google.vr.gvr.platform
LOCAL_MODULE := com.google.vr.gvr.platform
LOCAL_REQUIRED_MODULES := libgvr_system_loader libgvr_system
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_SRC_FILES := $(call all-java-files-under, java)
include $(BUILD_JAVA_LIBRARY)

# Library to perform dlopen on the actual platform library.
+30 −24
Original line number Diff line number Diff line
package com.google.vr.gvr.platform;

import android.os.SystemProperties;

/**
 * Auxiliary class to load the system implementation of the GVR API.
 * @hide
 */
public class Loader {

    private static final String VR_MODE_BOOT = "ro.boot.vr";

    /**
   * Opens a shared library containing the system implementation for the GVR
   * API and returns the handle to it.
     * Opens a shared library containing the system implementation for the GVR API and returns the
     * handle to it.
     *
     * @return A Long object describing the handle returned by dlopen.
     */
    public static Long loadLibrary() {
    // Note: we cannot safely do caller verifications here, so instead we do
    // them in the service side. This means that private API symbols will be
    // visible to any app adding the appropriate <uses-library> in their
    // manifest, but any requests to such APIs will fail if not done from a
    // trusted package like VrCore.
    //
    // Trusted packages are defined by (package name, signature) pairs in within
    // a system service, and both must match.
        // Note: caller verifications cannot be safely done here. Any app can find and use this API.
        // Any sensitive functions must have appropriate checks on the service side.

        // Load a thin JNI library that runs dlopen on request.
        System.loadLibrary("gvr_system_loader");
@@ -28,5 +27,12 @@ public class Loader {
        return nativeLoadLibrary("libgvr_system.so");
    }

    /**
     * Returns true if this device boots directly in VR mode.
     */
    public static boolean getVrBoot() {
        return SystemProperties.getBoolean(VR_MODE_BOOT, false);
    }

    private static native long nativeLoadLibrary(String library);
}