Loading services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +13 −6 Original line number Original line Diff line number Diff line Loading @@ -1053,15 +1053,22 @@ public class VoiceInteractionManagerService extends SystemService { if (sessionArgs != null && sessionArgs.containsKey(csKey)) { if (sessionArgs != null && sessionArgs.containsKey(csKey)) { if (sessionArgs.getBoolean(csEnabledKey, true)) { if (sessionArgs.getBoolean(csEnabledKey, true)) { // If Contextual Search is enabled, try to follow that path. // If Contextual Search is enabled, try to follow that path. Intent launchIntent = getContextualSearchIntent(sessionArgs); Intent launchIntent; final long getSearchIntentCaller = Binder.clearCallingIdentity(); try { launchIntent = getContextualSearchIntent(sessionArgs); } finally { Binder.restoreCallingIdentity(getSearchIntentCaller); } if (launchIntent != null) { if (launchIntent != null) { // Hand over to contextual search helper. // Hand over to contextual search helper. Slog.d(TAG, "Handed over to contextual search helper."); Slog.d(TAG, "Handed over to contextual search helper."); final long caller = Binder.clearCallingIdentity(); final int userId = Binder.getCallingUserHandle().getIdentifier(); final long startSearchCaller = Binder.clearCallingIdentity(); try { try { return startContextualSearch(launchIntent); return startContextualSearch(launchIntent, userId); } finally { } finally { Binder.restoreCallingIdentity(caller); Binder.restoreCallingIdentity(startSearchCaller); } } } } } } Loading Loading @@ -2762,7 +2769,7 @@ public class VoiceInteractionManagerService extends SystemService { } } @RequiresPermission(android.Manifest.permission.START_TASKS_FROM_RECENTS) @RequiresPermission(android.Manifest.permission.START_TASKS_FROM_RECENTS) private boolean startContextualSearch(Intent launchIntent) { private boolean startContextualSearch(Intent launchIntent, final int userId) { // Contextual search starts with a frozen screen - so we launch without // Contextual search starts with a frozen screen - so we launch without // any system animations or starting window. // any system animations or starting window. final ActivityOptions opts = ActivityOptions.makeCustomTaskAnimation(mContext, final ActivityOptions opts = ActivityOptions.makeCustomTaskAnimation(mContext, Loading @@ -2770,7 +2777,7 @@ public class VoiceInteractionManagerService extends SystemService { opts.setDisableStartingWindow(true); opts.setDisableStartingWindow(true); int resultCode = mAtmInternal.startActivityWithScreenshot(launchIntent, int resultCode = mAtmInternal.startActivityWithScreenshot(launchIntent, mContext.getPackageName(), Binder.getCallingUid(), Binder.getCallingPid(), null, mContext.getPackageName(), Binder.getCallingUid(), Binder.getCallingPid(), null, opts.toBundle(), Binder.getCallingUserHandle().getIdentifier()); opts.toBundle(), userId); return resultCode == ActivityManager.START_SUCCESS; return resultCode == ActivityManager.START_SUCCESS; } } Loading Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +13 −6 Original line number Original line Diff line number Diff line Loading @@ -1053,15 +1053,22 @@ public class VoiceInteractionManagerService extends SystemService { if (sessionArgs != null && sessionArgs.containsKey(csKey)) { if (sessionArgs != null && sessionArgs.containsKey(csKey)) { if (sessionArgs.getBoolean(csEnabledKey, true)) { if (sessionArgs.getBoolean(csEnabledKey, true)) { // If Contextual Search is enabled, try to follow that path. // If Contextual Search is enabled, try to follow that path. Intent launchIntent = getContextualSearchIntent(sessionArgs); Intent launchIntent; final long getSearchIntentCaller = Binder.clearCallingIdentity(); try { launchIntent = getContextualSearchIntent(sessionArgs); } finally { Binder.restoreCallingIdentity(getSearchIntentCaller); } if (launchIntent != null) { if (launchIntent != null) { // Hand over to contextual search helper. // Hand over to contextual search helper. Slog.d(TAG, "Handed over to contextual search helper."); Slog.d(TAG, "Handed over to contextual search helper."); final long caller = Binder.clearCallingIdentity(); final int userId = Binder.getCallingUserHandle().getIdentifier(); final long startSearchCaller = Binder.clearCallingIdentity(); try { try { return startContextualSearch(launchIntent); return startContextualSearch(launchIntent, userId); } finally { } finally { Binder.restoreCallingIdentity(caller); Binder.restoreCallingIdentity(startSearchCaller); } } } } } } Loading Loading @@ -2762,7 +2769,7 @@ public class VoiceInteractionManagerService extends SystemService { } } @RequiresPermission(android.Manifest.permission.START_TASKS_FROM_RECENTS) @RequiresPermission(android.Manifest.permission.START_TASKS_FROM_RECENTS) private boolean startContextualSearch(Intent launchIntent) { private boolean startContextualSearch(Intent launchIntent, final int userId) { // Contextual search starts with a frozen screen - so we launch without // Contextual search starts with a frozen screen - so we launch without // any system animations or starting window. // any system animations or starting window. final ActivityOptions opts = ActivityOptions.makeCustomTaskAnimation(mContext, final ActivityOptions opts = ActivityOptions.makeCustomTaskAnimation(mContext, Loading @@ -2770,7 +2777,7 @@ public class VoiceInteractionManagerService extends SystemService { opts.setDisableStartingWindow(true); opts.setDisableStartingWindow(true); int resultCode = mAtmInternal.startActivityWithScreenshot(launchIntent, int resultCode = mAtmInternal.startActivityWithScreenshot(launchIntent, mContext.getPackageName(), Binder.getCallingUid(), Binder.getCallingPid(), null, mContext.getPackageName(), Binder.getCallingUid(), Binder.getCallingPid(), null, opts.toBundle(), Binder.getCallingUserHandle().getIdentifier()); opts.toBundle(), userId); return resultCode == ActivityManager.START_SUCCESS; return resultCode == ActivityManager.START_SUCCESS; } } Loading