Loading services/core/java/com/android/server/am/ActivityManagerService.java +18 −23 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.*; import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID; import static com.android.server.am.TaskRecord.INVALID_TASK_ID; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_DONT_LOCK; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE_PRIV; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_PINNABLE; import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT; Loading Loading @@ -10338,11 +10337,12 @@ public final class ActivityManagerService extends ActivityManagerNative void startRunningVoiceLocked(IVoiceInteractionSession session, int targetUid) { mVoiceWakeLock.setWorkSource(new WorkSource(targetUid)); if (mRunningVoice == null || mRunningVoice.asBinder() != session.asBinder()) { if (mRunningVoice == null) { boolean wasRunningVoice = mRunningVoice != null; mRunningVoice = session; if (!wasRunningVoice) { mVoiceWakeLock.acquire(); updateSleepIfNeededLocked(); } mRunningVoice = session; } } Loading Loading @@ -18595,13 +18595,9 @@ public final class ActivityManagerService extends ActivityManagerNative return; } boolean isInteraction; if (!mSleeping) { isInteraction = app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.fgInteractionTime = 0; } else { // If the display is off, we are going to be more restrictive about what we consider // to be an app interaction. Being the top activity doesn't count, nor do generally // foreground services. // To avoid some abuse patterns, we are going to be careful about what we consider // to be an app interaction. Being the top activity doesn't count while the display // is sleeping, nor do short foreground services. if (app.curProcState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) { isInteraction = true; app.fgInteractionTime = 0; Loading @@ -18618,7 +18614,6 @@ public final class ActivityManagerService extends ActivityManagerNative <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.fgInteractionTime = 0; } } if (isInteraction && !app.reportedInteraction) { String[] packages = app.getPackageList(); if (packages != null) { services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +71 −38 Original line number Diff line number Diff line Loading @@ -853,7 +853,38 @@ public class VoiceInteractionManagerService extends SystemService { PackageMonitor mPackageMonitor = new PackageMonitor() { @Override public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) { return super.onHandleForceStop(intent, packages, uid, doit); if (DEBUG) Slog.d(TAG, "onHandleForceStop uid=" + uid + " doit=" + doit); int userHandle = UserHandle.getUserId(uid); ComponentName curInteractor = getCurInteractor(userHandle); ComponentName curRecognizer = getCurRecognizer(userHandle); boolean hit = false; for (String pkg : packages) { if (curInteractor != null && pkg.equals(curInteractor.getPackageName())) { hit = true; break; } else if (curRecognizer != null && pkg.equals(curRecognizer.getPackageName())) { hit = true; break; } } if (hit && doit) { // The user is force stopping our current interactor/recognizer. // Clear the current settings and restore default state. synchronized (VoiceInteractionManagerService.this) { mSoundTriggerHelper.stopAllRecognitions(); if (mImpl != null) { mImpl.shutdownLocked(); mImpl = null; } setCurInteractor(null, userHandle); setCurRecognizer(null, userHandle); initForUser(userHandle); switchImplementationIfNeededLocked(true); } } return hit; } @Override Loading @@ -865,6 +896,7 @@ public class VoiceInteractionManagerService extends SystemService { int userHandle = getChangingUserId(); if (DEBUG) Slog.d(TAG, "onSomePackagesChanged user=" + userHandle); synchronized (VoiceInteractionManagerService.this) { ComponentName curInteractor = getCurInteractor(userHandle); ComponentName curRecognizer = getCurRecognizer(userHandle); if (curRecognizer == null) { Loading Loading @@ -912,6 +944,7 @@ public class VoiceInteractionManagerService extends SystemService { userHandle), userHandle); } } } }; } } Loading
services/core/java/com/android/server/am/ActivityManagerService.java +18 −23 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.*; import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID; import static com.android.server.am.TaskRecord.INVALID_TASK_ID; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_DONT_LOCK; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE_PRIV; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_PINNABLE; import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT; Loading Loading @@ -10338,11 +10337,12 @@ public final class ActivityManagerService extends ActivityManagerNative void startRunningVoiceLocked(IVoiceInteractionSession session, int targetUid) { mVoiceWakeLock.setWorkSource(new WorkSource(targetUid)); if (mRunningVoice == null || mRunningVoice.asBinder() != session.asBinder()) { if (mRunningVoice == null) { boolean wasRunningVoice = mRunningVoice != null; mRunningVoice = session; if (!wasRunningVoice) { mVoiceWakeLock.acquire(); updateSleepIfNeededLocked(); } mRunningVoice = session; } } Loading Loading @@ -18595,13 +18595,9 @@ public final class ActivityManagerService extends ActivityManagerNative return; } boolean isInteraction; if (!mSleeping) { isInteraction = app.curProcState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.fgInteractionTime = 0; } else { // If the display is off, we are going to be more restrictive about what we consider // to be an app interaction. Being the top activity doesn't count, nor do generally // foreground services. // To avoid some abuse patterns, we are going to be careful about what we consider // to be an app interaction. Being the top activity doesn't count while the display // is sleeping, nor do short foreground services. if (app.curProcState <= ActivityManager.PROCESS_STATE_BOUND_FOREGROUND_SERVICE) { isInteraction = true; app.fgInteractionTime = 0; Loading @@ -18618,7 +18614,6 @@ public final class ActivityManagerService extends ActivityManagerNative <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.fgInteractionTime = 0; } } if (isInteraction && !app.reportedInteraction) { String[] packages = app.getPackageList(); if (packages != null) {
services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +71 −38 Original line number Diff line number Diff line Loading @@ -853,7 +853,38 @@ public class VoiceInteractionManagerService extends SystemService { PackageMonitor mPackageMonitor = new PackageMonitor() { @Override public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) { return super.onHandleForceStop(intent, packages, uid, doit); if (DEBUG) Slog.d(TAG, "onHandleForceStop uid=" + uid + " doit=" + doit); int userHandle = UserHandle.getUserId(uid); ComponentName curInteractor = getCurInteractor(userHandle); ComponentName curRecognizer = getCurRecognizer(userHandle); boolean hit = false; for (String pkg : packages) { if (curInteractor != null && pkg.equals(curInteractor.getPackageName())) { hit = true; break; } else if (curRecognizer != null && pkg.equals(curRecognizer.getPackageName())) { hit = true; break; } } if (hit && doit) { // The user is force stopping our current interactor/recognizer. // Clear the current settings and restore default state. synchronized (VoiceInteractionManagerService.this) { mSoundTriggerHelper.stopAllRecognitions(); if (mImpl != null) { mImpl.shutdownLocked(); mImpl = null; } setCurInteractor(null, userHandle); setCurRecognizer(null, userHandle); initForUser(userHandle); switchImplementationIfNeededLocked(true); } } return hit; } @Override Loading @@ -865,6 +896,7 @@ public class VoiceInteractionManagerService extends SystemService { int userHandle = getChangingUserId(); if (DEBUG) Slog.d(TAG, "onSomePackagesChanged user=" + userHandle); synchronized (VoiceInteractionManagerService.this) { ComponentName curInteractor = getCurInteractor(userHandle); ComponentName curRecognizer = getCurRecognizer(userHandle); if (curRecognizer == null) { Loading Loading @@ -912,6 +944,7 @@ public class VoiceInteractionManagerService extends SystemService { userHandle), userHandle); } } } }; } }