Skip to content

Commit

Permalink
ARCore Android SDK v1.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nvictornvictor committed Dec 12, 2019
1 parent 2ac280b commit 8a5f99a
Show file tree
Hide file tree
Showing 16 changed files with 1,499 additions and 263 deletions.
1,678 changes: 1,439 additions & 239 deletions LICENSE

Large diffs are not rendered by default.

30 changes: 23 additions & 7 deletions libraries/include/arcore_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,13 @@ AR_DEFINE_ENUM(ArTrackingFailureReason){
/// Motion tracking lost due to insufficient visual features. Ask the user
/// to move to a different area and to avoid blank walls and surfaces
/// without detail.
AR_TRACKING_FAILURE_REASON_INSUFFICIENT_FEATURES = 4};
AR_TRACKING_FAILURE_REASON_INSUFFICIENT_FEATURES = 4,
/// Motion tracking paused because the camera is in use by another
/// application. Tracking will resume once this app regains priority, or
/// once all apps with higher priority have stopped using the camera. Prior
/// to ARCore SDK 1.13, AR_TRACKING_FAILURE_REASON_NONE is returned in this
/// case instead.
AR_TRACKING_FAILURE_REASON_CAMERA_UNAVAILABLE = 5};

/// @ingroup cloud
/// Describes the current cloud state of an @c Anchor.
Expand Down Expand Up @@ -812,12 +818,12 @@ AR_DEFINE_ENUM(ArCloudAnchorState){
/// it.
AR_CLOUD_ANCHOR_STATE_ERROR_RESOLVING_SDK_VERSION_TOO_OLD = -8,

/// The anchor could not be acquired because the SDK used to host the anchor
/// was older than and incompatible with the version being used to acquire
/// it.
/// The Cloud Anchor could not be acquired because the SDK used to host the
/// anchor was older than and incompatible with the version being used to
/// acquire it.
AR_CLOUD_ANCHOR_STATE_ERROR_RESOLVING_SDK_VERSION_TOO_NEW = -9,

/// The ARCore Cloud Anchor Service was unreachable. This can happen for
/// The ARCore Cloud Anchor service was unreachable. This can happen for
/// a number of reasons. The device might be in airplane mode or does not
/// have a working internet connection. The request sent to the server might
/// have timed out with no response, or there might be a bad network
Expand Down Expand Up @@ -1008,7 +1014,8 @@ AR_DEFINE_ENUM(ArCloudAnchorMode){
/// Anchor Hosting is enabled. Setting this value and calling
/// @c ArSession_configure() will require that the application have the
/// Android INTERNET permission.
AR_CLOUD_ANCHOR_MODE_ENABLED = 1};
AR_CLOUD_ANCHOR_MODE_ENABLED = 1,
};

/// @ingroup frame
/// 2d coordinate systems supported by ARCore.
Expand Down Expand Up @@ -3348,9 +3355,14 @@ void ArAugmentedImageDatabase_serialize(
///
/// The image name is expected to be a null-terminated string in UTF-8 format.
///
/// Currently, only images for which the stride is equal to the width are
/// supported.
///
/// @return #AR_SUCCESS or any of:
/// - #AR_ERROR_IMAGE_INSUFFICIENT_QUALITY - image quality is insufficient, e.g.
/// because of lack of features in the image.
/// - #AR_ERROR_INVALID_ARGUMENT - if image_stride_in_pixels is not equal to
/// image_width_in_pixels.
ArStatus ArAugmentedImageDatabase_addImage(
const ArSession *session,
ArAugmentedImageDatabase *augmented_image_database,
Expand Down Expand Up @@ -3382,10 +3394,14 @@ ArStatus ArAugmentedImageDatabase_addImage(
///
/// The image name is expected to be a null-terminated string in UTF-8 format.
///
/// Currently, only images for which the stride is equal to the width are
/// supported.
///
/// @return #AR_SUCCESS or any of:
/// - #AR_ERROR_IMAGE_INSUFFICIENT_QUALITY - image quality is insufficient, e.g.
/// because of lack of features in the image.
/// - #AR_ERROR_INVALID_ARGUMENT - image_width_in_meters is <= 0.
/// - #AR_ERROR_INVALID_ARGUMENT - image_width_in_meters is <= 0 or if
/// image_stride_in_pixels is not equal to image_width_in_pixels.
ArStatus ArAugmentedImageDatabase_addImageWithPhysicalSize(
const ArSession *session,
ArAugmentedImageDatabase *augmented_image_database,
Expand Down
4 changes: 2 additions & 2 deletions samples/augmented_image_c/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.13.0'
natives 'com.google.ar:core:1.13.0'
implementation 'com.google.ar:core:1.14.0'
natives 'com.google.ar:core:1.14.0'

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
Expand Down
2 changes: 1 addition & 1 deletion samples/augmented_image_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.13.0'
implementation 'com.google.ar:core:1.14.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public final class TrackingStateHelper {
"Too dark. Try moving to a well-lit area.";
private static final String BAD_STATE_MESSAGE =
"Tracking lost due to bad internal state. Please try restarting the AR experience.";
private static final String CAMERA_UNAVAILABLE_MESSAGE =
"Another app is using the camera. Tap on this app or try closing the other one.";

private final Activity activity;

Expand Down Expand Up @@ -71,6 +73,8 @@ public static String getTrackingFailureReasonString(Camera camera) {
return EXCESSIVE_MOTION_MESSAGE;
case INSUFFICIENT_FEATURES:
return INSUFFICIENT_FEATURES_MESSAGE;
case CAMERA_UNAVAILABLE:
return CAMERA_UNAVAILABLE_MESSAGE;
}
return "Unknown tracking failure reason: " + reason;
}
Expand Down
2 changes: 1 addition & 1 deletion samples/cloud_anchor_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.13.0'
implementation 'com.google.ar:core:1.14.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public final class TrackingStateHelper {
"Too dark. Try moving to a well-lit area.";
private static final String BAD_STATE_MESSAGE =
"Tracking lost due to bad internal state. Please try restarting the AR experience.";
private static final String CAMERA_UNAVAILABLE_MESSAGE =
"Another app is using the camera. Tap on this app or try closing the other one.";

private final Activity activity;

Expand Down Expand Up @@ -71,6 +73,8 @@ public static String getTrackingFailureReasonString(Camera camera) {
return EXCESSIVE_MOTION_MESSAGE;
case INSUFFICIENT_FEATURES:
return INSUFFICIENT_FEATURES_MESSAGE;
case CAMERA_UNAVAILABLE:
return CAMERA_UNAVAILABLE_MESSAGE;
}
return "Unknown tracking failure reason: " + reason;
}
Expand Down
4 changes: 2 additions & 2 deletions samples/computervision_c/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.13.0'
natives 'com.google.ar:core:1.13.0'
implementation 'com.google.ar:core:1.14.0'
natives 'com.google.ar:core:1.14.0'

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
Expand Down
2 changes: 1 addition & 1 deletion samples/computervision_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.13.0'
implementation 'com.google.ar:core:1.14.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public final class TrackingStateHelper {
"Too dark. Try moving to a well-lit area.";
private static final String BAD_STATE_MESSAGE =
"Tracking lost due to bad internal state. Please try restarting the AR experience.";
private static final String CAMERA_UNAVAILABLE_MESSAGE =
"Another app is using the camera. Tap on this app or try closing the other one.";

private final Activity activity;

Expand Down Expand Up @@ -71,6 +73,8 @@ public static String getTrackingFailureReasonString(Camera camera) {
return EXCESSIVE_MOTION_MESSAGE;
case INSUFFICIENT_FEATURES:
return INSUFFICIENT_FEATURES_MESSAGE;
case CAMERA_UNAVAILABLE:
return CAMERA_UNAVAILABLE_MESSAGE;
}
return "Unknown tracking failure reason: " + reason;
}
Expand Down
4 changes: 2 additions & 2 deletions samples/hello_ar_c/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.13.0'
natives 'com.google.ar:core:1.13.0'
implementation 'com.google.ar:core:1.14.0'
natives 'com.google.ar:core:1.14.0'

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
Expand Down
2 changes: 1 addition & 1 deletion samples/hello_ar_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ android {
dependencies {
// ARCore library
// Dependency version is rewritten at build time.
implementation 'com.google.ar:core:1.13.0'
implementation 'com.google.ar:core:1.14.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public final class TrackingStateHelper {
"Too dark. Try moving to a well-lit area.";
private static final String BAD_STATE_MESSAGE =
"Tracking lost due to bad internal state. Please try restarting the AR experience.";
private static final String CAMERA_UNAVAILABLE_MESSAGE =
"Another app is using the camera. Tap on this app or try closing the other one.";

private final Activity activity;

Expand Down Expand Up @@ -71,6 +73,8 @@ public static String getTrackingFailureReasonString(Camera camera) {
return EXCESSIVE_MOTION_MESSAGE;
case INSUFFICIENT_FEATURES:
return INSUFFICIENT_FEATURES_MESSAGE;
case CAMERA_UNAVAILABLE:
return CAMERA_UNAVAILABLE_MESSAGE;
}
return "Unknown tracking failure reason: " + reason;
}
Expand Down
2 changes: 1 addition & 1 deletion samples/shared_camera_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.13.0'
implementation 'com.google.ar:core:1.14.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public final class TrackingStateHelper {
"Too dark. Try moving to a well-lit area.";
private static final String BAD_STATE_MESSAGE =
"Tracking lost due to bad internal state. Please try restarting the AR experience.";
private static final String CAMERA_UNAVAILABLE_MESSAGE =
"Another app is using the camera. Tap on this app or try closing the other one.";

private final Activity activity;

Expand Down Expand Up @@ -71,6 +73,8 @@ public static String getTrackingFailureReasonString(Camera camera) {
return EXCESSIVE_MOTION_MESSAGE;
case INSUFFICIENT_FEATURES:
return INSUFFICIENT_FEATURES_MESSAGE;
case CAMERA_UNAVAILABLE:
return CAMERA_UNAVAILABLE_MESSAGE;
}
return "Unknown tracking failure reason: " + reason;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public void onError(@NonNull CameraDevice cameraDevice, int error) {
};

// Repeating camera capture session state callback.
CameraCaptureSession.StateCallback cameraCaptureCallback =
CameraCaptureSession.StateCallback cameraSessionStateCallback =
new CameraCaptureSession.StateCallback() {

// Called when the camera capture session is first configured after the app
Expand Down Expand Up @@ -302,7 +302,7 @@ public void onConfigureFailed(@NonNull CameraCaptureSession session) {
};

// Repeating camera capture session capture callback.
private final CameraCaptureSession.CaptureCallback captureSessionCallback =
private final CameraCaptureSession.CaptureCallback cameraCaptureCallback =
new CameraCaptureSession.CaptureCallback() {

@Override
Expand Down Expand Up @@ -413,6 +413,7 @@ protected void onResume() {

@Override
public void onPause() {
shouldUpdateSurfaceTexture.set(false);
surfaceView.onPause();
waitUntilCameraCaptureSesssionIsActive();
displayRotationHelper.onPause();
Expand Down Expand Up @@ -444,7 +445,7 @@ private void resumeARCore() {
updateSnackbarMessage();

// Set capture session callback while in AR mode.
sharedCamera.setCaptureCallback(captureSessionCallback, backgroundHandler);
sharedCamera.setCaptureCallback(cameraCaptureCallback, backgroundHandler);
} catch (CameraNotAvailableException e) {
Log.e(TAG, "Failed to resume ARCore session", e);
return;
Expand All @@ -453,7 +454,6 @@ private void resumeARCore() {
}

private void pauseARCore() {
shouldUpdateSurfaceTexture.set(false);
if (arcoreActive) {
// Pause ARCore.
sharedSession.pause();
Expand All @@ -477,7 +477,7 @@ private void setRepeatingCaptureRequest() {
setCameraEffects(previewCaptureRequestBuilder);

captureSession.setRepeatingRequest(
previewCaptureRequestBuilder.build(), captureSessionCallback, backgroundHandler);
previewCaptureRequestBuilder.build(), cameraCaptureCallback, backgroundHandler);
} catch (CameraAccessException e) {
Log.e(TAG, "Failed to set repeating request", e);
}
Expand Down Expand Up @@ -512,7 +512,7 @@ private void createCameraPreviewSession() {

// Wrap our callback in a shared camera callback.
CameraCaptureSession.StateCallback wrappedCallback =
sharedCamera.createARSessionStateCallback(cameraCaptureCallback, backgroundHandler);
sharedCamera.createARSessionStateCallback(cameraSessionStateCallback, backgroundHandler);

// Create camera capture session for camera preview using ARCore wrapped callback.
cameraDevice.createCaptureSession(surfaceList, wrappedCallback, backgroundHandler);
Expand Down

0 comments on commit 8a5f99a

Please sign in to comment.