Loading services/contextualsearch/java/com/android/server/contextualsearch/ContextualSearchManagerService.java +18 −5 Original line number Original line Diff line number Diff line Loading @@ -466,12 +466,25 @@ public class ContextualSearchManagerService extends SystemService { issueToken(); issueToken(); Bundle bundle = new Bundle(); Bundle bundle = new Bundle(); bundle.putParcelable(ContextualSearchManager.EXTRA_TOKEN, mToken); bundle.putParcelable(ContextualSearchManager.EXTRA_TOKEN, mToken); // We get take the screenshot with the system server's identity because the system // server has READ_FRAME_BUFFER permission to get the screenshot. Binder.withCleanCallingIdentity(() -> { if (mWmInternal != null) { bundle.putParcelable(ContextualSearchManager.EXTRA_SCREENSHOT, mWmInternal.takeAssistScreenshot(Set.of( TYPE_STATUS_BAR, TYPE_NAVIGATION_BAR, TYPE_NAVIGATION_BAR_PANEL, TYPE_POINTER)) .asBitmap().asShared()); } try { try { callback.onResult( callback.onResult( new ContextualSearchState(null, null, bundle)); new ContextualSearchState(null, null, bundle)); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Error invoking ContextualSearchCallback", e); Log.e(TAG, "Error invoking ContextualSearchCallback", e); } } }); } } synchronized (mLock) { synchronized (mLock) { mStateCallback = callback; mStateCallback = callback; Loading Loading
services/contextualsearch/java/com/android/server/contextualsearch/ContextualSearchManagerService.java +18 −5 Original line number Original line Diff line number Diff line Loading @@ -466,12 +466,25 @@ public class ContextualSearchManagerService extends SystemService { issueToken(); issueToken(); Bundle bundle = new Bundle(); Bundle bundle = new Bundle(); bundle.putParcelable(ContextualSearchManager.EXTRA_TOKEN, mToken); bundle.putParcelable(ContextualSearchManager.EXTRA_TOKEN, mToken); // We get take the screenshot with the system server's identity because the system // server has READ_FRAME_BUFFER permission to get the screenshot. Binder.withCleanCallingIdentity(() -> { if (mWmInternal != null) { bundle.putParcelable(ContextualSearchManager.EXTRA_SCREENSHOT, mWmInternal.takeAssistScreenshot(Set.of( TYPE_STATUS_BAR, TYPE_NAVIGATION_BAR, TYPE_NAVIGATION_BAR_PANEL, TYPE_POINTER)) .asBitmap().asShared()); } try { try { callback.onResult( callback.onResult( new ContextualSearchState(null, null, bundle)); new ContextualSearchState(null, null, bundle)); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Error invoking ContextualSearchCallback", e); Log.e(TAG, "Error invoking ContextualSearchCallback", e); } } }); } } synchronized (mLock) { synchronized (mLock) { mStateCallback = callback; mStateCallback = callback; Loading