Disabling the shortcut if no service is configured, so we users won't see an "On" unless the shortcut will have an effect. If no service is configured and the user tries to enable the shortcut, the service picking UI is shown. If the user chooses a service, the shortcut turns on. If not, the shortcut remains off. Service selection is disabled when the shortcut is disabled (except for the specific case above). Lock screen behavior selection is disabled when the shortcut is disabled. Also updating a couple of strings based on UX input. Adding an AOSP header to a file that somehow got checked in without one. Fixes: 37443184 Fixes: 38030853 Test: Manually went through the various combinations of shortcut on and service enabled. I turned off the default selection of TalkBack as the shortcut service to ensure that we show a dialog when no service is selected. Change-Id: Iac5cff12edea91a496fc81781518db4ae49ef334
51 lines
1.7 KiB
Java
51 lines
1.7 KiB
Java
/*
|
|
* Copyright (C) 2017 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.settings.accessibility;
|
|
|
|
import android.content.Context;
|
|
|
|
import com.android.settings.R;
|
|
import com.android.settings.SettingsRobolectricTestRunner;
|
|
import com.android.settings.TestConfig;
|
|
import com.android.settings.testutils.XmlTestUtils;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.robolectric.RuntimeEnvironment;
|
|
import org.robolectric.annotation.Config;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import static com.google.common.truth.Truth.assertThat;
|
|
|
|
@RunWith(SettingsRobolectricTestRunner.class)
|
|
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
|
public class AccessibilitySettingsTest {
|
|
|
|
@Test
|
|
public void testNonIndexableKeys_existInXmlLayout() {
|
|
final Context context = RuntimeEnvironment.application;
|
|
final List<String> niks = AccessibilitySettings.SEARCH_INDEX_DATA_PROVIDER
|
|
.getNonIndexableKeys(context);
|
|
final List<String> keys = new ArrayList<>();
|
|
|
|
keys.addAll(XmlTestUtils.getKeysFromPreferenceXml(context, R.xml.accessibility_settings));
|
|
|
|
assertThat(keys).containsAllIn(niks);
|
|
}
|
|
}
|