Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [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.server.policy; |
| 18 | |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 19 | import static com.android.server.policy.PhoneWindowManager.DEBUG_SPLASH_SCREEN; |
| 20 | |
| 21 | import android.os.Debug; |
| 22 | import android.os.IBinder; |
| 23 | import android.util.Slog; |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 24 | import android.view.View; |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 25 | import android.view.WindowManager; |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 26 | |
| 27 | import com.android.internal.policy.DecorView; |
| 28 | import com.android.internal.policy.PhoneWindow; |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 29 | import com.android.server.policy.WindowManagerPolicy.StartingSurface; |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Holds the contents of a splash screen starting window, i.e. the {@link DecorView} of a |
| 33 | * {@link PhoneWindow}. This is just a wrapper such that we can return it from |
| 34 | * {@link WindowManagerPolicy#addSplashScreen}. |
| 35 | */ |
| 36 | class SplashScreenSurface implements StartingSurface { |
| 37 | |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 38 | private static final String TAG = PhoneWindowManager.TAG; |
| 39 | private final View mView; |
| 40 | private final IBinder mAppToken; |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 41 | |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 42 | SplashScreenSurface(View view, IBinder appToken) { |
| 43 | mView = view; |
| 44 | mAppToken = appToken; |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public void remove() { |
| 49 | if (DEBUG_SPLASH_SCREEN) Slog.v(TAG, "Removing splash screen window for " + mAppToken + ": " |
| 50 | + this + " Callers=" + Debug.getCallers(4)); |
| 51 | |
| 52 | final WindowManager wm = mView.getContext().getSystemService(WindowManager.class); |
| 53 | wm.removeView(mView); |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 54 | } |
| 55 | } |