Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
shell
platform
android
io
flutter
util
HandlerCompat.java
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
5
package
io.flutter.util;
6
7
import
static
io.flutter.Build.API_LEVELS;
8
9
import
android
.os.Build;
10
import
android
.os.Handler;
11
import
android
.os.Looper;
12
13
/** Compatability wrapper over {@link Handler}. */
14
public
final
class
HandlerCompat
{
15
/**
16
* Create a new Handler whose posted messages and runnables are not subject to synchronization
17
* barriers such as display vsync.
18
*
19
* <p>Messages sent to an async handler are guaranteed to be ordered with respect to one another,
20
* but not necessarily with respect to messages from other Handlers. Compatibility behavior:
21
*
22
* <ul>
23
* <li>SDK 28 and above, this method matches platform behavior.
24
* <li>Otherwise, returns a synchronous handler instance.
25
* </ul>
26
*
27
* @param looper the Looper that the new Handler should be bound to
28
* @return a new async Handler instance
29
* @see Handler#createAsync(Looper)
30
*/
31
public
static
Handler
createAsyncHandler
(Looper looper) {
32
if
(
Build
.VERSION.SDK_INT >= API_LEVELS.API_28) {
33
return
Handler.createAsync(looper);
34
}
35
return
new
Handler(looper);
36
}
37
}
io.flutter.Build
Definition
Build.java:8
io.flutter.util.HandlerCompat
Definition
HandlerCompat.java:14
io.flutter.util.HandlerCompat.createAsyncHandler
static Handler createAsyncHandler(Looper looper)
Definition
HandlerCompat.java:31
android
Definition
BitmapRegionDecoder.cpp:14
Generated on Fri Apr 26 2024 06:14:21 for Flutter Engine by
1.9.8