diff options
author | Jorim Jaggi <jjaggi@google.com> | 2015-05-29 14:49:08 -0700 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2015-06-01 18:01:20 -0700 |
commit | d944986fbdb3d45fab9ae4120af76ca4f6b0909c (patch) | |
tree | 8e7f67f5b08b7e64f86806b8d29579f03057c3e6 /tests | |
parent | cd0f3a1afe668ba3705819da0350d6d05a0b1bcf (diff) | |
download | frameworks_base-d944986fbdb3d45fab9ae4120af76ca4f6b0909c.zip frameworks_base-d944986fbdb3d45fab9ae4120af76ca4f6b0909c.tar.gz frameworks_base-d944986fbdb3d45fab9ae4120af76ca4f6b0909c.tar.bz2 |
Fix API review: Camera prewarm
Let the intent receiver of a camea launch intent declare a prewarm
service instead of sending broadcasts.
Bug: 21347653
Change-Id: I11e31aad4f788ad90eb46a661b819d3e808ddb51
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CameraPrewarmTest/AndroidManifest.xml | 23 | ||||
-rw-r--r-- | tests/CameraPrewarmTest/res/values/strings.xml | 2 | ||||
-rw-r--r-- | tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/CameraActivity.java | 2 | ||||
-rw-r--r-- | tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/PrewarmService.java (renamed from tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/PrewarmReceiver.java) | 20 |
4 files changed, 21 insertions, 26 deletions
diff --git a/tests/CameraPrewarmTest/AndroidManifest.xml b/tests/CameraPrewarmTest/AndroidManifest.xml index eb40200..11b2686 100644 --- a/tests/CameraPrewarmTest/AndroidManifest.xml +++ b/tests/CameraPrewarmTest/AndroidManifest.xml @@ -22,13 +22,13 @@ <activity android:name=".CameraActivity" android:theme="@android:style/Theme.NoTitleBar"> <intent-filter> - <action android:name="android.media.action.STILL_IMAGE_CAMERA_SECURE" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - <intent-filter> <action android:name="android.media.action.STILL_IMAGE_CAMERA" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> + <meta-data + android:name="android.media.still_image_camera_preview_service" + android:value="com.google.android.test.cameraprewarm.PrewarmService"> + </meta-data> </activity> <activity android:name=".SecureCameraActivity" @@ -37,16 +37,15 @@ <action android:name="android.media.action.STILL_IMAGE_CAMERA_SECURE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> + <meta-data + android:name="android.media.still_image_camera_preview_service" + android:value="com.google.android.test.cameraprewarm.PrewarmService"> + </meta-data> </activity> - <receiver android:name=".PrewarmReceiver" > - <intent-filter> - <action android:name="android.media.action.STILL_IMAGE_CAMERA_PREWARM" /> - </intent-filter> - <intent-filter> - <action android:name="android.media.action.STILL_IMAGE_CAMERA_COOLDOWN" /> - </intent-filter> - </receiver> + <service android:name=".PrewarmService" + android:exported="true"> + </service> </application> </manifest> diff --git a/tests/CameraPrewarmTest/res/values/strings.xml b/tests/CameraPrewarmTest/res/values/strings.xml index 11f7ac7..fe39ac1 100644 --- a/tests/CameraPrewarmTest/res/values/strings.xml +++ b/tests/CameraPrewarmTest/res/values/strings.xml @@ -16,6 +16,6 @@ --> <resources> - <string name="activity_title">Assistant</string> + <string name="activity_title">Camera Prewarm test</string> <string name="search_label">Orilla Search Engine</string> </resources> diff --git a/tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/CameraActivity.java b/tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/CameraActivity.java index 4d22234..0b43666 100644 --- a/tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/CameraActivity.java +++ b/tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/CameraActivity.java @@ -19,7 +19,6 @@ package com.google.android.test.cameraprewarm; import android.app.Activity; import android.os.Bundle; import android.util.Log; -import android.view.WindowManager; import com.google.android.test.cameraprewarm.R; @@ -31,7 +30,6 @@ public class CameraActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.camera_activity); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); Log.i(TAG, "Activity created"); } } diff --git a/tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/PrewarmReceiver.java b/tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/PrewarmService.java index d49f96d..d080b1a 100644 --- a/tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/PrewarmReceiver.java +++ b/tests/CameraPrewarmTest/src/com/google/android/test/cameraprewarm/PrewarmService.java @@ -16,20 +16,18 @@ package com.google.android.test.cameraprewarm; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.provider.MediaStore; +import android.service.media.CameraPrewarmService; import android.util.Log; -public class PrewarmReceiver extends BroadcastReceiver { +public class PrewarmService extends CameraPrewarmService { @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(MediaStore.ACTION_STILL_IMAGE_CAMERA_PREWARM)) { - Log.i(CameraActivity.TAG, "Prewarm received"); - } else if (intent.getAction().equals(MediaStore.ACTION_STILL_IMAGE_CAMERA_COOLDOWN)){ - Log.i(CameraActivity.TAG, "Cooldown received"); - } + public void onPrewarm() { + Log.i("PrewarmService", "Warming up"); + } + + @Override + public void onCooldown(boolean cameraIntentFired) { + Log.i("PrewarmService", "Cooling down fired=" + cameraIntentFired); } } |