blob: b9202c334fecd8316b6902253265634e6e6a476c [file] [log] [blame]
Jorim Jaggiba41f4b2016-12-14 17:43:07 -08001/*
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.server.policy;
18
Jorim Jaggi02886a82016-12-06 09:10:06 -080019import static com.android.server.policy.PhoneWindowManager.DEBUG_SPLASH_SCREEN;
20
21import android.os.Debug;
22import android.os.IBinder;
23import android.util.Slog;
Jorim Jaggiba41f4b2016-12-14 17:43:07 -080024import android.view.View;
Jorim Jaggi02886a82016-12-06 09:10:06 -080025import android.view.WindowManager;
Jorim Jaggiba41f4b2016-12-14 17:43:07 -080026
27import com.android.internal.policy.DecorView;
28import com.android.internal.policy.PhoneWindow;
Adrian Roose99bc052017-11-20 17:55:31 +010029import com.android.server.policy.WindowManagerPolicy.StartingSurface;
Jorim Jaggiba41f4b2016-12-14 17:43:07 -080030
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 */
36class SplashScreenSurface implements StartingSurface {
37
Jorim Jaggi02886a82016-12-06 09:10:06 -080038 private static final String TAG = PhoneWindowManager.TAG;
39 private final View mView;
40 private final IBinder mAppToken;
Jorim Jaggiba41f4b2016-12-14 17:43:07 -080041
Jorim Jaggi02886a82016-12-06 09:10:06 -080042 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 Jaggiba41f4b2016-12-14 17:43:07 -080054 }
55}