diff options
| author | 2017-02-16 17:33:22 +0000 | |
|---|---|---|
| committer | 2017-02-16 17:33:23 +0000 | |
| commit | a01c1e34edd90bc000aa80c6bb42aebcbd7ca8f9 (patch) | |
| tree | f3557f4d8db34c394389c3a3e39da747ae7f35c0 | |
| parent | 52eb3c9f8b436c0e389090436b5aac2b6ff888aa (diff) | |
| parent | 46481aa3e02451a2a2dbab0eba17845d2c50c5a4 (diff) | |
Merge "Remove Java and gvr references from vr window manager."
15 files changed, 10 insertions, 530 deletions
| diff --git a/services/vr/vr_window_manager/Android.mk b/services/vr/vr_window_manager/Android.mk index 85f8e1f3bb..adbfb98566 100644 --- a/services/vr/vr_window_manager/Android.mk +++ b/services/vr/vr_window_manager/Android.mk @@ -37,33 +37,18 @@ LOCAL_MODULE := libvrwm_binder  LOCAL_MODULE_TAGS := optional  include $(BUILD_STATIC_LIBRARY) -  native_src := \    application.cpp \    controller_mesh.cpp \    elbow_model.cpp \    hwc_callback.cpp \    reticle.cpp \ -  render_thread.cpp \    shell_view.cpp \    surface_flinger_view.cpp \    texture.cpp \    vr_window_manager.cpp \    ../virtual_touchpad/aidl/android/dvr/VirtualTouchpadService.aidl \ -src := \ -  vr_window_manager_jni.cpp \ -  application.cpp \ -  controller_mesh.cpp \ -  elbow_model.cpp \ -  hwc_callback.cpp \ -  reticle.cpp \ -  render_thread.cpp \ -  shell_view.cpp \ -  surface_flinger_view.cpp \ -  texture.cpp \ -  ../virtual_touchpad/aidl/android/dvr/VirtualTouchpadService.aidl \ -  static_libs := \    libdisplay \    libbufferhub \ @@ -97,62 +82,19 @@ shared_libs := \    libhidlbase \    libhidltransport - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(src) -LOCAL_STATIC_LIBRARIES := $(static_libs) -LOCAL_SHARED_LIBRARIES := $(shared_libs) -LOCAL_SHARED_LIBRARIES += libgvr -LOCAL_STATIC_LIBRARIES += libgvr_ext -LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES -LOCAL_CFLAGS += -DLOG_TAG=\"VrWindowManager\" -LOCAL_LDLIBS := -llog -LOCAL_MODULE := libvr_window_manager_jni -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64 -LOCAL_MULTILIB := 64 -LOCAL_CXX_STL := libc++_static -include $(BUILD_SHARED_LIBRARY) -  include $(CLEAR_VARS)  LOCAL_SRC_FILES := $(native_src)  LOCAL_STATIC_LIBRARIES := $(static_libs) libvrwm_binder  LOCAL_SHARED_LIBRARIES := $(shared_libs) -LOCAL_SHARED_LIBRARIES += libgvr -LOCAL_STATIC_LIBRARIES += libgvr_ext  LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES  LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES  LOCAL_CFLAGS += -DLOG_TAG=\"VrWindowManager\"  LOCAL_LDLIBS := -llog  LOCAL_MODULE := vr_wm  LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64  LOCAL_INIT_RC := vr_wm.rc  include $(BUILD_EXECUTABLE) -include $(CLEAR_VARS) -LOCAL_PACKAGE_NAME := VrWindowManager - -# We need to be priveleged to run as the system user, which is necessary for -# getting hmd input events and doing input injection. -LOCAL_CERTIFICATE := platform -LOCAL_PRIVILEGED_MODULE := true - -LOCAL_MODULE_TAGS := optional -LOCAL_SRC_FILES := $(call all-java-files-under, java) -LOCAL_JNI_SHARED_LIBRARIES := libvr_window_manager_jni -LOCAL_STATIC_JAVA_AAR_LIBRARIES := gvr_common_library_aar -# gvr_common_library_aar depends on nano version of libprotobuf -LOCAL_STATIC_JAVA_LIBRARIES := libprotobuf-java-nano -# Make sure that libgvr's resources are loaded -LOCAL_AAPT_FLAGS += --auto-add-overlay -LOCAL_AAPT_FLAGS += --extra-packages com.google.vr.cardboard -LOCAL_PROGUARD_FLAG_FILES := proguard.flags -LOCAL_MODULE_TARGET_ARCH := arm arm64 x86 x86_64 -include $(BUILD_PACKAGE) - -  cmd_src := \    vr_wm_ctl.cpp \    aidl/android/service/vr/IVrWindowManager.aidl diff --git a/services/vr/vr_window_manager/AndroidManifest.xml b/services/vr/vr_window_manager/AndroidManifest.xml deleted file mode 100644 index d5008a3a09..0000000000 --- a/services/vr/vr_window_manager/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" -          package="com.google.vr.windowmanager" -          coreApp="true" -          android:sharedUserId="android.uid.system" -          android:versionCode="1" -          android:versionName="1.0" > - -  <!-- The GVR SDK requires API 19+ and OpenGL ES 2+. --> -  <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="24" /> -  <uses-feature android:glEsVersion="0x00020000" android:required="true" /> - -  <!-- We need the DIAGNOSTIC permission to read HMD button events. DIAGNOSTIC -       ensures our process runs with the "input" group, so we can access -       /dev/input. See frameworks/base/data/etc/platform.xml for the permission -       to group mappings. - -       TODO(steventhomas): We shouldn't use this DIAGNOSTIC permission. Figure -       out the correct way to get access to the HMD buttons. -       Bug: b/33253485. --> -  <uses-permission android:name="android.permission.DIAGNOSTIC"/> -  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> - -  <application -      android:label="vr_window_manager" -      android:theme="@style/AppStyle"> -    <service android:name=".VrWindowManagerService" /> -    <receiver android:name="com.google.vr.windowmanager.BootCompletedReceiver"> -      <intent-filter> -        <!-- action android:name="android.intent.action.BOOT_COMPLETED" / --> -      </intent-filter> -    </receiver> -  </application> -</manifest> diff --git a/services/vr/vr_window_manager/application.cpp b/services/vr/vr_window_manager/application.cpp index 895f25f3f6..e20bf4784e 100644 --- a/services/vr/vr_window_manager/application.cpp +++ b/services/vr/vr_window_manager/application.cpp @@ -16,25 +16,18 @@  namespace android {  namespace dvr { -Application::Application() -    : controller_api_status_logged_(false), -      controller_connection_state_logged_(false) {} +Application::Application() {}  Application::~Application() {  } -int Application::Initialize(JNIEnv* env, jobject app_context, -                            jobject class_loader) { +int Application::Initialize() {    dvrSetCpuPartition(0, "/application/performance");    bool is_right_handed = true;  // TODO: retrieve setting from system    elbow_model_.Enable(ElbowModel::kDefaultNeckPosition, is_right_handed);    last_frame_time_ = std::chrono::system_clock::now(); -  java_env_ = env; -  app_context_ = app_context; -  class_loader_ = class_loader; -    return 0;  } @@ -100,42 +93,10 @@ int Application::AllocateResources() {    fov_[1] = FieldOfView(lens_info.right_fov[0], lens_info.right_fov[1],                          lens_info.right_fov[2], lens_info.right_fov[3]); -  if (java_env_) { -    int ret = InitializeController(); -    if (ret) -      return ret; -  } - -  return 0; -} - -int Application::InitializeController() { -  gvr_context_ = gvr::GvrApi::Create(java_env_, app_context_, class_loader_); -  if (gvr_context_ == nullptr) { -    ALOGE("Gvr context creation failed"); -    return 1; -  } - -  int32_t options = gvr_controller_get_default_options(); -  options |= GVR_CONTROLLER_ENABLE_GYRO | GVR_CONTROLLER_ENABLE_ACCEL; - -  controller_.reset(new gvr::ControllerApi); -  if (!controller_->Init(java_env_, app_context_, class_loader_, options, -                         gvr_context_->cobj())) { -    ALOGE("Gvr controller init failed"); -    return 1; -  } - -  controller_state_.reset(new gvr::ControllerState); -    return 0;  }  void Application::DeallocateResources() { -  gvr_context_.reset(); -  controller_.reset(); -  controller_state_.reset(); -    if (graphics_context_)      dvrGraphicsContextDestroy(graphics_context_); @@ -309,47 +270,6 @@ void Application::ProcessControllerInput() {        return;      }    } - -  if (!controller_) -    return; - -  controller_state_->Update(*controller_); -  gvr::ControllerApiStatus new_api_status = controller_state_->GetApiStatus(); -  gvr::ControllerConnectionState new_connection_state = -      controller_state_->GetConnectionState(); - -  if (!controller_api_status_logged_) { -    controller_api_status_logged_ = true; -    ALOGI("Controller api status: %s", -          gvr::ControllerApi::ToString(new_api_status)); -  } else if (new_api_status != controller_api_status_) { -    ALOGI("Controller api status changed: %s --> %s", -          gvr::ControllerApi::ToString(controller_api_status_), -          gvr::ControllerApi::ToString(new_api_status)); -  } - -  if (new_api_status == gvr::kControllerApiOk) { -    if (!controller_connection_state_logged_) { -      controller_connection_state_logged_ = true; -      ALOGI("Controller connection state: %s", -            gvr::ControllerApi::ToString(new_connection_state)); -    } else if (new_connection_state != controller_connection_state_) { -      ALOGI("Controller connection state changed: %s --> %s", -            gvr::ControllerApi::ToString(controller_connection_state_), -            gvr::ControllerApi::ToString(new_connection_state)); -    } -  } else { -    controller_connection_state_logged_ = false; -  } - -  if (new_api_status == gvr::kControllerApiOk) { -    gvr_quatf orientation = controller_state_->GetOrientation(); -    controller_orientation_ = -        quat(orientation.qw, orientation.qx, orientation.qy, orientation.qz); -  } - -  controller_api_status_ = new_api_status; -  controller_connection_state_ = new_connection_state;  }  void Application::SetVisibility(bool visible) { @@ -357,12 +277,6 @@ void Application::SetVisibility(bool visible) {    if (changed) {      is_visible_ = visible;      dvrGraphicsSurfaceSetVisible(graphics_context_, is_visible_); -    if (controller_) { -      if (is_visible_) -        controller_->Resume(); -      else -        controller_->Pause(); -    }      OnVisibilityChanged(is_visible_);    }  } diff --git a/services/vr/vr_window_manager/application.h b/services/vr/vr_window_manager/application.h index 0c6385f7db..c7aa4dd87d 100644 --- a/services/vr/vr_window_manager/application.h +++ b/services/vr/vr_window_manager/application.h @@ -1,15 +1,13 @@  #ifndef VR_WINDOW_MANAGER_APPLICATION_H_  #define VR_WINDOW_MANAGER_APPLICATION_H_ -#include <jni.h>  #include <memory>  #include <private/dvr/types.h>  #include <stdint.h> -#include <vr/gvr/capi/include/gvr.h> -#include <vr/gvr/capi/include/gvr_controller.h>  #include <chrono>  #include <mutex> +#include <vector>  #include "controller_data_provider.h"  #include "elbow_model.h" @@ -25,8 +23,7 @@ class Application {    Application();    virtual ~Application(); -  virtual int Initialize(JNIEnv* env, jobject app_context, -                         jobject class_loader); +  virtual int Initialize();    virtual int AllocateResources();    virtual void DeallocateResources(); @@ -59,8 +56,6 @@ class Application {    void QueueTask(MainThreadTask task); -  int InitializeController(); -    DvrGraphicsContext* graphics_context_ = nullptr;    DvrPose* pose_client_ = nullptr; @@ -69,15 +64,8 @@ class Application {    FieldOfView fov_[2];    Posef last_pose_; -  std::unique_ptr<gvr::GvrApi> gvr_context_; -  std::unique_ptr<gvr::ControllerApi> controller_; -  std::unique_ptr<gvr::ControllerState> controller_state_; -  gvr::ControllerApiStatus controller_api_status_; -  gvr::ControllerConnectionState controller_connection_state_;    quat controller_orientation_;    bool shmem_controller_active_ = false; -  bool controller_api_status_logged_; -  bool controller_connection_state_logged_;    uint64_t shmem_controller_buttons_;    bool is_visible_ = false; @@ -95,11 +83,6 @@ class Application {    bool initialized_ = false;    std::vector<MainThreadTask> main_thread_tasks_; -  // Java Resources. -  JNIEnv* java_env_; -  jobject app_context_; -  jobject class_loader_; -    // Controller data provider from shared memory buffer.    ControllerDataProvider* controller_data_provider_ = nullptr; diff --git a/services/vr/vr_window_manager/java/com/google/vr/windowmanager/BootCompletedReceiver.java b/services/vr/vr_window_manager/java/com/google/vr/windowmanager/BootCompletedReceiver.java deleted file mode 100644 index 01d1bdb76b..0000000000 --- a/services/vr/vr_window_manager/java/com/google/vr/windowmanager/BootCompletedReceiver.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.google.vr.windowmanager; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -public class BootCompletedReceiver extends BroadcastReceiver { -  private static final String TAG = BootCompletedReceiver.class.getSimpleName(); - -  @Override -  public void onReceive(Context context, Intent intent) { -    Log.i(TAG, "Starting VRWindowManager"); -    Intent vrWindowManagerIntent = new Intent(context, VrWindowManagerService.class); -    context.startService(vrWindowManagerIntent); -  } -} diff --git a/services/vr/vr_window_manager/java/com/google/vr/windowmanager/VrWindowManagerService.java b/services/vr/vr_window_manager/java/com/google/vr/windowmanager/VrWindowManagerService.java deleted file mode 100644 index 1d815ca68b..0000000000 --- a/services/vr/vr_window_manager/java/com/google/vr/windowmanager/VrWindowManagerService.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.google.vr.windowmanager; - -import android.app.Service; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Handler; -import android.os.IBinder; -import android.util.Log; - -public class VrWindowManagerService extends Service { -  private static final String TAG = VrWindowManagerService.class.getSimpleName(); -  private long nativeVrWindowManager; - -  // This is a temporary debugging tool for development only. -  // It allows us to show VrWindowManager in debug mode via command line. -  private final BroadcastReceiver debugReceiver = new BroadcastReceiver() { -    @Override -    public void onReceive(Context context, Intent intent) { -      String action = intent.getAction(); -      if (action.equals("com.google.vr.windowmanager.intent.SHOW")) { -        nativeEnableDebug(nativeVrWindowManager); -      } else if (action.equals("com.google.vr.windowmanager.intent.HIDE")) { -        nativeDisableDebug(nativeVrWindowManager); -      } else if (action.equals("com.google.vr.windowmanager.intent.ENTER_VR")) { -        nativeEnterVrMode(nativeVrWindowManager); -      } else if (action.equals("com.google.vr.windowmanager.intent.EXIT_VR")) { -        nativeExitVrMode(nativeVrWindowManager); -      } -    } -  }; - -  static { -    System.loadLibrary("vr_window_manager_jni"); -  } - -  @Override -  public void onCreate() { -    super.onCreate(); -    destroyRenderer(); -    nativeVrWindowManager = nativeCreate(getClass().getClassLoader(), getApplicationContext()); -    if (nativeVrWindowManager == 0) { -      Log.e(TAG, "Failed to create native renderer"); -    } - -    // For development, testing and debugging. -    IntentFilter filter = new IntentFilter(); -    filter.addAction("com.google.vr.windowmanager.intent.SHOW"); -    filter.addAction("com.google.vr.windowmanager.intent.HIDE"); -    filter.addAction("com.google.vr.windowmanager.intent.ENTER_VR"); -    filter.addAction("com.google.vr.windowmanager.intent.EXIT_VR"); -    registerReceiver(debugReceiver, filter); -  } - -  @Override -  public int onStartCommand(Intent intent, int flags, int startId) { -    return START_STICKY; -  } - -  @Override -  public IBinder onBind(Intent intent) { -    Log.i(TAG, "Ignoring bind request"); -    return null; -  } - -  @Override -  public void onDestroy() { -    super.onDestroy(); -    unregisterReceiver(debugReceiver); -    destroyRenderer(); -  } - -  private void destroyRenderer() { -    if (nativeVrWindowManager != 0) { -      nativeDestroy(nativeVrWindowManager); -      nativeVrWindowManager = 0; -    } -  } - -  private native long nativeCreate(ClassLoader appClassLoader, Context context); -  private native void nativeDestroy(long nativeVrWindowManager); -  private native void nativeEnableDebug(long nativeVrWindowManager); -  private native void nativeDisableDebug(long nativeVrWindowManager); -  private native void nativeEnterVrMode(long nativeVrWindowManager); -  private native void nativeExitVrMode(long nativeVrWindowManager); -} diff --git a/services/vr/vr_window_manager/render_thread.cpp b/services/vr/vr_window_manager/render_thread.cpp deleted file mode 100644 index b67a05196d..0000000000 --- a/services/vr/vr_window_manager/render_thread.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include <jni.h> -#include <log/log.h> -#include <future> - -#include "render_thread.h" -#include "shell_view.h" - -namespace android { -namespace dvr { - -RenderThread::RenderThread(JNIEnv* env, jobject class_loader, -                           jobject android_context) -    : jvm_(nullptr), -      class_loader_global_ref_(0), -      android_context_global_ref_(0), -      quit_(false) { -  env->GetJavaVM(&jvm_); - -  // Create global references so we can access these objects on the render -  // thread -  class_loader_global_ref_ = env->NewGlobalRef(class_loader); -  android_context_global_ref_ = env->NewGlobalRef(android_context); - -  std::promise<int> render_thread_init_result_promise; -  thread_ = std::thread([this, &render_thread_init_result_promise] { -    JNIEnv* render_thread_jni_env = nullptr; -    jvm_->AttachCurrentThread(&render_thread_jni_env, nullptr); -    RunRenderLoop(&render_thread_init_result_promise); -    jvm_->DetachCurrentThread(); -  }); - -  // Wait to see if the render thread started successfully. If not bail. -  int render_thread_init_result = -      render_thread_init_result_promise.get_future().get(); -  LOG_ALWAYS_FATAL_IF(render_thread_init_result != 0, -                      "Failed initializing render thread. result=%d", -                      render_thread_init_result); -} - -RenderThread::~RenderThread() { Quit(); } - -void RenderThread::Quit() { -  if (thread_.joinable()) { -    quit_ = true; -    thread_.join(); -  } - -  JNIEnv* env = GetJniEnv(); -  if (class_loader_global_ref_ != 0) { -    env->DeleteGlobalRef(class_loader_global_ref_); -    class_loader_global_ref_ = 0; -  } -  if (android_context_global_ref_ != 0) { -    env->DeleteGlobalRef(android_context_global_ref_); -    android_context_global_ref_ = 0; -  } -} - -void RenderThread::EnableDebug(bool debug) { shell_view_.EnableDebug(debug); } - -void RenderThread::VrMode(bool mode) { shell_view_.VrMode(mode); } - -JNIEnv* RenderThread::GetJniEnv() { -  JNIEnv* env; -  jvm_->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6); -  return env; -} - -void RenderThread::RunRenderLoop( -    std::promise<int>* init_result_promise) { -  // TODO(steventhomas): Create local refs to work around b/33251144. Remove -  // once that bug is fixed. -  JNIEnv* env = GetJniEnv(); -  jobject class_loader = env->NewLocalRef(class_loader_global_ref_); -  jobject android_context = env->NewLocalRef(android_context_global_ref_); - -  int init_result = shell_view_.Initialize(env, android_context, class_loader); -  init_result_promise->set_value(init_result); -  if (init_result == 0) { -    while (!quit_) -      shell_view_.DrawFrame(); -  } else { -    ALOGE("Failed to initialize ShellView"); -  } - -  env->DeleteLocalRef(class_loader); -  env->DeleteLocalRef(android_context); -} - -}  // namespace dvr -}  // namespace android diff --git a/services/vr/vr_window_manager/render_thread.h b/services/vr/vr_window_manager/render_thread.h deleted file mode 100644 index e193643183..0000000000 --- a/services/vr/vr_window_manager/render_thread.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef VR_WINDOW_MANAGER_RENDER_THREAD_H_ -#define VR_WINDOW_MANAGER_RENDER_THREAD_H_ - -#include <atomic> -#include <future> -#include <jni.h> -#include <thread> - -#include "shell_view.h" - -namespace android { -namespace dvr { - -class RenderThread { - public: -  RenderThread(JNIEnv* env, jobject class_loader, jobject android_context); -  ~RenderThread(); -  void Quit(); -  void EnableDebug(bool debug); -  void VrMode(bool mode); - -  RenderThread(const RenderThread&) = delete; -  void operator=(const RenderThread&) = delete; - - private: -  // Called by both the main thread and render thread. Will return the correct -  // JNIEnv for the current thread. -  JNIEnv* GetJniEnv(); - -  void RunRenderLoop(std::promise<int>* init_result_promise); - -  // Accessed only by the main thread. -  std::thread thread_; - -  // The vars below are accessed by both the main thread and the render thread. -  JavaVM* jvm_; -  jobject class_loader_global_ref_; -  jobject android_context_global_ref_; -  std::atomic_bool quit_; - -  ShellView shell_view_; -}; - -}  // namespace dvr -}  // namespace android - -#endif  // VR_WINDOW_MANAGER_RENDER_THREAD_H_ diff --git a/services/vr/vr_window_manager/res/drawable-nodpi/vr_icon.png b/services/vr/vr_window_manager/res/drawable-nodpi/vr_icon.pngBinary files differ deleted file mode 100644 index 06f896dbc1..0000000000 --- a/services/vr/vr_window_manager/res/drawable-nodpi/vr_icon.png +++ /dev/null diff --git a/services/vr/vr_window_manager/res/drawable-nodpi/vr_icon_background.png b/services/vr/vr_window_manager/res/drawable-nodpi/vr_icon_background.pngBinary files differ deleted file mode 100644 index d336da3f4f..0000000000 --- a/services/vr/vr_window_manager/res/drawable-nodpi/vr_icon_background.png +++ /dev/null diff --git a/services/vr/vr_window_manager/res/values/styles.xml b/services/vr/vr_window_manager/res/values/styles.xml deleted file mode 100644 index 8a1a74b044..0000000000 --- a/services/vr/vr_window_manager/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> -<add-resource type="style" name="AppStyle"></add-resource> -<style name="AppStyle" -    parent="@android:style/Theme.Holo.NoActionBar.Fullscreen"> -  <item name="android:windowDisablePreview">true</item> -</style> -</resources> diff --git a/services/vr/vr_window_manager/shell_view.cpp b/services/vr/vr_window_manager/shell_view.cpp index 29ade643fd..84b8467ccb 100644 --- a/services/vr/vr_window_manager/shell_view.cpp +++ b/services/vr/vr_window_manager/shell_view.cpp @@ -238,9 +238,8 @@ ShellView::ShellView() {  ShellView::~ShellView() {} -int ShellView::Initialize(JNIEnv* env, jobject app_context, -                          jobject class_loader) { -  int ret = Application::Initialize(env, app_context, class_loader); +int ShellView::Initialize() { +  int ret = Application::Initialize();    if (ret)      return ret; @@ -604,10 +603,7 @@ void ShellView::DrawReticle(const mat4& perspective, const mat4& eye_matrix,    vec3 pointer_location = last_pose_.GetPosition();    quat view_quaternion = last_pose_.GetRotation(); -  bool gvr_api_active = -      controller_ && controller_api_status_ == gvr::kControllerApiOk; - -  if (gvr_api_active || shmem_controller_active_) { +  if (shmem_controller_active_) {      view_quaternion = controller_orientation_;      vec4 controller_location = controller_translate_ * vec4(0, 0, 0, 1);      pointer_location = vec3(controller_location.x(), controller_location.y(), @@ -635,18 +631,6 @@ void ShellView::DrawReticle(const mat4& perspective, const mat4& eye_matrix,          }          buttons >>= 4;        } -    } else if (controller_) { -      if (controller_state_->GetButtonDown(gvr::kControllerButtonClick)) -        OnClick(true); - -      if (controller_state_->GetButtonUp(gvr::kControllerButtonClick)) -        OnClick(false); - -      if (controller_state_->GetButtonDown(gvr::kControllerButtonApp)) -        OnTouchpadButton(true, AMOTION_EVENT_BUTTON_BACK); - -      if (controller_state_->GetButtonUp(gvr::kControllerButtonApp)) -        OnTouchpadButton(false, AMOTION_EVENT_BUTTON_BACK);      }    } @@ -676,7 +660,7 @@ void ShellView::DrawReticle(const mat4& perspective, const mat4& eye_matrix,  void ShellView::DrawController(const mat4& perspective, const mat4& eye_matrix,                                 const mat4& head_matrix) { -  if (!controller_ && !shmem_controller_active_) +  if (!shmem_controller_active_)      return;    controller_program_->Use(); diff --git a/services/vr/vr_window_manager/shell_view.h b/services/vr/vr_window_manager/shell_view.h index 14ad0f3cb8..39b5451aee 100644 --- a/services/vr/vr_window_manager/shell_view.h +++ b/services/vr/vr_window_manager/shell_view.h @@ -28,8 +28,7 @@ class ShellView : public Application,    ShellView();    virtual ~ShellView(); -  int Initialize(JNIEnv* env, jobject app_context, -                 jobject class_loader) override; +  int Initialize() override;    int AllocateResources() override;    void DeallocateResources() override; diff --git a/services/vr/vr_window_manager/vr_window_manager.cpp b/services/vr/vr_window_manager/vr_window_manager.cpp index c51ddee007..f478f45bd3 100644 --- a/services/vr/vr_window_manager/vr_window_manager.cpp +++ b/services/vr/vr_window_manager/vr_window_manager.cpp @@ -7,7 +7,7 @@  int main(int /* argc */, char** /* argv */) {    android::dvr::ShellView app; -  const int app_status = app.Initialize(nullptr, nullptr, nullptr); +  const int app_status = app.Initialize();    LOG_ALWAYS_FATAL_IF(app_status != 0, "failed to initialize: %d", app_status);    android::service::vr::VrWindowManagerBinder service(app); diff --git a/services/vr/vr_window_manager/vr_window_manager_jni.cpp b/services/vr/vr_window_manager/vr_window_manager_jni.cpp deleted file mode 100644 index 49eaba1cd7..0000000000 --- a/services/vr/vr_window_manager/vr_window_manager_jni.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include <jni.h> -#include <log/log.h> - -#include <memory> - -#include "render_thread.h" - -#define JNI_METHOD(return_type, method_name) \ -  JNIEXPORT return_type JNICALL              \ -      Java_com_google_vr_windowmanager_VrWindowManagerService_##method_name - -namespace { - -inline jlong jptr(android::dvr::RenderThread* native_vr_window_manager) { -  return reinterpret_cast<intptr_t>(native_vr_window_manager); -} - -inline android::dvr::RenderThread* native(jlong ptr) { -  return reinterpret_cast<android::dvr::RenderThread*>(ptr); -} - -}  // namespace - -extern "C" { - -JNI_METHOD(jlong, nativeCreate)(JNIEnv* env, jclass /*clazz*/, -                                jobject class_loader, -                                jobject android_context) { -  return jptr(new android::dvr::RenderThread( -      env, class_loader, android_context)); -} - -JNI_METHOD(void, nativeDestroy) -(JNIEnv* /*env*/, jclass /*clazz*/, jlong native_render_thread) { -  delete native(native_render_thread); -} - -JNI_METHOD(void, nativeEnableDebug) -(JNIEnv* /*env*/, jclass /*clazz*/, jlong native_render_thread) { -  native(native_render_thread)->EnableDebug(true); -} - -JNI_METHOD(void, nativeDisableDebug) -(JNIEnv* /*env*/, jclass /*clazz*/, jlong native_render_thread) { -  native(native_render_thread)->EnableDebug(false); -} - -JNI_METHOD(void, nativeEnterVrMode) -(JNIEnv* /*env*/, jclass /*clazz*/, jlong native_render_thread) { -  native(native_render_thread)->VrMode(true); -} - -JNI_METHOD(void, nativeExitVrMode) -(JNIEnv* /*env*/, jclass /*clazz*/, jlong native_render_thread) { -  native(native_render_thread)->VrMode(false); -} - -}  // extern "C" |