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.content.res.Configuration;
     20 import android.graphics.Bitmap;
     21 import android.graphics.GraphicBuffer;
     22 import android.graphics.Point;
     23 import android.graphics.Rect;
     24 import android.graphics.Region;
     25 import android.os.Bundle;
     26 import android.os.IBinder;
     27 import android.os.IRemoteCallback;
     28 import android.os.ParcelFileDescriptor;
     29 import android.os.RemoteException;
     30 import android.util.DisplayMetrics;
     31 
     32 import com.android.internal.app.IAssistScreenshotReceiver;
     33 import com.android.internal.os.IResultReceiver;
     34 import com.android.internal.policy.IKeyguardDismissCallback;
     35 import com.android.internal.policy.IShortcutService;
     36 import com.android.internal.view.IInputContext;
     37 import com.android.internal.view.IInputMethodClient;
     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 getDefaultDisplayRotation() 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 addWindowToken(IBinder arg0, int arg1, int arg2) throws RemoteException {
     80         // TODO Auto-generated method stub
     81 
     82     }
     83 
     84     @Override
     85     public void clearForcedDisplaySize(int displayId) throws RemoteException {
     86         // TODO Auto-generated method stub
     87     }
     88 
     89     @Override
     90     public void clearForcedDisplayDensityForUser(int displayId, int userId) throws RemoteException {
     91         // TODO Auto-generated method stub
     92     }
     93 
     94     @Override
     95     public void setOverscan(int displayId, int left, int top, int right, int bottom)
     96             throws RemoteException {
     97         // TODO Auto-generated method stub
     98     }
     99 
    100     @Override
    101     public void closeSystemDialogs(String arg0) throws RemoteException {
    102         // TODO Auto-generated method stub
    103 
    104     }
    105 
    106     @Override
    107     public void startFreezingScreen(int exitAnim, int enterAnim) {
    108         // TODO Auto-generated method stub
    109     }
    110 
    111     @Override
    112     public void stopFreezingScreen() {
    113         // TODO Auto-generated method stub
    114     }
    115 
    116     @Override
    117     public void disableKeyguard(IBinder arg0, String arg1) throws RemoteException {
    118         // TODO Auto-generated method stub
    119 
    120     }
    121 
    122     @Override
    123     public void executeAppTransition() throws RemoteException {
    124         // TODO Auto-generated method stub
    125 
    126     }
    127 
    128     @Override
    129     public void exitKeyguardSecurely(IOnKeyguardExitResult arg0) throws RemoteException {
    130         // TODO Auto-generated method stub
    131 
    132     }
    133 
    134     @Override
    135     public void freezeRotation(int arg0) throws RemoteException {
    136         // TODO Auto-generated method stub
    137 
    138     }
    139 
    140     @Override
    141     public float getAnimationScale(int arg0) throws RemoteException {
    142         // TODO Auto-generated method stub
    143         return 0;
    144     }
    145 
    146     @Override
    147     public float[] getAnimationScales() throws RemoteException {
    148         // TODO Auto-generated method stub
    149         return null;
    150     }
    151 
    152     @Override
    153     public int getPendingAppTransition() throws RemoteException {
    154         // TODO Auto-generated method stub
    155         return 0;
    156     }
    157 
    158     @Override
    159     public boolean inKeyguardRestrictedInputMode() throws RemoteException {
    160         // TODO Auto-generated method stub
    161         return false;
    162     }
    163 
    164     @Override
    165     public boolean inputMethodClientHasFocus(IInputMethodClient arg0) throws RemoteException {
    166         // TODO Auto-generated method stub
    167         return false;
    168     }
    169 
    170     @Override
    171     public boolean isKeyguardLocked() throws RemoteException {
    172         // TODO Auto-generated method stub
    173         return false;
    174     }
    175 
    176     @Override
    177     public boolean isKeyguardSecure() throws RemoteException {
    178         // TODO Auto-generated method stub
    179         return false;
    180     }
    181 
    182     @Override
    183     public boolean isViewServerRunning() throws RemoteException {
    184         // TODO Auto-generated method stub
    185         return false;
    186     }
    187 
    188     @Override
    189     public IWindowSession openSession(IWindowSessionCallback argn1, IInputMethodClient arg0,
    190             IInputContext arg1) throws RemoteException {
    191         // TODO Auto-generated method stub
    192         return null;
    193     }
    194 
    195     @Override
    196     public void overridePendingAppTransition(String arg0, int arg1, int arg2,
    197             IRemoteCallback startedCallback) throws RemoteException {
    198         // TODO Auto-generated method stub
    199 
    200     }
    201 
    202     @Override
    203     public void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
    204             int startHeight) throws RemoteException {
    205         // TODO Auto-generated method stub
    206     }
    207 
    208     @Override
    209     public void overridePendingAppTransitionClipReveal(int startX, int startY,
    210             int startWidth, int startHeight) throws RemoteException {
    211         // TODO Auto-generated method stub
    212     }
    213 
    214     @Override
    215     public void overridePendingAppTransitionThumb(GraphicBuffer srcThumb, int startX, int startY,
    216             IRemoteCallback startedCallback, boolean scaleUp) throws RemoteException {
    217         // TODO Auto-generated method stub
    218     }
    219 
    220     @Override
    221     public void overridePendingAppTransitionAspectScaledThumb(GraphicBuffer srcThumb, int startX,
    222             int startY, int targetWidth, int targetHeight, IRemoteCallback startedCallback,
    223             boolean scaleUp) {
    224         // TODO Auto-generated method stub
    225     }
    226 
    227     @Override
    228     public void overridePendingAppTransitionInPlace(String packageName, int anim) {
    229         // TODO Auto-generated method stub
    230     }
    231 
    232     @Override
    233     public void overridePendingAppTransitionMultiThumbFuture(
    234             IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback startedCallback,
    235             boolean scaleUp) throws RemoteException {
    236 
    237     }
    238 
    239     @Override
    240     public void overridePendingAppTransitionMultiThumb(AppTransitionAnimationSpec[] specs,
    241             IRemoteCallback callback0, IRemoteCallback callback1, boolean scaleUp) {
    242         // TODO Auto-generated method stub
    243     }
    244 
    245     @Override
    246     public void prepareAppTransition(int arg0, boolean arg1) throws RemoteException {
    247         // TODO Auto-generated method stub
    248 
    249     }
    250 
    251     @Override
    252     public void reenableKeyguard(IBinder arg0) throws RemoteException {
    253         // TODO Auto-generated method stub
    254 
    255     }
    256 
    257     @Override
    258     public void removeWindowToken(IBinder arg0, int arg1) throws RemoteException {
    259         // TODO Auto-generated method stub
    260 
    261     }
    262 
    263     @Override
    264     public boolean requestAssistScreenshot(IAssistScreenshotReceiver receiver)
    265             throws RemoteException {
    266         // TODO Auto-generated method stub
    267         return false;
    268     }
    269 
    270     @Override
    271     public void setAnimationScale(int arg0, float arg1) throws RemoteException {
    272         // TODO Auto-generated method stub
    273 
    274     }
    275 
    276     @Override
    277     public void setAnimationScales(float[] arg0) throws RemoteException {
    278         // TODO Auto-generated method stub
    279 
    280     }
    281 
    282     @Override
    283     public float getCurrentAnimatorScale() throws RemoteException {
    284         return 0;
    285     }
    286 
    287     @Override
    288     public void setEventDispatching(boolean arg0) throws RemoteException {
    289         // TODO Auto-generated method stub
    290     }
    291 
    292     @Override
    293     public void setFocusedApp(IBinder arg0, boolean arg1) throws RemoteException {
    294         // TODO Auto-generated method stub
    295     }
    296 
    297     @Override
    298     public void getInitialDisplaySize(int displayId, Point size) {
    299         // TODO Auto-generated method stub
    300     }
    301 
    302     @Override
    303     public void getBaseDisplaySize(int displayId, Point size) {
    304         // TODO Auto-generated method stub
    305     }
    306 
    307     @Override
    308     public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException {
    309         // TODO Auto-generated method stub
    310     }
    311 
    312     @Override
    313     public int getInitialDisplayDensity(int displayId) {
    314         return -1;
    315     }
    316 
    317     @Override
    318     public int getBaseDisplayDensity(int displayId) {
    319         return -1;
    320     }
    321 
    322     @Override
    323     public void setForcedDisplayDensityForUser(int displayId, int density, int userId)
    324             throws RemoteException {
    325         // TODO Auto-generated method stub
    326     }
    327 
    328     @Override
    329     public void setForcedDisplayScalingMode(int displayId, int mode) {
    330     }
    331 
    332     @Override
    333     public void setInTouchMode(boolean arg0) throws RemoteException {
    334         // TODO Auto-generated method stub
    335     }
    336 
    337     @Override
    338     public int[] setNewDisplayOverrideConfiguration(Configuration arg0, int displayId)
    339             throws RemoteException {
    340         // TODO Auto-generated method stub
    341         return null;
    342     }
    343 
    344     @Override
    345     public void setScreenCaptureDisabled(int userId, boolean disabled) {
    346         // TODO Auto-generated method stub
    347     }
    348 
    349     @Override
    350     public void updateRotation(boolean arg0, boolean arg1) throws RemoteException {
    351         // TODO Auto-generated method stub
    352     }
    353 
    354     @Override
    355     public void setStrictModeVisualIndicatorPreference(String arg0) throws RemoteException {
    356         // TODO Auto-generated method stub
    357     }
    358 
    359     @Override
    360     public void showStrictModeViolation(boolean arg0) throws RemoteException {
    361         // TODO Auto-generated method stub
    362     }
    363 
    364     @Override
    365     public boolean startViewServer(int arg0) throws RemoteException {
    366         // TODO Auto-generated method stub
    367         return false;
    368     }
    369 
    370     @Override
    371     public void statusBarVisibilityChanged(int arg0) throws RemoteException {
    372         // TODO Auto-generated method stub
    373     }
    374 
    375     @Override
    376     public void setRecentsVisibility(boolean visible) {
    377         // TODO Auto-generated method stub
    378     }
    379 
    380     @Override
    381     public void setPipVisibility(boolean visible) {
    382         // TODO Auto-generated method stub
    383     }
    384 
    385     @Override
    386     public boolean stopViewServer() throws RemoteException {
    387         // TODO Auto-generated method stub
    388         return false;
    389     }
    390 
    391     @Override
    392     public void thawRotation() throws RemoteException {
    393         // TODO Auto-generated method stub
    394     }
    395 
    396     @Override
    397     public Configuration updateOrientationFromAppTokens(Configuration arg0, IBinder arg1, int arg2)
    398             throws RemoteException {
    399         // TODO Auto-generated method stub
    400         return null;
    401     }
    402 
    403     @Override
    404     public int watchRotation(IRotationWatcher arg0, int arg1) throws RemoteException {
    405         // TODO Auto-generated method stub
    406         return 0;
    407     }
    408 
    409     @Override
    410     public void removeRotationWatcher(IRotationWatcher arg0) throws RemoteException {
    411     }
    412 
    413     @Override
    414     public IBinder asBinder() {
    415         // TODO Auto-generated method stub
    416         return null;
    417     }
    418 
    419     @Override
    420     public int getPreferredOptionsPanelGravity() throws RemoteException {
    421         return Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
    422     }
    423 
    424     @Override
    425     public void dismissKeyguard(IKeyguardDismissCallback callback) throws RemoteException {
    426     }
    427 
    428     @Override
    429     public void setSwitchingUser(boolean switching) throws RemoteException {
    430     }
    431 
    432     @Override
    433     public void lockNow(Bundle options) {
    434         // TODO Auto-generated method stub
    435     }
    436 
    437     @Override
    438     public boolean isSafeModeEnabled() {
    439         return false;
    440     }
    441 
    442     @Override
    443     public boolean isRotationFrozen() throws RemoteException {
    444         // TODO Auto-generated method stub
    445         return false;
    446     }
    447 
    448     @Override
    449     public void enableScreenIfNeeded() throws RemoteException {
    450         // TODO Auto-generated method stub
    451     }
    452 
    453     @Override
    454     public boolean clearWindowContentFrameStats(IBinder token) throws RemoteException {
    455         // TODO Auto-generated method stub
    456         return false;
    457     }
    458 
    459     @Override
    460     public WindowContentFrameStats getWindowContentFrameStats(IBinder token)
    461             throws RemoteException {
    462         // TODO Auto-generated method stub
    463         return null;
    464     }
    465 
    466     @Override
    467     public int getDockedStackSide() throws RemoteException {
    468         return 0;
    469     }
    470 
    471     @Override
    472     public void setDockedStackResizing(boolean resizing) throws RemoteException {
    473     }
    474 
    475     @Override
    476     public void endProlongedAnimations() {
    477     }
    478 
    479     @Override
    480     public void registerDockedStackListener(IDockedStackListener listener) throws RemoteException {
    481     }
    482 
    483     @Override
    484     public void registerPinnedStackListener(int displayId, IPinnedStackListener listener) throws RemoteException {
    485     }
    486 
    487     @Override
    488     public void setResizeDimLayer(boolean visible, int targetStackId, float alpha)
    489             throws RemoteException {
    490     }
    491 
    492     @Override
    493     public void setDockedStackDividerTouchRegion(Rect touchableRegion) throws RemoteException {
    494     }
    495 
    496     @Override
    497     public void requestAppKeyboardShortcuts(
    498             IResultReceiver receiver, int deviceId) throws RemoteException {
    499     }
    500 
    501     @Override
    502     public void getStableInsets(int displayId, Rect outInsets) throws RemoteException {
    503     }
    504 
    505     @Override
    506     public void registerShortcutKey(long shortcutCode, IShortcutService service)
    507         throws RemoteException {}
    508 
    509     @Override
    510     public void createInputConsumer(String name, InputChannel inputChannel)
    511             throws RemoteException {}
    512 
    513     @Override
    514     public boolean destroyInputConsumer(String name) throws RemoteException {
    515         return false;
    516     }
    517 
    518     @Override
    519     public Bitmap screenshotWallpaper() throws RemoteException {
    520         return null;
    521     }
    522 
    523     @Override
    524     public void enableSurfaceTrace(ParcelFileDescriptor fd) throws RemoteException {
    525     }
    526 
    527     @Override
    528     public void disableSurfaceTrace() throws RemoteException {
    529     }
    530 
    531     @Override
    532     public Region getCurrentImeTouchRegion() throws RemoteException {
    533         return null;
    534     }
    535 
    536     @Override
    537     public boolean registerWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
    538             int displayId) throws RemoteException {
    539         return false;
    540     }
    541 
    542     @Override
    543     public void unregisterWallpaperVisibilityListener(IWallpaperVisibilityListener listener,
    544             int displayId) throws RemoteException {
    545     }
    546 }
    547