Flutter Impeller
surface_control.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 
10 
11 namespace impeller::android {
12 
13 std::unique_ptr<SurfaceControl> SurfaceControl::Create(ANativeWindow* window,
14  const char* debug_name) {
15  return std::unique_ptr<SurfaceControl>(
16  new SurfaceControlImpl(window, debug_name));
17 }
18 
20  auto api_level = android_get_device_api_level();
21 
22  // Technically SurfaceControl is supported on API 29 but I've observed
23  // enough reported bugs that I'm bumping the constraint to 30. If
24  // we had more time to test all of these older devices maybe we could
25  // figure out what the problem is.
26  // https://github.com/flutter/flutter/issues/155877
27  return api_level >= 29 && GetProcTable().IsValid() &&
28  GetProcTable().ASurfaceControl_createFromWindow.IsAvailable();
29 }
30 
31 } // namespace impeller::android
static std::unique_ptr< SurfaceControl > Create(ANativeWindow *window, const char *debug_name=nullptr)
Creates a new surface control and adds it as a child of the given window.
const ProcTable & GetProcTable()
Definition: proc_table.cc:12
bool IsValid() const
If a valid proc table could be setup. This may fail in case of setup on non-Android platforms.
Definition: proc_table.cc:65