Home | History | Annotate | Download | only in view
      1 /*
      2 ** Copyright 2006, 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 com.android.internal.view.IInputContext;
     20 import com.android.internal.view.IInputMethodClient;
     21 
     22 import android.content.res.CompatibilityInfo;
     23 import android.content.res.Configuration;
     24 import android.graphics.Bitmap;
     25 import android.graphics.Point;
     26 import android.graphics.Rect;
     27 import android.os.Bundle;
     28 import android.os.IRemoteCallback;
     29 import android.view.IApplicationToken;
     30 import android.view.IMagnificationCallbacks;
     31 import android.view.IOnKeyguardExitResult;
     32 import android.view.IRotationWatcher;
     33 import android.view.IWindowSession;
     34 import android.view.KeyEvent;
     35 import android.view.InputEvent;
     36 import android.view.MagnificationSpec;
     37 import android.view.MotionEvent;
     38 import android.view.InputChannel;
     39 import android.view.InputDevice;
     40 import android.view.IInputFilter;
     41 
     42 /**
     43  * System private interface to the window manager.
     44  *
     45  * {@hide}
     46  */
     47 interface IWindowManager
     48 {
     49     /**
     50      * ===== NOTICE =====
     51      * The first three methods must remain the first three methods. Scripts
     52      * and tools rely on their transaction number to work properly.
     53      */
     54     // This is used for debugging
     55     boolean startViewServer(int port);   // Transaction #1
     56     boolean stopViewServer();            // Transaction #2
     57     boolean isViewServerRunning();       // Transaction #3
     58 
     59     IWindowSession openSession(in IInputMethodClient client,
     60             in IInputContext inputContext);
     61     boolean inputMethodClientHasFocus(IInputMethodClient client);
     62 
     63     void getInitialDisplaySize(int displayId, out Point size);
     64     void getBaseDisplaySize(int displayId, out Point size);
     65     void setForcedDisplaySize(int displayId, int width, int height);
     66     void clearForcedDisplaySize(int displayId);
     67     int getInitialDisplayDensity(int displayId);
     68     int getBaseDisplayDensity(int displayId);
     69     void setForcedDisplayDensity(int displayId, int density);
     70     void clearForcedDisplayDensity(int displayId);
     71 
     72     void setOverscan(int displayId, int left, int top, int right, int bottom);
     73 
     74     // These can only be called when holding the MANAGE_APP_TOKENS permission.
     75     void pauseKeyDispatching(IBinder token);
     76     void resumeKeyDispatching(IBinder token);
     77     void setEventDispatching(boolean enabled);
     78     void addWindowToken(IBinder token, int type);
     79     void removeWindowToken(IBinder token);
     80     void addAppToken(int addPos, IApplicationToken token, int groupId, int stackId,
     81             int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
     82             int configChanges);
     83     void setAppGroupId(IBinder token, int groupId);
     84     void setAppOrientation(IApplicationToken token, int requestedOrientation);
     85     int getAppOrientation(IApplicationToken token);
     86     void setFocusedApp(IBinder token, boolean moveFocusNow);
     87     void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
     88     int getPendingAppTransition();
     89     void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
     90             IRemoteCallback startedCallback);
     91     void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
     92             int startHeight);
     93     void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
     94             IRemoteCallback startedCallback, boolean scaleUp);
     95     void executeAppTransition();
     96     void setAppStartingWindow(IBinder token, String pkg, int theme,
     97             in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
     98             int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
     99     void setAppWillBeHidden(IBinder token);
    100     void setAppVisibility(IBinder token, boolean visible);
    101     void startAppFreezingScreen(IBinder token, int configChanges);
    102     void stopAppFreezingScreen(IBinder token, boolean force);
    103     void removeAppToken(IBinder token);
    104 
    105     // Re-evaluate the current orientation from the caller's state.
    106     // If there is a change, the new Configuration is returned and the
    107     // caller must call setNewConfiguration() sometime later.
    108     Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
    109             IBinder freezeThisOneIfNeeded);
    110     void setNewConfiguration(in Configuration config);
    111 
    112     void startFreezingScreen(int exitAnim, int enterAnim);
    113     void stopFreezingScreen();
    114 
    115     // these require DISABLE_KEYGUARD permission
    116     void disableKeyguard(IBinder token, String tag);
    117     void reenableKeyguard(IBinder token);
    118     void exitKeyguardSecurely(IOnKeyguardExitResult callback);
    119     boolean isKeyguardLocked();
    120     boolean isKeyguardSecure();
    121     boolean inKeyguardRestrictedInputMode();
    122     void dismissKeyguard();
    123 
    124     void closeSystemDialogs(String reason);
    125 
    126     // These can only be called with the SET_ANIMATON_SCALE permission.
    127     float getAnimationScale(int which);
    128     float[] getAnimationScales();
    129     void setAnimationScale(int which, float scale);
    130     void setAnimationScales(in float[] scales);
    131 
    132     // For testing
    133     void setInTouchMode(boolean showFocus);
    134 
    135     // For StrictMode flashing a red border on violations from the UI
    136     // thread.  The uid/pid is implicit from the Binder call, and the Window
    137     // Manager uses that to determine whether or not the red border should
    138     // actually be shown.  (it will be ignored that pid doesn't have windows
    139     // on screen)
    140     void showStrictModeViolation(boolean on);
    141 
    142     // Proxy to set the system property for whether the flashing
    143     // should be enabled.  The 'enabled' value is null or blank for
    144     // the system default (differs per build variant) or any valid
    145     // boolean string as parsed by SystemProperties.getBoolean().
    146     void setStrictModeVisualIndicatorPreference(String enabled);
    147 
    148     // These can only be called with the SET_ORIENTATION permission.
    149     /**
    150      * Update the current screen rotation based on the current state of
    151      * the world.
    152      * @param alwaysSendConfiguration Flag to force a new configuration to
    153      * be evaluated.  This can be used when there are other parameters in
    154      * configuration that are changing.
    155      * @param forceRelayout If true, the window manager will always do a relayout
    156      * of its windows even if the rotation hasn't changed.
    157      */
    158     void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
    159 
    160     /**
    161      * Retrieve the current screen orientation, constants as per
    162      * {@link android.view.Surface}.
    163      */
    164     int getRotation();
    165 
    166     /**
    167      * Watch the rotation of the screen.  Returns the current rotation,
    168      * calls back when it changes.
    169      */
    170     int watchRotation(IRotationWatcher watcher);
    171 
    172     /**
    173      * Remove a rotation watcher set using watchRotation.
    174      * @hide
    175      */
    176     void removeRotationWatcher(IRotationWatcher watcher);
    177 
    178     /**
    179      * Determine the preferred edge of the screen to pin the compact options menu against.
    180      * @return a Gravity value for the options menu panel
    181      * @hide
    182      */
    183     int getPreferredOptionsPanelGravity();
    184 
    185     /**
    186      * Lock the device orientation to the specified rotation, or to the
    187      * current rotation if -1.  Sensor input will be ignored until
    188      * thawRotation() is called.
    189      * @hide
    190      */
    191     void freezeRotation(int rotation);
    192 
    193     /**
    194      * Release the orientation lock imposed by freezeRotation().
    195      * @hide
    196      */
    197     void thawRotation();
    198 
    199     /**
    200      * Gets whether the rotation is frozen.
    201      *
    202      * @return Whether the rotation is frozen.
    203      */
    204     boolean isRotationFrozen();
    205 
    206     /**
    207      * Create a screenshot of the applications currently displayed.
    208      */
    209     Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth,
    210             int maxHeight, boolean force565);
    211 
    212     /**
    213      * Called by the status bar to notify Views of changes to System UI visiblity.
    214      */
    215     oneway void statusBarVisibilityChanged(int visibility);
    216 
    217     /**
    218      * Block until the given window has been drawn to the screen.
    219      * Returns true if really waiting, false if the window does not exist.
    220      */
    221     boolean waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
    222 
    223     /**
    224      * Device has a software navigation bar (separate from the status bar).
    225      */
    226     boolean hasNavigationBar();
    227 
    228     /**
    229      * Lock the device immediately with the specified options (can be null).
    230      */
    231     void lockNow(in Bundle options);
    232 
    233     /**
    234      * Gets the token for the focused window.
    235      */
    236     IBinder getFocusedWindowToken();
    237 
    238     /**
    239      * Sets an input filter for manipulating the input event stream.
    240      */
    241     void setInputFilter(in IInputFilter filter);
    242 
    243     /**
    244      * Gets the frame of a window given its token.
    245      */
    246     void getWindowFrame(IBinder token, out Rect outFrame);
    247 
    248     /**
    249      * Device is in safe mode.
    250      */
    251     boolean isSafeModeEnabled();
    252 
    253     /**
    254      * Sets the display magnification callbacks. These callbacks notify
    255      * the client for contextual changes related to display magnification.
    256      *
    257      * @param callbacks The magnification callbacks.
    258      */
    259     void setMagnificationCallbacks(IMagnificationCallbacks callbacks);
    260 
    261     /**
    262      * Sets the magnification spec to be applied to all windows that can be
    263      * magnified.
    264      *
    265      * @param spec The current magnification spec.
    266      */
    267     void setMagnificationSpec(in MagnificationSpec spec);
    268 
    269     /**
    270      * Gets the magnification spec for a window given its token. If the
    271      * window has a compatibility scale it is also folded in the returned
    272      * magnification spec.
    273      *
    274      * @param windowToken The unique window token.
    275      * @return The magnification spec if such or null.
    276      */
    277     MagnificationSpec getCompatibleMagnificationSpecForWindow(in IBinder windowToken);
    278 
    279     /**
    280      * Sets the current touch exploration state.
    281      *
    282      * @param enabled Whether touch exploration is enabled.
    283      */
    284     void setTouchExplorationEnabled(boolean enabled);
    285 }
    286