From d69e4c1460017062e7c36be55801cb434ad19d97 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Fri, 24 Apr 2015 09:54:54 -0700 Subject: Update use of procstate for services. Now that we have a separate foreground service proc state (above a sleeping top app), update various system services to put their bindings into this state when appropriate. There are two new bind flags for this -- one that just always makes it a foreground service, another that only does it when the device is awake (useful for things like the wallpaper). And with all of that, tweak network policy manager to only include apps that are at least foreground service state when in power save and device idle modes. This will allow us to further reduce the set of apps that have network access (in particular not giving access to the current top app when the screen is off), hopefully leading to even better battery life. Change-Id: I91d85a5c5ed64e856149e9a5d94a634a7925ec7f --- .../server/voiceinteraction/VoiceInteractionManagerServiceImpl.java | 2 +- .../server/voiceinteraction/VoiceInteractionSessionConnection.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'services/voiceinteraction') diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index 61ec162..f439915 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -229,7 +229,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne Intent intent = new Intent(VoiceInteractionService.SERVICE_INTERFACE); intent.setComponent(mComponent); mBound = mContext.bindServiceAsUser(intent, mConnection, - Context.BIND_AUTO_CREATE, new UserHandle(mUser)); + Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE, new UserHandle(mUser)); if (!mBound) { Slog.w(TAG, "Failed binding to voice interaction service " + mComponent); } diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java index 9634ab8..42eb6c3 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionSessionConnection.java @@ -180,7 +180,8 @@ final class VoiceInteractionSessionConnection implements ServiceConnection { if (mBound) { if (!mFullyBound) { mFullyBound = mContext.bindServiceAsUser(mBindIntent, mFullConnection, - Context.BIND_AUTO_CREATE|Context.BIND_TREAT_LIKE_ACTIVITY, + Context.BIND_AUTO_CREATE | Context.BIND_TREAT_LIKE_ACTIVITY + | Context.BIND_FOREGROUND_SERVICE, new UserHandle(mUser)); } mShown = true; -- cgit v1.1