Attaches source for camera launch when unlocked.
If the double tap power button gesture is detected while the device is unlocked, we are using a different code path to start the camera app. In this code path, we were not actually attaching the source to identify ourselves as the double tap power button System UI gesture. This CL updates that path to include the source. Bug: 262193771 Test: manually verified that we are attaching the extra (though it doesn't fix the camera bug) Change-Id: If5844a2ceb165303240265f0c0955f94fc8076a0
This commit is contained in:
@@ -28,7 +28,6 @@ import android.os.RemoteException
|
||||
import android.os.UserHandle
|
||||
import android.util.Log
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import com.android.keyguard.KeyguardUpdateMonitor
|
||||
import com.android.systemui.ActivityIntentHelper
|
||||
import com.android.systemui.dagger.qualifiers.Main
|
||||
@@ -83,7 +82,7 @@ class CameraGestureHelper @Inject constructor(
|
||||
*/
|
||||
fun launchCamera(source: Int) {
|
||||
val intent: Intent = getStartCameraIntent()
|
||||
intent.putExtra(EXTRA_CAMERA_LAUNCH_SOURCE, source)
|
||||
intent.putExtra(CameraIntents.EXTRA_LAUNCH_SOURCE, source)
|
||||
val wouldLaunchResolverActivity = activityIntentHelper.wouldLaunchResolverActivity(
|
||||
intent, KeyguardUpdateMonitor.getCurrentUser()
|
||||
)
|
||||
@@ -149,9 +148,4 @@ class CameraGestureHelper @Inject constructor(
|
||||
cameraIntents.getInsecureCameraIntent()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@VisibleForTesting
|
||||
const val EXTRA_CAMERA_LAUNCH_SOURCE = "com.android.systemui.camera_launch_source"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ class CameraIntents {
|
||||
MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE
|
||||
val DEFAULT_INSECURE_CAMERA_INTENT_ACTION =
|
||||
MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA
|
||||
const val EXTRA_LAUNCH_SOURCE = "com.android.systemui.camera_launch_source"
|
||||
|
||||
@JvmStatic
|
||||
fun getOverrideCameraPackage(context: Context): String? {
|
||||
|
||||
@@ -371,6 +371,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
||||
|
||||
if (!mKeyguardStateController.isShowing()) {
|
||||
final Intent cameraIntent = CameraIntents.getInsecureCameraIntent(mContext);
|
||||
cameraIntent.putExtra(CameraIntents.EXTRA_LAUNCH_SOURCE, source);
|
||||
mCentralSurfaces.startActivityDismissingKeyguard(cameraIntent,
|
||||
false /* onlyProvisioned */, true /* dismissShade */,
|
||||
true /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, 0,
|
||||
|
||||
@@ -301,7 +301,7 @@ class CameraGestureHelperTest : SysuiTestCase() {
|
||||
val intent = intentCaptor.value
|
||||
|
||||
assertThat(CameraIntents.isSecureCameraIntent(intent)).isEqualTo(isSecure)
|
||||
assertThat(intent.getIntExtra(CameraGestureHelper.EXTRA_CAMERA_LAUNCH_SOURCE, -1))
|
||||
assertThat(intent.getIntExtra(CameraIntents.EXTRA_LAUNCH_SOURCE, -1))
|
||||
.isEqualTo(source)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user