First step of improving app screen size compatibility mode. When running in compat mode, an application's windows are scaled up on the screen rather than being small with 1:1 pixels. Currently we scale the application to fill the entire screen, so don't use an even pixel scaling. Though this may have some negative impact on the appearance (it looks okay to me), it has a big benefit of allowing us to now treat these apps as normal full-screens apps and do the normal transition animations as you move in and out and around in them. This introduces fun stuff in the input system to take care of modifying pointer coordinates to account for the app window surface scaling. The input dispatcher is told about the scale that is being applied to each window and, when there is one, adjusts pointer events appropriately as they are being sent to the transport. Also modified is CompatibilityInfo, which has been greatly simplified to not be so insane and incomprehendible. It is now simple -- when constructed it determines if the given app is compatible with the current screen size and density, and that is that. There are new APIs on ActivityManagerService to put applications that we would traditionally consider compatible with larger screens in compatibility mode. This is the start of a facility to have a UI affordance for a user to switch apps in and out of compatibility. To test switching of modes, there is a new variation of the "am" command to do this: am screen-compat [on|off] [package] This mode switching has the fundamentals of restarting activities when it is changed, though the state still needs to be persisted and the overall mode switch cleaned up. For the few small apps I have tested, things mostly seem to be working well. I know of one problem with the text selection handles being drawn at the wrong position because at some point the window offset is being scaled incorrectly. There are probably other similar issues around the interaction between two windows because the different window coordinate spaces are done in a hacky way instead of being formally integrated into the window manager layout process. Change-Id: Ie038e3746b448135117bd860859d74e360938557
83 lines
2.2 KiB
Java
83 lines
2.2 KiB
Java
/*
|
|
* Copyright (C) 2010 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package com.android.server.wm;
|
|
|
|
import android.graphics.Region;
|
|
import android.view.InputChannel;
|
|
|
|
/**
|
|
* Describes input-related window properties for use by the input dispatcher.
|
|
* @hide
|
|
*/
|
|
public final class InputWindow {
|
|
// The window handle.
|
|
public InputWindowHandle inputWindowHandle;
|
|
|
|
// The input channel associated with the window.
|
|
public InputChannel inputChannel;
|
|
|
|
// The window name.
|
|
public String name;
|
|
|
|
// Window layout params attributes. (WindowManager.LayoutParams)
|
|
public int layoutParamsFlags;
|
|
public int layoutParamsType;
|
|
|
|
// Dispatching timeout.
|
|
public long dispatchingTimeoutNanos;
|
|
|
|
// Window frame.
|
|
public int frameLeft;
|
|
public int frameTop;
|
|
public int frameRight;
|
|
public int frameBottom;
|
|
|
|
// Global scaling factor applied to touch events when they are dispatched
|
|
// to the window
|
|
public float scaleFactor;
|
|
|
|
// Window touchable region.
|
|
public final Region touchableRegion = new Region();
|
|
|
|
// Window is visible.
|
|
public boolean visible;
|
|
|
|
// Window can receive keys.
|
|
public boolean canReceiveKeys;
|
|
|
|
// Window has focus.
|
|
public boolean hasFocus;
|
|
|
|
// Window has wallpaper. (window is the current wallpaper target)
|
|
public boolean hasWallpaper;
|
|
|
|
// Input event dispatching is paused.
|
|
public boolean paused;
|
|
|
|
// Window layer.
|
|
public int layer;
|
|
|
|
// Id of process and user that owns the window.
|
|
public int ownerPid;
|
|
public int ownerUid;
|
|
|
|
public void recycle() {
|
|
inputWindowHandle = null;
|
|
inputChannel = null;
|
|
}
|
|
}
|