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.os.IRemoteCallback;
     27 import android.view.IApplicationToken;
     28 import android.view.IOnKeyguardExitResult;
     29 import android.view.IRotationWatcher;
     30 import android.view.IWindowSession;
     31 import android.view.KeyEvent;
     32 import android.view.InputEvent;
     33 import android.view.MotionEvent;
     34 import android.view.InputChannel;
     35 import android.view.InputDevice;
     36 
     37 /**
     38  * System private interface to the window manager.
     39  *
     40  * {@hide}
     41  */
     42 interface IWindowManager
     43 {
     44     /**
     45      * ===== NOTICE =====
     46      * The first three methods must remain the first three methods. Scripts
     47      * and tools rely on their transaction number to work properly.
     48      */
     49     // This is used for debugging
     50     boolean startViewServer(int port);   // Transaction #1
     51     boolean stopViewServer();            // Transaction #2
     52     boolean isViewServerRunning();       // Transaction #3
     53 
     54     IWindowSession openSession(in IInputMethodClient client,
     55             in IInputContext inputContext);
     56     boolean inputMethodClientHasFocus(IInputMethodClient client);
     57 
     58     void getDisplaySize(out Point size);
     59     void getRealDisplaySize(out Point size);
     60     int getMaximumSizeDimension();
     61 
     62     void setForcedDisplaySize(int longDimen, int shortDimen);
     63     void clearForcedDisplaySize();
     64 
     65     // Is device configured with a hideable status bar or a tablet system bar?
     66     boolean canStatusBarHide();
     67 
     68     // These can only be called when injecting events to your own window,
     69     // or by holding the INJECT_EVENTS permission.  These methods may block
     70     // until pending input events are finished being dispatched even when 'sync' is false.
     71     // Avoid calling these methods on your UI thread or use the 'NoWait' version instead.
     72     boolean injectKeyEvent(in KeyEvent ev, boolean sync);
     73     boolean injectPointerEvent(in MotionEvent ev, boolean sync);
     74     boolean injectTrackballEvent(in MotionEvent ev, boolean sync);
     75     boolean injectInputEventNoWait(in InputEvent ev);
     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);
     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     void executeAppTransition();
     93     void setAppStartingWindow(IBinder token, String pkg, int theme,
     94             in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
     95             int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
     96     void setAppWillBeHidden(IBinder token);
     97     void setAppVisibility(IBinder token, boolean visible);
     98     void startAppFreezingScreen(IBinder token, int configChanges);
     99     void stopAppFreezingScreen(IBinder token, boolean force);
    100     void removeAppToken(IBinder token);
    101     void moveAppToken(int index, IBinder token);
    102     void moveAppTokensToTop(in List<IBinder> tokens);
    103     void moveAppTokensToBottom(in List<IBinder> tokens);
    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     // these require DISABLE_KEYGUARD permission
    113     void disableKeyguard(IBinder token, String tag);
    114     void reenableKeyguard(IBinder token);
    115     void exitKeyguardSecurely(IOnKeyguardExitResult callback);
    116     boolean isKeyguardLocked();
    117     boolean isKeyguardSecure();
    118     boolean inKeyguardRestrictedInputMode();
    119     void dismissKeyguard();
    120 
    121     void closeSystemDialogs(String reason);
    122 
    123     // These can only be called with the SET_ANIMATON_SCALE permission.
    124     float getAnimationScale(int which);
    125     float[] getAnimationScales();
    126     void setAnimationScale(int which, float scale);
    127     void setAnimationScales(in float[] scales);
    128 
    129     // These require the READ_INPUT_STATE permission.
    130     int getSwitchState(int sw);
    131     int getSwitchStateForDevice(int devid, int sw);
    132     int getScancodeState(int sw);
    133     int getScancodeStateForDevice(int devid, int sw);
    134     int getTrackballScancodeState(int sw);
    135     int getDPadScancodeState(int sw);
    136     int getKeycodeState(int sw);
    137     int getKeycodeStateForDevice(int devid, int sw);
    138     int getTrackballKeycodeState(int sw);
    139     int getDPadKeycodeState(int sw);
    140     InputChannel monitorInput(String inputChannelName);
    141 
    142     // Report whether the hardware supports the given keys; returns true if successful
    143     boolean hasKeys(in int[] keycodes, inout boolean[] keyExists);
    144 
    145     // Get input device information.
    146     InputDevice getInputDevice(int deviceId);
    147     int[] getInputDeviceIds();
    148 
    149     // For testing
    150     void setInTouchMode(boolean showFocus);
    151 
    152     // For StrictMode flashing a red border on violations from the UI
    153     // thread.  The uid/pid is implicit from the Binder call, and the Window
    154     // Manager uses that to determine whether or not the red border should
    155     // actually be shown.  (it will be ignored that pid doesn't have windows
    156     // on screen)
    157     void showStrictModeViolation(boolean on);
    158 
    159     // Proxy to set the system property for whether the flashing
    160     // should be enabled.  The 'enabled' value is null or blank for
    161     // the system default (differs per build variant) or any valid
    162     // boolean string as parsed by SystemProperties.getBoolean().
    163     void setStrictModeVisualIndicatorPreference(String enabled);
    164 
    165     // These can only be called with the SET_ORIENTATION permission.
    166     /**
    167      * Update the current screen rotation based on the current state of
    168      * the world.
    169      * @param alwaysSendConfiguration Flag to force a new configuration to
    170      * be evaluated.  This can be used when there are other parameters in
    171      * configuration that are changing.
    172      */
    173     void updateRotation(boolean alwaysSendConfiguration);
    174 
    175     /**
    176      * Retrieve the current screen orientation, constants as per
    177      * {@link android.view.Surface}.
    178      */
    179     int getRotation();
    180 
    181     /**
    182      * Watch the rotation of the screen.  Returns the current rotation,
    183      * calls back when it changes.
    184      */
    185     int watchRotation(IRotationWatcher watcher);
    186 
    187     /**
    188      * Determine the preferred edge of the screen to pin the compact options menu against.
    189      * @return a Gravity value for the options menu panel
    190      * @hide
    191      */
    192     int getPreferredOptionsPanelGravity();
    193 
    194 	/**
    195 	 * Lock the device orientation to the specified rotation, or to the
    196 	 * current rotation if -1.  Sensor input will be ignored until
    197 	 * thawRotation() is called.
    198 	 * @hide
    199 	 */
    200 	void freezeRotation(int rotation);
    201 
    202 	/**
    203 	 * Release the orientation lock imposed by freezeRotation().
    204 	 * @hide
    205 	 */
    206 	void thawRotation();
    207 
    208 	/**
    209 	 * Create a screenshot of the applications currently displayed.
    210 	 */
    211 	Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight);
    212 
    213     /**
    214      * Called by the status bar to notify Views of changes to System UI visiblity.
    215      */
    216     void statusBarVisibilityChanged(int visibility);
    217 
    218     /**
    219      * Called by the settings application to temporarily set the pointer speed.
    220      */
    221     void setPointerSpeed(int speed);
    222 
    223     /**
    224      * Block until the given window has been drawn to the screen.
    225      */
    226     void waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
    227 
    228     /**
    229      * Device has a software navigation bar (separate from the status bar).
    230      */
    231     boolean hasNavigationBar();
    232 }
    233