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 import android.view.WindowManagerPolicy; 27 import android.view.WindowManagerPolicy.StartingSurface; 28 29 import com.android.internal.policy.DecorView; 30 import com.android.internal.policy.PhoneWindow; 31 32 /** 33 * Holds the contents of a splash screen starting window, i.e. the {@link DecorView} of a 34 * {@link PhoneWindow}. This is just a wrapper such that we can return it from 35 * {@link WindowManagerPolicy#addSplashScreen}. 36 */ 37 class SplashScreenSurface implements StartingSurface { 38 39 private static final String TAG = PhoneWindowManager.TAG; 40 private final View mView; 41 private final IBinder mAppToken; 42 43 SplashScreenSurface(View view, IBinder appToken) { 44 mView = view; 45 mAppToken = appToken; 46 } 47 48 @Override 49 public void remove() { 50 if (DEBUG_SPLASH_SCREEN) Slog.v(TAG, "Removing splash screen window for " + mAppToken + ": " 51 + this + " Callers=" + Debug.getCallers(4)); 52 53 final WindowManager wm = mView.getContext().getSystemService(WindowManager.class); 54 wm.removeView(mView); 55 } 56 } 57