Merge "Launch voice-based searches as current user"

This commit is contained in:
Jean-Michel Trivi
2013-07-23 16:20:25 +00:00
committed by Android (Google) Code Review

View File

@@ -822,15 +822,17 @@ public class MediaFocusControl implements OnFinished {
if (needWakeLock) {
mMediaEventWakeLock.acquire();
}
final long identity = Binder.clearCallingIdentity();
try {
if (voiceIntent != null) {
voiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
mContext.startActivity(voiceIntent);
mContext.startActivityAsUser(voiceIntent, UserHandle.CURRENT);
}
} catch (ActivityNotFoundException e) {
Log.w(TAG, "No activity for search: " + e);
} finally {
Binder.restoreCallingIdentity(identity);
if (needWakeLock) {
mMediaEventWakeLock.release();
}