Skip to content

Commit 9e130e7

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Limit certain actions to default Display." into jb-mr1-dev
2 parents 5851c6e + 69b0818 commit 9e130e7

File tree

7 files changed

+281
-218
lines changed

7 files changed

+281
-218
lines changed

core/java/android/view/WindowManagerPolicy.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public interface WindowManagerPolicy {
123123
/**
124124
* This key event should put the device to sleep (and engage keyguard if necessary)
125125
* To be returned from {@link #interceptKeyBeforeQueueing}.
126-
* Do not return this and {@link #ACTION_POKE_USER_ACTIVITY} or {@link #ACTION_PASS_TO_USER}.
126+
* Do not return this and {@link #ACTION_WAKE_UP} or {@link #ACTION_PASS_TO_USER}.
127127
*/
128128
public final static int ACTION_GO_TO_SLEEP = 0x00000004;
129129

@@ -338,6 +338,12 @@ public void computeFrameLw(Rect parentFrame, Rect displayFrame,
338338
* Check whether the process hosting this window is currently alive.
339339
*/
340340
public boolean isAlive();
341+
342+
/**
343+
* Check if window is on {@link Display#DEFAULT_DISPLAY}.
344+
* @return true if window is on default display.
345+
*/
346+
public boolean isDefaultDisplay();
341347
}
342348

343349
/**
@@ -707,7 +713,7 @@ public int prepareAddWindowLw(WindowState win,
707713
* @param isScreenOn True if the screen is already on
708714
*
709715
* @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
710-
* {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
716+
* {@link #ACTION_WAKE_UP} and {@link #ACTION_GO_TO_SLEEP} flags.
711717
*/
712718
public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn);
713719

@@ -721,7 +727,7 @@ public int prepareAddWindowLw(WindowState win,
721727
* @param policyFlags The policy flags associated with the motion.
722728
*
723729
* @return The bitwise or of the {@link #ACTION_PASS_TO_USER},
724-
* {@link #ACTION_POKE_USER_ACTIVITY} and {@link #ACTION_GO_TO_SLEEP} flags.
730+
* {@link #ACTION_WAKE_UP} and {@link #ACTION_GO_TO_SLEEP} flags.
725731
*/
726732
public int interceptMotionBeforeQueueingWhenScreenOff(int policyFlags);
727733

@@ -762,12 +768,14 @@ public int prepareAddWindowLw(WindowState win,
762768
/**
763769
* Called when layout of the windows is about to start.
764770
*
771+
* @param isDefaultDisplay true if window is on {@link Display#DEFAULT_DISPLAY}.
765772
* @param displayWidth The current full width of the screen.
766773
* @param displayHeight The current full height of the screen.
767774
* @param displayRotation The current rotation being applied to the base
768775
* window.
769776
*/
770-
public void beginLayoutLw(int displayWidth, int displayHeight, int displayRotation);
777+
public void beginLayoutLw(boolean isDefaultDisplay, int displayWidth, int displayHeight,
778+
int displayRotation);
771779

772780
/**
773781
* Return the rectangle of the screen currently covered by system decorations.
@@ -1066,9 +1074,9 @@ interface OnKeyguardExitResult {
10661074
* Inform the policy that the user has chosen a preferred orientation ("rotation lock").
10671075
*
10681076
* @param mode One of {@link WindowManagerPolicy#USER_ROTATION_LOCKED} or
1069-
* {@link * WindowManagerPolicy#USER_ROTATION_FREE}.
1077+
* {@link WindowManagerPolicy#USER_ROTATION_FREE}.
10701078
* @param rotation One of {@link Surface#ROTATION_0}, {@link Surface#ROTATION_90},
1071-
* {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
1079+
* {@link Surface#ROTATION_180}, {@link Surface#ROTATION_270}.
10721080
*/
10731081
public void setUserRotationMode(int mode, int rotation);
10741082

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 155 additions & 132 deletions
Large diffs are not rendered by default.

services/java/com/android/server/wm/DisplayContent.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ class DisplayContent {
6565
// Accessed directly by all users.
6666
boolean layoutNeeded;
6767
int pendingLayoutChanges;
68+
final boolean isDefaultDisplay;
6869

6970
DisplayContent(Display display) {
7071
mDisplay = display;
7172
mDisplayId = display.getDisplayId();
7273
display.getDisplayInfo(mDisplayInfo);
74+
isDefaultDisplay = mDisplayId == Display.DEFAULT_DISPLAY;
7375
}
7476

7577
int getDisplayId() {
@@ -85,7 +87,7 @@ Display getDisplay() {
8587
}
8688

8789
DisplayInfo getDisplayInfo() {
88-
mDisplay.getDisplayInfo(mDisplayInfo);
90+
// TODO: Add a listener for changes to Display and update mDisplayInfo when appropriate.
8991
return mDisplayInfo;
9092
}
9193

@@ -111,7 +113,7 @@ public void dump(PrintWriter pw) {
111113
pw.print("x"); pw.print(mDisplayInfo.smallestNominalAppHeight);
112114
pw.print("-"); pw.print(mDisplayInfo.largestNominalAppWidth);
113115
pw.print("x"); pw.println(mDisplayInfo.largestNominalAppHeight);
114-
pw.print("layoutNeeded="); pw.println(layoutNeeded);
116+
pw.print(" layoutNeeded="); pw.println(layoutNeeded);
115117
pw.println();
116118
}
117119
}

services/java/com/android/server/wm/WindowAnimator.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class WindowAnimator {
5050
// Layout changes for individual Displays. Indexed by displayId.
5151
SparseIntArray mPendingLayoutChanges = new SparseIntArray();
5252

53+
// TODO: Assign these from each iteration through DisplayContent. Only valid between loops.
5354
/** Overall window dimensions */
5455
int mDw, mDh;
5556

@@ -698,20 +699,6 @@ public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
698699
}
699700
}
700701

701-
static class SetAnimationParams {
702-
final WindowStateAnimator mWinAnimator;
703-
final Animation mAnimation;
704-
final int mAnimDw;
705-
final int mAnimDh;
706-
public SetAnimationParams(final WindowStateAnimator winAnimator,
707-
final Animation animation, final int animDw, final int animDh) {
708-
mWinAnimator = winAnimator;
709-
mAnimation = animation;
710-
mAnimDw = animDw;
711-
mAnimDh = animDh;
712-
}
713-
}
714-
715702
void clearPendingActions() {
716703
synchronized (this) {
717704
mPendingActions = 0;

0 commit comments

Comments
 (0)