Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70974f88 authored by Archisha Baranwal's avatar Archisha Baranwal Committed by Android (Google) Code Review
Browse files

Merge "Adding method to provide an instance of ViewCaptureAwareWindowManager." into main

parents 9f36e3c0 e5d780c8
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Looper
import android.os.Process
import android.tracing.Flags
import android.util.Log
import android.view.WindowManager

/**
 * Factory to create polymorphic instances of ViewCapture according to build configurations and
@@ -68,5 +69,20 @@ class ViewCaptureFactory {
                }
            }.also { instance = it }
        }

        /** Returns an instance of [ViewCaptureAwareWindowManager]. */
        @JvmStatic
        fun getViewCaptureAwareWindowManagerInstance(
            context: Context,
            isViewCaptureTracingEnabled: Boolean
        ): ViewCaptureAwareWindowManager {
            val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
            val lazyViewCapture = lazy { getInstance(context) }
            return ViewCaptureAwareWindowManager(
                windowManager,
                lazyViewCapture,
                isViewCaptureTracingEnabled
            )
        }
    }
}