summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml6
-rw-r--r--res/values/styles.xml36
-rw-r--r--src/com/android/camera/CameraActivity.java14
-rw-r--r--src/com/android/camera/MediaSaveService.java16
-rw-r--r--src/com/android/camera/PhotoUI.java4
-rw-r--r--src/com/android/camera/VideoModule.java4
-rw-r--r--src/com/android/camera/ui/CameraSwitcher.java2
-rw-r--r--src/com/android/camera/ui/FilmStripView.java2
-rw-r--r--tests/AndroidManifest.xml26
-rwxr-xr-xtests/src/com/android/camera/CameraTestRunner.java (renamed from tests/src/com/android/gallery3d/CameraTestRunner.java)10
-rwxr-xr-xtests/src/com/android/camera/StressTests.java (renamed from tests/src/com/android/gallery3d/StressTests.java)15
-rw-r--r--tests/src/com/android/camera/functional/CameraTest.java (renamed from tests/src/com/android/gallery3d/functional/CameraTest.java)2
-rw-r--r--tests/src/com/android/camera/functional/ImageCaptureIntentTest.java (renamed from tests/src/com/android/gallery3d/functional/ImageCaptureIntentTest.java)2
-rw-r--r--tests/src/com/android/camera/functional/VideoCaptureIntentTest.java (renamed from tests/src/com/android/gallery3d/functional/VideoCaptureIntentTest.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/CameraLatency.java (renamed from tests/src/com/android/gallery3d/stress/CameraLatency.java)2
-rw-r--r--tests/src/com/android/camera/stress/CameraStartUp.java (renamed from tests/src/com/android/gallery3d/stress/CameraStartUp.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/CameraStressTestRunner.java (renamed from tests/src/com/android/gallery3d/stress/CameraStressTestRunner.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/ImageCapture.java (renamed from tests/src/com/android/gallery3d/stress/ImageCapture.java)4
-rw-r--r--tests/src/com/android/camera/stress/ShotToShotLatency.java (renamed from tests/src/com/android/gallery3d/stress/ShotToShotLatency.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/SwitchPreview.java (renamed from tests/src/com/android/gallery3d/stress/SwitchPreview.java)2
-rw-r--r--tests/src/com/android/camera/stress/TestUtil.java (renamed from tests/src/com/android/gallery3d/stress/TestUtil.java)2
-rwxr-xr-xtests/src/com/android/camera/stress/VideoCapture.java (renamed from tests/src/com/android/gallery3d/stress/VideoCapture.java)6
-rw-r--r--tests/src/com/android/camera/unittest/CameraUnitTest.java107
-rw-r--r--tests/src/com/android/gallery3d/unittest/CameraUnitTest.java107
24 files changed, 182 insertions, 195 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index aa4e4060d..37a231760 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -908,7 +908,7 @@
<string name="effect_background">BACKGROUND</string>
<!-- The shutter button. [CHAR LIMIT = NONE] -->
- <string name="accessibility_shutter_button">Shutter button</string>
+ <string name="accessibility_shutter_button">Shutter</string>
<!-- The menu button. [CHAR LIMIT = NONE] -->
<string name="accessibility_menu_button">Menu button</string>
<!-- The button to review the thumbnail. [CHAR LIMIT = NONE] -->
@@ -935,8 +935,8 @@
<string name="accessibility_switch_to_video">Switch to video</string>
<!-- The button to switch to Panorama mode. [CHAR LIMIT = NONE] -->
<string name="accessibility_switch_to_panorama">Switch to panorama</string>
- <!-- The button to switch to new Panorama mode. [CHAR LIMIT = NONE] -->
- <string name="accessibility_switch_to_new_panorama">Switch to new panorama</string>
+ <!-- The button to switch to the Photo Sphere mode. [CHAR LIMIT = NONE] -->
+ <string name="accessibility_switch_to_photo_sphere">Switch to Photo Sphere</string>
<!-- The button to switch to the Re-Focus mode. [CHAR LIMIT = NONE] -->
<string name="accessibility_switch_to_refocus">Switch to Refocus</string>
<!-- The button in review mode indicating that the photo taking, video recording, and panorama saving session should be canceled [CHAR LIMIT = NONE] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 50892329b..2fd7dbd24 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -15,46 +15,12 @@
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-<!-- <style name="Theme.GalleryBase" parent="android:Theme.Holo">
- <item name="listPreferredItemHeightSmall">48dp</item>
- <item name="switchStyle">@android:style/Widget.CompoundButton</item>
- </style>
- <style name="Theme.Gallery.Dialog" parent="android:Theme.Holo.Dialog"/>
- <style name="Theme.Gallery" parent="Theme.GalleryBase">
- <item name="android:displayOptions"></item>
- <item name="android:windowContentOverlay">@null</item>
- <item name="android:actionBarStyle">@style/Holo.ActionBar</item>
- <item name="android:windowBackground">@android:color/black</item>
- <item name="android:colorBackground">@null</item>
- <item name="android:colorBackgroundCacheHint">@null</item>
- </style>
- <style name="Theme.FilterShow" parent="Theme.Gallery">
- <item name="android:windowBackground">@color/background_screen</item>
- </style>
- <style name="Holo.ActionBar" parent="android:Widget.Holo.ActionBar">
- <item name="android:displayOptions">useLogo|showHome</item>
- <item name="android:background">@drawable/actionbar_translucent</item>
- <item name="android:backgroundStacked">@null</item>
- </style>
- <style name="MediaButton.Play" parent="@android:style/MediaButton.Play">
- <item name="android:background">@null</item>
- <item name="android:src">@drawable/icn_media_play</item>
- </style>
- <style name="DialogPickerTheme" parent="Theme.Gallery">
- </style>
- <bool name="picker_is_dialog">false</bool>
- <color name="darker_transparent">#C1000000</color>
- <style name="ActionBarTwoLinePrimary" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"></style>
- <style name="ActionBarTwoLineSecondary" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle"></style>
- <style name="ActionBarTwoLineItem">
- <item name="android:background">@drawable/action_bar_two_line_background</item>
- </style> -->
-
<!-- Camera resources below -->
<style name="Theme.ProxyLauncher" parent="@android:Theme.Translucent.NoTitleBar">
</style>
<style name="Theme.Camera" parent="Theme.CameraBase">
+ <item name="android:windowFullscreen">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowTitleSize">0dp</item>
<item name="android:windowActionBarOverlay">true</item>
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 947f8f20c..2cff06306 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -442,7 +442,7 @@ public class CameraActivity extends Activity
case R.id.action_edit:
launchEditor(localData);
return true;
- case R.id.action_trim:
+ case R.id.action_trim: {
// This is going to be handled by the Gallery app.
Intent intent = new Intent(ACTION_TRIM_VIDEO);
LocalData currentData = mDataAdapter.getLocalData(
@@ -452,6 +452,7 @@ public class CameraActivity extends Activity
intent.putExtra(MEDIA_ITEM_PATH, currentData.getPath());
startActivity(intent);
return true;
+ }
case R.id.action_rotate_ccw:
// TODO: add the functionality.
return true;
@@ -461,9 +462,16 @@ public class CameraActivity extends Activity
case R.id.action_crop:
// TODO: add the functionality.
return true;
- case R.id.action_setas:
- // TODO: add the functionality.
+ case R.id.action_setas: {
+ Intent intent = new Intent(Intent.ACTION_ATTACH_DATA)
+ .setDataAndType(localData.getContentUri(),
+ localData.getMimeType())
+ .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ intent.putExtra("mimeType", intent.getType());
+ startActivity(Intent.createChooser(
+ intent, getString(R.string.set_as)));
return true;
+ }
case R.id.action_details:
(new AsyncTask<Void, Void, MediaDetails>() {
@Override
diff --git a/src/com/android/camera/MediaSaveService.java b/src/com/android/camera/MediaSaveService.java
index 40675b8c0..713821d50 100644
--- a/src/com/android/camera/MediaSaveService.java
+++ b/src/com/android/camera/MediaSaveService.java
@@ -20,6 +20,7 @@ import android.app.Service;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Intent;
+import android.graphics.BitmapFactory;
import android.location.Location;
import android.net.Uri;
import android.os.AsyncTask;
@@ -100,6 +101,13 @@ public class MediaSaveService extends Service {
t.execute();
}
+ public void addImage(final byte[] data, String title, long date, Location loc,
+ int orientation, ExifInterface exif,
+ OnMediaSavedListener l, ContentResolver resolver) {
+ // When dimensions are unknown, pass 0 as width and height,
+ // and decode image for width and height later in a background thread
+ addImage(data, title, date, loc, 0, 0, orientation, exif, l, resolver);
+ }
public void addImage(final byte[] data, String title, Location loc,
int width, int height, int orientation, ExifInterface exif,
OnMediaSavedListener l, ContentResolver resolver) {
@@ -161,6 +169,14 @@ public class MediaSaveService extends Service {
@Override
protected Uri doInBackground(Void... v) {
+ if (width == 0 || height == 0) {
+ // Decode bounds
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inJustDecodeBounds = true;
+ BitmapFactory.decodeByteArray(data, 0, data.length, options);
+ width = options.outWidth;
+ height = options.outHeight;
+ }
return Storage.addImage(
resolver, title, date, loc, orientation, exif, data, width, height);
}
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 1f5ae2467..43862d376 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -129,7 +129,7 @@ public class PhotoUI implements PieListener,
int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
int width = right - left;
int height = bottom - top;
- // Full-screen screennail
+ // Full-screen preview
int w = width;
int h = height;
if (CameraUtil.getDisplayRotation(mActivity) % 180 != 0) {
@@ -139,6 +139,7 @@ public class PhotoUI implements PieListener,
if (mPreviewWidth != width || mPreviewHeight != height) {
mPreviewWidth = width;
mPreviewHeight = height;
+ setTransformMatrix(width, height);
mController.onScreenSizeChanged(width, height, w, h);
}
}
@@ -204,7 +205,6 @@ public class PhotoUI implements PieListener,
private void setTransformMatrix(int width, int height) {
mMatrix = mTextureView.getTransform(mMatrix);
- int orientation = CameraUtil.getDisplayRotation(mActivity);
float scaleX = 1f, scaleY = 1f;
float scaledTextureWidth, scaledTextureHeight;
if (width > height) {
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 9f5ca08e9..e1b921d4c 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -2141,9 +2141,9 @@ public class VideoModule implements CameraModule,
String title = CameraUtil.createJpegName(dateTaken);
ExifInterface exif = Exif.getExif(data);
int orientation = Exif.getOrientation(exif);
- Size s = mParameters.getPictureSize();
+
mActivity.getMediaSaveService().addImage(
- data, title, dateTaken, loc, s.width, s.height, orientation,
+ data, title, dateTaken, loc, orientation,
exif, mOnPhotoSavedListener, mContentResolver);
}
diff --git a/src/com/android/camera/ui/CameraSwitcher.java b/src/com/android/camera/ui/CameraSwitcher.java
index 4a42e34e7..d970537d3 100644
--- a/src/com/android/camera/ui/CameraSwitcher.java
+++ b/src/com/android/camera/ui/CameraSwitcher.java
@@ -193,7 +193,7 @@ public class CameraSwitcher extends RotateImageView
break;
case R.drawable.ic_switch_photosphere:
item.setContentDescription(getContext().getResources().getString(
- R.string.accessibility_switch_to_new_panorama));
+ R.string.accessibility_switch_to_photo_sphere));
break;
case R.drawable.ic_switch_refocus:
item.setContentDescription(getContext().getResources().getString(
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java
index 5edf06fca..650f10ae6 100644
--- a/src/com/android/camera/ui/FilmStripView.java
+++ b/src/com/android/camera/ui/FilmStripView.java
@@ -635,6 +635,8 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
// Set the position of the "View Photo Sphere" button.
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mBottomControls
.getLayoutParams();
+ params.leftMargin = insets.left;
+ params.rightMargin = insets.right;
params.bottomMargin = insets.bottom;
mBottomControls.setLayoutParams(params);
}
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index f44156ea4..a19dd387e 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -15,7 +15,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.gallery3d.tests">
+ package="com.android.camera.tests">
<application
android:debuggable="true">
@@ -23,26 +23,22 @@
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="com.android.gallery3d"
- android:label="Tests for GalleryNew3D application."/>
+ android:targetPackage="com.android.camera2"
+ android:label="Tests for Camera2 application."/>
- <instrumentation android:name="com.android.gallery3d.CameraTestRunner"
- android:targetPackage="com.android.gallery3d"
+ <instrumentation android:name="com.android.camera.CameraTestRunner"
+ android:targetPackage="com.android.camera2"
android:label="Camera continuous test runner"/>
- <instrumentation android:name="com.android.gallery3d.exif.ExifTestRunner"
- android:targetPackage="com.android.gallery3d"
+ <instrumentation android:name="com.android.camera.exif.ExifTestRunner"
+ android:targetPackage="com.android.camera2"
android:label="Tests for ExifParser."/>
- <instrumentation android:name="com.android.gallery3d.jpegstream.JpegStreamTestRunner"
- android:targetPackage="com.android.gallery3d"
+ <instrumentation android:name="com.android.camera.jpegstream.JpegStreamTestRunner"
+ android:targetPackage="com.android.camera2"
android:label="Tests for JpegStream classes."/>
- <instrumentation android:name="com.android.gallery3d.stress.CameraStressTestRunner"
- android:targetPackage="com.android.gallery3d"
+ <instrumentation android:name="com.android.camera.stress.CameraStressTestRunner"
+ android:targetPackage="com.android.camera2"
android:label="Camera stress test runner"/>
-
- <instrumentation android:name="com.android.photos.data.DataTestRunner"
- android:targetPackage="com.android.gallery3d"
- android:label="Tests for android photo DataProviders."/>
</manifest>
diff --git a/tests/src/com/android/gallery3d/CameraTestRunner.java b/tests/src/com/android/camera/CameraTestRunner.java
index 503233675..03ec6b3be 100755
--- a/tests/src/com/android/gallery3d/CameraTestRunner.java
+++ b/tests/src/com/android/camera/CameraTestRunner.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package com.android.gallery3d;
+package com.android.camera;
import android.test.InstrumentationTestRunner;
import android.test.InstrumentationTestSuite;
-import com.android.gallery3d.functional.CameraTest;
-import com.android.gallery3d.functional.ImageCaptureIntentTest;
-import com.android.gallery3d.functional.VideoCaptureIntentTest;
-import com.android.gallery3d.unittest.CameraUnitTest;
+import com.android.camera.functional.CameraTest;
+import com.android.camera.functional.ImageCaptureIntentTest;
+import com.android.camera.functional.VideoCaptureIntentTest;
+import com.android.camera.unittest.CameraUnitTest;
import junit.framework.TestSuite;
diff --git a/tests/src/com/android/gallery3d/StressTests.java b/tests/src/com/android/camera/StressTests.java
index b991e9e8d..1734ef010 100755
--- a/tests/src/com/android/gallery3d/StressTests.java
+++ b/tests/src/com/android/camera/StressTests.java
@@ -14,25 +14,24 @@
* limitations under the License.
*/
-package com.android.gallery3d;
+package com.android.camera;
-import com.android.gallery3d.stress.CameraLatency;
-import com.android.gallery3d.stress.CameraStartUp;
-import com.android.gallery3d.stress.ImageCapture;
-import com.android.gallery3d.stress.SwitchPreview;
+import com.android.camera.stress.CameraLatency;
+import com.android.camera.stress.CameraStartUp;
+import com.android.camera.stress.ImageCapture;
+import com.android.camera.stress.SwitchPreview;
import junit.framework.Test;
import junit.framework.TestSuite;
-
/**
* Instrumentation Test Runner for all Camera tests.
*
* Running all tests:
*
* adb shell am instrument \
- * -e class com.android.gallery3d.StressTests \
- * -w com.google.android.gallery3d.tests/com.android.gallery3d.stress.CameraStressTestRunner
+ * -e class com.android.camera.StressTests \
+ * -w com.google.android.camera.tests/com.android.camera.stress.CameraStressTestRunner
*/
public class StressTests extends TestSuite {
diff --git a/tests/src/com/android/gallery3d/functional/CameraTest.java b/tests/src/com/android/camera/functional/CameraTest.java
index c293c0d4a..3fdebc030 100644
--- a/tests/src/com/android/gallery3d/functional/CameraTest.java
+++ b/tests/src/com/android/camera/functional/CameraTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.functional;
+package com.android.camera.functional;
import com.android.camera.CameraActivity;
diff --git a/tests/src/com/android/gallery3d/functional/ImageCaptureIntentTest.java b/tests/src/com/android/camera/functional/ImageCaptureIntentTest.java
index 9ea912864..45af1ba08 100644
--- a/tests/src/com/android/gallery3d/functional/ImageCaptureIntentTest.java
+++ b/tests/src/com/android/camera/functional/ImageCaptureIntentTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.functional;
+package com.android.camera.functional;
import com.android.camera.CameraActivity;
import com.android.camera2.R;
diff --git a/tests/src/com/android/gallery3d/functional/VideoCaptureIntentTest.java b/tests/src/com/android/camera/functional/VideoCaptureIntentTest.java
index 349398949..269b84f73 100644
--- a/tests/src/com/android/gallery3d/functional/VideoCaptureIntentTest.java
+++ b/tests/src/com/android/camera/functional/VideoCaptureIntentTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.functional;
+package com.android.camera.functional;
import com.android.camera.CameraActivity;
import com.android.camera2.R;
diff --git a/tests/src/com/android/gallery3d/stress/CameraLatency.java b/tests/src/com/android/camera/stress/CameraLatency.java
index 2cdc2f1b7..527b5860d 100755
--- a/tests/src/com/android/gallery3d/stress/CameraLatency.java
+++ b/tests/src/com/android/camera/stress/CameraLatency.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
diff --git a/tests/src/com/android/gallery3d/stress/CameraStartUp.java b/tests/src/com/android/camera/stress/CameraStartUp.java
index 3ca163227..4a9b773d1 100644
--- a/tests/src/com/android/gallery3d/stress/CameraStartUp.java
+++ b/tests/src/com/android/camera/stress/CameraStartUp.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
diff --git a/tests/src/com/android/gallery3d/stress/CameraStressTestRunner.java b/tests/src/com/android/camera/stress/CameraStressTestRunner.java
index d3fb10dad..b1bb2a899 100755
--- a/tests/src/com/android/gallery3d/stress/CameraStressTestRunner.java
+++ b/tests/src/com/android/camera/stress/CameraStressTestRunner.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import android.os.Bundle;
import android.test.InstrumentationTestRunner;
diff --git a/tests/src/com/android/gallery3d/stress/ImageCapture.java b/tests/src/com/android/camera/stress/ImageCapture.java
index 5a9ee6a6c..fd7e2afa7 100755
--- a/tests/src/com/android/gallery3d/stress/ImageCapture.java
+++ b/tests/src/com/android/camera/stress/ImageCapture.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
-import com.android.gallery3d.stress.CameraStressTestRunner;
+import com.android.camera.stress.CameraStressTestRunner;
import android.app.Instrumentation;
import android.content.Intent;
diff --git a/tests/src/com/android/gallery3d/stress/ShotToShotLatency.java b/tests/src/com/android/camera/stress/ShotToShotLatency.java
index 0d5749e7d..345379f2a 100644
--- a/tests/src/com/android/gallery3d/stress/ShotToShotLatency.java
+++ b/tests/src/com/android/camera/stress/ShotToShotLatency.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import android.app.Instrumentation;
import android.os.Environment;
diff --git a/tests/src/com/android/gallery3d/stress/SwitchPreview.java b/tests/src/com/android/camera/stress/SwitchPreview.java
index 3545f3b3e..a818bdf60 100755
--- a/tests/src/com/android/gallery3d/stress/SwitchPreview.java
+++ b/tests/src/com/android/camera/stress/SwitchPreview.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
diff --git a/tests/src/com/android/gallery3d/stress/TestUtil.java b/tests/src/com/android/camera/stress/TestUtil.java
index 56ab715f7..64e2039f2 100644
--- a/tests/src/com/android/gallery3d/stress/TestUtil.java
+++ b/tests/src/com/android/camera/stress/TestUtil.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import android.os.Environment;
import java.io.FileWriter;
diff --git a/tests/src/com/android/gallery3d/stress/VideoCapture.java b/tests/src/com/android/camera/stress/VideoCapture.java
index 8211badf7..3688d8909 100755
--- a/tests/src/com/android/gallery3d/stress/VideoCapture.java
+++ b/tests/src/com/android/camera/stress/VideoCapture.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package com.android.gallery3d.stress;
+package com.android.camera.stress;
import com.android.camera.CameraActivity;
-import com.android.gallery3d.stress.TestUtil;
+import com.android.camera.stress.TestUtil;
import android.app.Activity;
import android.app.Instrumentation;
@@ -27,7 +27,7 @@ import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.KeyEvent;
-import com.android.gallery3d.stress.CameraStressTestRunner;
+import com.android.camera.stress.CameraStressTestRunner;
/**
* Junit / Instrumentation test case for camera test
diff --git a/tests/src/com/android/camera/unittest/CameraUnitTest.java b/tests/src/com/android/camera/unittest/CameraUnitTest.java
new file mode 100644
index 000000000..70faa5c8d
--- /dev/null
+++ b/tests/src/com/android/camera/unittest/CameraUnitTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+package com.android.camera.unittest;
+
+import com.android.camera.util.CameraUtil;
+
+import android.graphics.Matrix;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import junit.framework.TestCase;
+
+@SmallTest
+public class CameraUnitTest extends TestCase {
+ public void testRoundOrientation() {
+ int h = CameraUtil.ORIENTATION_HYSTERESIS;
+ assertEquals(0, CameraUtil.roundOrientation(0, 0));
+ assertEquals(0, CameraUtil.roundOrientation(359, 0));
+ assertEquals(0, CameraUtil.roundOrientation(0 + 44 + h, 0));
+ assertEquals(90, CameraUtil.roundOrientation(0 + 45 + h, 0));
+ assertEquals(0, CameraUtil.roundOrientation(360 - 44 - h, 0));
+ assertEquals(270, CameraUtil.roundOrientation(360 - 45 - h, 0));
+
+ assertEquals(90, CameraUtil.roundOrientation(90, 90));
+ assertEquals(90, CameraUtil.roundOrientation(90 + 44 + h, 90));
+ assertEquals(180, CameraUtil.roundOrientation(90 + 45 + h, 90));
+ assertEquals(90, CameraUtil.roundOrientation(90 - 44 - h, 90));
+ assertEquals(0, CameraUtil.roundOrientation(90 - 45 - h, 90));
+
+ assertEquals(180, CameraUtil.roundOrientation(180, 180));
+ assertEquals(180, CameraUtil.roundOrientation(180 + 44 + h, 180));
+ assertEquals(270, CameraUtil.roundOrientation(180 + 45 + h, 180));
+ assertEquals(180, CameraUtil.roundOrientation(180 - 44 - h, 180));
+ assertEquals(90, CameraUtil.roundOrientation(180 - 45 - h, 180));
+
+ assertEquals(270, CameraUtil.roundOrientation(270, 270));
+ assertEquals(270, CameraUtil.roundOrientation(270 + 44 + h, 270));
+ assertEquals(0, CameraUtil.roundOrientation(270 + 45 + h, 270));
+ assertEquals(270, CameraUtil.roundOrientation(270 - 44 - h, 270));
+ assertEquals(180, CameraUtil.roundOrientation(270 - 45 - h, 270));
+
+ assertEquals(90, CameraUtil.roundOrientation(90, 0));
+ assertEquals(180, CameraUtil.roundOrientation(180, 0));
+ assertEquals(270, CameraUtil.roundOrientation(270, 0));
+
+ assertEquals(0, CameraUtil.roundOrientation(0, 90));
+ assertEquals(180, CameraUtil.roundOrientation(180, 90));
+ assertEquals(270, CameraUtil.roundOrientation(270, 90));
+
+ assertEquals(0, CameraUtil.roundOrientation(0, 180));
+ assertEquals(90, CameraUtil.roundOrientation(90, 180));
+ assertEquals(270, CameraUtil.roundOrientation(270, 180));
+
+ assertEquals(0, CameraUtil.roundOrientation(0, 270));
+ assertEquals(90, CameraUtil.roundOrientation(90, 270));
+ assertEquals(180, CameraUtil.roundOrientation(180, 270));
+ }
+
+ public void testPrepareMatrix() {
+ Matrix matrix = new Matrix();
+ float[] points;
+ int[] expected;
+
+ CameraUtil.prepareMatrix(matrix, false, 0, 800, 480);
+ points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
+ expected = new int[] {0, 0, 400, 240, 800, 480, 400, 480, 100, 300};
+ matrix.mapPoints(points);
+ assertEquals(expected, points);
+
+ CameraUtil.prepareMatrix(matrix, false, 90, 800, 480);
+ points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
+ expected = new int[] {800, 0, 400, 240, 0, 480, 0, 240, 300, 60};
+ matrix.mapPoints(points);
+ assertEquals(expected, points);
+
+ CameraUtil.prepareMatrix(matrix, false, 180, 800, 480);
+ points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
+ expected = new int[] {800, 480, 400, 240, 0, 0, 400, 0, 700, 180};
+ matrix.mapPoints(points);
+ assertEquals(expected, points);
+
+ CameraUtil.prepareMatrix(matrix, true, 180, 800, 480);
+ points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
+ expected = new int[] {0, 480, 400, 240, 800, 0, 400, 0, 100, 180};
+ matrix.mapPoints(points);
+ assertEquals(expected, points);
+ }
+
+ private void assertEquals(int expected[], float[] actual) {
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals("Array index " + i + " mismatch", expected[i], Math.round(actual[i]));
+ }
+ }
+}
diff --git a/tests/src/com/android/gallery3d/unittest/CameraUnitTest.java b/tests/src/com/android/gallery3d/unittest/CameraUnitTest.java
deleted file mode 100644
index b8fb05fc2..000000000
--- a/tests/src/com/android/gallery3d/unittest/CameraUnitTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-package com.android.gallery3d.unittest;
-
-import com.android.camera.Util;
-
-import android.graphics.Matrix;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import junit.framework.TestCase;
-
-@SmallTest
-public class CameraUnitTest extends TestCase {
- public void testRoundOrientation() {
- int h = Util.ORIENTATION_HYSTERESIS;
- assertEquals(0, Util.roundOrientation(0, 0));
- assertEquals(0, Util.roundOrientation(359, 0));
- assertEquals(0, Util.roundOrientation(0 + 44 + h, 0));
- assertEquals(90, Util.roundOrientation(0 + 45 + h, 0));
- assertEquals(0, Util.roundOrientation(360 - 44 - h, 0));
- assertEquals(270, Util.roundOrientation(360 - 45 - h, 0));
-
- assertEquals(90, Util.roundOrientation(90, 90));
- assertEquals(90, Util.roundOrientation(90 + 44 + h, 90));
- assertEquals(180, Util.roundOrientation(90 + 45 + h, 90));
- assertEquals(90, Util.roundOrientation(90 - 44 - h, 90));
- assertEquals(0, Util.roundOrientation(90 - 45 - h, 90));
-
- assertEquals(180, Util.roundOrientation(180, 180));
- assertEquals(180, Util.roundOrientation(180 + 44 + h, 180));
- assertEquals(270, Util.roundOrientation(180 + 45 + h, 180));
- assertEquals(180, Util.roundOrientation(180 - 44 - h, 180));
- assertEquals(90, Util.roundOrientation(180 - 45 - h, 180));
-
- assertEquals(270, Util.roundOrientation(270, 270));
- assertEquals(270, Util.roundOrientation(270 + 44 + h, 270));
- assertEquals(0, Util.roundOrientation(270 + 45 + h, 270));
- assertEquals(270, Util.roundOrientation(270 - 44 - h, 270));
- assertEquals(180, Util.roundOrientation(270 - 45 - h, 270));
-
- assertEquals(90, Util.roundOrientation(90, 0));
- assertEquals(180, Util.roundOrientation(180, 0));
- assertEquals(270, Util.roundOrientation(270, 0));
-
- assertEquals(0, Util.roundOrientation(0, 90));
- assertEquals(180, Util.roundOrientation(180, 90));
- assertEquals(270, Util.roundOrientation(270, 90));
-
- assertEquals(0, Util.roundOrientation(0, 180));
- assertEquals(90, Util.roundOrientation(90, 180));
- assertEquals(270, Util.roundOrientation(270, 180));
-
- assertEquals(0, Util.roundOrientation(0, 270));
- assertEquals(90, Util.roundOrientation(90, 270));
- assertEquals(180, Util.roundOrientation(180, 270));
- }
-
- public void testPrepareMatrix() {
- Matrix matrix = new Matrix();
- float[] points;
- int[] expected;
-
- Util.prepareMatrix(matrix, false, 0, 800, 480);
- points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
- expected = new int[] {0, 0, 400, 240, 800, 480, 400, 480, 100, 300};
- matrix.mapPoints(points);
- assertEquals(expected, points);
-
- Util.prepareMatrix(matrix, false, 90, 800, 480);
- points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
- expected = new int[] {800, 0, 400, 240, 0, 480, 0, 240, 300, 60};
- matrix.mapPoints(points);
- assertEquals(expected, points);
-
- Util.prepareMatrix(matrix, false, 180, 800, 480);
- points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
- expected = new int[] {800, 480, 400, 240, 0, 0, 400, 0, 700, 180};
- matrix.mapPoints(points);
- assertEquals(expected, points);
-
- Util.prepareMatrix(matrix, true, 180, 800, 480);
- points = new float[] {-1000, -1000, 0, 0, 1000, 1000, 0, 1000, -750, 250};
- expected = new int[] {0, 480, 400, 240, 800, 0, 400, 0, 100, 180};
- matrix.mapPoints(points);
- assertEquals(expected, points);
- }
-
- private void assertEquals(int expected[], float[] actual) {
- for (int i = 0; i < expected.length; i++) {
- assertEquals("Array index " + i + " mismatch", expected[i], Math.round(actual[i]));
- }
- }
-}