summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/EventLogTags.logtags6
-rw-r--r--services/java/com/android/server/LocationManagerService.java4
-rwxr-xr-xservices/java/com/android/server/NotificationManagerService.java28
-rw-r--r--services/java/com/android/server/accessibility/ScreenMagnifier.java29
-rw-r--r--services/java/com/android/server/display/DisplayManagerService.java8
-rw-r--r--services/java/com/android/server/display/LogicalDisplay.java10
-rw-r--r--services/java/com/android/server/wm/WindowAnimator.java1
-rwxr-xr-xservices/java/com/android/server/wm/WindowManagerService.java82
8 files changed, 119 insertions, 49 deletions
diff --git a/services/java/com/android/server/EventLogTags.logtags b/services/java/com/android/server/EventLogTags.logtags
index 840e006..0fe66fc 100644
--- a/services/java/com/android/server/EventLogTags.logtags
+++ b/services/java/com/android/server/EventLogTags.logtags
@@ -52,12 +52,12 @@ option java_package com.android.server
# NotificationManagerService.java
# ---------------------------
# when a NotificationManager.notify is called
-2750 notification_enqueue (pkg|3),(id|1|5),(tag|3),(notification|3)
+2750 notification_enqueue (pkg|3),(id|1|5),(tag|3),(userid|1|5),(notification|3)
# when someone tries to cancel a notification, the notification manager sometimes
# calls this with flags too
-2751 notification_cancel (pkg|3),(id|1|5),(tag|3),(required_flags|1),(forbidden_flags|1)
+2751 notification_cancel (pkg|3),(id|1|5),(tag|3),(userid|1|5),(required_flags|1),(forbidden_flags|1)
# when someone tries to cancel all of the notifications for a particular package
-2752 notification_cancel_all (pkg|3),(required_flags|1),(forbidden_flags|1)
+2752 notification_cancel_all (pkg|3),(userid|1|5),(required_flags|1),(forbidden_flags|1)
# ---------------------------
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 6948927..63eeeb3 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -1340,6 +1340,10 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
*/
@Override
public ProviderProperties getProviderProperties(String provider) {
+ if (mProvidersByName.get(provider) == null) {
+ return null;
+ }
+
checkPermissionForProvider(getBestCallingPermission(), provider);
LocationProviderInterface p;
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 09a606e..4a54efe 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -916,7 +916,7 @@ public class NotificationManagerService extends INotificationManager.Stub
// behalf of the download manager without affecting other apps.
if (!pkg.equals("com.android.providers.downloads")
|| Log.isLoggable("DownloadManager", Log.VERBOSE)) {
- EventLog.writeEvent(EventLogTags.NOTIFICATION_ENQUEUE, pkg, id, tag,
+ EventLog.writeEvent(EventLogTags.NOTIFICATION_ENQUEUE, pkg, id, tag, userId,
notification.toString());
}
@@ -1207,7 +1207,7 @@ public class NotificationManagerService extends INotificationManager.Stub
*/
private void cancelNotification(String pkg, String tag, int id, int mustHaveFlags,
int mustNotHaveFlags, boolean sendDelete, int userId) {
- EventLog.writeEvent(EventLogTags.NOTIFICATION_CANCEL, pkg, id, tag,
+ EventLog.writeEvent(EventLogTags.NOTIFICATION_CANCEL, pkg, id, tag, userId,
mustHaveFlags, mustNotHaveFlags);
synchronized (mNotificationList) {
@@ -1231,20 +1231,34 @@ public class NotificationManagerService extends INotificationManager.Stub
}
/**
+ * Determine whether the userId applies to the notification in question, either because
+ * they match exactly, or one of them is USER_ALL (which is treated as a wildcard).
+ */
+ private boolean notificationMatchesUserId(NotificationRecord r, int userId) {
+ return
+ // looking for USER_ALL notifications? match everything
+ userId == UserHandle.USER_ALL
+ // a notification sent to USER_ALL matches any query
+ || r.userId == UserHandle.USER_ALL
+ // an exact user match
+ || r.userId == userId;
+ }
+
+ /**
* Cancels all notifications from a given package that have all of the
* {@code mustHaveFlags}.
*/
boolean cancelAllNotificationsInt(String pkg, int mustHaveFlags,
int mustNotHaveFlags, boolean doit, int userId) {
- EventLog.writeEvent(EventLogTags.NOTIFICATION_CANCEL_ALL, pkg, mustHaveFlags,
- mustNotHaveFlags);
+ EventLog.writeEvent(EventLogTags.NOTIFICATION_CANCEL_ALL, pkg, userId,
+ mustHaveFlags, mustNotHaveFlags);
synchronized (mNotificationList) {
final int N = mNotificationList.size();
boolean canceledSomething = false;
for (int i = N-1; i >= 0; --i) {
NotificationRecord r = mNotificationList.get(i);
- if (userId != UserHandle.USER_ALL && r.userId != userId) {
+ if (!notificationMatchesUserId(r, userId)) {
continue;
}
if ((r.notification.flags & mustHaveFlags) != mustHaveFlags) {
@@ -1322,7 +1336,7 @@ public class NotificationManagerService extends INotificationManager.Stub
for (int i=N-1; i>=0; i--) {
NotificationRecord r = mNotificationList.get(i);
- if (r.userId != userId) {
+ if (!notificationMatchesUserId(r, userId)) {
continue;
}
@@ -1376,7 +1390,7 @@ public class NotificationManagerService extends INotificationManager.Stub
final int len = list.size();
for (int i=0; i<len; i++) {
NotificationRecord r = list.get(i);
- if (r.userId != userId || r.id != id) {
+ if (!notificationMatchesUserId(r, userId) || r.id != id) {
continue;
}
if (tag == null) {
diff --git a/services/java/com/android/server/accessibility/ScreenMagnifier.java b/services/java/com/android/server/accessibility/ScreenMagnifier.java
index c8931f4..d5a8537 100644
--- a/services/java/com/android/server/accessibility/ScreenMagnifier.java
+++ b/services/java/com/android/server/accessibility/ScreenMagnifier.java
@@ -850,6 +850,7 @@ public final class ScreenMagnifier implements EventStreamTransformation {
private static final int MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED = 3;
private static final int MESSAGE_ON_WINDOW_TRANSITION = 4;
private static final int MESSAGE_ON_ROTATION_CHANGED = 5;
+ private static final int MESSAGE_ON_WINDOW_LAYERS_CHANGED = 6;
private final Handler mHandler = new MyHandler();
@@ -880,24 +881,8 @@ public final class ScreenMagnifier implements EventStreamTransformation {
mDisplayContentChangeListener = new IDisplayContentChangeListener.Stub() {
@Override
public void onWindowTransition(int displayId, int transition, WindowInfo info) {
- Message message = mHandler.obtainMessage(MESSAGE_ON_WINDOW_TRANSITION,
- transition, 0, WindowInfo.obtain(info));
- // TODO: This makes me quite unhappy but for the time being the
- // least risky fix for cases where the keyguard is removed but
- // the windows it force hides are not made visible yet. Hence,
- // we would compute the magnified frame before we have a stable
- // state. One more reason to move the magnified frame computation
- // in the window manager!
- if (info.type == WindowManager.LayoutParams.TYPE_KEYGUARD
- || info.type == WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG
- && (transition == WindowManagerPolicy.TRANSIT_EXIT
- || transition == WindowManagerPolicy.TRANSIT_HIDE)) {
- final long delay = (long) (2 * mLongAnimationDuration
- * mWindowAnimationScale);
- mHandler.sendMessageDelayed(message, delay);
- } else {
- message.sendToTarget();
- }
+ mHandler.obtainMessage(MESSAGE_ON_WINDOW_TRANSITION,
+ transition, 0, WindowInfo.obtain(info)).sendToTarget();
}
@Override
@@ -917,6 +902,11 @@ public final class ScreenMagnifier implements EventStreamTransformation {
mHandler.obtainMessage(MESSAGE_ON_ROTATION_CHANGED, rotation, 0)
.sendToTarget();
}
+
+ @Override
+ public void onWindowLayersChanged(int displayId) throws RemoteException {
+ mHandler.sendEmptyMessage(MESSAGE_ON_WINDOW_LAYERS_CHANGED);
+ }
};
try {
@@ -1192,6 +1182,9 @@ public final class ScreenMagnifier implements EventStreamTransformation {
final int rotation = message.arg1;
handleOnRotationChanged(rotation);
} break;
+ case MESSAGE_ON_WINDOW_LAYERS_CHANGED: {
+ mViewport.recomputeBounds(mMagnificationController.isMagnifying());
+ } break;
default: {
throw new IllegalArgumentException("Unknown message: " + action);
}
diff --git a/services/java/com/android/server/display/DisplayManagerService.java b/services/java/com/android/server/display/DisplayManagerService.java
index 0a42528..93896af 100644
--- a/services/java/com/android/server/display/DisplayManagerService.java
+++ b/services/java/com/android/server/display/DisplayManagerService.java
@@ -305,6 +305,8 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
DisplayDevice device = mDisplayDevices.get(i);
device.blankLocked();
}
+
+ scheduleTraversalLocked(false);
}
}
}
@@ -322,6 +324,8 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
DisplayDevice device = mDisplayDevices.get(i);
device.unblankLocked();
}
+
+ scheduleTraversalLocked(false);
}
}
}
@@ -755,7 +759,9 @@ public final class DisplayManagerService extends IDisplayManager.Stub {
+ device.getDisplayDeviceInfoLocked());
return;
} else {
- display.configureDisplayInTransactionLocked(device);
+ boolean isBlanked = (mAllDisplayBlankStateFromPowerManager
+ == DISPLAY_BLANK_STATE_BLANKED);
+ display.configureDisplayInTransactionLocked(device, isBlanked);
}
// Update the viewports if needed.
diff --git a/services/java/com/android/server/display/LogicalDisplay.java b/services/java/com/android/server/display/LogicalDisplay.java
index c4b749c..680662e 100644
--- a/services/java/com/android/server/display/LogicalDisplay.java
+++ b/services/java/com/android/server/display/LogicalDisplay.java
@@ -55,6 +55,10 @@ import libcore.util.Objects;
final class LogicalDisplay {
private final DisplayInfo mBaseDisplayInfo = new DisplayInfo();
+ // The layer stack we use when the display has been blanked to prevent any
+ // of its content from appearing.
+ private static final int BLANK_LAYER_STACK = -1;
+
private final int mDisplayId;
private final int mLayerStack;
private DisplayInfo mOverrideDisplayInfo; // set by the window manager
@@ -217,13 +221,15 @@ final class LogicalDisplay {
* where the display is being mirrored.
*
* @param device The display device to modify.
+ * @param isBlanked True if the device is being blanked.
*/
- public void configureDisplayInTransactionLocked(DisplayDevice device) {
+ public void configureDisplayInTransactionLocked(DisplayDevice device,
+ boolean isBlanked) {
final DisplayInfo displayInfo = getDisplayInfoLocked();
final DisplayDeviceInfo displayDeviceInfo = device.getDisplayDeviceInfoLocked();
// Set the layer stack.
- device.setLayerStackInTransactionLocked(mLayerStack);
+ device.setLayerStackInTransactionLocked(isBlanked ? BLANK_LAYER_STACK : mLayerStack);
// Set the viewport.
// This is the area of the logical display that we intend to show on the
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index b67fb51..269eac0 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -618,6 +618,7 @@ public class WindowAnimator {
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(
TAG, ">>> OPEN TRANSACTION animateLocked");
Surface.openTransaction();
+ Surface.setAnimationTransaction();
try {
updateAppWindowsLocked();
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 77d815b..fa450ae 100755
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -265,7 +265,7 @@ public class WindowManagerService extends IWindowManager.Stub
static final int DEFAULT_FADE_IN_OUT_DURATION = 400;
/** Amount of time (in milliseconds) to delay before declaring a window freeze timeout. */
- static final int WINDOW_FREEZE_TIMEOUT_DURATION = 3000;
+ static final int WINDOW_FREEZE_TIMEOUT_DURATION = 2000;
/**
* If true, the window manager will do its own custom freezing and general
@@ -2823,16 +2823,9 @@ public class WindowManagerService extends IWindowManager.Stub
"Relayout window turning screen on: " + win);
win.mTurnOnScreen = true;
}
- int diff = 0;
- if (win.mConfiguration != mCurConfiguration
- && (win.mConfiguration == null
- || (diff=mCurConfiguration.diff(win.mConfiguration)) != 0)) {
- win.mConfiguration = mCurConfiguration;
- if (DEBUG_CONFIGURATION) {
- Slog.i(TAG, "Window " + win + " visible with new config: "
- + win.mConfiguration + " / 0x"
- + Integer.toHexString(diff));
- }
+ if (win.isConfigChanged()) {
+ if (DEBUG_CONFIGURATION) Slog.i(TAG, "Window " + win
+ + " visible with new config: " + win.mConfiguration);
outConfig.setTo(mCurConfiguration);
}
}
@@ -6576,6 +6569,36 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
+ private void scheduleNotifyWindowLayersChangedIfNeededLocked(DisplayContent displayContent) {
+ if (displayContent.mDisplayContentChangeListeners != null
+ && displayContent.mDisplayContentChangeListeners.getRegisteredCallbackCount() > 0) {
+ mH.obtainMessage(H.NOTIFY_WINDOW_LAYERS_CHANGED, displayContent) .sendToTarget();
+ }
+ }
+
+ private void handleNotifyWindowLayersChanged(DisplayContent displayContent) {
+ RemoteCallbackList<IDisplayContentChangeListener> callbacks = null;
+ synchronized (mWindowMap) {
+ callbacks = displayContent.mDisplayContentChangeListeners;
+ if (callbacks == null) {
+ return;
+ }
+ }
+ try {
+ final int watcherCount = callbacks.beginBroadcast();
+ for (int i = 0; i < watcherCount; i++) {
+ try {
+ callbacks.getBroadcastItem(i).onWindowLayersChanged(
+ displayContent.getDisplayId());
+ } catch (RemoteException re) {
+ /* ignore */
+ }
+ }
+ } finally {
+ callbacks.finishBroadcast();
+ }
+ }
+
public void addWindowChangeListener(WindowChangeListener listener) {
synchronized(mWindowMap) {
mWindowChangeListeners.add(listener);
@@ -7222,12 +7245,13 @@ public class WindowManagerService extends IWindowManager.Stub
public static final int NOTIFY_ROTATION_CHANGED = 28;
public static final int NOTIFY_WINDOW_TRANSITION = 29;
public static final int NOTIFY_RECTANGLE_ON_SCREEN_REQUESTED = 30;
+ public static final int NOTIFY_WINDOW_LAYERS_CHANGED = 31;
- public static final int DO_DISPLAY_ADDED = 31;
- public static final int DO_DISPLAY_REMOVED = 32;
- public static final int DO_DISPLAY_CHANGED = 33;
+ public static final int DO_DISPLAY_ADDED = 32;
+ public static final int DO_DISPLAY_REMOVED = 33;
+ public static final int DO_DISPLAY_CHANGED = 34;
- public static final int CLIENT_FREEZE_TIMEOUT = 34;
+ public static final int CLIENT_FREEZE_TIMEOUT = 35;
public static final int ANIMATOR_WHAT_OFFSET = 100000;
public static final int SET_TRANSPARENT_REGION = ANIMATOR_WHAT_OFFSET + 1;
@@ -7699,6 +7723,12 @@ public class WindowManagerService extends IWindowManager.Stub
break;
}
+ case NOTIFY_WINDOW_LAYERS_CHANGED: {
+ DisplayContent displayContent = (DisplayContent) msg.obj;
+ handleNotifyWindowLayersChanged(displayContent);
+ break;
+ }
+
case DO_DISPLAY_ADDED:
synchronized (mWindowMap) {
handleDisplayAddedLocked(msg.arg1);
@@ -8075,6 +8105,8 @@ public class WindowManagerService extends IWindowManager.Stub
Slog.v(TAG, "Assigning layers", here);
}
+ boolean anyLayerChanged = false;
+
for (i=0; i<N; i++) {
final WindowState w = windows.get(i);
final WindowStateAnimator winAnimator = w.mWinAnimator;
@@ -8090,6 +8122,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (w.mLayer != oldLayer) {
layerChanged = true;
+ anyLayerChanged = true;
}
oldLayer = winAnimator.mAnimLayer;
if (w.mTargetAppToken != null) {
@@ -8108,6 +8141,7 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (winAnimator.mAnimLayer != oldLayer) {
layerChanged = true;
+ anyLayerChanged = true;
}
if (layerChanged && mAnimator.isDimmingLocked(winAnimator)) {
// Force an animation pass just to update the mDimAnimator layer.
@@ -8122,10 +8156,22 @@ public class WindowManagerService extends IWindowManager.Stub
//System.out.println(
// "Assigned layer " + curLayer + " to " + w.mClient.asBinder());
}
+
+ if (anyLayerChanged) {
+ scheduleNotifyWindowLayersChangedIfNeededLocked(getDefaultDisplayContentLocked());
+ }
}
- private boolean mInLayout = false;
private final void performLayoutAndPlaceSurfacesLocked() {
+ do {
+ mTraversalScheduled = false;
+ performLayoutAndPlaceSurfacesLockedLoop();
+ mH.removeMessages(H.DO_TRAVERSAL);
+ } while (mTraversalScheduled);
+ }
+
+ private boolean mInLayout = false;
+ private final void performLayoutAndPlaceSurfacesLockedLoop() {
if (mInLayout) {
if (DEBUG) {
throw new RuntimeException("Recursive call!");
@@ -8260,7 +8306,7 @@ public class WindowManagerService extends IWindowManager.Stub
Slog.v(TAG, "1ST PASS " + win
+ ": gone=" + gone + " mHaveFrame=" + win.mHaveFrame
+ " mLayoutAttached=" + win.mLayoutAttached
- + " screen changed=" + win.isConfigDiff(ActivityInfo.CONFIG_SCREEN_SIZE));
+ + " screen changed=" + win.isConfigChanged());
final AppWindowToken atoken = win.mAppToken;
if (gone) Slog.v(TAG, " GONE: mViewVisibility="
+ win.mViewVisibility + " mRelayoutCalled="
@@ -8282,7 +8328,7 @@ public class WindowManagerService extends IWindowManager.Stub
// windows, since that means "perform layout as normal,
// just don't display").
if (!gone || !win.mHaveFrame || win.mLayoutNeeded
- || win.isConfigDiff(ActivityInfo.CONFIG_SCREEN_SIZE)
+ || win.isConfigChanged()
|| win.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) {
if (!win.mLayoutAttached) {
if (initial) {