diff --git a/build.gradle b/build.gradle index 285af7ea..0bb1d851 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.13.1' + classpath 'com.android.tools.build:gradle:9.2.0' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.10.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55b..b1b8ef56 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aaaabb3c..a9db1155 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 23d15a93..249efbb0 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -29,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index 5eed7ee8..8508ef68 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -19,12 +19,12 @@ @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -51,7 +51,7 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -65,30 +65,18 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line -set CLASSPATH= -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/hellocardboard-android/build.gradle b/hellocardboard-android/build.gradle index 716c872a..5a1bca27 100644 --- a/hellocardboard-android/build.gradle +++ b/hellocardboard-android/build.gradle @@ -18,7 +18,7 @@ android { minSdkVersion = 26 targetSdkVersion = 35 versionCode 1 - versionName "1.34.0" + versionName "1.35.0" testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' ndk { abiFilters 'armeabi-v7a', 'arm64-v8a' diff --git a/hellocardboard-ios/HelloCardboard-Info.plist b/hellocardboard-ios/HelloCardboard-Info.plist index 6daa9683..b8e60138 100644 --- a/hellocardboard-ios/HelloCardboard-Info.plist +++ b/hellocardboard-ios/HelloCardboard-Info.plist @@ -15,9 +15,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.34.0 + 1.35.0 CFBundleVersion - 1.34.0 + 1.35.0 LSRequiresIPhoneOS NSCameraUsageDescription diff --git a/hellocardboard-ios/HelloCardboardGlUtils.cc b/hellocardboard-ios/HelloCardboardGlUtils.cc index 1ea54ce7..7e583f9c 100644 --- a/hellocardboard-ios/HelloCardboardGlUtils.cc +++ b/hellocardboard-ios/HelloCardboardGlUtils.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include "HelloCardboardFileUtils.h" diff --git a/paperscope/core/SupportedAppProvider.java b/paperscope/core/SupportedAppProvider.java index 2e6d1b04..a50b1928 100644 --- a/paperscope/core/SupportedAppProvider.java +++ b/paperscope/core/SupportedAppProvider.java @@ -30,7 +30,7 @@ final class SupportedAppProvider { private List installedApps; private SupportedAppProvider() { - installedApps = new ArrayList(); + installedApps = new ArrayList<>(); } public static SupportedAppProvider getInstance() { @@ -141,11 +141,11 @@ private void appendInstalledAppsWithCardboardSupportIntent( private List getSupportedAppList(PackageManager packageManager, Context context) { // Map of package name and basicAppInfo that will be used to ensure uniqueness. - Map supportedAppsMap = new LinkedHashMap(); + Map supportedAppsMap = new LinkedHashMap<>(); // Add apps that have cardboard intent. appendInstalledAppsWithCardboardSupportIntent(packageManager, context, supportedAppsMap); - List supportedApps = new ArrayList(supportedAppsMap.values()); + List supportedApps = new ArrayList<>(supportedAppsMap.values()); sortAppListByName(supportedApps); return supportedApps; } diff --git a/paperscope/myvideos/VideoFetcher.java b/paperscope/myvideos/VideoFetcher.java index 823195f9..a58cd50e 100644 --- a/paperscope/myvideos/VideoFetcher.java +++ b/paperscope/myvideos/VideoFetcher.java @@ -91,7 +91,7 @@ public void getLocalVideos() { int idColumn = videoCursor.getColumnIndex(MediaStore.Video.Media._ID); int dataColumn = videoCursor.getColumnIndex(MediaStore.Video.Media.DATA); - List videoInfoList = new ArrayList(); + List videoInfoList = new ArrayList<>(); while (videoCursor.moveToNext()) { Uri contentUri = Uri.parse( android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI diff --git a/paperscope/photosphere/lightcycle/opengl/DrawableGL.java b/paperscope/photosphere/lightcycle/opengl/DrawableGL.java index 9f9cb4b2..16151cf8 100644 --- a/paperscope/photosphere/lightcycle/opengl/DrawableGL.java +++ b/paperscope/photosphere/lightcycle/opengl/DrawableGL.java @@ -31,7 +31,7 @@ public abstract class DrawableGL { protected ShortBuffer mIndices = null; /** Storage for textures. */ - protected Vector mTextures = new Vector(); + protected Vector mTextures = new Vector<>(); /** Transformation. */ protected float[] mLocalMatrix = new float[16]; @@ -115,7 +115,7 @@ public void draw(float[] parentTransform, Vector3 lookAt, float minVisibilityDot // Add a child of the drawable. public void addChild(DrawableGL child) { if (mChildren == null) { - mChildren = new HashSet(); + mChildren = new HashSet<>(); } mChildren.add(child); } diff --git a/paperscope/photosphere/lightcycle/opengl/PartialSphere.java b/paperscope/photosphere/lightcycle/opengl/PartialSphere.java index ada2423b..46098947 100644 --- a/paperscope/photosphere/lightcycle/opengl/PartialSphere.java +++ b/paperscope/photosphere/lightcycle/opengl/PartialSphere.java @@ -243,7 +243,7 @@ private void generateGeometry(float radius) { for (int x = 0, u = 0; u < textureCountX; x += tesselationFactor, ++u) { curvedTiles[u][v] = new CurvedTile(v + (u * textureCountY), tesselationFactor); - List vertexList = new ArrayList(); + List vertexList = new ArrayList<>(); // For each texture, add the relevant vertices. // TODO(haeberling): We should store vertices in a single buffer for diff --git a/paperscope/photosphere/lightcycle/opengl/TextureLoaderManager.java b/paperscope/photosphere/lightcycle/opengl/TextureLoaderManager.java index c0b8e168..5e29a58b 100644 --- a/paperscope/photosphere/lightcycle/opengl/TextureLoaderManager.java +++ b/paperscope/photosphere/lightcycle/opengl/TextureLoaderManager.java @@ -21,7 +21,7 @@ public class TextureLoaderManager { private Semaphore bitmapLoadingSemaphore; private final TileProvider tileProvider; - private final List loaders = new ArrayList(); + private final List loaders = new ArrayList<>(); /** * This instance is given to all texture loaders. It's called when any of them loaded a texture diff --git a/sdk/qrcode/ios/sdk.bundle/resolutions.csv b/sdk/qrcode/ios/sdk.bundle/resolutions.csv index 19a84733..8d4ee149 100644 --- a/sdk/qrcode/ios/sdk.bundle/resolutions.csv +++ b/sdk/qrcode/ios/sdk.bundle/resolutions.csv @@ -1,3 +1,4 @@ +# LINT.IfChange identifier,device_name,dpis iPhone1.1,iPhone,326.0f iPhone1.2,iPhone 3G,326.0f @@ -60,4 +61,5 @@ iPhone18.4,iPhone Air,460.0f iPhone18.3,iPhone 17,460.0f iPhone18.1,iPhone 17 Pro,460.0f iPhone18.2,iPhone 17 Pro Max,460.0f -iPod9.1,iPod touch (7th generation),326.0f \ No newline at end of file +iPod9.1,iPod touch (7th generation),326.0f +# LINT.ThenChange(//depot/google3/third_party/cardboard_oss_unity/unity_plugin/Packages/cardboard-xr-plugin/Runtime/iOS/sdk.bundle/resolutions.csv) \ No newline at end of file diff --git a/sdk/screen_params/ios/screen_params.mm b/sdk/screen_params/ios/screen_params.mm index 29b2dba2..e4edec76 100644 --- a/sdk/screen_params/ios/screen_params.mm +++ b/sdk/screen_params/ios/screen_params.mm @@ -53,8 +53,10 @@ IosScreenParamsMap loadIosScreenParamsFromFile(std::string_view filePath) { } std::string line; - std::getline(screenParamsFile, line); // Skip the header while (std::getline(screenParamsFile, line)) { + if (line.starts_with('#') || line.starts_with("identifier,") || line.empty()) { + continue; + } const std::array tokens {stringSplit(line, ',')}; screenParams[tokens.at(0)] = {tokens.at(1), strtod(tokens.at(2).c_str(), nullptr)}; } @@ -63,28 +65,44 @@ IosScreenParamsMap loadIosScreenParamsFromFile(std::string_view filePath) { } CGFloat getDpi() { - // Gets model name. - struct utsname systemInfo; - uname(&systemInfo); + @autoreleasepool { + // Gets model name. + struct utsname systemInfo; + if (uname(&systemInfo) < 0) { + CARDBOARD_LOGE("uname failed."); + return kDefaultDpi; + } - NSString *machineName = [NSString stringWithCString:systemInfo.machine - encoding:NSUTF8StringEncoding]; - machineName = [machineName stringByReplacingOccurrencesOfString:@"," withString:@"."]; - const std::string modelName{[machineName UTF8String]}; + NSString *machineName = [NSString stringWithCString:systemInfo.machine + encoding:NSUTF8StringEncoding]; + if (!machineName) { + CARDBOARD_LOGE("Couldn't get machine name."); + return kDefaultDpi; + } - CARDBOARD_LOGI("Model name: %s", modelName.c_str()); + machineName = [machineName stringByReplacingOccurrencesOfString:@"," withString:@"."]; + const std::string modelName{[machineName UTF8String]}; - const SDKBundleFinder *bundleFinder = [[SDKBundleFinder alloc] init]; - const NSBundle *sdkBundle = [bundleFinder getSDKBundle]; - const NSString *screenParamsFilePath = [sdkBundle pathForResource:@"resolutions" ofType:@"csv"]; - const IosScreenParamsMap screenParams{loadIosScreenParamsFromFile([screenParamsFilePath UTF8String])}; + CARDBOARD_LOGI("Model name: %s", modelName.c_str()); - if (screenParams.find(modelName) == screenParams.end()) { - CARDBOARD_LOGE("Couldn't find screen params for model: %s", modelName.c_str()); - return kDefaultDpi; - } + const SDKBundleFinder *bundleFinder = [[SDKBundleFinder alloc] init]; + const NSBundle *sdkBundle = [bundleFinder getSDKBundle]; + const NSString *screenParamsFilePath = [sdkBundle pathForResource:@"resolutions" ofType:@"csv"]; + if (!screenParamsFilePath) { + CARDBOARD_LOGE("Couldn't find screen params file."); + return kDefaultDpi; + } + + const IosScreenParamsMap screenParams{ + loadIosScreenParamsFromFile([screenParamsFilePath UTF8String])}; + const auto it = screenParams.find(modelName); + if (it == screenParams.end()) { + CARDBOARD_LOGE("Couldn't find screen params for model: %s", modelName.c_str()); + return kDefaultDpi; + } - return screenParams.at(modelName).second; + return it->second.second; + } } void getScreenSizeInMeters(int width_pixels, int height_pixels, float *out_width_meters,