Merge "Forcibly show IME even hardware keyboard is conencted"
This commit is contained in:
committed by
Android (Google) Code Review
commit
72ea549909
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.systemui.globalactions;
|
||||
|
||||
import static android.provider.Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD;
|
||||
import static android.view.WindowInsets.Type.ime;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -24,9 +25,11 @@ import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsController;
|
||||
@@ -41,6 +44,7 @@ import androidx.test.rule.ActivityTestRule;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -54,8 +58,23 @@ public class GlobalActionsImeTest extends SysuiTestCase {
|
||||
public ActivityTestRule<TestActivity> mActivityTestRule = new ActivityTestRule<>(
|
||||
TestActivity.class, false, false);
|
||||
|
||||
private int mOriginalShowImeWithHardKeyboard;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
final ContentResolver contentResolver = mContext.getContentResolver();
|
||||
mOriginalShowImeWithHardKeyboard = Settings.Secure.getInt(
|
||||
contentResolver, SHOW_IME_WITH_HARD_KEYBOARD, 0);
|
||||
// Forcibly shows IME even when hardware keyboard is connected.
|
||||
// To change USER_SYSTEM settings, we have to use settings shell command.
|
||||
executeShellCommand("settings put secure " + SHOW_IME_WITH_HARD_KEYBOARD + " 1");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
// To restore USER_SYSTEM settings, we have to use settings shell command.
|
||||
executeShellCommand("settings put secure "
|
||||
+ SHOW_IME_WITH_HARD_KEYBOARD + " " + mOriginalShowImeWithHardKeyboard);
|
||||
executeShellCommand("input keyevent HOME");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user