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

Commit e5d780c8 authored by archisha's avatar archisha Committed by Archisha Baranwal
Browse files

Adding method to provide an instance of ViewCaptureAwareWindowManager.

Bug: 361019202
Flag: NONE library change
Test: NA library change
Change-Id: I316868f3ba169941b2f2dbda7859abf9aec63da5
parent d0f6ef48
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
            )
        }
    }
}