Loading viewcapturelib/src/com/android/app/viewcapture/NoOpViewCapture.kt +2 −2 Original line number Diff line number Diff line Loading @@ -11,11 +11,11 @@ import android.view.Window */ class NoOpViewCapture: ViewCapture(0, 0, createAndStartNewLooperExecutor("NoOpViewCapture", HandlerThread.MIN_PRIORITY)) { override fun startCapture(view: View?, name: String?): SafeCloseable { override fun startCapture(view: View, name: String): SafeCloseable { return SafeCloseable { } } override fun startCapture(window: Window?): SafeCloseable { override fun startCapture(window: Window): SafeCloseable { return SafeCloseable { } } } No newline at end of file viewcapturelib/src/com/android/app/viewcapture/ViewCapture.java +6 −6 Original line number Diff line number Diff line Loading @@ -128,7 +128,7 @@ public abstract class ViewCapture { * Attaches the ViewCapture to the provided window and returns a handle to detach the listener */ @NonNull public SafeCloseable startCapture(Window window) { public SafeCloseable startCapture(@NonNull Window window) { String title = window.getAttributes().getTitle().toString(); String name = TextUtils.isEmpty(title) ? window.toString() : title; return startCapture(window.getDecorView(), name); Loading @@ -139,16 +139,16 @@ public abstract class ViewCapture { * Verifies that ViewCapture is enabled before actually attaching an onDrawListener. */ @NonNull public SafeCloseable startCapture(View view, String name) { public SafeCloseable startCapture(@NonNull View view, @NonNull String name) { WindowListener listener = new WindowListener(view, name); if (mIsEnabled) MAIN_EXECUTOR.execute(listener::attachToRoot); mListeners.add(listener); Context context = view.getContext(); context.registerComponentCallbacks(listener); view.getContext().registerComponentCallbacks(listener); return () -> { context.unregisterComponentCallbacks(listener); if (listener.mRoot != null && listener.mRoot.getContext() != null) { listener.mRoot.getContext().unregisterComponentCallbacks(listener); } mListeners.remove(listener); listener.detachFromRoot(); }; Loading Loading
viewcapturelib/src/com/android/app/viewcapture/NoOpViewCapture.kt +2 −2 Original line number Diff line number Diff line Loading @@ -11,11 +11,11 @@ import android.view.Window */ class NoOpViewCapture: ViewCapture(0, 0, createAndStartNewLooperExecutor("NoOpViewCapture", HandlerThread.MIN_PRIORITY)) { override fun startCapture(view: View?, name: String?): SafeCloseable { override fun startCapture(view: View, name: String): SafeCloseable { return SafeCloseable { } } override fun startCapture(window: Window?): SafeCloseable { override fun startCapture(window: Window): SafeCloseable { return SafeCloseable { } } } No newline at end of file
viewcapturelib/src/com/android/app/viewcapture/ViewCapture.java +6 −6 Original line number Diff line number Diff line Loading @@ -128,7 +128,7 @@ public abstract class ViewCapture { * Attaches the ViewCapture to the provided window and returns a handle to detach the listener */ @NonNull public SafeCloseable startCapture(Window window) { public SafeCloseable startCapture(@NonNull Window window) { String title = window.getAttributes().getTitle().toString(); String name = TextUtils.isEmpty(title) ? window.toString() : title; return startCapture(window.getDecorView(), name); Loading @@ -139,16 +139,16 @@ public abstract class ViewCapture { * Verifies that ViewCapture is enabled before actually attaching an onDrawListener. */ @NonNull public SafeCloseable startCapture(View view, String name) { public SafeCloseable startCapture(@NonNull View view, @NonNull String name) { WindowListener listener = new WindowListener(view, name); if (mIsEnabled) MAIN_EXECUTOR.execute(listener::attachToRoot); mListeners.add(listener); Context context = view.getContext(); context.registerComponentCallbacks(listener); view.getContext().registerComponentCallbacks(listener); return () -> { context.unregisterComponentCallbacks(listener); if (listener.mRoot != null && listener.mRoot.getContext() != null) { listener.mRoot.getContext().unregisterComponentCallbacks(listener); } mListeners.remove(listener); listener.detachFromRoot(); }; Loading