Skip to content

projectionManager field is unused #6

Description

@rogue-socket

Summary

MediaProjectionController.kt lines 17-18 eagerly initialize a projectionManager class field that is never referenced. createProjectionIntent() (line 21-22) creates its own local manager variable instead.

Details

// Line 17-18: field initialized but never used
private val projectionManager =
    appContext.getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager

// Line 21-22: creates a new local instead of using the field
fun createProjectionIntent(): android.content.Intent {
    val manager = appContext.getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager
    return manager.createScreenCaptureIntent()
}

The field performs a system service lookup at construction time for no purpose.

Fix

Remove the field and keep the local in createProjectionIntent() (or vice versa).

Files

  • action-executor/src/main/java/com/scroller/agent/executor/MediaProjectionController.kt (lines 17-18, 21-22)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions