Home | History | Annotate | Download | only in view
      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.graphics.Point;
     20 import com.android.internal.view.IInputContext;
     21 import com.android.internal.view.IInputMethodClient;
     22 
     23 import android.content.res.CompatibilityInfo;
     24 import android.content.res.Configuration;
     25 import android.graphics.Bitmap;
     26 import android.graphics.Rect;
     27 import android.os.Bundle;
     28 import android.os.IBinder;
     29 import android.os.IRemoteCallback;
     30 import android.os.RemoteException;
     31 import android.util.DisplayMetrics;
     32 import android.view.Display;
     33 import android.view.Gravity;
     34 import android.view.IApplicationToken;
     35 import android.view.IInputFilter;
     36 import android.view.IOnKeyguardExitResult;
     37 import android.view.IRotationWatcher;
     38 import android.view.IWindowManager;
     39 import android.view.IWindowSession;
     40 
     41 import java.util.List;
     42 
     43 /**
     44  * Basic implementation of {@link IWindowManager} so that {@link Display} (and
     45  * {@link Display_Delegate}) can return a valid instance.
     46  */
     47 public class IWindowManagerImpl implements IWindowManager {
     48 
     49     private final Configuration mConfig;
     50     private final DisplayMetrics mMetrics;
     51     private final int mRotation;
     52     private final boolean mHasSystemNavBar;
     53     private final boolean mHasNavigationBar;
     54 
     55     public IWindowManagerImpl(Configuration config, DisplayMetrics metrics, int rotation,
     56             boolean hasSystemNavBar, boolean hasNavigationBar) {
     57         mConfig = config;
     58         mMetrics = metrics;
     59         mRotation = rotation;
     60         mHasSystemNavBar = hasSystemNavBar;
     61         mHasNavigationBar = hasNavigationBar;
     62     }
     63 
     64     // custom API.
     65 
     66     public DisplayMetrics getMetrics() {
     67         return mMetrics;
     68     }
     69 
     70     // ---- implementation of IWindowManager that we care about ----
     71 
     72     @Override
     73     public int getRotation() throws RemoteException {
     74         return mRotation;
     75     }
     76 
     77     @Override
     78     public boolean hasNavigationBar() {
     79         return mHasNavigationBar;
     80     }
     81 
     82     @Override
     83     public boolean hasSystemNavBar() throws RemoteException {
     84         return mHasSystemNavBar;
     85     }
     86 
     87     // ---- unused implementation of IWindowManager ----
     88 
     89     @Override
     90     public void addAppToken(int arg0, IApplicationToken arg1, int arg2, int arg3, boolean arg4,
     91                             boolean arg5)
     92             throws RemoteException {
     93         // TODO Auto-generated method stub
     94 
     95     }
     96 
     97     @Override
     98     public void addWindowToken(IBinder arg0, int arg1) throws RemoteException {
     99         // TODO Auto-generated method stub
    100 
    101     }
    102 
    103     @Override
    104     public void clearForcedDisplaySize(int displayId) throws RemoteException {
    105         // TODO Auto-generated method stub
    106     }
    107 
    108     @Override
    109     public void clearForcedDisplayDensity(int displayId) throws RemoteException {
    110         // TODO Auto-generated method stub
    111     }
    112 
    113     @Override
    114     public void setOverscan(int displayId, int left, int top, int right, int bottom)
    115             throws RemoteException {
    116         // TODO Auto-generated method stub
    117     }
    118 
    119     @Override
    120     public void closeSystemDialogs(String arg0) throws RemoteException {
    121         // TODO Auto-generated method stub
    122 
    123     }
    124 
    125     @Override
    126     public void startFreezingScreen(int exitAnim, int enterAnim) {
    127         // TODO Auto-generated method stub
    128     }
    129 
    130     @Override
    131     public void stopFreezingScreen() {
    132         // TODO Auto-generated method stub
    133     }
    134 
    135     @Override
    136     public void disableKeyguard(IBinder arg0, String arg1) throws RemoteException {
    137         // TODO Auto-generated method stub
    138 
    139     }
    140 
    141     @Override
    142     public void executeAppTransition() throws RemoteException {
    143         // TODO Auto-generated method stub
    144 
    145     }
    146 
    147     @Override
    148     public void exitKeyguardSecurely(IOnKeyguardExitResult arg0) throws RemoteException {
    149         // TODO Auto-generated method stub
    150 
    151     }
    152 
    153     @Override
    154     public void freezeRotation(int arg0) throws RemoteException {
    155         // TODO Auto-generated method stub
    156 
    157     }
    158 
    159     @Override
    160     public float getAnimationScale(int arg0) throws RemoteException {
    161         // TODO Auto-generated method stub
    162         return 0;
    163     }
    164 
    165     @Override
    166     public float[] getAnimationScales() throws RemoteException {
    167         // TODO Auto-generated method stub
    168         return null;
    169     }
    170 
    171     @Override
    172     public int getAppOrientation(IApplicationToken arg0) throws RemoteException {
    173         // TODO Auto-generated method stub
    174         return 0;
    175     }
    176 
    177     @Override
    178     public int getPendingAppTransition() throws RemoteException {
    179         // TODO Auto-generated method stub
    180         return 0;
    181     }
    182 
    183     @Override
    184     public boolean inKeyguardRestrictedInputMode() throws RemoteException {
    185         // TODO Auto-generated method stub
    186         return false;
    187     }
    188 
    189     @Override
    190     public boolean inputMethodClientHasFocus(IInputMethodClient arg0) throws RemoteException {
    191         // TODO Auto-generated method stub
    192         return false;
    193     }
    194 
    195     @Override
    196     public boolean isKeyguardLocked() throws RemoteException {
    197         // TODO Auto-generated method stub
    198         return false;
    199     }
    200 
    201     @Override
    202     public boolean isKeyguardSecure() throws RemoteException {
    203         // TODO Auto-generated method stub
    204         return false;
    205     }
    206 
    207     @Override
    208     public boolean isViewServerRunning() throws RemoteException {
    209         // TODO Auto-generated method stub
    210         return false;
    211     }
    212 
    213     @Override
    214     public void moveAppToken(int arg0, IBinder arg1) throws RemoteException {
    215         // TODO Auto-generated method stub
    216 
    217     }
    218 
    219     @Override
    220     public void moveAppTokensToBottom(List<IBinder> arg0) throws RemoteException {
    221         // TODO Auto-generated method stub
    222 
    223     }
    224 
    225     @Override
    226     public void moveAppTokensToTop(List<IBinder> arg0) throws RemoteException {
    227         // TODO Auto-generated method stub
    228 
    229     }
    230 
    231     @Override
    232     public IWindowSession openSession(IInputMethodClient arg0, IInputContext arg1)
    233             throws RemoteException {
    234         // TODO Auto-generated method stub
    235         return null;
    236     }
    237 
    238     @Override
    239     public void overridePendingAppTransition(String arg0, int arg1, int arg2,
    240             IRemoteCallback startedCallback) throws RemoteException {
    241         // TODO Auto-generated method stub
    242 
    243     }
    244 
    245     @Override
    246     public void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
    247             int startHeight) throws RemoteException {
    248         // TODO Auto-generated method stub
    249     }
    250 
    251     @Override
    252     public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX, int startY,
    253             IRemoteCallback startedCallback, boolean scaleUp) throws RemoteException {
    254         // TODO Auto-generated method stub
    255     }
    256 
    257     @Override
    258     public void pauseKeyDispatching(IBinder arg0) throws RemoteException {
    259         // TODO Auto-generated method stub
    260 
    261     }
    262 
    263     @Override
    264     public void prepareAppTransition(int arg0, boolean arg1) throws RemoteException {
    265         // TODO Auto-generated method stub
    266 
    267     }
    268 
    269     @Override
    270     public void reenableKeyguard(IBinder arg0) throws RemoteException {
    271         // TODO Auto-generated method stub
    272 
    273     }
    274 
    275     @Override
    276     public void removeAppToken(IBinder arg0) throws RemoteException {
    277         // TODO Auto-generated method stub
    278 
    279     }
    280 
    281     @Override
    282     public void removeWindowToken(IBinder arg0) throws RemoteException {
    283         // TODO Auto-generated method stub
    284 
    285     }
    286 
    287     @Override
    288     public void resumeKeyDispatching(IBinder arg0) throws RemoteException {
    289         // TODO Auto-generated method stub
    290 
    291     }
    292 
    293     @Override
    294     public Bitmap screenshotApplications(IBinder arg0, int displayId, int arg1, int arg2)
    295             throws RemoteException {
    296         // TODO Auto-generated method stub
    297         return null;
    298     }
    299 
    300     @Override
    301     public void setAnimationScale(int arg0, float arg1) throws RemoteException {
    302         // TODO Auto-generated method stub
    303 
    304     }
    305 
    306     @Override
    307     public void setAnimationScales(float[] arg0) throws RemoteException {
    308         // TODO Auto-generated method stub
    309 
    310     }
    311 
    312     @Override
    313     public void setAppGroupId(IBinder arg0, int arg1) throws RemoteException {
    314         // TODO Auto-generated method stub
    315 
    316     }
    317 
    318     @Override
    319     public void setAppOrientation(IApplicationToken arg0, int arg1) throws RemoteException {
    320         // TODO Auto-generated method stub
    321     }
    322 
    323     @Override
    324     public void setAppStartingWindow(IBinder arg0, String arg1, int arg2, CompatibilityInfo arg3,
    325             CharSequence arg4, int arg5, int arg6, int arg7, IBinder arg8, boolean arg9)
    326             throws RemoteException {
    327         // TODO Auto-generated method stub
    328     }
    329 
    330     @Override
    331     public void setAppVisibility(IBinder arg0, boolean arg1) throws RemoteException {
    332         // TODO Auto-generated method stub
    333 
    334     }
    335 
    336     @Override
    337     public void setAppWillBeHidden(IBinder arg0) throws RemoteException {
    338         // TODO Auto-generated method stub
    339     }
    340 
    341     @Override
    342     public void setEventDispatching(boolean arg0) throws RemoteException {
    343         // TODO Auto-generated method stub
    344     }
    345 
    346     @Override
    347     public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException {
    348         // TODO Auto-generated method stub
    349     }
    350 
    351     @Override
    352     public void getInitialDisplaySize(int displayId, Point size) {
    353         // TODO Auto-generated method stub
    354     }
    355 
    356     @Override
    357     public void getBaseDisplaySize(int displayId, Point size) {
    358         // TODO Auto-generated method stub
    359     }
    360 
    361     @Override
    362     public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException {
    363         // TODO Auto-generated method stub
    364     }
    365 
    366     @Override
    367     public int getInitialDisplayDensity(int displayId) {
    368         return -1;
    369     }
    370 
    371     @Override
    372     public int getBaseDisplayDensity(int displayId) {
    373         return -1;
    374     }
    375 
    376     @Override
    377     public void setForcedDisplayDensity(int displayId, int density) throws RemoteException {
    378         // TODO Auto-generated method stub
    379     }
    380 
    381     @Override
    382     public void setInTouchMode(boolean arg0) throws RemoteException {
    383         // TODO Auto-generated method stub
    384     }
    385 
    386     @Override
    387     public void setNewConfiguration(Configuration arg0) throws RemoteException {
    388         // TODO Auto-generated method stub
    389     }
    390 
    391     @Override
    392     public void updateRotation(boolean arg0, boolean arg1) throws RemoteException {
    393         // TODO Auto-generated method stub
    394     }
    395 
    396     @Override
    397     public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException {
    398         // TODO Auto-generated method stub
    399     }
    400 
    401     @Override
    402     public void showStrictModeViolation(boolean arg0) throws RemoteException {
    403         // TODO Auto-generated method stub
    404     }
    405 
    406     @Override
    407     public void startAppFreezingScreen(IBinder arg0, int arg1) throws RemoteException {
    408         // TODO Auto-generated method stub
    409     }
    410 
    411     @Override
    412     public boolean startViewServer(int arg0) throws RemoteException {
    413         // TODO Auto-generated method stub
    414         return false;
    415     }
    416 
    417     @Override
    418     public void statusBarVisibilityChanged(int arg0) throws RemoteException {
    419         // TODO Auto-generated method stub
    420     }
    421 
    422     @Override
    423     public void stopAppFreezingScreen(IBinder arg0, boolean arg1) throws RemoteException {
    424         // TODO Auto-generated method stub
    425     }
    426 
    427     @Override
    428     public boolean stopViewServer() throws RemoteException {
    429         // TODO Auto-generated method stub
    430         return false;
    431     }
    432 
    433     @Override
    434     public void thawRotation() throws RemoteException {
    435         // TODO Auto-generated method stub
    436     }
    437 
    438     @Override
    439     public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1)
    440             throws RemoteException {
    441         // TODO Auto-generated method stub
    442         return null;
    443     }
    444 
    445     @Override
    446     public int watchRotation(IRotationWatcher arg0) throws RemoteException {
    447         // TODO Auto-generated method stub
    448         return 0;
    449     }
    450 
    451     @Override
    452     public void removeRotationWatcher(IRotationWatcher arg0) throws RemoteException {
    453     }
    454 
    455     @Override
    456     public boolean waitForWindowDrawn(IBinder token, IRemoteCallback callback) {
    457         return false;
    458     }
    459 
    460     @Override
    461     public IBinder asBinder() {
    462         // TODO Auto-generated method stub
    463         return null;
    464     }
    465 
    466     @Override
    467     public int getPreferredOptionsPanelGravity() throws RemoteException {
    468         return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
    469     }
    470 
    471     @Override
    472     public void dismissKeyguard() {
    473     }
    474 
    475     @Override
    476     public void lockNow(Bundle options) {
    477         // TODO Auto-generated method stub
    478     }
    479 
    480     @Override
    481     public boolean isSafeModeEnabled() {
    482         return false;
    483     }
    484 
    485     @Override
    486     public void showAssistant() {
    487 
    488     }
    489 
    490     @Override
    491     public IBinder getFocusedWindowToken() {
    492         // TODO Auto-generated method stub
    493         return null;
    494     }
    495 
    496     @Override
    497     public void setInputFilter(IInputFilter filter) throws RemoteException {
    498         // TODO Auto-generated method stub
    499     }
    500 
    501     @Override
    502     public void getWindowFrame(IBinder token, Rect outFrame) {
    503         // TODO Auto-generated method stub
    504     }
    505 
    506     @Override
    507     public void setMagnificationCallbacks(IMagnificationCallbacks callbacks) {
    508         // TODO Auto-generated method stub
    509     }
    510 
    511     @Override
    512     public void setMagnificationSpec(MagnificationSpec spec) {
    513         // TODO Auto-generated method stub
    514     }
    515 
    516     @Override
    517     public MagnificationSpec getCompatibleMagnificationSpecForWindow(IBinder windowToken) {
    518         // TODO Auto-generated method stub
    519         return null;
    520     }
    521 
    522     @Override
    523     public boolean isRotationFrozen() throws RemoteException {
    524         // TODO Auto-generated method stub
    525         return false;
    526     }
    527 }
    528