Snap for 6389733 from 36d89020d1 to mainline-release

Change-Id: I67d7fa8a273699bf569880fa8377a8d730d572d4
This commit is contained in:
android-build-team Robot
2020-04-13 07:05:49 +00:00
17 changed files with 54 additions and 50 deletions

View File

@@ -7438,6 +7438,8 @@
<string name="connected_devices_dashboard_no_driving_mode_no_nfc_summary">Bluetooth</string> <string name="connected_devices_dashboard_no_driving_mode_no_nfc_summary">Bluetooth</string>
<!-- Summary for Tap & pay settings, explaning a few important settings under it [CHAR LIMIT=NONE]--> <!-- Summary for Tap & pay settings, explaning a few important settings under it [CHAR LIMIT=NONE]-->
<string name="nfc_and_payment_settings_payment_off_nfc_off_summary">Unavailable because NFC is off</string> <string name="nfc_and_payment_settings_payment_off_nfc_off_summary">Unavailable because NFC is off</string>
<!-- Summary for Tap & pay settings, explaning a few important settings under it [CHAR LIMIT=NONE]-->
<string name="nfc_and_payment_settings_no_payment_installed_summary">To use, first install a payment app</string>
<!-- Title for setting tile leading to Apps & Notification settings [CHAR LIMIT=40]--> <!-- Title for setting tile leading to Apps & Notification settings [CHAR LIMIT=40]-->
<string name="app_and_notification_dashboard_title">Apps &amp; notifications</string> <string name="app_and_notification_dashboard_title">Apps &amp; notifications</string>
<!-- Summary for Apps & Notification settings, explaining a few important settings under it [CHAR LIMIT=NONE]--> <!-- Summary for Apps & Notification settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->

View File

