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

Commit 997dd181 authored by Patrick Plunkett's avatar Patrick Plunkett Committed by Android (Google) Code Review
Browse files

Merge "Remove libdvr platform library"

parents 1dd4435c 741a690b
Loading
Loading
Loading
Loading

vr/Android.bp

deleted100644 → 0
+0 −41
Original line number Diff line number Diff line
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Library to perform dlopen on the actual shared library.
cc_library_shared {
    name: "libdvr_loader",
    owner: "google",
    srcs: ["dvr_library_loader.cpp"],
    cflags: [
        "-Wall",
        "-Werror",
    ],
}

// Java platform library for vr stuff.
java_library {
    name: "com.google.vr.platform",
    installable: true,
    owner: "google",
    required: [
        "libdvr_loader",
        "libdvr",
    ],
    srcs: ["java/**/*.java"],
}

prebuilt_etc_xml {
    name: "com.google.vr.platform.xml",
    src: "com.google.vr.platform.xml",
}

vr/com.google.vr.platform.xml

deleted100644 → 0
+0 −20
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<permissions>
    <library name="com.google.vr.platform"
             file="/system/framework/com.google.vr.platform.jar" />
</permissions>

vr/dvr_library_loader.cpp

deleted100644 → 0
+0 −25
Original line number Diff line number Diff line
#include <dlfcn.h>
#include <jni.h>

#include <string>

extern "C" {

JNIEXPORT jlong JNICALL
Java_com_google_vr_platform_Dvr_nativeLoadLibrary(
    JNIEnv* env, jclass, jstring java_library) {
  if (!java_library)
    return 0;

  // Convert the Java String object to a C++ null-terminated string.
  const char* data = env->GetStringUTFChars(java_library, NULL);
  size_t size = env->GetStringUTFLength(java_library);
  std::string library(data, size);
  env->ReleaseStringUTFChars(java_library, data);

  // Return the handle to the requested library.
  return reinterpret_cast<jlong>(
      dlopen(library.c_str(), RTLD_NOW | RTLD_LOCAL));
}

}  // extern "C"
+0 −21
Original line number Diff line number Diff line
package com.google.vr.platform;

import android.annotation.UnsupportedAppUsage;
import android.os.SystemProperties;

/**
 * Class to get information about the vr device.
 * @hide
 */
public class DeviceInfo {

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

    /**
     * Returns true if this device boots directly in VR mode.
     */
    @UnsupportedAppUsage
    public static boolean getVrBoot() {
        return SystemProperties.getBoolean(VR_MODE_BOOT, false);
    }
}
+0 −25
Original line number Diff line number Diff line
package com.google.vr.platform;

import android.annotation.UnsupportedAppUsage;

/**
 * Class to load the dvr api.
 * @hide
 */
public class Dvr {
    /**
     * Opens a shared library containing the dvr api and returns the handle to it.
     *
     * @return A Long object describing the handle returned by dlopen.
     */
    @UnsupportedAppUsage
    public static Long loadLibrary() {
        // Load a thin JNI library that runs dlopen on request.
        System.loadLibrary("dvr_loader");

        // Performs dlopen on the library and returns the handle.
        return nativeLoadLibrary("libdvr.so");
    }

    private static native long nativeLoadLibrary(String library);
}