Update system setting page subtext

- Move android version from about phone subtext to system update
- Updates strings for autofill, keyboard & input, factory reset, swipe
  for notification
- Add a new pref category for spell checker and personal dictionary
- Display "None" if any default app is not selected
- Display current keyboard type as language subtext

Bug: 36395109
Test: make RunSettingsRoboTests
Change-Id: Id6ca94ea31e55f1c1ec04e47dcf657a25c35c7fe
This commit is contained in:
Fan Zhang
2017-03-21 15:15:27 -07:00
parent aaa042de4e
commit 3720e0c4f1
13 changed files with 148 additions and 62 deletions

View File

@@ -16,8 +16,14 @@
package com.android.settings.language;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.input.InputManager;
import android.provider.Settings;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.textservice.TextServicesManager;
import com.android.internal.hardware.AmbientDisplayConfiguration;
@@ -27,6 +33,8 @@ import com.android.settings.TestConfig;
import com.android.settings.core.PreferenceController;
import com.android.settings.core.lifecycle.Lifecycle;
import com.android.settings.core.lifecycle.LifecycleObserver;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.testutils.shadow.ShadowSecureSettings;
import org.junit.Before;
import org.junit.Test;
@@ -36,6 +44,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
import java.util.ArrayList;
import java.util.List;
import static com.google.common.truth.Truth.assertThat;
@@ -51,6 +60,10 @@ public class LanguageAndInputSettingsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Context mContext;
@Mock
private PackageManager mPackageManager;
@Mock
private InputMethodManager mInputMethodManager;
private TestFragment mFragment;
@Before
@@ -58,7 +71,7 @@ public class LanguageAndInputSettingsTest {
MockitoAnnotations.initMocks(this);
when(mContext.getSystemService(Context.INPUT_SERVICE)).thenReturn(mock(InputManager.class));
when(mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE))
.thenReturn(mock(TextServicesManager.class));
.thenReturn(mock(TextServicesManager.class));
mFragment = new TestFragment(mContext);
}
@@ -87,6 +100,33 @@ public class LanguageAndInputSettingsTest {
assertThat(controllers.isEmpty()).isFalse();
}
@Test
@Config(shadows = {
ShadowSecureSettings.class,
})
public void testSummary_shouldSetToCurrentImeName() {
final Activity activity = mock(Activity.class);
final SummaryLoader loader = mock(SummaryLoader.class);
final ComponentName componentName = new ComponentName("pkg", "cls");
ShadowSecureSettings.putString(null, Settings.Secure.DEFAULT_INPUT_METHOD,
componentName.flattenToString());
when(activity.getSystemService(Context.INPUT_METHOD_SERVICE))
.thenReturn(mInputMethodManager);
when(activity.getPackageManager()).thenReturn(mPackageManager);
final List<InputMethodInfo> imis = new ArrayList<>();
imis.add(mock(InputMethodInfo.class));
when(imis.get(0).getPackageName()).thenReturn(componentName.getPackageName());
when(mInputMethodManager.getInputMethodList()).thenReturn(imis);
SummaryLoader.SummaryProvider provider = mFragment.SUMMARY_PROVIDER_FACTORY
.createSummaryProvider(activity, loader);
provider.setListening(true);
verify(imis.get(0)).loadLabel(mPackageManager);
verify(loader).setSummary(provider, null);
}
/**
* Test fragment to expose lifecycle and context so we can verify behavior for observables.
*/