Merge "Make scribe setting default_on and secure" into udc-dev am: b679e3eeba
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21618239 Change-Id: I03e0487c804b8f9016f51c52fbdc17c52a27cd57 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -2616,7 +2616,6 @@ package android.provider {
|
|||||||
field @Deprecated public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
|
field @Deprecated public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
|
||||||
field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
|
field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
|
||||||
field public static final String SHOW_FIRST_CRASH_DIALOG = "show_first_crash_dialog";
|
field public static final String SHOW_FIRST_CRASH_DIALOG = "show_first_crash_dialog";
|
||||||
field public static final String STYLUS_HANDWRITING_ENABLED = "stylus_handwriting_enabled";
|
|
||||||
field public static final String USER_DISABLED_HDR_FORMATS = "user_disabled_hdr_formats";
|
field public static final String USER_DISABLED_HDR_FORMATS = "user_disabled_hdr_formats";
|
||||||
field public static final String USER_PREFERRED_REFRESH_RATE = "user_preferred_refresh_rate";
|
field public static final String USER_PREFERRED_REFRESH_RATE = "user_preferred_refresh_rate";
|
||||||
field public static final String USER_PREFERRED_RESOLUTION_HEIGHT = "user_preferred_resolution_height";
|
field public static final String USER_PREFERRED_RESOLUTION_HEIGHT = "user_preferred_resolution_height";
|
||||||
@@ -2648,6 +2647,8 @@ package android.provider {
|
|||||||
field public static final String SHOW_FIRST_CRASH_DIALOG_DEV_OPTION = "show_first_crash_dialog_dev_option";
|
field public static final String SHOW_FIRST_CRASH_DIALOG_DEV_OPTION = "show_first_crash_dialog_dev_option";
|
||||||
field public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
|
field public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
|
||||||
field public static final String STYLUS_BUTTONS_ENABLED = "stylus_buttons_enabled";
|
field public static final String STYLUS_BUTTONS_ENABLED = "stylus_buttons_enabled";
|
||||||
|
field public static final int STYLUS_HANDWRITING_DEFAULT_VALUE = 1; // 0x1
|
||||||
|
field public static final String STYLUS_HANDWRITING_ENABLED = "stylus_handwriting_enabled";
|
||||||
field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
|
field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
|
||||||
field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
|
field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7112,6 +7112,28 @@ public final class Settings {
|
|||||||
public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
|
public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
|
||||||
"input_method_selector_visibility";
|
"input_method_selector_visibility";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle for enabling stylus handwriting. When enabled, current Input method receives
|
||||||
|
* stylus {@link MotionEvent}s if an {@link Editor} is focused.
|
||||||
|
*
|
||||||
|
* @see #STYLUS_HANDWRITING_DEFAULT_VALUE
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
@Readable
|
||||||
|
@SuppressLint("NoSettingsProvider")
|
||||||
|
public static final String STYLUS_HANDWRITING_ENABLED = "stylus_handwriting_enabled";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default value for {@link #STYLUS_HANDWRITING_ENABLED}.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
@Readable
|
||||||
|
@SuppressLint("NoSettingsProvider")
|
||||||
|
public static final int STYLUS_HANDWRITING_DEFAULT_VALUE = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The currently selected voice interaction service flattened ComponentName.
|
* The currently selected voice interaction service flattened ComponentName.
|
||||||
* @hide
|
* @hide
|
||||||
@@ -16481,17 +16503,6 @@ public final class Settings {
|
|||||||
@Readable
|
@Readable
|
||||||
public static final String AUTOFILL_MAX_VISIBLE_DATASETS = "autofill_max_visible_datasets";
|
public static final String AUTOFILL_MAX_VISIBLE_DATASETS = "autofill_max_visible_datasets";
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggle for enabling stylus handwriting. When enabled, current Input method receives
|
|
||||||
* stylus {@link MotionEvent}s if an {@link Editor} is focused.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@TestApi
|
|
||||||
@Readable
|
|
||||||
@SuppressLint("NoSettingsProvider")
|
|
||||||
public static final String STYLUS_HANDWRITING_ENABLED = "stylus_handwriting_enabled";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether a stylus has ever been used on the device.
|
* Indicates whether a stylus has ever been used on the device.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -508,6 +508,7 @@ final class IInputMethodManagerGlobalInvoker {
|
|||||||
@AnyThread
|
@AnyThread
|
||||||
static void prepareStylusHandwritingDelegation(
|
static void prepareStylusHandwritingDelegation(
|
||||||
@NonNull IInputMethodClient client,
|
@NonNull IInputMethodClient client,
|
||||||
|
@UserIdInt int userId,
|
||||||
@NonNull String delegatePackageName,
|
@NonNull String delegatePackageName,
|
||||||
@NonNull String delegatorPackageName) {
|
@NonNull String delegatorPackageName) {
|
||||||
final IInputMethodManager service = getService();
|
final IInputMethodManager service = getService();
|
||||||
@@ -516,7 +517,7 @@ final class IInputMethodManagerGlobalInvoker {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
service.prepareStylusHandwritingDelegation(
|
service.prepareStylusHandwritingDelegation(
|
||||||
client, delegatePackageName, delegatorPackageName);
|
client, userId, delegatePackageName, delegatorPackageName);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
@@ -525,6 +526,7 @@ final class IInputMethodManagerGlobalInvoker {
|
|||||||
@AnyThread
|
@AnyThread
|
||||||
static boolean acceptStylusHandwritingDelegation(
|
static boolean acceptStylusHandwritingDelegation(
|
||||||
@NonNull IInputMethodClient client,
|
@NonNull IInputMethodClient client,
|
||||||
|
@UserIdInt int userId,
|
||||||
@NonNull String delegatePackageName,
|
@NonNull String delegatePackageName,
|
||||||
@NonNull String delegatorPackageName) {
|
@NonNull String delegatorPackageName) {
|
||||||
final IInputMethodManager service = getService();
|
final IInputMethodManager service = getService();
|
||||||
@@ -533,7 +535,7 @@ final class IInputMethodManagerGlobalInvoker {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return service.acceptStylusHandwritingDelegation(
|
return service.acceptStylusHandwritingDelegation(
|
||||||
client, delegatePackageName, delegatorPackageName);
|
client, userId, delegatePackageName, delegatorPackageName);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1553,9 +1553,7 @@ public final class InputMethodManager {
|
|||||||
if (fallbackContext == null) {
|
if (fallbackContext == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isStylusHandwritingEnabled(fallbackContext)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return IInputMethodManagerGlobalInvoker.isStylusHandwritingAvailableAsUser(userId);
|
return IInputMethodManagerGlobalInvoker.isStylusHandwritingAvailableAsUser(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2244,11 +2242,6 @@ public final class InputMethodManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean useDelegation = !TextUtils.isEmpty(delegatorPackageName);
|
boolean useDelegation = !TextUtils.isEmpty(delegatorPackageName);
|
||||||
if (!isStylusHandwritingEnabled(view.getContext())) {
|
|
||||||
Log.w(TAG, "Stylus handwriting pref is disabled. "
|
|
||||||
+ "Ignoring calls to start stylus handwriting.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkFocus();
|
checkFocus();
|
||||||
synchronized (mH) {
|
synchronized (mH) {
|
||||||
@@ -2264,7 +2257,8 @@ public final class InputMethodManager {
|
|||||||
}
|
}
|
||||||
if (useDelegation) {
|
if (useDelegation) {
|
||||||
return IInputMethodManagerGlobalInvoker.acceptStylusHandwritingDelegation(
|
return IInputMethodManagerGlobalInvoker.acceptStylusHandwritingDelegation(
|
||||||
mClient, view.getContext().getOpPackageName(), delegatorPackageName);
|
mClient, UserHandle.myUserId(), view.getContext().getOpPackageName(),
|
||||||
|
delegatorPackageName);
|
||||||
} else {
|
} else {
|
||||||
IInputMethodManagerGlobalInvoker.startStylusHandwriting(mClient);
|
IInputMethodManagerGlobalInvoker.startStylusHandwriting(mClient);
|
||||||
}
|
}
|
||||||
@@ -2272,15 +2266,6 @@ public final class InputMethodManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isStylusHandwritingEnabled(@NonNull Context context) {
|
|
||||||
if (Settings.Global.getInt(context.getContentResolver(),
|
|
||||||
Settings.Global.STYLUS_HANDWRITING_ENABLED, 0) == 0) {
|
|
||||||
Log.d(TAG, "Stylus handwriting pref is disabled.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares delegation of starting stylus handwriting session to a different editor in same
|
* Prepares delegation of starting stylus handwriting session to a different editor in same
|
||||||
* or different window than the view on which initial handwriting stroke was detected.
|
* or different window than the view on which initial handwriting stroke was detected.
|
||||||
@@ -2344,13 +2329,9 @@ public final class InputMethodManager {
|
|||||||
fallbackImm.prepareStylusHandwritingDelegation(delegatorView, delegatePackageName);
|
fallbackImm.prepareStylusHandwritingDelegation(delegatorView, delegatePackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isStylusHandwritingEnabled(delegatorView.getContext())) {
|
|
||||||
Log.w(TAG, "Stylus handwriting pref is disabled. "
|
|
||||||
+ "Ignoring prepareStylusHandwritingDelegation().");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
IInputMethodManagerGlobalInvoker.prepareStylusHandwritingDelegation(
|
IInputMethodManagerGlobalInvoker.prepareStylusHandwritingDelegation(
|
||||||
mClient,
|
mClient,
|
||||||
|
UserHandle.myUserId(),
|
||||||
delegatePackageName,
|
delegatePackageName,
|
||||||
delegatorView.getContext().getOpPackageName());
|
delegatorView.getContext().getOpPackageName());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,12 +150,13 @@ interface IInputMethodManager {
|
|||||||
|
|
||||||
/** Prepares delegation of starting stylus handwriting session to a different editor **/
|
/** Prepares delegation of starting stylus handwriting session to a different editor **/
|
||||||
void prepareStylusHandwritingDelegation(in IInputMethodClient client,
|
void prepareStylusHandwritingDelegation(in IInputMethodClient client,
|
||||||
|
in int userId,
|
||||||
in String delegatePackageName,
|
in String delegatePackageName,
|
||||||
in String delegatorPackageName);
|
in String delegatorPackageName);
|
||||||
|
|
||||||
/** Accepts and starts a stylus handwriting session for the delegate view **/
|
/** Accepts and starts a stylus handwriting session for the delegate view **/
|
||||||
boolean acceptStylusHandwritingDelegation(in IInputMethodClient client,
|
boolean acceptStylusHandwritingDelegation(in IInputMethodClient client,
|
||||||
in String delegatePackageName, in String delegatorPackageName);
|
in int userId, in String delegatePackageName, in String delegatorPackageName);
|
||||||
|
|
||||||
/** Returns {@code true} if currently selected IME supports Stylus handwriting. */
|
/** Returns {@code true} if currently selected IME supports Stylus handwriting. */
|
||||||
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
|
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
|
||||||
|
|||||||
@@ -273,7 +273,6 @@ public class SettingsBackupTest {
|
|||||||
Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
|
Settings.Global.DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD,
|
||||||
Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
|
Settings.Global.SMART_REPLIES_IN_NOTIFICATIONS_FLAGS,
|
||||||
Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS,
|
Settings.Global.SMART_SUGGESTIONS_IN_NOTIFICATIONS_FLAGS,
|
||||||
Settings.Global.STYLUS_HANDWRITING_ENABLED,
|
|
||||||
Settings.Global.STYLUS_EVER_USED,
|
Settings.Global.STYLUS_EVER_USED,
|
||||||
Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT,
|
Settings.Global.ENABLE_ADB_INCREMENTAL_INSTALL_DEFAULT,
|
||||||
Settings.Global.ENABLE_MULTI_SLOT_TIMEOUT_MILLIS,
|
Settings.Global.ENABLE_MULTI_SLOT_TIMEOUT_MILLIS,
|
||||||
@@ -785,6 +784,7 @@ public class SettingsBackupTest {
|
|||||||
Settings.Secure.SMS_DEFAULT_APPLICATION,
|
Settings.Secure.SMS_DEFAULT_APPLICATION,
|
||||||
Settings.Secure.SPELL_CHECKER_ENABLED, // Intentionally removed in Q
|
Settings.Secure.SPELL_CHECKER_ENABLED, // Intentionally removed in Q
|
||||||
Settings.Secure.STYLUS_BUTTONS_ENABLED,
|
Settings.Secure.STYLUS_BUTTONS_ENABLED,
|
||||||
|
Settings.Secure.STYLUS_HANDWRITING_ENABLED,
|
||||||
Settings.Secure.TRUST_AGENTS_INITIALIZED,
|
Settings.Secure.TRUST_AGENTS_INITIALIZED,
|
||||||
Settings.Secure.KNOWN_TRUST_AGENTS_INITIALIZED,
|
Settings.Secure.KNOWN_TRUST_AGENTS_INITIALIZED,
|
||||||
Settings.Secure.TV_APP_USES_NON_SYSTEM_INPUTS,
|
Settings.Secure.TV_APP_USES_NON_SYSTEM_INPUTS,
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL;
|
|||||||
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
|
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
|
||||||
import static android.os.IServiceManager.DUMP_FLAG_PROTO;
|
import static android.os.IServiceManager.DUMP_FLAG_PROTO;
|
||||||
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
|
||||||
|
import static android.provider.Settings.Secure.STYLUS_HANDWRITING_DEFAULT_VALUE;
|
||||||
|
import static android.provider.Settings.Secure.STYLUS_HANDWRITING_ENABLED;
|
||||||
import static android.server.inputmethod.InputMethodManagerServiceProto.BACK_DISPOSITION;
|
import static android.server.inputmethod.InputMethodManagerServiceProto.BACK_DISPOSITION;
|
||||||
import static android.server.inputmethod.InputMethodManagerServiceProto.BOUND_TO_METHOD;
|
import static android.server.inputmethod.InputMethodManagerServiceProto.BOUND_TO_METHOD;
|
||||||
import static android.server.inputmethod.InputMethodManagerServiceProto.CUR_ATTRIBUTE;
|
import static android.server.inputmethod.InputMethodManagerServiceProto.CUR_ATTRIBUTE;
|
||||||
@@ -2067,10 +2069,14 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized (ImfLock.class) {
|
synchronized (ImfLock.class) {
|
||||||
|
if (!isStylusHandwritingEnabled(mContext, userId)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if selected IME of current user supports handwriting.
|
||||||
if (userId == mSettings.getCurrentUserId()) {
|
if (userId == mSettings.getCurrentUserId()) {
|
||||||
return mBindingController.supportsStylusHandwriting();
|
return mBindingController.supportsStylusHandwriting();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO(b/197848765): This can be optimized by caching multi-user methodMaps/methodList.
|
//TODO(b/197848765): This can be optimized by caching multi-user methodMaps/methodList.
|
||||||
//TODO(b/210039666): use cache.
|
//TODO(b/210039666): use cache.
|
||||||
final ArrayMap<String, InputMethodInfo> methodMap = queryMethodMapForUser(userId);
|
final ArrayMap<String, InputMethodInfo> methodMap = queryMethodMapForUser(userId);
|
||||||
@@ -2081,6 +2087,18 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isStylusHandwritingEnabled(
|
||||||
|
@NonNull Context context, @UserIdInt int userId) {
|
||||||
|
// If user is a profile, use preference of it`s parent profile.
|
||||||
|
final int profileParentUserId = mUserManagerInternal.getProfileParentId(userId);
|
||||||
|
if (Settings.Secure.getIntForUser(context.getContentResolver(),
|
||||||
|
STYLUS_HANDWRITING_ENABLED, STYLUS_HANDWRITING_DEFAULT_VALUE,
|
||||||
|
profileParentUserId) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@GuardedBy("ImfLock.class")
|
@GuardedBy("ImfLock.class")
|
||||||
private List<InputMethodInfo> getInputMethodListLocked(@UserIdInt int userId,
|
private List<InputMethodInfo> getInputMethodListLocked(@UserIdInt int userId,
|
||||||
@DirectBootAwareness int directBootAwareness, int callingUid) {
|
@DirectBootAwareness int directBootAwareness, int callingUid) {
|
||||||
@@ -3418,8 +3436,14 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public void prepareStylusHandwritingDelegation(
|
public void prepareStylusHandwritingDelegation(
|
||||||
@NonNull IInputMethodClient client,
|
@NonNull IInputMethodClient client,
|
||||||
|
@UserIdInt int userId,
|
||||||
@NonNull String delegatePackageName,
|
@NonNull String delegatePackageName,
|
||||||
@NonNull String delegatorPackageName) {
|
@NonNull String delegatorPackageName) {
|
||||||
|
if (!isStylusHandwritingEnabled(mContext, userId)) {
|
||||||
|
Slog.w(TAG, "Can not prepare stylus handwriting delegation. Stylus handwriting"
|
||||||
|
+ " pref is disabled for user: " + userId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!verifyClientAndPackageMatch(client, delegatorPackageName)) {
|
if (!verifyClientAndPackageMatch(client, delegatorPackageName)) {
|
||||||
Slog.w(TAG, "prepareStylusHandwritingDelegation() fail");
|
Slog.w(TAG, "prepareStylusHandwritingDelegation() fail");
|
||||||
throw new IllegalArgumentException("Delegator doesn't match Uid");
|
throw new IllegalArgumentException("Delegator doesn't match Uid");
|
||||||
@@ -3430,8 +3454,14 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public boolean acceptStylusHandwritingDelegation(
|
public boolean acceptStylusHandwritingDelegation(
|
||||||
@NonNull IInputMethodClient client,
|
@NonNull IInputMethodClient client,
|
||||||
|
@UserIdInt int userId,
|
||||||
@NonNull String delegatePackageName,
|
@NonNull String delegatePackageName,
|
||||||
@NonNull String delegatorPackageName) {
|
@NonNull String delegatorPackageName) {
|
||||||
|
if (!isStylusHandwritingEnabled(mContext, userId)) {
|
||||||
|
Slog.w(TAG, "Can not accept stylus handwriting delegation. Stylus handwriting"
|
||||||
|
+ " pref is disabled for user: " + userId);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!verifyDelegator(client, delegatePackageName, delegatorPackageName)) {
|
if (!verifyDelegator(client, delegatePackageName, delegatorPackageName)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user