diff options
author | junjiez <junjiez@codeaurora.org> | 2016-08-15 11:29:56 +0800 |
---|---|---|
committer | junjiez <junjiez@codeaurora.org> | 2016-08-16 10:49:16 +0800 |
commit | 54718277469d05cf7e45703bad283d26a40115c6 (patch) | |
tree | 8f3f40d75c314d529423df728c1ab77120b7b90e /src/com/android/camera/CameraActivity.java | |
parent | bec67f460a2acb5d239ab5455a8eb0b8a66cfe23 (diff) | |
download | android_packages_apps_Snap-54718277469d05cf7e45703bad283d26a40115c6.tar.gz android_packages_apps_Snap-54718277469d05cf7e45703bad283d26a40115c6.tar.bz2 android_packages_apps_Snap-54718277469d05cf7e45703bad283d26a40115c6.zip |
SnapdragonCamera:Add intent interface for APT automation
Add intent interface to allow APT changing the UI settings
by adb command.
Change-Id: I28276ed398a09dceca6c5e59c755339fb229d1fd
CRs-Fixed: 1043197
Diffstat (limited to 'src/com/android/camera/CameraActivity.java')
-rw-r--r--[-rwxr-xr-x] | src/com/android/camera/CameraActivity.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 5666331fa..7b2c4187c 100755..100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -147,6 +147,8 @@ public class CameraActivity extends Activity // This string is used for judge start activity from screenoff or not public static final String GESTURE_CAMERA_NAME = "com.android.camera.CameraGestureActivity"; + private static final String AUTO_TEST_INTENT ="com.android.camera.autotest"; + /** * Request code from an activity we started that indicated that we do not * want to reset the view to the preview in onResume. @@ -251,6 +253,8 @@ public class CameraActivity extends Activity private boolean mDataRequested; private Cursor mCursor; + private boolean mAutoTestEnabled = false; + private WakeLock mWakeLock; private static final int REFOCUS_ACTIVITY_CODE = 1; @@ -1392,6 +1396,24 @@ public class CameraActivity extends Activity } } + private BroadcastReceiver mAutoTestReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (intent.hasExtra("KEY") && intent.hasExtra("VALUE")) { + String key = intent.getExtras().getString("KEY"); + String value = intent.getExtras().getString("VALUE"); + if (mCurrentModule != null) { + mCurrentModule.setPreferenceForTest(key,value); + } + } + } + }; + + private void registerAutoTestReceiver() { + IntentFilter filter = new IntentFilter(AUTO_TEST_INTENT); + registerReceiver(mAutoTestReceiver, filter); + } + @Override public void onCreate(Bundle state) { super.onCreate(state); @@ -1449,11 +1471,11 @@ public class CameraActivity extends Activity moduleIndex = ModuleSwitcher.VIDEO_MODULE_INDEX; } else if (MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA.equals(getIntent().getAction()) || MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE.equals(getIntent() - .getAction())) { + .getAction())) { moduleIndex = ModuleSwitcher.PHOTO_MODULE_INDEX; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (prefs.getInt(CameraSettings.KEY_STARTUP_MODULE_INDEX, -1) - == ModuleSwitcher.GCAM_MODULE_INDEX && GcamHelper.hasGcamCapture()) { + == ModuleSwitcher.GCAM_MODULE_INDEX && GcamHelper.hasGcamCapture()) { moduleIndex = ModuleSwitcher.GCAM_MODULE_INDEX; } } else if (MediaStore.ACTION_IMAGE_CAPTURE.equals(getIntent().getAction()) @@ -1580,6 +1602,11 @@ public class CameraActivity extends Activity SETTING_LIST_WIDTH_1 = lower / 2 + offset; SETTING_LIST_WIDTH_2 = lower / 2 - offset; registerSDcardMountedReceiver(); + mAutoTestEnabled = SystemProperties.getBoolean("camera.ui.auto_test", false); + + if (mAutoTestEnabled) { + registerAutoTestReceiver(); + } } private void setRotationAnimation() { @@ -1774,6 +1801,9 @@ public class CameraActivity extends Activity mCursor.close(); mCursor=null; } + if (mAutoTestEnabled) { + unregisterReceiver(mAutoTestReceiver); + } super.onDestroy(); } |