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 android.graphics.Rect;
     21 import com.android.internal.app.IAssistScreenshotReceiver;
     22 import com.android.internal.os.IResultReceiver;
     23 import com.android.internal.policy.IShortcutService;
     24 import com.android.internal.view.IInputContext;
     25 import com.android.internal.view.IInputMethodClient;
     26 
     27 import android.content.res.CompatibilityInfo;
     28 import android.content.res.Configuration;
     29 import android.graphics.Bitmap;
     30 import android.os.Bundle;
     31 import android.os.IBinder;
     32 import android.os.IRemoteCallback;
     33 import android.os.RemoteException;
     34 import android.util.DisplayMetrics;
     35 import android.view.AppTransitionAnimationSpec;
     36 
     37 import java.lang.Override;
     38 
     39 /**
     40  * Basic implementation of {@link IWindowManager} so that {@link Display} (and
     41  * {@link Display_Delegate}) can return a valid instance.
     42  */
     43 public class IWindowManagerImpl implements IWindowManager {
     44 
     45     private final Configuration mConfig;
     46     private final DisplayMetrics mMetrics;
     47     private final int mRotation;
     48     private final boolean mHasNavigationBar;
     49 
     50     public IWindowManagerImpl(Configuration config, DisplayMetrics metrics, int rotation,
     51             boolean hasNavigationBar) {
     52         mConfig = config;
     53         mMetrics = metrics;
     54         mRotation = rotation;
     55         mHasNavigationBar = hasNavigationBar;
     56     }
     57 
     58     // custom API.
     59 
     60     public DisplayMetrics getMetrics() {
     61         return mMetrics;
     62     }
     63 
     64     // ---- implementation of IWindowManager that we care about ----
     65 
     66     @Override
     67     public int getRotation() throws RemoteException {
     68         return mRotation;
     69     }
     70 
     71     @Override
     72     public boolean hasNavigationBar() {
     73         return mHasNavigationBar;
     74     }
     75 
     76     // ---- unused implementation of IWindowManager ----
     77 
     78     @Override
     79     public void addAppToken(int arg0, IApplicationToken arg1, int arg2, int arg3, int arg4,
     80             boolean arg5, boolean arg6, int arg7, int arg8, boolean arg9, boolean arg10,
     81             Rect arg11, Configuration arg12, int arg13, boolean arg14, boolean arg15, int arg16,
     82             int arg17)
     83             throws RemoteException {
     84         // TODO Auto-generated method stub
     85     }
     86 
     87     @Override
     88     public void addWindowToken(IBinder arg0, int arg1) throws RemoteException {
     89         // TODO Auto-generated method stub
     90 
     91     }
     92 
     93     @Override
     94     public void clearForcedDisplaySize(int displayId) throws RemoteException {
     95         // TODO Auto-generated method stub
     96     }
     97 
     98     @Override
     99     public void clearForcedDisplayDensity(int displayId) throws RemoteException {
    100         // TODO Auto-generated method stub
    101     }
    102 
    103     @Override
    104     public void setOverscan(int displayId, int left, int top, int right, int bottom)
    105             throws RemoteException {
    106         // TODO Auto-generated method stub
    107     }
    108 
    109     @Override
    110     public void closeSystemDialogs(String arg0) throws RemoteException {
    111         // TODO Auto-generated method stub
    112 
    113     }
    114 
    115     @Override
    116     public void startFreezingScreen(int exitAnim, int enterAnim) {
    117         // TODO Auto-generated method stub
    118     }
    119 
    120     @Override
    121     public void stopFreezingScreen() {
    122         // TODO Auto-generated method stub
    123     }
    124 
    125     @Override
    126     public void disableKeyguard(IBinder arg0, String arg1) throws RemoteException {
    127         // TODO Auto-generated method stub
    128 
    129     }
    130 
    131     @Override
    132     public void executeAppTransition() throws RemoteException {
    133         // TODO Auto-generated method stub
    134 
    135     }
    136 
    137     @Override
    138     public void exitKeyguardSecurely(IOnKeyguardExitResult arg0) throws RemoteException {
    139         // TODO Auto-generated method stub
    140 
    141     }
    142 
    143     @Override
    144     public void freezeRotation(int arg0) throws RemoteException {
    145         // TODO Auto-generated method stub
    146 
    147     }
    148 
    149     @Override
    150     public float getAnimationScale(int arg0) throws RemoteException {
    151         // TODO Auto-generated method stub
    152         return 0;
    153     }
    154 
    155     @Override
    156     public float[] getAnimationScales() throws RemoteException {
    157         // TODO Auto-generated method stub
    158         return null;
    159     }
    160 
    161     @Override
    162     public int getAppOrientation(IApplicationToken arg0) throws RemoteException {
    163         // TODO Auto-generated method stub
    164         return 0;
    165     }
    166 
    167     @Override
    168     public int getPendingAppTransition() throws RemoteException {
    169         // TODO Auto-generated method stub
    170         return 0;
    171     }
    172 
    173     @Override
    174     public boolean inKeyguardRestrictedInputMode() throws RemoteException {
    175         // TODO Auto-generated method stub
    176         return false;
    177     }
    178 
    179     @Override
    180     public boolean inputMethodClientHasFocus(IInputMethodClient arg0) throws RemoteException {
    181         // TODO Auto-generated method stub
    182         return false;
    183     }
    184 
    185     @Override
    186     public boolean isKeyguardLocked() throws RemoteException {
    187         // TODO Auto-generated method stub
    188         return false;
    189     }
    190 
    191     @Override
    192     public boolean isKeyguardSecure() throws RemoteException {
    193         // TODO Auto-generated method stub
    194         return false;
    195     }
    196 
    197     @Override
    198     public boolean isViewServerRunning() throws RemoteException {
    199         // TODO Auto-generated method stub
    200         return false;
    201     }
    202 
    203     @Override
    204     public IWindowSession openSession(IWindowSessionCallback argn1, IInputMethodClient arg0,
    205             IInputContext arg1) throws RemoteException {
    206         // TODO Auto-generated method stub
    207         return null;
    208     }
    209 
    210     @Override
    211     public void overridePendingAppTransition(String arg0, int arg1, int arg2,
    212             IRemoteCallback startedCallback) throws RemoteException {
    213         // TODO Auto-generated method stub
    214 
    215     }
    216 
    217     @Override
    218     public void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
    219             int startHeight) throws RemoteException {
    220         // TODO Auto-generated method stub
    221     }
    222 
    223     @Override
    224     public void overridePendingAppTransitionClipReveal(int startX, int startY,
    225             int startWidth, int startHeight) throws RemoteException {
    226         // TODO Auto-generated method stub
    227     }
    228 
    229     @Override
    230     public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX, int startY,
    231             IRemoteCallback startedCallback, boolean scaleUp) throws RemoteException {
    232         // TODO Auto-generated method stub
    233     }
    234 
    235     @Override
    236     public void overridePendingAppTransitionAspectScaledThumb(Bitmap srcThumb, int startX,
    237             int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
    238             boolean scaleUp) {
    239         // TODO Auto-generated method stub
    240     }
    241 
    242     @Override
    243     public void overridePendingAppTransitionInPlace(String packageName, int anim) {
    244         // TODO Auto-generated method stub
    245     }
    246 
    247     @Override
    248     public void overridePendingAppTransitionMultiThumbFuture(
    249             IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
    250             boolean scaleUp) throws RemoteException {
    251 
    252     }
    253 
    254     @Override
    255     public void overridePendingAppTransitionMultiThumb(AppTransitionAnimationSpec[] specs,
    256             IRemoteCallback callback0, IRemoteCallback callback1, boolean scaleUp) {
    257         // TODO Auto-generated method stub
    258     }
    259 
    260     @Override
    261     public void pauseKeyDispatching(IBinder arg0) throws RemoteException {
    262         // TODO Auto-generated method stub
    263 
    264     }
    265 
    266     @Override
    267     public void prepareAppTransition(int arg0, boolean arg1) throws RemoteException {
    268         // TODO Auto-generated method stub
    269 
    270     }
    271 
    272     @Override
    273     public void reenableKeyguard(IBinder arg0) throws RemoteException {
    274         // TODO Auto-generated method stub
    275 
    276     }
    277 
    278     @Override
    279     public void removeAppToken(IBinder arg0) throws RemoteException {
    280         // TODO Auto-generated method stub
    281 
    282     }
    283 
    284     @Override
    285     public void removeWindowToken(IBinder arg0) throws RemoteException {
    286         // TODO Auto-generated method stub
    287 
    288     }
    289 
    290     @Override
    291     public void resumeKeyDispatching(IBinder arg0) throws RemoteException {
    292         // TODO Auto-generated method stub
    293 
    294     }
    295 
    296     @Override
    297     public boolean requestAssistScreenshot(IAssistScreenshotReceiver receiver)
    298             throws RemoteException {
    299         // TODO Auto-generated method stub
    300         return false;
    301     }
    302 
    303     @Override
    304     public Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth,
    305             int maxHeight, float frameScale) throws RemoteException {
    306         // TODO Auto-generated method stub
    307         return null;
    308     }
    309 
    310     @Override
    311     public void setAnimationScale(int arg0, float arg1) throws RemoteException {
    312         // TODO Auto-generated method stub
    313 
    314     }
    315 
    316     @Override
    317     public void setAnimationScales(float[] arg0) throws RemoteException {
    318         // TODO Auto-generated method stub
    319 
    320     }
    321 
    322     @Override
    323     public float getCurrentAnimatorScale() throws RemoteException {
    324         return 0;
    325     }
    326 
    327     @Override
    328     public void setAppTask(IBinder arg0, int arg1, int arg2, Rect arg3, Configuration arg4,
    329             int arg5, boolean arg6)
    330             throws RemoteException {
    331         // TODO Auto-generated method stub
    332     }
    333 
    334     @Override
    335     public void setAppOrientation(IApplicationToken arg0, int arg1) throws RemoteException {
    336         // TODO Auto-generated method stub
    337     }
    338 
    339     @Override
    340     public boolean setAppStartingWindow(IBinder arg0, String arg1, int arg2, CompatibilityInfo arg3,
    341             CharSequence arg4, int arg5, int arg6, int arg7, int arg8, IBinder arg9, boolean arg10)
    342             throws RemoteException {
    343         // TODO Auto-generated method stub
    344         return false;
    345     }
    346 
    347     @Override
    348     public void setAppVisibility(IBinder arg0, boolean arg1) throws RemoteException {
    349         // TODO Auto-generated method stub
    350 
    351     }
    352 
    353     @Override
    354     public void notifyAppResumed(IBinder token, boolean wasStopped, boolean allowSavedSurface)
    355             throws RemoteException {
    356         // TODO Auto-generated method stub
    357     }
    358 
    359     @Override
    360     public void notifyAppStopped(IBinder token) throws RemoteException {
    361         // TODO Auto-generated method stub
    362     }
    363 
    364     @Override
    365     public void setEventDispatching(boolean arg0) throws RemoteException {
    366         // TODO Auto-generated method stub
    367     }
    368 
    369     @Override
    370     public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException {
    371         // TODO Auto-generated method stub
    372     }
    373 
    374     @Override
    375     public void getInitialDisplaySize(int displayId, Point size) {
    376         // TODO Auto-generated method stub
    377     }
    378 
    379     @Override
    380     public void getBaseDisplaySize(int displayId, Point size) {
    381         // TODO Auto-generated method stub
    382     }
    383 
    384     @Override
    385     public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException {
    386         // TODO Auto-generated method stub
    387     }
    388 
    389     @Override
    390     public int getInitialDisplayDensity(int displayId) {
    391         return -1;
    392     }
    393 
    394     @Override
    395     public int getBaseDisplayDensity(int displayId) {
    396         return -1;
    397     }
    398 
    399     @Override
    400     public void setForcedDisplayDensity(int displayId, int density) throws RemoteException {
    401         // TODO Auto-generated method stub
    402     }
    403 
    404     @Override
    405     public void setForcedDisplayScalingMode(int displayId, int mode) {
    406     }
    407 
    408     @Override
    409     public void setInTouchMode(boolean arg0) throws RemoteException {
    410         // TODO Auto-generated method stub
    411     }
    412 
    413     @Override
    414     public int[] setNewConfiguration(Configuration arg0) throws RemoteException {
    415         // TODO Auto-generated method stub
    416         return null;
    417     }
    418 
    419     @Override
    420     public Rect getBoundsForNewConfiguration(int stackId) throws RemoteException {
    421         // TODO Auto-generated method stub
    422         return null;
    423     }
    424 
    425     @Override
    426     public void setScreenCaptureDisabled(int userId, boolean disabled) {
    427         // TODO Auto-generated method stub
    428     }
    429 
    430     @Override
    431     public void updateRotation(boolean arg0, boolean arg1) throws RemoteException {
    432         // TODO Auto-generated method stub
    433     }
    434 
    435     @Override
    436     public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException {
    437         // TODO Auto-generated method stub
    438     }
    439 
    440     @Override
    441     public void showStrictModeViolation(boolean arg0) throws RemoteException {
    442         // TODO Auto-generated method stub
    443     }
    444 
    445     @Override
    446     public void startAppFreezingScreen(IBinder arg0, int arg1) throws RemoteException {
    447         // TODO Auto-generated method stub
    448     }
    449 
    450     @Override
    451     public boolean startViewServer(int arg0) throws RemoteException {
    452         // TODO Auto-generated method stub
    453         return false;
    454     }
    455 
    456     @Override
    457     public void statusBarVisibilityChanged(int arg0) throws RemoteException {
    458         // TODO Auto-generated method stub
    459     }
    460 
    461     @Override
    462     public void stopAppFreezingScreen(IBinder arg0, boolean arg1) throws RemoteException {
    463         // TODO Auto-generated method stub
    464     }
    465 
    466     @Override
    467     public boolean stopViewServer() throws RemoteException {
    468         // TODO Auto-generated method stub
    469         return false;
    470     }
    471 
    472     @Override
    473     public void thawRotation() throws RemoteException {
    474         // TODO Auto-generated method stub
    475     }
    476 
    477     @Override
    478     public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1)
    479             throws RemoteException {
    480         // TODO Auto-generated method stub
    481         return null;
    482     }
    483 
    484     @Override
    485     public int watchRotation(IRotationWatcher arg0) throws RemoteException {
    486         // TODO Auto-generated method stub
    487         return 0;
    488     }
    489 
    490     @Override
    491     public void removeRotationWatcher(IRotationWatcher arg0) throws RemoteException {
    492     }
    493 
    494     @Override
    495     public IBinder asBinder() {
    496         // TODO Auto-generated method stub
    497         return null;
    498     }
    499 
    500     @Override
    501     public int getPreferredOptionsPanelGravity() throws RemoteException {
    502         return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
    503     }
    504 
    505     @Override
    506     public void dismissKeyguard() {
    507     }
    508 
    509     @Override
    510     public void keyguardGoingAway(int flags) throws RemoteException {
    511     }
    512 
    513     @Override
    514     public void lockNow(Bundle options) {
    515         // TODO Auto-generated method stub
    516     }
    517 
    518     @Override
    519     public boolean isSafeModeEnabled() {
    520         return false;
    521     }
    522 
    523     @Override
    524     public boolean isRotationFrozen() throws RemoteException {
    525         // TODO Auto-generated method stub
    526         return false;
    527     }
    528 
    529     @Override
    530     public void enableScreenIfNeeded() throws RemoteException {
    531         // TODO Auto-generated method stub
    532     }
    533 
    534     @Override
    535     public boolean clearWindowContentFrameStats(IBinder token) throws RemoteException {
    536         // TODO Auto-generated method stub
    537         return false;
    538     }
    539 
    540     @Override
    541     public WindowContentFrameStats getWindowContentFrameStats(IBinder token)
    542             throws RemoteException {
    543         // TODO Auto-generated method stub
    544         return null;
    545     }
    546 
    547     @Override
    548     public int getDockedStackSide() throws RemoteException {
    549         return 0;
    550     }
    551 
    552     @Override
    553     public void setDockedStackResizing(boolean resizing) throws RemoteException {
    554     }
    555 
    556     @Override
    557     public void cancelTaskWindowTransition(int taskId) {
    558     }
    559 
    560     @Override
    561     public void cancelTaskThumbnailTransition(int taskId) {
    562     }
    563 
    564     @Override
    565     public void endProlongedAnimations() {
    566     }
    567 
    568     @Override
    569     public void registerDockedStackListener(IDockedStackListener listener) throws RemoteException {
    570     }
    571 
    572     @Override
    573     public void setResizeDimLayer(boolean visible, int targetStackId, float alpha)
    574             throws RemoteException {
    575     }
    576 
    577     @Override
    578     public void setDockedStackDividerTouchRegion(Rect touchableRegion) throws RemoteException {
    579     }
    580 
    581     @Override
    582     public void requestAppKeyboardShortcuts(
    583             IResultReceiver receiver, int deviceId) throws RemoteException {
    584     }
    585 
    586     @Override
    587     public void getStableInsets(Rect outInsets) throws RemoteException {
    588     }
    589 
    590     @Override
    591     public void registerShortcutKey(long shortcutCode, IShortcutService service)
    592         throws RemoteException {}
    593 
    594     @Override
    595     public void createWallpaperInputConsumer(InputChannel inputChannel) throws RemoteException {}
    596 
    597     @Override
    598     public void removeWallpaperInputConsumer() throws RemoteException {}
    599 
    600     @Override
    601     public Bitmap screenshotWallpaper() throws RemoteException {
    602         return null;
    603     }
    604 }
    605