Winson | 73bc159 | 2016-10-18 18:47:43 -0700 | [diff] [blame^] | 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 | |
| 17 | package com.android.systemui.pip.phone; |
| 18 | |
| 19 | import android.app.ActivityManagerNative; |
| 20 | import android.app.IActivityManager; |
| 21 | import android.content.Context; |
| 22 | import android.view.IWindowManager; |
| 23 | import android.view.WindowManagerGlobal; |
| 24 | |
| 25 | /** |
| 26 | * Manages the picture-in-picture (PIP) UI and states for Phones. |
| 27 | */ |
| 28 | public class PipManager { |
| 29 | private static final String TAG = "PipManager"; |
| 30 | |
| 31 | private static PipManager sPipController; |
| 32 | |
| 33 | private Context mContext; |
| 34 | private IActivityManager mActivityManager; |
| 35 | private IWindowManager mWindowManager; |
| 36 | |
| 37 | private PipTouchHandler mTouchHandler; |
| 38 | |
| 39 | private PipManager() {} |
| 40 | |
| 41 | /** |
| 42 | * Initializes {@link PipManager}. |
| 43 | */ |
| 44 | public void initialize(Context context) { |
| 45 | mContext = context; |
| 46 | mActivityManager = ActivityManagerNative.getDefault(); |
| 47 | mWindowManager = WindowManagerGlobal.getWindowManagerService(); |
| 48 | |
| 49 | mTouchHandler = new PipTouchHandler(context, mActivityManager, mWindowManager); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Updates the PIP per configuration changed. |
| 54 | */ |
| 55 | public void onConfigurationChanged() {} |
| 56 | |
| 57 | /** |
| 58 | * Gets an instance of {@link PipManager}. |
| 59 | */ |
| 60 | public static PipManager getInstance() { |
| 61 | if (sPipController == null) { |
| 62 | sPipController = new PipManager(); |
| 63 | } |
| 64 | return sPipController; |
| 65 | } |
| 66 | } |