• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 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 android.view;
18 
19 import android.content.res.Configuration;
20 import android.os.RemoteException;
21 import android.util.DisplayMetrics;
22 
23 /**
24  * Basic implementation of {@link IWindowManager} so that {@link Display} (and
25  * {@link Display_Delegate}) can return a valid instance.
26  */
27 public class IWindowManagerImpl extends IWindowManager.Default {
28 
29     private final Configuration mConfig;
30     private final DisplayMetrics mMetrics;
31     private final int mRotation;
32     private final boolean mHasNavigationBar;
33 
IWindowManagerImpl(Configuration config, DisplayMetrics metrics, int rotation, boolean hasNavigationBar)34     public IWindowManagerImpl(Configuration config, DisplayMetrics metrics, int rotation,
35             boolean hasNavigationBar) {
36         mConfig = config;
37         mMetrics = metrics;
38         mRotation = rotation;
39         mHasNavigationBar = hasNavigationBar;
40     }
41 
42     // custom API.
43 
getMetrics()44     public DisplayMetrics getMetrics() {
45         return mMetrics;
46     }
47 
48     // ---- implementation of IWindowManager that we care about ----
49 
50     @Override
getDefaultDisplayRotation()51     public int getDefaultDisplayRotation() throws RemoteException {
52         return mRotation;
53     }
54 
55     @Override
hasNavigationBar(int displayId)56     public boolean hasNavigationBar(int displayId) {
57         // TODO(multi-display): Change it once we need it per display.
58         return mHasNavigationBar;
59     }
60 }
61