ThumbnailData.java revision 173020c2ef0a1dc109a9a39afc3e107badcd407e
1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.systemui.shared.recents.model;
18
19import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
20import static com.android.systemui.shared.system.WindowManagerWrapper.WINDOWING_MODE_UNDEFINED;
21
22import android.app.ActivityManager.TaskSnapshot;
23import android.graphics.Bitmap;
24import android.graphics.Rect;
25
26/**
27 * Data for a single thumbnail.
28 */
29public class ThumbnailData {
30
31    public final Bitmap thumbnail;
32    public int orientation;
33    public Rect insets;
34    public boolean reducedResolution;
35    public boolean isRealSnapshot;
36    public boolean isTranslucent;
37    public int windowingMode;
38    public int systemUiVisibility;
39    public float scale;
40
41    public ThumbnailData() {
42        thumbnail = null;
43        orientation = ORIENTATION_UNDEFINED;
44        insets = new Rect();
45        reducedResolution = false;
46        scale = 1f;
47        isRealSnapshot = true;
48        isTranslucent = false;
49        windowingMode = WINDOWING_MODE_UNDEFINED;
50        systemUiVisibility = 0;
51    }
52
53    public ThumbnailData(TaskSnapshot snapshot) {
54        thumbnail = Bitmap.createHardwareBitmap(snapshot.getSnapshot());
55        insets = new Rect(snapshot.getContentInsets());
56        orientation = snapshot.getOrientation();
57        reducedResolution = snapshot.isReducedResolution();
58        scale = snapshot.getScale();
59        isRealSnapshot = snapshot.isRealSnapshot();
60        isTranslucent = snapshot.isTranslucent();
61        windowingMode = snapshot.getWindowingMode();
62        systemUiVisibility = snapshot.getSystemUiVisibility();
63    }
64}
65