diff --git a/aosp/frameworks/base/apex/jobscheduler/framework/java/com/android/server/job/JobSchedulerInternal.java b/aosp/frameworks/base/apex/jobscheduler/framework/java/com/android/server/job/JobSchedulerInternal.java index 7833a037463c01806efc687f4beefd73c1f83574..d9e56c4636ce44a6669969514a766187f666bd6b 100644 --- a/aosp/frameworks/base/apex/jobscheduler/framework/java/com/android/server/job/JobSchedulerInternal.java +++ b/aosp/frameworks/base/apex/jobscheduler/framework/java/com/android/server/job/JobSchedulerInternal.java @@ -54,6 +54,8 @@ public interface JobSchedulerInternal { */ void reportAppUsage(String packageName, int userId); + void onInteraciveChange(boolean isInteractive); + /** * Report a snapshot of sync-related jobs back to the sync manager */ diff --git a/aosp/frameworks/base/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/aosp/frameworks/base/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java index 1e470ce50bbf61ee75bb576e1ca48bb190b66acd..e36b35516cd1a2374c5d183d23ddd648c3efcca0 100644 --- a/aosp/frameworks/base/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +++ b/aosp/frameworks/base/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java @@ -222,6 +222,7 @@ public class JobSchedulerService extends com.android.server.SystemService static final int MSG_UID_GONE = 5; static final int MSG_UID_ACTIVE = 6; static final int MSG_UID_IDLE = 7; + static final int MSG_INTERACTIVE_CHANGED = 8; /** * Track Services that have currently active or pending jobs. The index is provided by @@ -284,6 +285,7 @@ public class JobSchedulerService extends com.android.server.SystemService ActivityManagerInternal mActivityManagerInternal; IBatteryStats mBatteryStats; DeviceIdleInternal mLocalDeviceIdleController; + HwInteractiveController mHwInteractiveController; @VisibleForTesting AppStateTracker mAppStateTracker; final UsageStatsManagerInternal mUsageStats; @@ -1448,7 +1450,8 @@ public class JobSchedulerService extends com.android.server.SystemService mControllers.add(mDeviceIdleJobsController); mQuotaController = new QuotaController(this); mControllers.add(mQuotaController); - mControllers.add(new HwInteractiveController(this)); + mHwInteractiveController = new HwInteractiveController(this); + mControllers.add(mHwInteractiveController); mRestrictiveControllers = new ArrayList<>(); mRestrictiveControllers.add(mBatteryController); @@ -1976,7 +1979,11 @@ public class JobSchedulerService extends com.android.server.SystemService } break; } - + case MSG_INTERACTIVE_CHANGED: { + int interactive = message.arg1; + mHwInteractiveController.onInteraciveChange(interactive == 1); + break; + } } maybeRunPendingJobsLocked(); // Don't remove JOB_EXPIRED in case one came along while processing the queue. @@ -2455,6 +2462,13 @@ public class JobSchedulerService extends com.android.server.SystemService return new JobStorePersistStats(mJobs.getPersistStats()); } } + + @Override + public void onInteraciveChange(boolean isInteractive) { + Message msg = mHandler.obtainMessage(MSG_INTERACTIVE_CHANGED); + msg.arg1 = isInteractive ? 1 : 0; + mHandler.sendMessage(msg); + } } /** diff --git a/aosp/frameworks/base/services/core/java/com/android/server/power/Notifier.java b/aosp/frameworks/base/services/core/java/com/android/server/power/Notifier.java index b6a70074028fb9a1dd8acc6fa45b696e63d53726..8f0fd607f928860f6c05f0c2ca8845644e0e5075 100644 --- a/aosp/frameworks/base/services/core/java/com/android/server/power/Notifier.java +++ b/aosp/frameworks/base/services/core/java/com/android/server/power/Notifier.java @@ -96,7 +96,6 @@ public class Notifier { private static final int MSG_WIRELESS_CHARGING_STARTED = 3; private static final int MSG_PROFILE_TIMED_OUT = 5; private static final int MSG_WIRED_CHARGING_STARTED = 6; - private static final int MSG_INTERACTIVE = 7; private static final long[] CHARGING_VIBRATION_TIME = { 40, 40, 40, 40, 40, 40, 40, 40, 40, // ramp-up sampling rate = 40ms @@ -132,8 +131,6 @@ public class Notifier { private final Intent mScreenOnIntent; private final Intent mScreenOffIntent; - private final IHwNotifier mHwNotifier; - // True if the device should suspend when the screen is off due to proximity. private final boolean mSuspendWhenScreenOffDueToProximityConfig; @@ -191,8 +188,6 @@ public class Notifier { Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND | Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS); - mHwNotifier = new HwNotifier(mContext, mHandler); - mSuspendWhenScreenOffDueToProximityConfig = context.getResources().getBoolean( com.android.internal.R.bool.config_suspendWhenScreenOffDueToProximity); mShowWirelessChargingAnimationConfig = context.getResources().getBoolean( @@ -451,18 +446,6 @@ public class Notifier { } } - public void onInteraciveChange(boolean isInteractive) { - mHwNotifier.onInteraciveChange(isInteractive); - } - - private void sendNoInteractiveIntent(boolean isInteractive) { - synchronized (mLock) { - if (mActivityManagerInternal.isSystemReady()) { - mHwNotifier.sendNoInteractiveIntent(isInteractive); - } - } - } - /** * Handle early interactive state changes such as getting applications or the lock * screen running and ready for the user to see (such as when turning on the screen). @@ -895,8 +878,6 @@ public class Notifier { case MSG_WIRED_CHARGING_STARTED: showWiredChargingStarted(msg.arg1); break; - case MSG_INTERACTIVE: - sendNoInteractiveIntent(msg.arg1 == 1); } } } diff --git a/aosp/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java b/aosp/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java index 8c29844180731e6650f4662b81ea99383f3df876..8d98f7eaa3d904230c858e01b2a785b09375e3ec 100644 --- a/aosp/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java +++ b/aosp/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java @@ -2382,7 +2382,7 @@ public final class PowerManagerService extends SystemService || (mUserActivitySummary & (USER_ACTIVITY_SCREEN_BRIGHT | USER_ACTIVITY_SCREEN_DIM)) != 0 || mScreenBrightnessBoostInProgress); - mHwPowerManagerService.checkInteractiveStatusAndNotify(nowKeepInteractive, mNotifier); + mHwPowerManagerService.checkInteractiveStatusAndNotify(nowKeepInteractive); } private void scheduleUserInactivityTimeout(long timeMs) {