Make TEST_INPUT_METHOD @TestAPI
This is a follow up CL to my previous CL [1], which introduced
android.permission.TEST_INPUT_METHO
to protect several @TestApi methods in InputMethodManager.
This CL makes the permission itself as @TestApi so that it can be
included as an API constant in test-current.txt. This also enables us
to minimize special permission while running CTS as follows.
SystemUtil.runWithShellPermissionIdentity(() -> {
// do something.
}, Manifest.permission.TEST_INPUT_METHOD);
There must be no user observable behavior change in this CL.
[1]: Ie79a3e9d41ce22605ae083594d639c37d08b7def
b869c78380
Bug: 256239860
Test: presubmit
Change-Id: I1fd3ceda9a1b641e63c7633a223a9a806e78cd2d
This commit is contained in:
@@ -47,6 +47,7 @@ package android {
|
||||
field public static final String SET_KEYBOARD_LAYOUT = "android.permission.SET_KEYBOARD_LAYOUT";
|
||||
field public static final String SUSPEND_APPS = "android.permission.SUSPEND_APPS";
|
||||
field public static final String TEST_BIOMETRIC = "android.permission.TEST_BIOMETRIC";
|
||||
field public static final String TEST_INPUT_METHOD = "android.permission.TEST_INPUT_METHOD";
|
||||
field public static final String TEST_MANAGE_ROLLBACKS = "android.permission.TEST_MANAGE_ROLLBACKS";
|
||||
field public static final String UPGRADE_RUNTIME_PERMISSIONS = "android.permission.UPGRADE_RUNTIME_PERMISSIONS";
|
||||
field public static final String WRITE_DEVICE_CONFIG = "android.permission.WRITE_DEVICE_CONFIG";
|
||||
@@ -3160,8 +3161,8 @@ package android.view.inputmethod {
|
||||
method public int getDisplayId();
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public java.util.List<android.view.inputmethod.InputMethodInfo> getInputMethodListAsUser(int);
|
||||
method public boolean hasActiveInputConnection(@Nullable android.view.View);
|
||||
method public boolean isInputMethodPickerShown();
|
||||
method @RequiresPermission("android.permission.TEST_INPUT_METHOD") public void setStylusWindowIdleTimeoutForTest(long);
|
||||
method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean isInputMethodPickerShown();
|
||||
method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void setStylusWindowIdleTimeoutForTest(long);
|
||||
field public static final long CLEAR_SHOW_FORCED_FLAG_WHEN_LEAVING = 214016041L; // 0xcc1a029L
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.view.inputmethod;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.AnyThread;
|
||||
import android.annotation.DurationMillisLong;
|
||||
import android.annotation.NonNull;
|
||||
@@ -353,6 +354,7 @@ final class IInputMethodManagerGlobalInvoker {
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
@RequiresPermission(Manifest.permission.TEST_INPUT_METHOD)
|
||||
static boolean isInputMethodPickerShownForTest() {
|
||||
final IInputMethodManager service = getService();
|
||||
if (service == null) {
|
||||
|
||||
@@ -3459,6 +3459,7 @@ public final class InputMethodManager {
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
@RequiresPermission(Manifest.permission.TEST_INPUT_METHOD)
|
||||
public boolean isInputMethodPickerShown() {
|
||||
return IInputMethodManagerGlobalInvoker.isInputMethodPickerShownForTest();
|
||||
}
|
||||
|
||||
@@ -4127,7 +4127,8 @@
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<!-- Allows access to Test APIs defined in {@link android.view.inputmethod.InputMethodManager}.
|
||||
@hide -->
|
||||
@hide
|
||||
@TestApi -->
|
||||
<permission android:name="android.permission.TEST_INPUT_METHOD"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user