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     void getCurrentSizeRange(out Point smallestSize, out Point largestSize);
     62 
     63     void setForcedDisplaySize(int longDimen, int shortDimen);
     64     void clearForcedDisplaySize();
     65 
     66     // Is the device configured to have a full system bar for larger screens?
     67     boolean hasSystemNavBar();
     68 
     69     // These can only be called when holding the MANAGE_APP_TOKENS permission.
     70     void pauseKeyDispatching(IBinder token);
     71     void resumeKeyDispatching(IBinder token);
     72     void setEventDispatching(boolean enabled);
     73     void addWindowToken(IBinder token, int type);
     74     void removeWindowToken(IBinder token);
     75     void addAppToken(int addPos, IApplicationToken token,
     76             int groupId, int requestedOrientation, boolean fullscreen);
     77     void setAppGroupId(IBinder token, int groupId);
     78     void setAppOrientation(IApplicationToken token, int requestedOrientation);
     79     int getAppOrientation(IApplicationToken token);
     80     void setFocusedApp(IBinder token, boolean moveFocusNow);
     81     void prepareAppTransition(int transit, boolean alwaysKeepCurrent);
     82     int getPendingAppTransition();
     83     void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
     84             IRemoteCallback startedCallback);
     85     void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
     86             int startHeight);
     87     void overridePendingAppTransitionThumb(in Bitmap srcThumb, int startX, int startY,
     88             IRemoteCallback startedCallback, boolean delayed);
     89     void executeAppTransition();
     90     void setAppStartingWindow(IBinder token, String pkg, int theme,
     91             in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
     92             int icon, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
     93     void setAppWillBeHidden(IBinder token);
     94     void setAppVisibility(IBinder token, boolean visible);
     95     void startAppFreezingScreen(IBinder token, int configChanges);
     96     void stopAppFreezingScreen(IBinder token, boolean force);
     97     void removeAppToken(IBinder token);
     98     void moveAppToken(int index, IBinder token);
     99     void moveAppTokensToTop(in List<IBinder> tokens);
    100     void moveAppTokensToBottom(in List<IBinder> tokens);
    101 
    102     // Re-evaluate the current orientation from the caller's state.
    103     // If there is a change, the new Configuration is returned and the
    104     // caller must call setNewConfiguration() sometime later.
    105     Configuration updateOrientationFromAppTokens(in Configuration currentConfig,
    106             IBinder freezeThisOneIfNeeded);
    107     void setNewConfiguration(in Configuration config);
    108 
    109     // these require DISABLE_KEYGUARD permission
    110     void disableKeyguard(IBinder token, String tag);
    111     void reenableKeyguard(IBinder token);
    112     void exitKeyguardSecurely(IOnKeyguardExitResult callback);
    113     boolean isKeyguardLocked();
    114     boolean isKeyguardSecure();
    115     boolean inKeyguardRestrictedInputMode();
    116     void dismissKeyguard();
    117 
    118     void closeSystemDialogs(String reason);
    119 
    120     // These can only be called with the SET_ANIMATON_SCALE permission.
    121     float getAnimationScale(int which);
    122     float[] getAnimationScales();
    123     void setAnimationScale(int which, float scale);
    124     void setAnimationScales(in float[] scales);
    125 
    126     // For testing
    127     void setInTouchMode(boolean showFocus);
    128 
    129     // For StrictMode flashing a red border on violations from the UI
    130     // thread.  The uid/pid is implicit from the Binder call, and the Window
    131     // Manager uses that to determine whether or not the red border should
    132     // actually be shown.  (it will be ignored that pid doesn't have windows
    133     // on screen)
    134     void showStrictModeViolation(boolean on);
    135 
    136     // Proxy to set the system property for whether the flashing
    137     // should be enabled.  The 'enabled' value is null or blank for
    138     // the system default (differs per build variant) or any valid
    139     // boolean string as parsed by SystemProperties.getBoolean().
    140     void setStrictModeVisualIndicatorPreference(String enabled);
    141 
    142     // These can only be called with the SET_ORIENTATION permission.
    143     /**
    144      * Update the current screen rotation based on the current state of
    145      * the world.
    146      * @param alwaysSendConfiguration Flag to force a new configuration to
    147      * be evaluated.  This can be used when there are other parameters in
    148      * configuration that are changing.
    149      * @param forceRelayout If true, the window manager will always do a relayout
    150      * of its windows even if the rotation hasn't changed.
    151      */
    152     void updateRotation(boolean alwaysSendConfiguration, boolean forceRelayout);
    153 
    154     /**
    155      * Retrieve the current screen orientation, constants as per
    156      * {@link android.view.Surface}.
    157      */
    158     int getRotation();
    159 
    160     /**
    161      * Watch the rotation of the screen.  Returns the current rotation,
    162      * calls back when it changes.
    163      */
    164     int watchRotation(IRotationWatcher watcher);
    165 
    166     /**
    167      * Determine the preferred edge of the screen to pin the compact options menu against.
    168      * @return a Gravity value for the options menu panel
    169      * @hide
    170      */
    171     int getPreferredOptionsPanelGravity();
    172 
    173 	/**
    174 	 * Lock the device orientation to the specified rotation, or to the
    175 	 * current rotation if -1.  Sensor input will be ignored until
    176 	 * thawRotation() is called.
    177 	 * @hide
    178 	 */
    179 	void freezeRotation(int rotation);
    180 
    181 	/**
    182 	 * Release the orientation lock imposed by freezeRotation().
    183 	 * @hide
    184 	 */
    185 	void thawRotation();
    186 
    187 	/**
    188 	 * Create a screenshot of the applications currently displayed.
    189 	 */
    190 	Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight);
    191 
    192     /**
    193      * Called by the status bar to notify Views of changes to System UI visiblity.
    194      */
    195     void statusBarVisibilityChanged(int visibility);
    196 
    197     /**
    198      * Block until the given window has been drawn to the screen.
    199      */
    200     void waitForWindowDrawn(IBinder token, in IRemoteCallback callback);
    201 
    202     /**
    203      * Device has a software navigation bar (separate from the status bar).
    204      */
    205     boolean hasNavigationBar();
    206 
    207     /**
    208      * Lock the device immediately.
    209      */
    210     void lockNow();
    211 }
    212