Loading core/java/android/view/IWindowManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -397,4 +397,10 @@ interface IWindowManager * Return the touch region for the current IME window, or an empty region if there is none. */ Region getCurrentImeTouchRegion(); /** * Requests that the WindowManager sends WindowManagerPolicy#ACTION_USER_ACTIVITY_NOTIFICATION * on the next user activity. */ void requestUserActivityNotification(); } core/java/android/view/WindowManagerPolicy.java +12 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,12 @@ public interface WindowManagerPolicy { public final static boolean WATCH_POINTER = false; /** * Broadcast sent when a user activity is detected. */ public final static String ACTION_USER_ACTIVITY_NOTIFICATION = "android.intent.action.USER_ACTIVITY_NOTIFICATION"; /** * Sticky broadcast of the current HDMI plugged state. */ Loading Loading @@ -1741,4 +1747,10 @@ public interface WindowManagerPolicy { * @return true if ready; false otherwise. */ boolean canDismissBootAnimation(); /** * Requests that the WindowManager sends WindowManagerPolicy#ACTION_USER_ACTIVITY_NOTIFICATION * on the next user activity. */ public void requestUserActivityNotification(); } core/res/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ <protected-broadcast android:name="android.intent.action.OVERLAY_CHANGED" /> <protected-broadcast android:name="android.intent.action.OVERLAY_REMOVED" /> <protected-broadcast android:name="android.intent.action.OVERLAY_PRIORITY_CHANGED" /> <protected-broadcast android:name="android.intent.action.USER_ACTIVITY_NOTIFICATION" /> <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGED" /> <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGING" /> Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +24 −0 Original line number Diff line number Diff line Loading @@ -392,6 +392,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { KeyEvent.KEYCODE_CALCULATOR, Intent.CATEGORY_APP_CALCULATOR); } private static final int USER_ACTIVITY_NOTIFICATION_DELAY = 200; /** Amount of time (in milliseconds) to wait for windows drawn before powering on. */ static final int WAITING_FOR_DRAWN_TIMEOUT = 1000; Loading Loading @@ -677,6 +679,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mPendingKeyguardOccluded; private boolean mKeyguardOccludedChanged; private boolean mNotifyUserActivity; boolean mShowingDream; private boolean mLastShowingDream; Loading Loading @@ -831,6 +834,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private static final int MSG_DISPATCH_BACK_KEY_TO_AUTOFILL = 24; private static final int MSG_SYSTEM_KEY_PRESS = 25; private static final int MSG_HANDLE_ALL_APPS = 26; private static final int MSG_NOTIFY_USER_ACTIVITY = 27; private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS = 0; private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_NAVIGATION = 1; Loading Loading @@ -926,6 +930,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { case MSG_HANDLE_ALL_APPS: launchAllAppsAction(); break; case MSG_NOTIFY_USER_ACTIVITY: removeMessages(MSG_NOTIFY_USER_ACTIVITY); Intent intent = new Intent(ACTION_USER_ACTIVITY_NOTIFICATION); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); mContext.sendBroadcastAsUser(intent, UserHandle.ALL, android.Manifest.permission.USER_ACTIVITY); break; } } } Loading Loading @@ -7466,6 +7477,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHandler.sendEmptyMessage(MSG_HIDE_BOOT_MESSAGE); } @Override public void requestUserActivityNotification() { if (!mNotifyUserActivity && !mHandler.hasMessages(MSG_NOTIFY_USER_ACTIVITY)) { mNotifyUserActivity = true; } } /** {@inheritDoc} */ @Override public void userActivity() { Loading @@ -7487,6 +7505,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout); } } if (mAwake && mNotifyUserActivity) { mHandler.sendEmptyMessageDelayed(MSG_NOTIFY_USER_ACTIVITY, USER_ACTIVITY_NOTIFICATION_DELAY); mNotifyUserActivity = false; } } class ScreenLockTimeout implements Runnable { Loading services/core/java/com/android/server/wm/WindowManagerService.java +9 −0 Original line number Diff line number Diff line Loading @@ -7301,6 +7301,15 @@ public class WindowManagerService extends IWindowManager.Stub mPolicy.registerShortcutKey(shortcutCode, shortcutKeyReceiver); } @Override public void requestUserActivityNotification() { if (!checkCallingPermission(android.Manifest.permission.USER_ACTIVITY, "requestUserActivityNotification()")) { throw new SecurityException("Requires USER_ACTIVITY permission"); } mPolicy.requestUserActivityNotification(); } void markForSeamlessRotation(WindowState w, boolean seamlesslyRotated) { if (seamlesslyRotated == w.mSeamlesslyRotated) { return; Loading Loading
core/java/android/view/IWindowManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -397,4 +397,10 @@ interface IWindowManager * Return the touch region for the current IME window, or an empty region if there is none. */ Region getCurrentImeTouchRegion(); /** * Requests that the WindowManager sends WindowManagerPolicy#ACTION_USER_ACTIVITY_NOTIFICATION * on the next user activity. */ void requestUserActivityNotification(); }
core/java/android/view/WindowManagerPolicy.java +12 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,12 @@ public interface WindowManagerPolicy { public final static boolean WATCH_POINTER = false; /** * Broadcast sent when a user activity is detected. */ public final static String ACTION_USER_ACTIVITY_NOTIFICATION = "android.intent.action.USER_ACTIVITY_NOTIFICATION"; /** * Sticky broadcast of the current HDMI plugged state. */ Loading Loading @@ -1741,4 +1747,10 @@ public interface WindowManagerPolicy { * @return true if ready; false otherwise. */ boolean canDismissBootAnimation(); /** * Requests that the WindowManager sends WindowManagerPolicy#ACTION_USER_ACTIVITY_NOTIFICATION * on the next user activity. */ public void requestUserActivityNotification(); }
core/res/AndroidManifest.xml +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ <protected-broadcast android:name="android.intent.action.OVERLAY_CHANGED" /> <protected-broadcast android:name="android.intent.action.OVERLAY_REMOVED" /> <protected-broadcast android:name="android.intent.action.OVERLAY_PRIORITY_CHANGED" /> <protected-broadcast android:name="android.intent.action.USER_ACTIVITY_NOTIFICATION" /> <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGED" /> <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGING" /> Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +24 −0 Original line number Diff line number Diff line Loading @@ -392,6 +392,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { KeyEvent.KEYCODE_CALCULATOR, Intent.CATEGORY_APP_CALCULATOR); } private static final int USER_ACTIVITY_NOTIFICATION_DELAY = 200; /** Amount of time (in milliseconds) to wait for windows drawn before powering on. */ static final int WAITING_FOR_DRAWN_TIMEOUT = 1000; Loading Loading @@ -677,6 +679,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean mPendingKeyguardOccluded; private boolean mKeyguardOccludedChanged; private boolean mNotifyUserActivity; boolean mShowingDream; private boolean mLastShowingDream; Loading Loading @@ -831,6 +834,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private static final int MSG_DISPATCH_BACK_KEY_TO_AUTOFILL = 24; private static final int MSG_SYSTEM_KEY_PRESS = 25; private static final int MSG_HANDLE_ALL_APPS = 26; private static final int MSG_NOTIFY_USER_ACTIVITY = 27; private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS = 0; private static final int MSG_REQUEST_TRANSIENT_BARS_ARG_NAVIGATION = 1; Loading Loading @@ -926,6 +930,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { case MSG_HANDLE_ALL_APPS: launchAllAppsAction(); break; case MSG_NOTIFY_USER_ACTIVITY: removeMessages(MSG_NOTIFY_USER_ACTIVITY); Intent intent = new Intent(ACTION_USER_ACTIVITY_NOTIFICATION); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); mContext.sendBroadcastAsUser(intent, UserHandle.ALL, android.Manifest.permission.USER_ACTIVITY); break; } } } Loading Loading @@ -7466,6 +7477,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHandler.sendEmptyMessage(MSG_HIDE_BOOT_MESSAGE); } @Override public void requestUserActivityNotification() { if (!mNotifyUserActivity && !mHandler.hasMessages(MSG_NOTIFY_USER_ACTIVITY)) { mNotifyUserActivity = true; } } /** {@inheritDoc} */ @Override public void userActivity() { Loading @@ -7487,6 +7505,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { mHandler.postDelayed(mScreenLockTimeout, mLockScreenTimeout); } } if (mAwake && mNotifyUserActivity) { mHandler.sendEmptyMessageDelayed(MSG_NOTIFY_USER_ACTIVITY, USER_ACTIVITY_NOTIFICATION_DELAY); mNotifyUserActivity = false; } } class ScreenLockTimeout implements Runnable { Loading
services/core/java/com/android/server/wm/WindowManagerService.java +9 −0 Original line number Diff line number Diff line Loading @@ -7301,6 +7301,15 @@ public class WindowManagerService extends IWindowManager.Stub mPolicy.registerShortcutKey(shortcutCode, shortcutKeyReceiver); } @Override public void requestUserActivityNotification() { if (!checkCallingPermission(android.Manifest.permission.USER_ACTIVITY, "requestUserActivityNotification()")) { throw new SecurityException("Requires USER_ACTIVITY permission"); } mPolicy.requestUserActivityNotification(); } void markForSeamlessRotation(WindowState w, boolean seamlesslyRotated) { if (seamlesslyRotated == w.mSeamlesslyRotated) { return; Loading