@@ -0,0 +1,2472 @@
+/*%0A * Copyright 2019 The Android Open Source Project%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage androidx.camera.view;%0A%0Aimport android.graphics.SurfaceTexture;%0Aimport android.util.Log;%0Aimport android.view.TextureView;%0Aimport android.view.ViewGroup;%0Aimport android.widget.FrameLayout;%0A%0Aimport androidx.annotation.NonNull;%0Aimport androidx.camera.core.Preview;%0Aimport androidx.camera.core.PreviewUtil;%0A%0A/**%0A * The %7B@link TextureView%7D implementation for %7B@link PreviewView%7D%0A */%0Apublic class TextureViewImplementation implements PreviewView.Implementation %7B%0A%0A    private static final String TAG = %22TextureViewImpl%22;%0A%0A    // Synthetic Accessor%0A    @SuppressWarnings(%22WeakerAccess%22)%0A    TextureView mTextureView;%0A%0A    /**%0A     * %7B@inheritDoc%7D%0A     */%0A    @Override%0A    public void init(@NonNull FrameLayout parent) %7B%0A        mTextureView = new TextureView(parent.getContext());%0A        mTextureView.setLayoutParams(%0A                new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,%0A                        FrameLayout.LayoutParams.MATCH_PARENT));%0A        parent.addView(mTextureView);%0A    %7D%0A%0A    @NonNull%0A    @Override%0A    public Preview.PreviewSurfaceCallback getPreviewSurfaceCallback() %7B%0A        return PreviewUtil.createPreviewSurfaceCallback(new PreviewUtil.SurfaceTextureCallback() %7B%0A            @Override%0A            public void onSurfaceTextureReady(@NonNull SurfaceTexture surfaceTexture) %7B%0A                Log.d(TAG, %22onSurfaceTextureReady%22);%0A                final ViewGroup parent = (ViewGroup) mTextureView.getParent();%0A                parent.removeView(mTextureView);%0A                parent.addView(mTextureView);%0A                mTextureView.setSurfaceTexture(surfaceTexture);%0A            %7D%0A%0A            @Override%0A            public void onSafeToRelease(@NonNull SurfaceTexture surfaceTexture) %7B%0A                Log.d(TAG, %22onSafeToRelease%22);%0A                surfaceTexture.release();%0A            %7D%0A        %7D);%0A    %7D%0A%7D%0A

Add TextureViewImplementation, an implimentation of PreviewView.Implementation that uses a TextureView internally.