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     // Is the device configured to have a full system bar for larger screens?
     75     boolean hasSystemNavBar();
     76 
     77     // These can only be called when holding the MANAGE_APP_TOKENS permission.
     78     void pauseKeyDispatching(IBinder token);
     79     void resumeKeyDispatching(IBinder token);
     80     void setEventDispatching(boolean enabled);
     81     void addWindowToken(IBinder token, int type);
     82     void removeWindowToken(IBinder token);
     83     void addAppToken(int addPos, IApplicationToken token,
     84             int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked);
     85     void setAppGroupId(IBinder token, int groupId);
     86     void setAppOrientation(IApplicationToken token, int requestedOrientation);
     87     int getAppOrientation(IApplicationToken token);
     88     void setFocusedApp(IBinder token, boolean moveFocusNow);
     89     void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
     90     int getPendingAppTransition();
     91     void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
     92             IRemoteCallback startedCallback);
     93     void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
     94             int startHeight);
     95     void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
     96             IRemoteCallback startedCallback, boolean scaleUp);
     97     void executeAppTransition();
     98     void setAppStartingWindow(IBinder token, String pkg, int theme,
     99             in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
    100             int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
    101     void setAppWillBeHidden(IBinder token);
    102     void setAppVisibility(IBinder token, boolean visible);
    103     void startAppFreezingScreen(IBinder token, int configChanges);
    104     void stopAppFreezingScreen(IBinder token, boolean force);
    105     void removeAppToken(IBinder token);
    106     void moveAppToken(int index, IBinder token);
    107     void moveAppTokensToTop(in List<IBinder> tokens);
    108     void moveAppTokensToBottom(in List<IBinder> tokens);
    109 
    110     // Re-evaluate the current orientation from the caller's state.
    111     // If there is a change, the new Configuration is returned and the
    112     // caller must call setNewConfiguration() sometime later.
    113     Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
    114             IBinder freezeThisOneIfNeeded);
    115     void setNewConfiguration(in Configuration config);
    116 
    117     void startFreezingScreen(int exitAnim, int enterAnim);
    118     void stopFreezingScreen();
    119 
    120     // these require DISABLE_KEYGUARD permission
    121     void disableKeyguard(IBinder token, String tag);
    122     void reenableKeyguard(IBinder token);
    123     void exitKeyguardSecurely(IOnKeyguardExitResult callback);
    124     boolean isKeyguardLocked();
    125     boolean isKeyguardSecure();
    126     boolean inKeyguardRestrictedInputMode();
    127     void dismissKeyguard();
    128 
    129     void closeSystemDialogs(String reason);
    130 
    131     // These can only be called with the SET_ANIMATON_SCALE permission.
    132     float getAnimationScale(int which);
    133     float[] getAnimationScales();
    134     void setAnimationScale(int which, float scale);
    135     void setAnimationScales(in float[] scales);
    136 
    137     // For testing
    138     void setInTouchMode(boolean showFocus);
    139 
    140     // For StrictMode flashing a red border on violations from the UI
    141     // thread.  The uid/pid is implicit from the Binder call, and the Window
    142     // Manager uses that to determine whether or not the red border should
    143     // actually be shown.  (it will be ignored that pid doesn't have windows
    144     // on screen)
    145     void showStrictModeViolation(boolean on);
    146 
    147     // Proxy to set the system property for whether the flashing
    148     // should be enabled.  The 'enabled' value is null or blank for
    149     // the system default (differs per build variant) or any valid
    150     // boolean string as parsed by SystemProperties.getBoolean().
    151     void setStrictModeVisualIndicatorPreference(String enabled);
    152 
    153     // These can only be called with the SET_ORIENTATION permission.
    154     /**
    155      * Update the current screen rotation based on the current state of
    156      * the world.
    157      * @param alwaysSendConfiguration Flag to force a new configuration to
    158      * be evaluated.  This can be used when there are other parameters in
    159      * configuration that are changing.
    160      * @param forceRelayout If true, the window manager will always do a relayout
    161      * of its windows even if the rotation hasn't changed.
    162      */
    163     void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
    164 
    165     /**
    166      * Retrieve the current screen orientation, constants as per
    167      * {@link android.view.Surface}.
    168      */
    169     int getRotation();
    170 
    171     /**
    172      * Watch the rotation of the screen.  Returns the current rotation,
    173      * calls back when it changes.
    174      */
    175     int watchRotation(IRotationWatcher watcher);
    176 
    177     /**
    178      * Remove a rotation watcher set using watchRotation.
    179      * @hide
    180      */
    181     void removeRotationWatcher(IRotationWatcher watcher);
    182 
    183     /**
    184      * Determine the preferred edge of the screen to pin the compact options menu against.
    185      * @return a Gravity value for the options menu panel
    186      * @hide
    187      */
    188     int getPreferredOptionsPanelGravity();
    189 
    190     /**
    191      * Lock the device orientation to the specified rotation, or to the
    192      * current rotation if -1.  Sensor input will be ignored until
    193      * thawRotation() is called.
    194      * @hide
    195      */
    196     void freezeRotation(int rotation);
    197 
    198     /**
    199      * Release the orientation lock imposed by freezeRotation().
    200      * @hide
    201      */
    202     void thawRotation();
    203 
    204     /**
    205      * Gets whether the rotation is frozen.
    206      *
    207      * @return Whether the rotation is frozen.
    208      */
    209     boolean isRotationFrozen();
    210 
    211     /**
    212      * Create a screenshot of the applications currently displayed.
    213      */
    214     Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
    215 
    216     /**
    217      * Called by the status bar to notify Views of changes to System UI visiblity.
    218      */
    219     void statusBarVisibilityChanged(int visibility);
    220 
    221     /**
    222      * Block until the given window has been drawn to the screen.
    223      * Returns true if really waiting, false if the window does not exist.
    224      */
    225     boolean waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
    226 
    227     /**
    228      * Device has a software navigation bar (separate from the status bar).
    229      */
    230     boolean hasNavigationBar();
    231 
    232     /**
    233      * Lock the device immediately with the specified options (can be null).
    234      */
    235     void lockNow(in Bundle options);
    236 
    237     /**
    238      * Gets the token for the focused window.
    239      */
    240     IBinder getFocusedWindowToken();
    241 
    242     /**
    243      * Sets an input filter for manipulating the input event stream.
    244      */
    245     void setInputFilter(in IInputFilter filter);
    246 
    247     /**
    248      * Gets the frame of a window given its token.
    249      */
    250     void getWindowFrame(IBinder token, out Rect outFrame);
    251 
    252     /**
    253      * Device is in safe mode.
    254      */
    255     boolean isSafeModeEnabled();
    256 
    257     /**
    258      * Tell keyguard to show the assistant (Intent.ACTION_ASSIST) after asking for the user's
    259      * credentials.
    260      */
    261     void showAssistant();
    262 
    263     /**
    264      * Sets the display magnification callbacks. These callbacks notify
    265      * the client for contextual changes related to display magnification.
    266      *
    267      * @param callbacks The magnification callbacks.
    268      */
    269     void setMagnificationCallbacks(IMagnificationCallbacks callbacks);
    270 
    271     /**
    272      * Sets the magnification spec to be applied to all windows that can be
    273      * magnified.
    274      *
    275      * @param spec The current magnification spec.
    276      */
    277     void setMagnificationSpec(in MagnificationSpec spec);
    278 
    279     /**
    280      * Gets the magnification spec for a window given its token. If the
    281      * window has a compatibility scale it is also folded in the returned
    282      * magnification spec.
    283      *
    284      * @param windowToken The unique window token.
    285      * @return The magnification spec if such or null.
    286      */
    287     MagnificationSpec getCompatibleMagnificationSpecForWindow(in IBinder windowToken);
    288 }
    289