Loading core/java/android/content/Context.java +15 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,21 @@ public abstract class Context { */ public static final int BIND_ADJUST_WITH_ACTIVITY = 0x0080; /** * @hide Flag for {@link #bindService}: Like {@link #BIND_FOREGROUND_SERVICE}, * but only applies while the device is awake. */ public static final int BIND_FOREGROUND_SERVICE_WHILE_AWAKE = 0x02000000; /** * @hide Flag for {@link #bindService}: For only the case where the binding * is coming from the system, set the process state to FOREGROUND_SERVICE * instead of the normal maximum of IMPORTANT_FOREGROUND. That is, this is * saying that the process shouldn't participate in the normal power reduction * modes (removing network access etc). */ public static final int BIND_FOREGROUND_SERVICE = 0x04000000; /** * @hide Flag for {@link #bindService}: Treat the binding as hosting * an activity, an unbinding as the activity going in the background. Loading services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +3 −1 Original line number Diff line number Diff line Loading @@ -2060,7 +2060,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { UserState userState = getUserStateLocked(mUserId); if (!mIsAutomation) { if (mService == null && mContext.bindServiceAsUser( mIntent, this, Context.BIND_AUTO_CREATE, new UserHandle(mUserId))) { mIntent, this, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, new UserHandle(mUserId))) { userState.mBindingServices.add(mComponentName); } } else { Loading services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +4 −2 Original line number Diff line number Diff line Loading @@ -1492,7 +1492,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku // RemoteViewsService. final long token = Binder.clearCallingIdentity(); try { mContext.bindServiceAsUser(intent, conn, Context.BIND_AUTO_CREATE, mContext.bindServiceAsUser(intent, conn, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, widget.provider.info.getProfile()); } finally { Binder.restoreCallingIdentity(token); Loading Loading @@ -2907,7 +2908,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku UserHandle userHandle) { final long token = Binder.clearCallingIdentity(); try { mContext.bindServiceAsUser(intent, connection, Context.BIND_AUTO_CREATE, mContext.bindServiceAsUser(intent, connection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, userHandle); } finally { Binder.restoreCallingIdentity(token); Loading services/core/java/com/android/server/InputMethodManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -1993,7 +1993,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (mHaveConnection && !mVisibleBound) { bindCurrentInputMethodService( mCurIntent, mVisibleConnection, Context.BIND_AUTO_CREATE | Context.BIND_TREAT_LIKE_ACTIVITY); | Context.BIND_TREAT_LIKE_ACTIVITY | Context.BIND_FOREGROUND_SERVICE); mVisibleBound = true; } res = true; Loading services/core/java/com/android/server/TextServicesManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -555,7 +555,8 @@ public class TextServicesManagerService extends ITextServicesManager.Stub { if (DBG) { Slog.w(TAG, "bind service: " + info.getId()); } if (!bindCurrentSpellCheckerService(serviceIntent, connection, Context.BIND_AUTO_CREATE)) { if (!bindCurrentSpellCheckerService(serviceIntent, connection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE)) { Slog.e(TAG, "Failed to get a spell checker service."); return; } Loading Loading
core/java/android/content/Context.java +15 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,21 @@ public abstract class Context { */ public static final int BIND_ADJUST_WITH_ACTIVITY = 0x0080; /** * @hide Flag for {@link #bindService}: Like {@link #BIND_FOREGROUND_SERVICE}, * but only applies while the device is awake. */ public static final int BIND_FOREGROUND_SERVICE_WHILE_AWAKE = 0x02000000; /** * @hide Flag for {@link #bindService}: For only the case where the binding * is coming from the system, set the process state to FOREGROUND_SERVICE * instead of the normal maximum of IMPORTANT_FOREGROUND. That is, this is * saying that the process shouldn't participate in the normal power reduction * modes (removing network access etc). */ public static final int BIND_FOREGROUND_SERVICE = 0x04000000; /** * @hide Flag for {@link #bindService}: Treat the binding as hosting * an activity, an unbinding as the activity going in the background. Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +3 −1 Original line number Diff line number Diff line Loading @@ -2060,7 +2060,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { UserState userState = getUserStateLocked(mUserId); if (!mIsAutomation) { if (mService == null && mContext.bindServiceAsUser( mIntent, this, Context.BIND_AUTO_CREATE, new UserHandle(mUserId))) { mIntent, this, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, new UserHandle(mUserId))) { userState.mBindingServices.add(mComponentName); } } else { Loading
services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +4 −2 Original line number Diff line number Diff line Loading @@ -1492,7 +1492,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku // RemoteViewsService. final long token = Binder.clearCallingIdentity(); try { mContext.bindServiceAsUser(intent, conn, Context.BIND_AUTO_CREATE, mContext.bindServiceAsUser(intent, conn, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, widget.provider.info.getProfile()); } finally { Binder.restoreCallingIdentity(token); Loading Loading @@ -2907,7 +2908,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku UserHandle userHandle) { final long token = Binder.clearCallingIdentity(); try { mContext.bindServiceAsUser(intent, connection, Context.BIND_AUTO_CREATE, mContext.bindServiceAsUser(intent, connection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE, userHandle); } finally { Binder.restoreCallingIdentity(token); Loading
services/core/java/com/android/server/InputMethodManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -1993,7 +1993,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (mHaveConnection && !mVisibleBound) { bindCurrentInputMethodService( mCurIntent, mVisibleConnection, Context.BIND_AUTO_CREATE | Context.BIND_TREAT_LIKE_ACTIVITY); | Context.BIND_TREAT_LIKE_ACTIVITY | Context.BIND_FOREGROUND_SERVICE); mVisibleBound = true; } res = true; Loading
services/core/java/com/android/server/TextServicesManagerService.java +2 −1 Original line number Diff line number Diff line Loading @@ -555,7 +555,8 @@ public class TextServicesManagerService extends ITextServicesManager.Stub { if (DBG) { Slog.w(TAG, "bind service: " + info.getId()); } if (!bindCurrentSpellCheckerService(serviceIntent, connection, Context.BIND_AUTO_CREATE)) { if (!bindCurrentSpellCheckerService(serviceIntent, connection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE)) { Slog.e(TAG, "Failed to get a spell checker service."); return; } Loading