diff options
29 files changed, 963 insertions, 85 deletions
diff --git a/Android.bp b/Android.bp index 1c59e2b2cd03..415eff3db7d7 100644 --- a/Android.bp +++ b/Android.bp @@ -368,6 +368,7 @@ java_defaults { "core/java/com/android/internal/app/IAppOpsService.aidl", "core/java/com/android/internal/app/IBatteryStats.aidl", "core/java/com/android/internal/app/ISoundTriggerService.aidl", + "core/java/com/android/internal/app/IVoiceActionCheckCallback.aidl", "core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl", "core/java/com/android/internal/app/IVoiceInteractionSessionListener.aidl", "core/java/com/android/internal/app/IVoiceInteractionSessionShowCallback.aidl", diff --git a/api/current.txt b/api/current.txt index 90ceee61108e..6042b2fa4c32 100755 --- a/api/current.txt +++ b/api/current.txt @@ -39928,6 +39928,7 @@ package android.service.voice { method public int getDisabledShowContext(); method public static boolean isActiveService(android.content.Context, android.content.ComponentName); method public android.os.IBinder onBind(android.content.Intent); + method public java.util.Set<java.lang.String> onGetSupportedVoiceActions(java.util.Set<java.lang.String>); method public void onLaunchVoiceAssistFromKeyguard(); method public void onReady(); method public void onShutdown(); diff --git a/core/java/android/service/autofill/FillCallback.java b/core/java/android/service/autofill/FillCallback.java index 663bdcb707c9..3893f2a6033d 100644 --- a/core/java/android/service/autofill/FillCallback.java +++ b/core/java/android/service/autofill/FillCallback.java @@ -43,13 +43,20 @@ public final class FillCallback { } /** - * Notifies the Android System that an - * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, - * FillCallback)} was successfully fulfilled by the service. + * Notifies the Android System that a fill request + * ({@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, + * FillCallback)}) was successfully fulfilled by the service. + * + * <p>This method should always be called, even if the service doesn't have the heuristics to + * fulfill the request (in which case it should be called with {@code null}). + * + * <p>See the main {@link AutofillService} documentation for more details and examples. + * + * @param response autofill information for that activity, or {@code null} when the service + * cannot autofill the activity. * - * @param response autofill information for that activity, or {@code null} when the activity - * cannot be autofilled (for example, if it only contains read-only fields). See - * {@link FillResponse} for examples. + * @throws IllegalStateException if this method or {@link #onFailure(CharSequence)} was already + * called. */ public void onSuccess(@Nullable FillResponse response) { assertNotCalled(); @@ -67,11 +74,25 @@ public final class FillCallback { } /** - * Notifies the Android System that an + * Notifies the Android System that a fill request ( * {@link AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, - * FillCallback)} could not be fulfilled by the service. + * FillCallback)}) could not be fulfilled by the service (for example, because the user data was + * not available yet), so the request could be retried later. + * + * <p><b>Note: </b>this method should not be used when the service didn't have the heursitics to + * fulfill the request; in this case, the service should call {@link #onSuccess(FillResponse) + * onSuccess(null)} instead. + * + * <p><b>Note: </b>on Android versions up to {@link android.os.Build.VERSION_CODES#P}, this + * method is not working as intended, and the service should call + * {@link #onSuccess(FillResponse) onSuccess(null)} instead. + * + * @param message error message to be displayed to the user. <b>Note: </b> this message is + * displayed on {@code logcat} logs and should not contain PII (Personally Identifiable + * Information, such as username or email address). * - * @param message error message to be displayed to the user. + * @throws IllegalStateException if this method or {@link #onSuccess(FillResponse)} was already + * called. */ public void onFailure(@Nullable CharSequence message) { Log.w(TAG, "onFailure(): " + (message == null ? null : message.length() + "_chars")); diff --git a/core/java/android/service/autofill/SaveCallback.java b/core/java/android/service/autofill/SaveCallback.java index e252e96f3fb4..0625095cfe3f 100644 --- a/core/java/android/service/autofill/SaveCallback.java +++ b/core/java/android/service/autofill/SaveCallback.java @@ -45,6 +45,9 @@ public final class SaveCallback { * Notifies the Android System that an * {@link AutofillService#onSaveRequest(SaveRequest, SaveCallback)} was successfully handled * by the service. + * + * @throws IllegalStateException if this method, {@link #onSuccess(IntentSender)}, or + * {@link #onFailure(CharSequence)} was already called. */ public void onSuccess() { onSuccessInternal(null); @@ -62,6 +65,9 @@ public final class SaveCallback { * * @param intentSender intent that will be launched from the context of activity being * autofilled. + * + * @throws IllegalStateException if this method, {@link #onSuccess()}, + * or {@link #onFailure(CharSequence)} was already called. */ public void onSuccess(@NonNull IntentSender intentSender) { onSuccessInternal(Preconditions.checkNotNull(intentSender)); @@ -90,7 +96,12 @@ public final class SaveCallback { * you prefer to show your own message, call {@link #onSuccess()} or * {@link #onSuccess(IntentSender)} instead. * - * @param message error message to be displayed to the user. + * @param message error message to be displayed to the user. <b>Note: </b> this message is + * displayed on {@code logcat} logs and should not contain PII (Personally Identifiable + * Information, such as username or email address). + * + * @throws IllegalStateException if this method, {@link #onSuccess()}, + * or {@link #onSuccess(IntentSender)} was already called. */ public void onFailure(CharSequence message) { Log.w(TAG, "onFailure(): " + (message == null ? null : message.length() + "_chars")); diff --git a/core/java/android/service/voice/IVoiceInteractionService.aidl b/core/java/android/service/voice/IVoiceInteractionService.aidl index e3d68a6cbd8b..24819a6785fb 100644 --- a/core/java/android/service/voice/IVoiceInteractionService.aidl +++ b/core/java/android/service/voice/IVoiceInteractionService.aidl @@ -16,6 +16,8 @@ package android.service.voice; +import com.android.internal.app.IVoiceActionCheckCallback; + /** * @hide */ @@ -24,4 +26,6 @@ oneway interface IVoiceInteractionService { void soundModelsChanged(); void shutdown(); void launchVoiceAssistFromKeyguard(); + void getActiveServiceSupportedActions(in List<String> voiceActions, + in IVoiceActionCheckCallback callback); } diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java index 0bbc07e8063e..e105fdf6cfb8 100644 --- a/core/java/android/service/voice/VoiceInteractionService.java +++ b/core/java/android/service/voice/VoiceInteractionService.java @@ -16,6 +16,8 @@ package android.service.voice; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.SdkConstant; import android.annotation.UnsupportedAppUsage; import android.app.Service; @@ -26,17 +28,22 @@ import android.hardware.soundtrigger.KeyphraseEnrollmentInfo; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; -import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; import android.provider.Settings; +import android.util.ArraySet; import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.app.IVoiceActionCheckCallback; import com.android.internal.app.IVoiceInteractionManagerService; +import com.android.internal.util.function.pooled.PooledLambda; import java.io.FileDescriptor; import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; import java.util.Locale; +import java.util.Set; /** * Top-level service of the current global voice interactor, which is providing @@ -71,22 +78,42 @@ public class VoiceInteractionService extends Service { public static final String SERVICE_META_DATA = "android.voice_interaction"; IVoiceInteractionService mInterface = new IVoiceInteractionService.Stub() { - @Override public void ready() { - mHandler.sendEmptyMessage(MSG_READY); + @Override + public void ready() { + Handler.getMain().executeOrSendMessage(PooledLambda.obtainMessage( + VoiceInteractionService::onReady, VoiceInteractionService.this)); } - @Override public void shutdown() { - mHandler.sendEmptyMessage(MSG_SHUTDOWN); + + @Override + public void shutdown() { + Handler.getMain().executeOrSendMessage(PooledLambda.obtainMessage( + VoiceInteractionService::onShutdownInternal, VoiceInteractionService.this)); } - @Override public void soundModelsChanged() { - mHandler.sendEmptyMessage(MSG_SOUND_MODELS_CHANGED); + + @Override + public void soundModelsChanged() { + Handler.getMain().executeOrSendMessage(PooledLambda.obtainMessage( + VoiceInteractionService::onSoundModelsChangedInternal, + VoiceInteractionService.this)); } + @Override - public void launchVoiceAssistFromKeyguard() throws RemoteException { - mHandler.sendEmptyMessage(MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD); + public void launchVoiceAssistFromKeyguard() { + Handler.getMain().executeOrSendMessage(PooledLambda.obtainMessage( + VoiceInteractionService::onLaunchVoiceAssistFromKeyguard, + VoiceInteractionService.this)); } - }; - MyHandler mHandler; + @Override + public void getActiveServiceSupportedActions(List<String> voiceActions, + IVoiceActionCheckCallback callback) { + Handler.getMain().executeOrSendMessage( + PooledLambda.obtainMessage(VoiceInteractionService::onHandleVoiceActionCheck, + VoiceInteractionService.this, + voiceActions, + callback)); + } + }; IVoiceInteractionManagerService mSystemService; @@ -96,33 +123,6 @@ public class VoiceInteractionService extends Service { private AlwaysOnHotwordDetector mHotwordDetector; - static final int MSG_READY = 1; - static final int MSG_SHUTDOWN = 2; - static final int MSG_SOUND_MODELS_CHANGED = 3; - static final int MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD = 4; - - class MyHandler extends Handler { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_READY: - onReady(); - break; - case MSG_SHUTDOWN: - onShutdownInternal(); - break; - case MSG_SOUND_MODELS_CHANGED: - onSoundModelsChangedInternal(); - break; - case MSG_LAUNCH_VOICE_ASSIST_FROM_KEYGUARD: - onLaunchVoiceAssistFromKeyguard(); - break; - default: - super.handleMessage(msg); - } - } - } - /** * Called when a user has activated an affordance to launch voice assist from the Keyguard. * @@ -186,7 +186,7 @@ public class VoiceInteractionService extends Service { * be any combination of * {@link VoiceInteractionSession#SHOW_WITH_ASSIST VoiceInteractionSession.SHOW_WITH_ASSIST} and * {@link VoiceInteractionSession#SHOW_WITH_SCREENSHOT - * VoiceInteractionSession.SHOW_WITH_SCREENSHOT} + * VoiceInteractionSession.SHOW_WITH_SCREENSHOT} * to request that the system generate and deliver assist data on the current foreground * app as part of showing the session UI. */ @@ -200,10 +200,22 @@ public class VoiceInteractionService extends Service { } } - @Override - public void onCreate() { - super.onCreate(); - mHandler = new MyHandler(); + /** + * Request to query for what extended voice actions this service supports. This method will + * be called when the system checks the supported actions of this + * {@link VoiceInteractionService}. Supported actions may be delivered to + * {@link VoiceInteractionSession} later to request a session to perform an action. + * + * <p>Voice actions are defined in support libraries and could vary based on platform context. + * For example, car related voice actions will be defined in car support libraries. + * + * @param voiceActions A set of checked voice actions. + * @return Returns a subset of checked voice actions. Additional voice actions in the + * returned set will be ignored. Returns null or empty set if no actions are supported. + */ + @Nullable + public Set<String> onGetSupportedVoiceActions(@NonNull Set<String> voiceActions) { + return null; } @Override @@ -254,6 +266,18 @@ public class VoiceInteractionService extends Service { } } + private void onHandleVoiceActionCheck(List<String> voiceActions, + IVoiceActionCheckCallback callback) { + if (callback != null) { + try { + Set<String> voiceActionsSet = new ArraySet<>(voiceActions); + Set<String> resultSet = onGetSupportedVoiceActions(voiceActionsSet); + callback.onComplete(resultSet == null ? null : new ArrayList<>(resultSet)); + } catch (RemoteException e) { + } + } + } + /** * Creates an {@link AlwaysOnHotwordDetector} for the given keyphrase and locale. * This instance must be retained and used by the client. @@ -289,12 +313,12 @@ public class VoiceInteractionService extends Service { } /** - * Checks if a given keyphrase and locale are supported to create an - * {@link AlwaysOnHotwordDetector}. - * - * @return true if the keyphrase and locale combination is supported, false otherwise. - * @hide - */ + * Checks if a given keyphrase and locale are supported to create an + * {@link AlwaysOnHotwordDetector}. + * + * @return true if the keyphrase and locale combination is supported, false otherwise. + * @hide + */ @UnsupportedAppUsage public final boolean isKeyphraseAndLocaleSupportedForHotword(String keyphrase, Locale locale) { if (mKeyphraseEnrollmentInfo == null) { diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 2f677f976e33..be50dd1f1448 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1348,6 +1348,10 @@ public final class InputMethodManager { mServedView.getWindowToken() == appWindowToken) { finishInputLocked(); } + if (mCurRootView != null && + mCurRootView.getWindowToken() == appWindowToken) { + mCurRootView = null; + } } } diff --git a/core/java/com/android/internal/app/AssistUtils.java b/core/java/com/android/internal/app/AssistUtils.java index 9171959537c8..0f8295ac5868 100644 --- a/core/java/com/android/internal/app/AssistUtils.java +++ b/core/java/com/android/internal/app/AssistUtils.java @@ -16,8 +16,7 @@ package com.android.internal.app; -import com.android.internal.R; - +import android.annotation.NonNull; import android.app.SearchManager; import android.content.ComponentName; import android.content.Context; @@ -32,6 +31,9 @@ import android.os.ServiceManager; import android.provider.Settings; import android.util.Log; +import java.util.ArrayList; +import java.util.Set; + /** * Utility method for dealing with the assistant aspects of * {@link com.android.internal.app.IVoiceInteractionManagerService IVoiceInteractionManagerService}. @@ -62,6 +64,30 @@ public class AssistUtils { return false; } + /** + * Checks the availability of a set of voice actions for the current active voice service. + * + * @param voiceActions A set of supported voice actions to be checked. + * @param callback The callback which will deliver a set of supported voice actions. If + * no voice actions are supported for the given voice action set, then null + * or empty set is provided. + */ + public void getActiveServiceSupportedActions(@NonNull Set<String> voiceActions, + @NonNull IVoiceActionCheckCallback callback) { + try { + if (mVoiceInteractionManagerService != null) { + mVoiceInteractionManagerService + .getActiveServiceSupportedActions(new ArrayList<>(voiceActions), callback); + } + } catch (RemoteException e) { + Log.w(TAG, "Failed to call activeServiceSupportedActions", e); + try { + callback.onComplete(null); + } catch (RemoteException re) { + } + } + } + public void launchVoiceAssistFromKeyguard() { try { if (mVoiceInteractionManagerService != null) { @@ -157,7 +183,7 @@ public class AssistUtils { return getActiveServiceComponentName(); } final SearchManager searchManager = - (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); + (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); if (searchManager == null) { return null; } diff --git a/core/java/com/android/internal/app/IVoiceActionCheckCallback.aidl b/core/java/com/android/internal/app/IVoiceActionCheckCallback.aidl new file mode 100644 index 000000000000..66ba93d73483 --- /dev/null +++ b/core/java/com/android/internal/app/IVoiceActionCheckCallback.aidl @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.app; + +oneway interface IVoiceActionCheckCallback { + void onComplete(in List<String> voiceActions); +} diff --git a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl index ff75a8b5fea4..5088ccae5c1f 100644 --- a/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl +++ b/core/java/com/android/internal/app/IVoiceInteractionManagerService.aidl @@ -20,6 +20,7 @@ import android.content.ComponentName; import android.content.Intent; import android.os.Bundle; +import com.android.internal.app.IVoiceActionCheckCallback; import com.android.internal.app.IVoiceInteractionSessionShowCallback; import com.android.internal.app.IVoiceInteractor; import com.android.internal.app.IVoiceInteractionSessionListener; @@ -143,4 +144,11 @@ interface IVoiceInteractionManagerService { * Register a voice interaction listener. */ void registerVoiceInteractionSessionListener(IVoiceInteractionSessionListener listener); + + /** + * Checks the availability of a set of voice actions for the current active voice service. + * Returns all supported voice actions. + */ + void getActiveServiceSupportedActions(in List<String> voiceActions, + in IVoiceActionCheckCallback callback); } diff --git a/data/keyboards/Vendor_054c_Product_0268.kl b/data/keyboards/Vendor_054c_Product_0268.kl index 522db3c9235e..b463dd84e75b 100644 --- a/data/keyboards/Vendor_054c_Product_0268.kl +++ b/data/keyboards/Vendor_054c_Product_0268.kl @@ -21,8 +21,6 @@ key 0x125 DPAD_RIGHT key 0x126 DPAD_DOWN key 0x127 DPAD_LEFT -key 0x120 BUTTON_SELECT -key 0x123 BUTTON_START key 0x12e BUTTON_A key 0x12d BUTTON_B key 0x12f BUTTON_X @@ -34,9 +32,6 @@ key 0x129 BUTTON_R2 key 0x121 BUTTON_THUMBL key 0x122 BUTTON_THUMBR -# PS key -key 0x2d0 BUTTON_MODE - # Left Analog Stick axis 0x00 X axis 0x01 Y @@ -74,3 +69,11 @@ axis 0x31 RTRIGGER # Square # axis 0x37 + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Select +key 0x120 BUTTON_SELECT +# Start +key 0x123 BUTTON_START +# PS key +key 0x2d0 BUTTON_MODE diff --git a/data/keyboards/Vendor_054c_Product_0268_Version_8000.kl b/data/keyboards/Vendor_054c_Product_0268_Version_8000.kl new file mode 100644 index 000000000000..3d93f0fec800 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_0268_Version_8000.kl @@ -0,0 +1,57 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R)3 Controller +# - Version 0x8000 and 0x8100 are for Linux hid-sony driver >=4.12 +# and when connected over Bluetooth +# + +key 0x220 DPAD_UP +key 0x223 DPAD_RIGHT +key 0x221 DPAD_DOWN +key 0x222 DPAD_LEFT + +key 0x130 BUTTON_A +key 0x131 BUTTON_B +key 0x134 BUTTON_X +key 0x133 BUTTON_Y +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 +key 0x13d BUTTON_THUMBL +key 0x13e BUTTON_THUMBR + +# left Analog Stick +axis 0x00 X +axis 0x01 Y + +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# L2 trigger +axis 0x02 LTRIGGER + +# R2 trigger +axis 0x05 RTRIGGER + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Select +key 0x13a BUTTON_SELECT +# Start +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE diff --git a/data/keyboards/Vendor_054c_Product_0268_Version_8100.kl b/data/keyboards/Vendor_054c_Product_0268_Version_8100.kl new file mode 100644 index 000000000000..3d93f0fec800 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_0268_Version_8100.kl @@ -0,0 +1,57 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R)3 Controller +# - Version 0x8000 and 0x8100 are for Linux hid-sony driver >=4.12 +# and when connected over Bluetooth +# + +key 0x220 DPAD_UP +key 0x223 DPAD_RIGHT +key 0x221 DPAD_DOWN +key 0x222 DPAD_LEFT + +key 0x130 BUTTON_A +key 0x131 BUTTON_B +key 0x134 BUTTON_X +key 0x133 BUTTON_Y +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 +key 0x13d BUTTON_THUMBL +key 0x13e BUTTON_THUMBR + +# left Analog Stick +axis 0x00 X +axis 0x01 Y + +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# L2 trigger +axis 0x02 LTRIGGER + +# R2 trigger +axis 0x05 RTRIGGER + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Select +key 0x13a BUTTON_SELECT +# Start +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE diff --git a/data/keyboards/Vendor_054c_Product_0268_Version_8111.kl b/data/keyboards/Vendor_054c_Product_0268_Version_8111.kl new file mode 100644 index 000000000000..5fe35f7faefa --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_0268_Version_8111.kl @@ -0,0 +1,57 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R)3 Controller +# - Version 0x8111 is for Linux hid-sony driver >=4.12 and when +# connected over USB +# + +key 0x220 DPAD_UP +key 0x223 DPAD_RIGHT +key 0x221 DPAD_DOWN +key 0x222 DPAD_LEFT + +key 0x130 BUTTON_A +key 0x131 BUTTON_B +key 0x134 BUTTON_X +key 0x133 BUTTON_Y +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 +key 0x13d BUTTON_THUMBL +key 0x13e BUTTON_THUMBR + +# left Analog Stick +axis 0x00 X +axis 0x01 Y + +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# L2 trigger +axis 0x02 LTRIGGER + +# R2 trigger +axis 0x05 RTRIGGER + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Select +key 0x13a BUTTON_SELECT +# Start +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE diff --git a/data/keyboards/Vendor_054c_Product_05c4.kl b/data/keyboards/Vendor_054c_Product_05c4.kl index a1284a49dad6..cd7ab1faec2e 100644 --- a/data/keyboards/Vendor_054c_Product_05c4.kl +++ b/data/keyboards/Vendor_054c_Product_05c4.kl @@ -60,7 +60,6 @@ axis 0x11 HAT_Y key 0x138 BUTTON_SELECT # Options key 0x139 BUTTON_START - # PS key key 0x13c BUTTON_MODE diff --git a/data/keyboards/Vendor_054c_Product_05c4_Version_8000.kl b/data/keyboards/Vendor_054c_Product_05c4_Version_8000.kl new file mode 100644 index 000000000000..19fcb86eb403 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_05c4_Version_8000.kl @@ -0,0 +1,68 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualShock 4 Controller +# - Version 0x8000 and 0x8100 are for Linux hid-sony driver >=4.10 +# and when connected over Bluetooth +# + + +# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html + +# Square +key 0x134 BUTTON_X +# Cross +key 0x130 BUTTON_A +# Circle +key 0x131 BUTTON_B +# Triangle +key 0x133 BUTTON_Y + +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 + +# L2 axis +axis 0x02 LTRIGGER +# R2 axis +axis 0x05 RTRIGGER + +# Left Analog Stick +axis 0x00 X +axis 0x01 Y +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# Left stick click +key 0x13d BUTTON_THUMBL +# Right stick click +key 0x13e BUTTON_THUMBR + +# Hat +axis 0x10 HAT_X +axis 0x11 HAT_Y + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Share +key 0x13a BUTTON_SELECT +# Options +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE + +# In kernel versions >= 4.10, the touchpad is a separate input device, +# so the touchpad button click will not be covered by this layout. diff --git a/data/keyboards/Vendor_054c_Product_05c4_Version_8100.kl b/data/keyboards/Vendor_054c_Product_05c4_Version_8100.kl new file mode 100644 index 000000000000..19fcb86eb403 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_05c4_Version_8100.kl @@ -0,0 +1,68 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualShock 4 Controller +# - Version 0x8000 and 0x8100 are for Linux hid-sony driver >=4.10 +# and when connected over Bluetooth +# + + +# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html + +# Square +key 0x134 BUTTON_X +# Cross +key 0x130 BUTTON_A +# Circle +key 0x131 BUTTON_B +# Triangle +key 0x133 BUTTON_Y + +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 + +# L2 axis +axis 0x02 LTRIGGER +# R2 axis +axis 0x05 RTRIGGER + +# Left Analog Stick +axis 0x00 X +axis 0x01 Y +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# Left stick click +key 0x13d BUTTON_THUMBL +# Right stick click +key 0x13e BUTTON_THUMBR + +# Hat +axis 0x10 HAT_X +axis 0x11 HAT_Y + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Share +key 0x13a BUTTON_SELECT +# Options +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE + +# In kernel versions >= 4.10, the touchpad is a separate input device, +# so the touchpad button click will not be covered by this layout. diff --git a/data/keyboards/Vendor_054c_Product_05c4_Version_8111.kl b/data/keyboards/Vendor_054c_Product_05c4_Version_8111.kl new file mode 100644 index 000000000000..d38bdec5dada --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_05c4_Version_8111.kl @@ -0,0 +1,68 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualShock 4 Controller +# - Version 0x8111 is for Linux hid-sony driver >=4.10 and when +# connected over USB +# + + +# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html + +# Square +key 0x134 BUTTON_X +# Cross +key 0x130 BUTTON_A +# Circle +key 0x131 BUTTON_B +# Triangle +key 0x133 BUTTON_Y + +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 + +# L2 axis +axis 0x02 LTRIGGER +# R2 axis +axis 0x05 RTRIGGER + +# Left Analog Stick +axis 0x00 X +axis 0x01 Y +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# Left stick click +key 0x13d BUTTON_THUMBL +# Right stick click +key 0x13e BUTTON_THUMBR + +# Hat +axis 0x10 HAT_X +axis 0x11 HAT_Y + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Share +key 0x13a BUTTON_SELECT +# Options +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE + +# In kernel versions >= 4.10, the touchpad is a separate input device, +# so the touchpad button click will not be covered by this layout. diff --git a/data/keyboards/Vendor_054c_Product_09cc.kl b/data/keyboards/Vendor_054c_Product_09cc.kl index a1284a49dad6..cd7ab1faec2e 100644 --- a/data/keyboards/Vendor_054c_Product_09cc.kl +++ b/data/keyboards/Vendor_054c_Product_09cc.kl @@ -60,7 +60,6 @@ axis 0x11 HAT_Y key 0x138 BUTTON_SELECT # Options key 0x139 BUTTON_START - # PS key key 0x13c BUTTON_MODE diff --git a/data/keyboards/Vendor_054c_Product_09cc_Version_8000.kl b/data/keyboards/Vendor_054c_Product_09cc_Version_8000.kl new file mode 100644 index 000000000000..19fcb86eb403 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_09cc_Version_8000.kl @@ -0,0 +1,68 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualShock 4 Controller +# - Version 0x8000 and 0x8100 are for Linux hid-sony driver >=4.10 +# and when connected over Bluetooth +# + + +# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html + +# Square +key 0x134 BUTTON_X +# Cross +key 0x130 BUTTON_A +# Circle +key 0x131 BUTTON_B +# Triangle +key 0x133 BUTTON_Y + +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 + +# L2 axis +axis 0x02 LTRIGGER +# R2 axis +axis 0x05 RTRIGGER + +# Left Analog Stick +axis 0x00 X +axis 0x01 Y +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# Left stick click +key 0x13d BUTTON_THUMBL +# Right stick click +key 0x13e BUTTON_THUMBR + +# Hat +axis 0x10 HAT_X +axis 0x11 HAT_Y + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Share +key 0x13a BUTTON_SELECT +# Options +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE + +# In kernel versions >= 4.10, the touchpad is a separate input device, +# so the touchpad button click will not be covered by this layout. diff --git a/data/keyboards/Vendor_054c_Product_09cc_Version_8100.kl b/data/keyboards/Vendor_054c_Product_09cc_Version_8100.kl new file mode 100644 index 000000000000..19fcb86eb403 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_09cc_Version_8100.kl @@ -0,0 +1,68 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualShock 4 Controller +# - Version 0x8000 and 0x8100 are for Linux hid-sony driver >=4.10 +# and when connected over Bluetooth +# + + +# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html + +# Square +key 0x134 BUTTON_X +# Cross +key 0x130 BUTTON_A +# Circle +key 0x131 BUTTON_B +# Triangle +key 0x133 BUTTON_Y + +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 + +# L2 axis +axis 0x02 LTRIGGER +# R2 axis +axis 0x05 RTRIGGER + +# Left Analog Stick +axis 0x00 X +axis 0x01 Y +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# Left stick click +key 0x13d BUTTON_THUMBL +# Right stick click +key 0x13e BUTTON_THUMBR + +# Hat +axis 0x10 HAT_X +axis 0x11 HAT_Y + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Share +key 0x13a BUTTON_SELECT +# Options +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE + +# In kernel versions >= 4.10, the touchpad is a separate input device, +# so the touchpad button click will not be covered by this layout. diff --git a/data/keyboards/Vendor_054c_Product_09cc_Version_8111.kl b/data/keyboards/Vendor_054c_Product_09cc_Version_8111.kl new file mode 100644 index 000000000000..d38bdec5dada --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_09cc_Version_8111.kl @@ -0,0 +1,68 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualShock 4 Controller +# - Version 0x8111 is for Linux hid-sony driver >=4.10 and when +# connected over USB +# + + +# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html + +# Square +key 0x134 BUTTON_X +# Cross +key 0x130 BUTTON_A +# Circle +key 0x131 BUTTON_B +# Triangle +key 0x133 BUTTON_Y + +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 + +# L2 axis +axis 0x02 LTRIGGER +# R2 axis +axis 0x05 RTRIGGER + +# Left Analog Stick +axis 0x00 X +axis 0x01 Y +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# Left stick click +key 0x13d BUTTON_THUMBL +# Right stick click +key 0x13e BUTTON_THUMBR + +# Hat +axis 0x10 HAT_X +axis 0x11 HAT_Y + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Share +key 0x13a BUTTON_SELECT +# Options +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE + +# In kernel versions >= 4.10, the touchpad is a separate input device, +# so the touchpad button click will not be covered by this layout. diff --git a/data/keyboards/Vendor_054c_Product_0ba0.kl b/data/keyboards/Vendor_054c_Product_0ba0.kl new file mode 100644 index 000000000000..bc6fc3b5e455 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_0ba0.kl @@ -0,0 +1,70 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualShock 4 USB Dongle +# + + +# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html + +# Square +key 0x130 BUTTON_X +# Cross +key 0x131 BUTTON_A +# Circle +key 0x132 BUTTON_B +# Triangle +key 0x133 BUTTON_Y + +key 0x134 BUTTON_L1 +key 0x135 BUTTON_R1 +key 0x136 BUTTON_L2 +key 0x137 BUTTON_R2 + +# L2 axis +axis 0x03 LTRIGGER +# R2 axis +axis 0x04 RTRIGGER + + +# Left Analog Stick +axis 0x00 X +axis 0x01 Y +# Right Analog Stick +axis 0x02 Z +axis 0x05 RZ + +# Left stick click +key 0x13a BUTTON_THUMBL +# Right stick click +key 0x13b BUTTON_THUMBR + +# Hat +axis 0x10 HAT_X +axis 0x11 HAT_Y + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Share +key 0x138 BUTTON_SELECT +# Options +key 0x139 BUTTON_START +# PS key +key 0x13c BUTTON_MODE + +# Touchpad press +# The touchpad for this joystick will become a separate input device in future releases +# and this button will be equivalent to left mouse button +# Therefore, map it to KEYCODE_BUTTON_1 here to allow apps to still handle this on earlier versions +key 0x13d BUTTON_1 diff --git a/data/keyboards/Vendor_054c_Product_0ba0_Version_8111.kl b/data/keyboards/Vendor_054c_Product_0ba0_Version_8111.kl new file mode 100644 index 000000000000..8b85a38b4318 --- /dev/null +++ b/data/keyboards/Vendor_054c_Product_0ba0_Version_8111.kl @@ -0,0 +1,67 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Sony Playstation(R) DualShock 4 USB Dongle +# - Version 0x8111 is for Linux hid-sony driver >=4.10 +# + + +# Mapping according to https://developer.android.com/training/game-controllers/controller-input.html + +# Square +key 0x134 BUTTON_X +# Cross +key 0x130 BUTTON_A +# Circle +key 0x131 BUTTON_B +# Triangle +key 0x133 BUTTON_Y + +key 0x136 BUTTON_L1 +key 0x137 BUTTON_R1 +key 0x138 BUTTON_L2 +key 0x139 BUTTON_R2 + +# L2 axis +axis 0x02 LTRIGGER +# R2 axis +axis 0x05 RTRIGGER + +# Left Analog Stick +axis 0x00 X +axis 0x01 Y +# Right Analog Stick +axis 0x03 Z +axis 0x04 RZ + +# Left stick click +key 0x13d BUTTON_THUMBL +# Right stick click +key 0x13e BUTTON_THUMBR + +# Hat +axis 0x10 HAT_X +axis 0x11 HAT_Y + +# Mapping according to https://www.kernel.org/doc/Documentation/input/gamepad.txt +# Share +key 0x13a BUTTON_SELECT +# Options +key 0x13b BUTTON_START +# PS key +key 0x13c BUTTON_MODE + +# In kernel versions >= 4.10, the touchpad is a separate input device, +# so the touchpad button click will not be covered by this layout. diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp index e6d2a6f555ac..f2d50cd42523 100644 --- a/libs/hwui/JankTracker.cpp +++ b/libs/hwui/JankTracker.cpp @@ -146,7 +146,7 @@ void JankTracker::finishFrame(const FrameInfo& frame) { frame[FrameInfoIndex::IntendedVsync] + mFrameInterval); // If we hit the deadline, cool! - if (frame[FrameInfoIndex::FrameCompleted] < mSwapDeadline) { + if (frame[FrameInfoIndex::FrameCompleted] < mSwapDeadline || totalDuration < mFrameInterval) { if (isTripleBuffered) { mData->reportJankType(JankType::kHighInputLatency); (*mGlobalData)->reportJankType(JankType::kHighInputLatency); diff --git a/packages/SystemUI/res/layout/recents_onboarding.xml b/packages/SystemUI/res/layout/recents_onboarding.xml index adf1e742d08a..2538612db452 100644 --- a/packages/SystemUI/res/layout/recents_onboarding.xml +++ b/packages/SystemUI/res/layout/recents_onboarding.xml @@ -37,7 +37,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center_vertical" - android:textColor="@android:color/white" + android:textColor="?attr/wallpaperTextColor" android:textSize="16sp"/> <ImageView android:id="@+id/dismiss" @@ -49,6 +49,7 @@ android:layout_marginEnd="2dp" android:alpha="0.7" android:src="@drawable/ic_close_white" + android:tint="?attr/wallpaperTextColor" android:background="?android:attr/selectableItemBackgroundBorderless" android:contentDescription="@string/accessibility_desc_close"/> </LinearLayout> diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java index 380f6a7e581e..a69d41683c29 100644 --- a/services/core/java/com/android/server/IpSecService.java +++ b/services/core/java/com/android/server/IpSecService.java @@ -1490,23 +1490,19 @@ public class IpSecService extends IIpSecService.Stub { } } - private static final String TUNNEL_OP = "STOPSHIP"; // = AppOpsManager.OP_MANAGE_IPSEC_TUNNELS; + private static final String TUNNEL_OP = AppOpsManager.OPSTR_MANAGE_IPSEC_TUNNELS; private void enforceTunnelPermissions(String callingPackage) { checkNotNull(callingPackage, "Null calling package cannot create IpSec tunnels"); - if (false) { // STOPSHIP if this line is present - switch (getAppOpsManager().noteOp( - TUNNEL_OP, - Binder.getCallingUid(), callingPackage)) { - case AppOpsManager.MODE_DEFAULT: - mContext.enforceCallingOrSelfPermission( - android.Manifest.permission.MANAGE_IPSEC_TUNNELS, "IpSecService"); - break; - case AppOpsManager.MODE_ALLOWED: - return; - default: - throw new SecurityException("Request to ignore AppOps for non-legacy API"); - } + switch (getAppOpsManager().noteOp(TUNNEL_OP, Binder.getCallingUid(), callingPackage)) { + case AppOpsManager.MODE_DEFAULT: + mContext.enforceCallingOrSelfPermission( + android.Manifest.permission.MANAGE_IPSEC_TUNNELS, "IpSecService"); + break; + case AppOpsManager.MODE_ALLOWED: + return; + default: + throw new SecurityException("Request to ignore AppOps for non-legacy API"); } } diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java index c5d6dc7da5a7..99ad1f4d6b50 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerService.java @@ -19,6 +19,8 @@ package com.android.server.voiceinteraction; import android.Manifest; import android.app.ActivityManager; import android.app.ActivityManagerInternal; + +import com.android.internal.app.IVoiceActionCheckCallback; import com.android.server.wm.ActivityTaskManagerInternal; import android.app.AppGlobals; import android.content.ComponentName; @@ -1128,6 +1130,27 @@ public class VoiceInteractionManagerService extends SystemService { } } + @Override + public void getActiveServiceSupportedActions(List<String> voiceActions, + IVoiceActionCheckCallback callback) { + enforceCallingPermission(Manifest.permission.ACCESS_VOICE_INTERACTION_SERVICE); + synchronized (this) { + if (mImpl == null) { + try { + callback.onComplete(null); + } catch (RemoteException e) { + } + return; + } + final long caller = Binder.clearCallingIdentity(); + try { + mImpl.getActiveServiceSupportedActions(voiceActions, callback); + } finally { + Binder.restoreCallingIdentity(caller); + } + } + } + public void onSessionShown() { synchronized (this) { final int size = mVoiceInteractionSessionListeners.beginBroadcast(); diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java index 57e9f661a0b0..61d7d6cf45d2 100644 --- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java @@ -25,6 +25,8 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; import android.app.ActivityManager; import android.app.ActivityOptions; import android.app.ActivityTaskManager; + +import com.android.internal.app.IVoiceActionCheckCallback; import com.android.server.wm.ActivityTaskManagerInternal; import android.app.IActivityManager; import android.app.IActivityTaskManager; @@ -57,6 +59,7 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; +import java.util.Set; class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConnection.Callback { final static String TAG = "VoiceInteractionServiceManager"; @@ -177,6 +180,23 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne activityTokens); } + public void getActiveServiceSupportedActions(List<String> commands, + IVoiceActionCheckCallback callback) { + if (mService == null) { + Slog.w(TAG, "Not bound to voice interaction service " + mComponent); + try { + callback.onComplete(null); + } catch (RemoteException e) { + } + return; + } + try { + mService.getActiveServiceSupportedActions(commands, callback); + } catch (RemoteException e) { + Slog.w(TAG, "RemoteException while calling getActiveServiceSupportedActions", e); + } + } + public boolean hideSessionLocked() { if (mActiveSession != null) { return mActiveSession.hideLocked(); |