Skip to content

Commit

Permalink
Cardboard SDK v1.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyunh0929 committed Oct 18, 2023
1 parent 8017020 commit 5c9f306
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 17 deletions.
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions hellocardboard-android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 31
compileSdkVersion 33
lintOptions {
abortOnError false
}
Expand All @@ -16,9 +16,9 @@ android {
//
// See the release notes for details.
minSdkVersion 24
targetSdkVersion 31
targetSdkVersion 33
versionCode 1
versionName "1.21.0"
versionName "1.22.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
Expand Down
4 changes: 2 additions & 2 deletions hellocardboard-ios/HelloCardboard-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.21.0</string>
<string>1.22.0</string>
<key>CFBundleVersion</key>
<string>1.21.0</string>
<string>1.22.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
Expand Down
6 changes: 3 additions & 3 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'com.google.protobuf'

android {
compileSdkVersion 31
compileSdkVersion 33
lintOptions {
abortOnError false
}
Expand All @@ -16,9 +16,9 @@ android {
//
// See the release notes for details.
minSdkVersion 24
targetSdkVersion 31
targetSdkVersion 33
versionCode 1
versionName "1.21.0"
versionName "1.22.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
Expand Down
8 changes: 8 additions & 0 deletions sdk/cardboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "util/logging.h"
#ifdef __ANDROID__
#include "device_params/android/device_params.h"
#include "jni_utils/android/jni_utils.h"
#endif

// TODO(b/134142617): Revisit struct/class hierarchy.
Expand Down Expand Up @@ -111,6 +112,7 @@ void Cardboard_initializeAndroid(JavaVM* vm, jobject context) {
vm->GetEnv((void**)&env, JNI_VERSION_1_6);
jobject global_context = env->NewGlobalRef(context);

cardboard::jni::initializeAndroid(vm, global_context);
cardboard::qrcode::initializeAndroid(vm, global_context);
cardboard::screen_params::initializeAndroid(vm, global_context);
cardboard::DeviceParams::initializeAndroid(vm, global_context);
Expand Down Expand Up @@ -323,6 +325,12 @@ void CardboardQrCode_getSavedDeviceParams(uint8_t** encoded_device_params,
}
std::vector<uint8_t> device_params =
cardboard::qrcode::getCurrentSavedDeviceParams();
if (device_params.empty()) {
CARDBOARD_LOGD("No device parameters currently saved.");
*size = 0;
*encoded_device_params = nullptr;
return;
}
*size = static_cast<int>(device_params.size());
*encoded_device_params = new uint8_t[*size];
memcpy(*encoded_device_params, &device_params[0], *size);
Expand Down
30 changes: 27 additions & 3 deletions sdk/qrcode/android/qr_code.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <jni.h>

#include <array>
#include <atomic>

#include "jni_utils/android/jni_utils.h"
Expand All @@ -25,6 +26,13 @@
JNIEXPORT return_type JNICALL \
Java_com_google_cardboard_sdk_##clazz##_##method_name

extern "C" {

JNI_METHOD(void, QrCodeCaptureActivity, nativeIncrementDeviceParamsChangedCount)
(JNIEnv* /*env*/, jobject /*obj*/);

} // extern "C"

namespace cardboard::qrcode {

namespace {
Expand All @@ -35,6 +43,13 @@ jclass intent_class_;
jclass component_name_class_;
std::atomic<int> device_params_changed_count_(0);

static const std::array<JNINativeMethod, 1>
kMethods_com_google_cardboard_sdk_QrCodeCaptureActivity = {
{{"nativeIncrementDeviceParamsChangedCount", "()V",
reinterpret_cast<void*>(
Java_com_google_cardboard_sdk_QrCodeCaptureActivity_nativeIncrementDeviceParamsChangedCount)}},
};

// TODO(b/180938531): Release these global references.
void LoadJNIResources(JNIEnv* env) {
cardboard_params_utils_class_ =
Expand All @@ -44,12 +59,21 @@ void LoadJNIResources(JNIEnv* env) {
cardboard::jni::LoadJClass(env, "android/content/Intent")));
component_name_class_ = reinterpret_cast<jclass>(env->NewGlobalRef(
cardboard::jni::LoadJClass(env, "android/content/ComponentName")));
}

void IncrementDeviceParamsChangedCount() {
device_params_changed_count_++;
// Registering native methods used within the SDK by the Java class
// QrCodeCaptureActivity. See
// https://developer.android.com/training/articles/perf-jni#native-libraries
jclass qr_code_scanner_activity_name_class =
reinterpret_cast<jclass>(cardboard::jni::LoadJClass(
env, "com/google/cardboard/sdk/QrCodeCaptureActivity"));
env->RegisterNatives(
qr_code_scanner_activity_name_class,
kMethods_com_google_cardboard_sdk_QrCodeCaptureActivity.data(),
kMethods_com_google_cardboard_sdk_QrCodeCaptureActivity.size());
}

void IncrementDeviceParamsChangedCount() { device_params_changed_count_++; }

} // anonymous namespace

void initializeAndroid(JavaVM* vm, jobject context) {
Expand Down
6 changes: 6 additions & 0 deletions sdk/rendering/opengl_es2_distortion_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
#include <array>
#include <vector>

#ifdef CARDBOARD_USE_CUSTOM_GL_BINDINGS
// If required, add a configuration header file with the OpenGL ES 2.0 binding
// customization.
#include "opengl_es2_custom_bindings.h"
#else
#ifdef __ANDROID__
#include <GLES2/gl2.h>
#endif
Expand All @@ -25,6 +30,7 @@
#ifdef __ANDROID__
#include <GLES2/gl2ext.h>
#endif
#endif // CARDBOARD_USE_CUSTOM_GL_BINDINGS
#include "distortion_renderer.h"
#include "include/cardboard.h"
#include "util/is_arg_null.h"
Expand Down
6 changes: 6 additions & 0 deletions sdk/rendering/opengl_es3_distortion_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#include <array>
#include <vector>

#ifdef CARDBOARD_USE_CUSTOM_GL_BINDINGS
// If required, add a configuration header file with the OpenGL ES 3.0 binding
// customization.
#include "opengl_es3_custom_bindings.h"
#else
#ifdef __ANDROID__
#include <GLES3/gl3.h>
#endif
Expand All @@ -28,6 +33,7 @@
#ifdef __ANDROID__
#include <GLES2/gl2ext.h>
#endif
#endif // CARDBOARD_USE_CUSTOM_GL_BINDINGS
#include "distortion_renderer.h"
#include "include/cardboard.h"
#include "util/is_arg_null.h"
Expand Down
12 changes: 12 additions & 0 deletions sdk/screen_params/ios/screen_params.mm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
NSString *const kGIPDeviceGenerationiPhone14Plus = @"iPhone 14 Plus";
NSString *const kGIPDeviceGenerationiPhone14Pro = @"iPhone 14 Pro";
NSString *const kGIPDeviceGenerationiPhone14ProMax = @"iPhone 14 Pro Max";
NSString *const kGIPDeviceGenerationiPhone15 = @"iPhone 15";
NSString *const kGIPDeviceGenerationiPhone15Plus = @"iPhone 15 Plus";
NSString *const kGIPDeviceGenerationiPhone15Pro = @"iPhone 15 Pro";
NSString *const kGIPDeviceGenerationiPhone15ProMax = @"iPhone 15 Pro Max";

// iPod touch Generations.
NSString *const kGIPDeviceGenerationiPodTouch7thGen = @"iPod touch (7th generation)";
Expand Down Expand Up @@ -132,6 +136,10 @@ CGFloat getDpi() {
@"iPhone14,8" : kGIPDeviceGenerationiPhone14Plus,
@"iPhone15,2" : kGIPDeviceGenerationiPhone14Pro,
@"iPhone15,3" : kGIPDeviceGenerationiPhone14ProMax,
@"iPhone15,4" : kGIPDeviceGenerationiPhone15,
@"iPhone15,5" : kGIPDeviceGenerationiPhone15Plus,
@"iPhone16,1" : kGIPDeviceGenerationiPhone15Pro,
@"iPhone16,2" : kGIPDeviceGenerationiPhone15ProMax,
@"iPod9,1" : kGIPDeviceGenerationiPodTouch7thGen,
};
NSString *model = models[modelName];
Expand Down Expand Up @@ -177,6 +185,10 @@ CGFloat getDpi() {
kGIPDeviceGenerationiPhone14Plus : @(kIPhoneOledDpi),
kGIPDeviceGenerationiPhone14Pro : @(kIPhone12Dpi),
kGIPDeviceGenerationiPhone14ProMax : @(kIPhone12Dpi),
kGIPDeviceGenerationiPhone15 : @(kIPhone12Dpi),
kGIPDeviceGenerationiPhone15Plus : @(kIPhone12Dpi),
kGIPDeviceGenerationiPhone15Pro : @(kIPhone12Dpi),
kGIPDeviceGenerationiPhone15ProMax : @(kIPhone12Dpi),
kGIPDeviceGenerationiPodTouch7thGen : @(kDefaultDpi),
};

Expand Down
13 changes: 8 additions & 5 deletions sdk/unity/xr_unity_plugin/vulkan/vulkan_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,14 @@ class VulkanRenderer : public Renderer {
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = image,
.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.subresourceRange.baseMipLevel = 0,
.subresourceRange.levelCount = 1,
.subresourceRange.baseArrayLayer = 0,
.subresourceRange.layerCount = 1,
.subresourceRange =
{
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0,
.levelCount = 1,
.baseArrayLayer = 0,
.layerCount = 1,
},
};

VkPipelineStageFlags source_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
Expand Down
36 changes: 36 additions & 0 deletions third_party/unity_plugin_api/bluze.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# proto-file: devtools/blueprint/blueprint_file.proto
# proto-message: BlueprintFile
# DO NOT EDIT! Regenerate the contents by running go/bluze after changing any BUILD file or the Blueprint.
# Override the default values in third_party.unity.pluginapi.blueprint instead.

buildable_unit: {
name: "third_party.unity.pluginapi"
build_pattern: "//third_party/unity/PluginApi/..."
test_pattern: "//third_party/unity/PluginApi/..."
test_tag_filter: "-nofastbuild"
build_tag_filter: "-nofastbuild"
enable_coverage: true
enable_presubmit: true
enable_continuous_build: true
continuous_build_email: {
build_cop_email_id: "[email protected]"
}
enable_release: false
}
buildable_unit: {
name: "third_party.unity.pluginapi.opt"
test_pattern: "//third_party/unity/PluginApi/..."
test_tag_filter: "-noopt"
build_flag: "--compilation_mode=opt"
enable_coverage: false
enable_presubmit: false
enable_continuous_build: false
continuous_build_email: {
build_cop_email_id: "[email protected]"
}
enable_release: false
[tap.tap_settings]: {
on_demand: true
on_demand_frequency: EVERY_4_HOURS
}
}
19 changes: 19 additions & 0 deletions third_party/unity_plugin_api/third_party.unity.pluginapi.blueprint
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
include "devtools/blueprint/bluze/public/bluze.ncl";
include bytes "third_party/unity/PluginApi/bluze.textproto" as textproto;

// See go/bluze/guide before editing. To check the generated final blueprint run
// rncl third_party/unity/PluginApi/third_party.unity.pluginapi.blueprint printproto blueprint_file

blueprint_file = ::bluze::BlueprintFile(
textproto,

project_name = "third_party.unity.pluginapi",
teams_product_id = 1134145041667,
tech_lead = ["jfinder"],
dev_mailing_list = "[email protected]",
mdb_groups = ["third-party-tap-forge"],
buganizer_component_ids = [437622],
metadata_path = "//depot/google3/third_party/unity/PluginApi/METADATA",

// Customize your blueprint here: go/blueprint/howto-write.
);

0 comments on commit 5c9f306

Please sign in to comment.