Пример #1
0
 private void inflatePreviews() {
   mPhonePreview = mPreviewInflater.inflatePreview(PHONE_INTENT);
   mCameraPreview = mPreviewInflater.inflatePreview(getCameraIntent());
   if (mPhonePreview != null) {
     mPreviewContainer.addView(mPhonePreview);
     mPhonePreview.setVisibility(View.INVISIBLE);
   }
   if (mCameraPreview != null) {
     mPreviewContainer.addView(mCameraPreview);
     mCameraPreview.setVisibility(View.INVISIBLE);
   }
 }
Пример #2
0
  public void launchCamera() {
    if (DEBUG) Log.d(TAG, "launchCamera() is called.");

    mFlashlightController.killFlashlight();

    Intent intent = getCameraIntent();
    boolean wouldLaunchResolverActivity =
        PreviewInflater.wouldLaunchResolverActivity(
            mContext, intent, mLockPatternUtils.getCurrentUser());
    if (intent == SECURE_CAMERA_INTENT && !wouldLaunchResolverActivity) {
      if (DEBUG) Log.d(TAG, "launchCamera() - launch SECURE_CAMERA_INTENT");
      /// M: [ALPS01844520] Insecure Camera may be resumed if no CLEAR_TOP attribute.
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
      mContext.startActivityAsUser(intent, UserHandle.CURRENT);
    } else {
      if (DEBUG) Log.d(TAG, "launchCamera() - launch INSECURE_CAMERA_INTENT");
      // We need to delay starting the activity because ResolverActivity finishes itself if
      // launched behind lockscreen.
      mActivityStarter.startActivity(intent, false /* dismissShade */);
    }
  }