@@ -32,7 +32,8 @@ import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@SearchIndexable /** Settings fragment containing accessibility control timeout preference. */
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public final class AccessibilityControlTimeoutPreferenceFragment extends DashboardFragment public final class AccessibilityControlTimeoutPreferenceFragment extends DashboardFragment
implements AccessibilityTimeoutController.OnChangeListener { implements AccessibilityTimeoutController.OnChangeListener {

View File

@@ -65,10 +65,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
/** /** Activity with the accessibility settings. */
* Activity with the accessibility settings. @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
*/
@SearchIndexable
public class AccessibilitySettings extends DashboardFragment { public class AccessibilitySettings extends DashboardFragment {
private static final String TAG = "AccessibilitySettings"; private static final String TAG = "AccessibilitySettings";

View File

@@ -44,10 +44,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /** Settings fragment containing font style of captioning properties. */
* Settings fragment containing font style of captioning properties. @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
*/
@SearchIndexable
public class CaptionAppearanceFragment extends SettingsPreferenceFragment public class CaptionAppearanceFragment extends SettingsPreferenceFragment
implements OnPreferenceChangeListener, OnValueChangedListener { implements OnPreferenceChangeListener, OnValueChangedListener {
private static final String PREF_CAPTION_PREVIEW = "caption_preview"; private static final String PREF_CAPTION_PREVIEW = "caption_preview";

View File

@@ -30,10 +30,8 @@ import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.search.SearchIndexable;
/** /** Settings fragment containing more options of captioning properties. */
* Settings fragment containing more options of captioning properties. @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
*/
@SearchIndexable
public class CaptionMoreOptionsFragment extends SettingsPreferenceFragment public class CaptionMoreOptionsFragment extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener { implements Preference.OnPreferenceChangeListener {
private static final String PREF_LOCALE = "captioning_locale"; private static final String PREF_LOCALE = "captioning_locale";

View File

@@ -37,10 +37,8 @@ import com.google.common.primitives.Floats;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /** Settings fragment containing captioning properties. */
* Settings fragment containing captioning properties. @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
*/
@SearchIndexable
public class CaptionPropertiesFragment extends SettingsPreferenceFragment public class CaptionPropertiesFragment extends SettingsPreferenceFragment
implements OnPreferenceChangeListener { implements OnPreferenceChangeListener {
private static final String PREF_SWITCH = "captioning_preference_switch"; private static final String PREF_SWITCH = "captioning_preference_switch";

View File

@@ -39,12 +39,11 @@ import com.android.settingslib.search.SearchIndexable;
import java.util.List; import java.util.List;
@SearchIndexable /** Settings fragment containing magnification preference. */
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public final class MagnificationPreferenceFragment extends DashboardFragment { public final class MagnificationPreferenceFragment extends DashboardFragment {
@VisibleForTesting @VisibleForTesting static final int ON = 1;
static final int ON = 1; @VisibleForTesting static final int OFF = 0;
@VisibleForTesting
static final int OFF = 0;
private static final String TAG = "MagnificationPreferenceFragment"; private static final String TAG = "MagnificationPreferenceFragment";
@@ -169,4 +168,4 @@ public final class MagnificationPreferenceFragment extends DashboardFragment {
return isApplicable(context.getResources()); return isApplicable(context.getResources());
} }
}; };
} }

View File

@@ -40,7 +40,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
/** Settings page for magnification. */ /** Settings page for magnification. */
@SearchIndexable @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class MagnificationSettingsFragment extends DashboardFragment { public class MagnificationSettingsFragment extends DashboardFragment {
private static final String TAG = "MagnificationSettingsFragment"; private static final String TAG = "MagnificationSettingsFragment";

View File

@@ -43,7 +43,7 @@ import java.util.List;
* Fragment for preference screen for settings related to Automatically click after mouse stops * Fragment for preference screen for settings related to Automatically click after mouse stops
* feature. * feature.
*/ */
@SearchIndexable @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class ToggleAutoclickPreferenceFragment extends DashboardFragment public class ToggleAutoclickPreferenceFragment extends DashboardFragment
implements ToggleAutoclickPreferenceController.OnChangeListener { implements ToggleAutoclickPreferenceController.OnChangeListener {

View File

@@ -39,7 +39,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
/** Settings page for color inversion. */ /** Settings page for color inversion. */
@SearchIndexable @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePreferenceFragment { public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePreferenceFragment {
private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED; private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED;

View File

@@ -44,7 +44,8 @@ import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@SearchIndexable /** Settings for daltonizer. */
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceFragment public final class ToggleDaltonizerPreferenceFragment extends ToggleFeaturePreferenceFragment
implements DaltonizerRadioButtonPreferenceController.OnChangeListener { implements DaltonizerRadioButtonPreferenceController.OnChangeListener {

View File

@@ -23,10 +23,8 @@ import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.search.SearchIndexable;
/** /** Accessibility settings for the vibration. */
* Accessibility settings for the vibration. @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
*/
@SearchIndexable
public class VibrationSettings extends DashboardFragment { public class VibrationSettings extends DashboardFragment {
private static final String TAG = "VibrationSettings"; private static final String TAG = "VibrationSettings";

View File

@@ -18,6 +18,7 @@ package com.android.settings.applications.specialaccess;
import android.content.Context; import android.content.Context;
import android.nfc.NfcAdapter; import android.nfc.NfcAdapter;
import android.nfc.cardemulation.CardEmulation;
import androidx.preference.Preference; import androidx.preference.Preference;
@@ -30,10 +31,14 @@ import com.android.settings.nfc.BaseNfcEnabler;
* preference is updated. * preference is updated.
*/ */
public class PaymentSettingsEnabler extends BaseNfcEnabler { public class PaymentSettingsEnabler extends BaseNfcEnabler {
private final CardEmulation mCardEmuManager;
private final Preference mPreference; private final Preference mPreference;
boolean mIsPaymentAvailable;
public PaymentSettingsEnabler(Context context, Preference preference) { public PaymentSettingsEnabler(Context context, Preference preference) {
super(context); super(context);
mCardEmuManager = CardEmulation.getInstance(super.mNfcAdapter);
mIsPaymentAvailable = false;
mPreference = preference; mPreference = preference;
} }
@@ -46,9 +51,29 @@ public class PaymentSettingsEnabler extends BaseNfcEnabler {
mPreference.setEnabled(false); mPreference.setEnabled(false);
break; break;
case NfcAdapter.STATE_ON: case NfcAdapter.STATE_ON:
mPreference.setSummary(null); if (mIsPaymentAvailable) {
mPreference.setEnabled(true); mPreference.setSummary(null);
mPreference.setEnabled(true);
} else {
mPreference.setSummary(
R.string.nfc_and_payment_settings_no_payment_installed_summary);
mPreference.setEnabled(false);
}
break; break;
} }
} }
@Override
public void resume() {
if (!isNfcAvailable()) {
return;
}
if (mCardEmuManager.getServices(CardEmulation.CATEGORY_PAYMENT).isEmpty()) {
mIsPaymentAvailable = false;
} else {
mIsPaymentAvailable = true;
}
super.resume();
}
} }

View File

@@ -35,7 +35,7 @@ import com.android.settingslib.widget.FooterPreference;
* Dedicated screen for allowing the user to toggle bluetooth which displays relevant information to * Dedicated screen for allowing the user to toggle bluetooth which displays relevant information to
* the user based on related settings such as bluetooth scanning. * the user based on related settings such as bluetooth scanning.
*/ */
@SearchIndexable(forTarget = SearchIndexable.ALL) @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class BluetoothDashboardFragment extends DashboardFragment { public class BluetoothDashboardFragment extends DashboardFragment {
private static final String TAG = "BluetoothDashboardFrag"; private static final String TAG = "BluetoothDashboardFrag";

View File

@@ -47,9 +47,6 @@ public class NfcAndPaymentFragmentController extends BasePreferenceController {
PackageManager.FEATURE_NFC_HOST_CARD_EMULATION)) { PackageManager.FEATURE_NFC_HOST_CARD_EMULATION)) {
return UNSUPPORTED_ON_DEVICE; return UNSUPPORTED_ON_DEVICE;
} }
if (!mUserManager.isAdminUser()) {
return DISABLED_FOR_USER;
}
return AVAILABLE; return AVAILABLE;
} }

View File

@@ -18,14 +18,12 @@ package com.android.settings.system;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
import android.content.Context; import android.content.Context;
import android.provider.SearchIndexableResource;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.applications.manageapplications.ResetAppPrefPreferenceController; import com.android.settings.applications.manageapplications.ResetAppPrefPreferenceController;
import com.android.settings.dashboard.DashboardFragment; import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.network.NetworkResetPreferenceController; import com.android.settings.network.NetworkResetPreferenceController;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.Indexable;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.search.SearchIndexable;
@@ -33,7 +31,8 @@ import com.android.settingslib.search.SearchIndexable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@SearchIndexable /** Settings fragment containing reset options. */
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class ResetDashboardFragment extends DashboardFragment { public class ResetDashboardFragment extends DashboardFragment {
private static final String TAG = "ResetDashboardFragment"; private static final String TAG = "ResetDashboardFragment";

View File

@@ -85,16 +85,6 @@ public class NfcAndPaymentFragmentControllerTest {
.isEqualTo(NfcAndPaymentFragmentController.UNSUPPORTED_ON_DEVICE); .isEqualTo(NfcAndPaymentFragmentController.UNSUPPORTED_ON_DEVICE);
} }
@Test
public void getAvailabilityStatus_notAdminUser_shouldReturnDisabled() {
when(mPackageManager.hasSystemFeature(anyString())).thenReturn(true);
when(mUserManager.isAdminUser()).thenReturn(false);
when(mNfcAdapter.isEnabled()).thenReturn(true);
assertThat(mController.getAvailabilityStatus())
.isEqualTo(NfcAndPaymentFragmentController.DISABLED_FOR_USER);
}
@Test @Test
public void getSummary_nfcOn_shouldProvideOnSummary() { public void getSummary_nfcOn_shouldProvideOnSummary() {
when(mNfcAdapter.isEnabled()).thenReturn(true); when(mNfcAdapter.isEnabled()).thenReturn(true);