am c1a564b1: Merge "Add support for secure system overlays. (DO NOT MERGE)" into gingerbread

Merge commit 'c1a564b108c511c0bdd699567c245b031930e718' into gingerbread-plus-aosp

* commit 'c1a564b108c511c0bdd699567c245b031930e718':
  Add support for secure system overlays.  (DO NOT MERGE)
This commit is contained in:
Jeff Brown
2010-10-15 18:40:39 -07:00
committed by Android Git Automerger
6 changed files with 27 additions and 7 deletions

View File

@@ -163,7 +163,8 @@ public interface WindowManager extends ViewManager {
@ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"), @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
@ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"), @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
@ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"), @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
@ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG") @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
@ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY")
}) })
public int type; public int type;
@@ -341,7 +342,19 @@ public interface WindowManager extends ViewManager {
* Window type: panel that slides out from the status bar * Window type: panel that slides out from the status bar
*/ */
public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14; public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
/**
* Window type: secure system overlay windows, which need to be displayed
* on top of everything else. These windows must not take input
* focus, or they will interfere with the keyguard.
*
* This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
* system itself is allowed to create these overlays. Applications cannot
* obtain permission to create secure system overlays.
* @hide
*/
public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
/** /**
* End of types of system windows. * End of types of system windows.
*/ */

View File

@@ -183,6 +183,7 @@ struct InputWindow {
TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12, TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12,
TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13, TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13,
TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14, TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14,
TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15,
LAST_SYSTEM_WINDOW = 2999, LAST_SYSTEM_WINDOW = 2999,
}; };

View File

@@ -149,7 +149,8 @@ bool InputWindow::frameContainsPoint(int32_t x, int32_t y) const {
bool InputWindow::isTrustedOverlay() const { bool InputWindow::isTrustedOverlay() const {
return layoutParamsType == TYPE_INPUT_METHOD return layoutParamsType == TYPE_INPUT_METHOD
|| layoutParamsType == TYPE_INPUT_METHOD_DIALOG; || layoutParamsType == TYPE_INPUT_METHOD_DIALOG
|| layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY;
} }
@@ -1350,7 +1351,7 @@ void InputDispatcher::addMonitoringTargetsLocked() {
target.flags = 0; target.flags = 0;
target.xOffset = 0; target.xOffset = 0;
target.yOffset = 0; target.yOffset = 0;
target.windowType = InputWindow::TYPE_SYSTEM_OVERLAY; target.windowType = -1;
} }
} }

View File

@@ -93,6 +93,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_PHONE; import static android.view.WindowManager.LayoutParams.TYPE_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE; import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR; import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG;
@@ -153,6 +154,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
static final int KEYGUARD_DIALOG_LAYER = 15; static final int KEYGUARD_DIALOG_LAYER = 15;
// things in here CAN NOT take focus, but are shown on top of everything else. // things in here CAN NOT take focus, but are shown on top of everything else.
static final int SYSTEM_OVERLAY_LAYER = 16; static final int SYSTEM_OVERLAY_LAYER = 16;
static final int SECURE_SYSTEM_OVERLAY_LAYER = 17;
static final int APPLICATION_MEDIA_SUBLAYER = -2; static final int APPLICATION_MEDIA_SUBLAYER = -2;
static final int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1; static final int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1;
@@ -631,7 +633,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
WindowManager.LayoutParams lp = new WindowManager.LayoutParams( WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT); WindowManager.LayoutParams.MATCH_PARENT);
lp.type = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; lp.type = WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
lp.flags = lp.flags =
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE|
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
@@ -727,6 +729,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
public void adjustWindowParamsLw(WindowManager.LayoutParams attrs) { public void adjustWindowParamsLw(WindowManager.LayoutParams attrs) {
switch (attrs.type) { switch (attrs.type) {
case TYPE_SYSTEM_OVERLAY: case TYPE_SYSTEM_OVERLAY:
case TYPE_SECURE_SYSTEM_OVERLAY:
case TYPE_TOAST: case TYPE_TOAST:
// These types of windows can't receive input events. // These types of windows can't receive input events.
attrs.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE attrs.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
@@ -804,6 +807,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return INPUT_METHOD_DIALOG_LAYER; return INPUT_METHOD_DIALOG_LAYER;
case TYPE_SYSTEM_OVERLAY: case TYPE_SYSTEM_OVERLAY:
return SYSTEM_OVERLAY_LAYER; return SYSTEM_OVERLAY_LAYER;
case TYPE_SECURE_SYSTEM_OVERLAY:
return SECURE_SYSTEM_OVERLAY_LAYER;
case TYPE_PRIORITY_PHONE: case TYPE_PRIORITY_PHONE:
return PRIORITY_PHONE_LAYER; return PRIORITY_PHONE_LAYER;
case TYPE_TOAST: case TYPE_TOAST:

View File

@@ -272,7 +272,7 @@ public class LoadAverageService extends Service {
WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT); PixelFormat.TRANSLUCENT);

View File

@@ -5891,7 +5891,7 @@ public final class ActivityManagerService extends ActivityManagerNative
View v = LayoutInflater.from(mContext).inflate( View v = LayoutInflater.from(mContext).inflate(
com.android.internal.R.layout.safe_mode, null); com.android.internal.R.layout.safe_mode, null);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.type = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; lp.type = WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
lp.width = WindowManager.LayoutParams.WRAP_CONTENT; lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
lp.gravity = Gravity.BOTTOM | Gravity.LEFT; lp.gravity = Gravity.BOTTOM | Gravity.LEFT;