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 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; 24 import android.view.View; 25 import android.view.WindowManager; 26 27 import com.android.internal.policy.DecorView; 28 import com.android.internal.policy.PhoneWindow; 29 import com.android.server.policy.WindowManagerPolicy.StartingSurface; 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 38 private static final String TAG = PhoneWindowManager.TAG; 39 private final View mView; 40 private final IBinder mAppToken; 41 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); 54 } 55 } 56