Snap for 10245577 from 374e222198 to udc-qpr1-release
Change-Id: I045cc0e988a5b0965bab3e98392c816486025e71
This commit is contained in:
@@ -149,14 +149,17 @@ filegroup {
|
|||||||
srcs: ["proguard.flags"],
|
srcs: ["proguard.flags"],
|
||||||
}
|
}
|
||||||
|
|
||||||
// The sources for Settings need to be exposed to SettingsGoogle, etc.
|
// Deprecated. The sources for Settings need to be exposed to ArcSettings, so they can run the
|
||||||
// so they can run the com.android.settingslib.search.IndexableProcessor
|
// com.android.settingslib.search.IndexableProcessor over all the sources together.
|
||||||
// over all the sources together.
|
// Use "-Acom.android.settingslib.search.processor.package=" instead to generate the search data
|
||||||
|
// separately for different modules.
|
||||||
filegroup {
|
filegroup {
|
||||||
name: "Settings_srcs",
|
name: "Settings_srcs",
|
||||||
srcs: ["src/**/*.java", "src/**/*.kt"],
|
srcs: ["src/**/*.java", "src/**/*.kt"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated. Do not depend on this, only depend on Settings-core, and its manifest is also
|
||||||
|
// included.
|
||||||
filegroup {
|
filegroup {
|
||||||
name: "Settings_manifest",
|
name: "Settings_manifest",
|
||||||
srcs: ["AndroidManifest.xml"],
|
srcs: ["AndroidManifest.xml"],
|
||||||
|
|||||||
@@ -4898,6 +4898,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".spa.SpaActivity"
|
android:name=".spa.SpaActivity"
|
||||||
android:configChanges="orientation|screenLayout|screenSize|smallestScreenSize"
|
android:configChanges="orientation|screenLayout|screenSize|smallestScreenSize"
|
||||||
|
android:knownActivityEmbeddingCerts="@array/config_known_host_certs"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
<activity android:name=".spa.SpaBridgeActivity" android:exported="false"/>
|
<activity android:name=".spa.SpaBridgeActivity" android:exported="false"/>
|
||||||
<activity android:name=".spa.SpaAppBridgeActivity" android:exported="false"/>
|
<activity android:name=".spa.SpaAppBridgeActivity" android:exported="false"/>
|
||||||
|
|||||||
@@ -7089,7 +7089,7 @@
|
|||||||
<string name="keywords_wallpaper">background, theme, grid, customize, personalize</string>
|
<string name="keywords_wallpaper">background, theme, grid, customize, personalize</string>
|
||||||
|
|
||||||
<!-- List of synonyms for the Styles picker setting, used to match in settings search [CHAR LIMIT=NONE] -->
|
<!-- List of synonyms for the Styles picker setting, used to match in settings search [CHAR LIMIT=NONE] -->
|
||||||
<string name="keywords_styles">icon, accent, color</string>
|
<string name="keywords_styles">icon, accent, color, home screen, lock screen, shortcut, clock size</string>
|
||||||
|
|
||||||
<!-- List of synonyms for the Default Assist and Voice input setting, used to match in settings search [CHAR LIMIT=NONE] -->
|
<!-- List of synonyms for the Default Assist and Voice input setting, used to match in settings search [CHAR LIMIT=NONE] -->
|
||||||
<string name="keywords_assist_input">default, assistant</string>
|
<string name="keywords_assist_input">default, assistant</string>
|
||||||
|
|||||||
@@ -464,6 +464,11 @@
|
|||||||
android:title="@string/pointer_location"
|
android:title="@string/pointer_location"
|
||||||
android:summary="@string/pointer_location_summary" />
|
android:summary="@string/pointer_location_summary" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="show_key_presses"
|
||||||
|
android:title="@string/show_key_presses"
|
||||||
|
android:summary="@string/show_key_presses_summary" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ public class HearingAidHelper {
|
|||||||
* @return a list of hearing aids {@link BluetoothDevice} objects
|
* @return a list of hearing aids {@link BluetoothDevice} objects
|
||||||
*/
|
*/
|
||||||
public List<BluetoothDevice> getConnectedHearingAidDeviceList() {
|
public List<BluetoothDevice> getConnectedHearingAidDeviceList() {
|
||||||
if (!isHearingAidSupported()) {
|
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()
|
||||||
|
|| !isHearingAidSupported()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
final List<BluetoothDevice> deviceList = new ArrayList<>();
|
final List<BluetoothDevice> deviceList = new ArrayList<>();
|
||||||
@@ -88,9 +89,6 @@ public class HearingAidHelper {
|
|||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
public boolean isHearingAidSupported() {
|
public boolean isHearingAidSupported() {
|
||||||
if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final List<Integer> supportedList = mBluetoothAdapter.getSupportedProfiles();
|
final List<Integer> supportedList = mBluetoothAdapter.getSupportedProfiles();
|
||||||
return supportedList.contains(BluetoothProfile.HEARING_AID)
|
return supportedList.contains(BluetoothProfile.HEARING_AID)
|
||||||
|| supportedList.contains(BluetoothProfile.HAP_CLIENT);
|
|| supportedList.contains(BluetoothProfile.HAP_CLIENT);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
|
|
||||||
import com.android.settings.bluetooth.HearingAidPairingDialogFragment;
|
import com.android.settings.bluetooth.HearingAidPairingDialogFragment;
|
||||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||||
|
import com.android.settingslib.bluetooth.CsipSetCoordinatorProfile;
|
||||||
import com.android.settingslib.bluetooth.HearingAidInfo;
|
import com.android.settingslib.bluetooth.HearingAidInfo;
|
||||||
|
|
||||||
/** Provides utility methods related hearing aids. */
|
/** Provides utility methods related hearing aids. */
|
||||||
@@ -40,6 +41,11 @@ public final class HearingAidUtils {
|
|||||||
*/
|
*/
|
||||||
public static void launchHearingAidPairingDialog(FragmentManager fragmentManager,
|
public static void launchHearingAidPairingDialog(FragmentManager fragmentManager,
|
||||||
@NonNull CachedBluetoothDevice device) {
|
@NonNull CachedBluetoothDevice device) {
|
||||||
|
// No need to show the pair another ear dialog if the device supports and enables CSIP.
|
||||||
|
// CSIP will pair other devices in the same set automatically.
|
||||||
|
if (isCsipSupportedAndEnabled(device)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (device.isConnectedAshaHearingAidDevice()
|
if (device.isConnectedAshaHearingAidDevice()
|
||||||
&& device.getDeviceMode() == HearingAidInfo.DeviceMode.MODE_BINAURAL
|
&& device.getDeviceMode() == HearingAidInfo.DeviceMode.MODE_BINAURAL
|
||||||
&& device.getSubDevice() == null) {
|
&& device.getSubDevice() == null) {
|
||||||
@@ -56,4 +62,10 @@ public final class HearingAidUtils {
|
|||||||
HearingAidPairingDialogFragment.newInstance(device.getAddress()).show(fragmentManager,
|
HearingAidPairingDialogFragment.newInstance(device.getAddress()).show(fragmentManager,
|
||||||
HearingAidPairingDialogFragment.TAG);
|
HearingAidPairingDialogFragment.TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isCsipSupportedAndEnabled(@NonNull CachedBluetoothDevice device) {
|
||||||
|
return device.getProfiles().stream().anyMatch(
|
||||||
|
profile -> (profile instanceof CsipSetCoordinatorProfile)
|
||||||
|
&& (profile.isEnabled(device.getDevice())));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,31 +16,42 @@
|
|||||||
package com.android.settings.accounts;
|
package com.android.settings.accounts;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.widget.Switch;
|
||||||
|
|
||||||
import androidx.lifecycle.DefaultLifecycleObserver;
|
import androidx.lifecycle.DefaultLifecycleObserver;
|
||||||
import androidx.lifecycle.LifecycleOwner;
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.core.BasePreferenceController;
|
||||||
import com.android.settings.slices.SliceData;
|
import com.android.settings.slices.SliceData;
|
||||||
import com.android.settings.widget.SettingsMainSwitchPreferenceController;
|
|
||||||
import com.android.settingslib.widget.MainSwitchPreference;
|
import com.android.settingslib.widget.MainSwitchPreference;
|
||||||
|
import com.android.settingslib.widget.OnMainSwitchChangeListener;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
|
||||||
public class WorkModePreferenceController extends SettingsMainSwitchPreferenceController
|
/** Controller for "Work apps" toggle that allows the user to enable/disable quiet mode. */
|
||||||
implements Preference.OnPreferenceChangeListener, DefaultLifecycleObserver,
|
public class WorkModePreferenceController extends BasePreferenceController
|
||||||
|
implements OnMainSwitchChangeListener, DefaultLifecycleObserver,
|
||||||
ManagedProfileQuietModeEnabler.QuietModeChangeListener {
|
ManagedProfileQuietModeEnabler.QuietModeChangeListener {
|
||||||
|
|
||||||
private final ManagedProfileQuietModeEnabler mQuietModeEnabler;
|
private final ManagedProfileQuietModeEnabler mQuietModeEnabler;
|
||||||
|
private MainSwitchPreference mPreference;
|
||||||
|
|
||||||
public WorkModePreferenceController(Context context, String key) {
|
public WorkModePreferenceController(Context context, String key) {
|
||||||
super(context, key);
|
super(context, key);
|
||||||
mQuietModeEnabler = new ManagedProfileQuietModeEnabler(context, this);
|
mQuietModeEnabler = new ManagedProfileQuietModeEnabler(context, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
|
super.displayPreference(screen);
|
||||||
|
mPreference = screen.findPreference(getPreferenceKey());
|
||||||
|
mPreference.addOnSwitchChangeListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
return (mQuietModeEnabler.isAvailable()) ? AVAILABLE : DISABLED_FOR_USER;
|
return (mQuietModeEnabler.isAvailable()) ? AVAILABLE : DISABLED_FOR_USER;
|
||||||
@@ -57,19 +68,18 @@ public class WorkModePreferenceController extends SettingsMainSwitchPreferenceCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChecked() {
|
public void onSwitchChanged(Switch switchView, boolean isChecked) {
|
||||||
return !mQuietModeEnabler.isQuietModeEnabled();
|
mQuietModeEnabler.setQuietModeEnabled(!isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setChecked(boolean isChecked) {
|
public final void updateState(Preference preference) {
|
||||||
mQuietModeEnabler.setQuietModeEnabled(!isChecked);
|
mPreference.updateStatus(!mQuietModeEnabler.isQuietModeEnabled());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onQuietModeChanged() {
|
public void onQuietModeChanged() {
|
||||||
updateState(mSwitchPreference);
|
updateState(mPreference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -82,9 +92,4 @@ public class WorkModePreferenceController extends SettingsMainSwitchPreferenceCo
|
|||||||
public int getSliceHighlightMenuRes() {
|
public int getSliceHighlightMenuRes() {
|
||||||
return R.string.menu_key_accounts;
|
return R.string.menu_key_accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
void setPreference(MainSwitchPreference preference) {
|
|
||||||
mSwitchPreference = preference;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,6 +208,10 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
mRemoveButton = findPreference(FaceSettingsRemoveButtonPreferenceController.KEY);
|
mRemoveButton = findPreference(FaceSettingsRemoveButtonPreferenceController.KEY);
|
||||||
mEnrollButton = findPreference(FaceSettingsEnrollButtonPreferenceController.KEY);
|
mEnrollButton = findPreference(FaceSettingsEnrollButtonPreferenceController.KEY);
|
||||||
|
|
||||||
|
final boolean hasEnrolled = mFaceManager.hasEnrolledTemplates(mUserId);
|
||||||
|
mEnrollButton.setVisible(!hasEnrolled);
|
||||||
|
mRemoveButton.setVisible(hasEnrolled);
|
||||||
|
|
||||||
// There is no better way to do this :/
|
// There is no better way to do this :/
|
||||||
for (AbstractPreferenceController controller : mControllers) {
|
for (AbstractPreferenceController controller : mControllers) {
|
||||||
if (controller instanceof FaceSettingsPreferenceController) {
|
if (controller instanceof FaceSettingsPreferenceController) {
|
||||||
@@ -233,8 +237,6 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
final boolean hasEnrolled = mFaceManager.hasEnrolledTemplates(mUserId);
|
final boolean hasEnrolled = mFaceManager.hasEnrolledTemplates(mUserId);
|
||||||
mEnrollButton.setVisible(!hasEnrolled);
|
|
||||||
mRemoveButton.setVisible(hasEnrolled);
|
|
||||||
|
|
||||||
// When the user has face id registered but failed enrolling in device lock state,
|
// When the user has face id registered but failed enrolling in device lock state,
|
||||||
// lead users directly to the confirm deletion dialog in Face Unlock settings.
|
// lead users directly to the confirm deletion dialog in Face Unlock settings.
|
||||||
|
|||||||
@@ -675,6 +675,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
|||||||
controllers.add(new NfcVerboseVendorLogPreferenceController(context, fragment));
|
controllers.add(new NfcVerboseVendorLogPreferenceController(context, fragment));
|
||||||
controllers.add(new ShowTapsPreferenceController(context));
|
controllers.add(new ShowTapsPreferenceController(context));
|
||||||
controllers.add(new PointerLocationPreferenceController(context));
|
controllers.add(new PointerLocationPreferenceController(context));
|
||||||
|
controllers.add(new ShowKeyPressesPreferenceController(context));
|
||||||
controllers.add(new ShowSurfaceUpdatesPreferenceController(context));
|
controllers.add(new ShowSurfaceUpdatesPreferenceController(context));
|
||||||
controllers.add(new ShowLayoutBoundsPreferenceController(context));
|
controllers.add(new ShowLayoutBoundsPreferenceController(context));
|
||||||
controllers.add(new ShowRefreshRatePreferenceController(context));
|
controllers.add(new ShowRefreshRatePreferenceController(context));
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 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.development;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
|
import com.android.settings.core.PreferenceControllerMixin;
|
||||||
|
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||||
|
|
||||||
|
/** PreferenceController that controls the "Show key presses" developer option. */
|
||||||
|
public class ShowKeyPressesPreferenceController extends
|
||||||
|
DeveloperOptionsPreferenceController implements
|
||||||
|
Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
|
||||||
|
|
||||||
|
private static final String SHOW_KEY_PRESSES_KEY = "show_key_presses";
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
static final int SETTING_VALUE_ON = 1;
|
||||||
|
@VisibleForTesting
|
||||||
|
static final int SETTING_VALUE_OFF = 0;
|
||||||
|
|
||||||
|
public ShowKeyPressesPreferenceController(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPreferenceKey() {
|
||||||
|
return SHOW_KEY_PRESSES_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
final boolean isEnabled = (Boolean) newValue;
|
||||||
|
Settings.System.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.System.SHOW_KEY_PRESSES, isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateState(Preference preference) {
|
||||||
|
int showKeyPresses = Settings.System.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.System.SHOW_KEY_PRESSES, SETTING_VALUE_OFF);
|
||||||
|
((SwitchPreference) mPreference).setChecked(showKeyPresses != SETTING_VALUE_OFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDeveloperOptionsSwitchDisabled() {
|
||||||
|
super.onDeveloperOptionsSwitchDisabled();
|
||||||
|
Settings.System.putInt(mContext.getContentResolver(), Settings.System.SHOW_KEY_PRESSES,
|
||||||
|
SETTING_VALUE_OFF);
|
||||||
|
((SwitchPreference) mPreference).setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -145,19 +145,13 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
super(UserManager.DISALLOW_CONFIG_TETHERING);
|
super(UserManager.DISALLOW_CONFIG_TETHERING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttach(Context context) {
|
|
||||||
super.onAttach(context);
|
|
||||||
TetheringManagerModel model = new ViewModelProvider(this).get(TetheringManagerModel.class);
|
|
||||||
mWifiTetherPreferenceController =
|
|
||||||
new WifiTetherPreferenceController(context, getSettingsLifecycle(), model);
|
|
||||||
mTm = model.getTetheringManager();
|
|
||||||
model.getTetheredInterfaces().observe(this, this::onTetheredInterfacesChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
setIfOnlyAvailableForAdmins(true);
|
||||||
|
if (isUiRestricted()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.tether_prefs);
|
addPreferencesFromResource(R.xml.tether_prefs);
|
||||||
mContext = getContext();
|
mContext = getContext();
|
||||||
@@ -165,13 +159,8 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
mDataSaverEnabled = mDataSaverBackend.isDataSaverEnabled();
|
mDataSaverEnabled = mDataSaverBackend.isDataSaverEnabled();
|
||||||
mDataSaverFooter = findPreference(KEY_DATA_SAVER_FOOTER);
|
mDataSaverFooter = findPreference(KEY_DATA_SAVER_FOOTER);
|
||||||
|
|
||||||
setIfOnlyAvailableForAdmins(true);
|
|
||||||
if (isUiRestricted()) {
|
|
||||||
getPreferenceScreen().removeAll();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setupTetherPreference();
|
setupTetherPreference();
|
||||||
|
setupViewModel();
|
||||||
|
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
@@ -223,8 +212,22 @@ public class TetherSettings extends RestrictedSettingsFragment
|
|||||||
onDataSaverChanged(mDataSaverBackend.isDataSaverEnabled());
|
onDataSaverChanged(mDataSaverBackend.isDataSaverEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void setupViewModel() {
|
||||||
|
TetheringManagerModel model = new ViewModelProvider(this).get(TetheringManagerModel.class);
|
||||||
|
mWifiTetherPreferenceController =
|
||||||
|
new WifiTetherPreferenceController(getContext(), getSettingsLifecycle(), model);
|
||||||
|
mTm = model.getTetheringManager();
|
||||||
|
model.getTetheredInterfaces().observe(this, this::onTetheredInterfacesChanged);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
if (isUiRestricted()) {
|
||||||
|
super.onDestroy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mDataSaverBackend.remListener(this);
|
mDataSaverBackend.remListener(this);
|
||||||
|
|
||||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
|
|||||||
@@ -95,8 +95,7 @@ public class HearingAidHelperTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isHearingAidSupported_supported_returnTrue() {
|
public void isHearingAidSupported_ashaSupported_returnTrue() {
|
||||||
mBluetoothAdapter.enable();
|
|
||||||
mShadowBluetoothAdapter.clearSupportedProfiles();
|
mShadowBluetoothAdapter.clearSupportedProfiles();
|
||||||
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);
|
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);
|
||||||
|
|
||||||
@@ -104,15 +103,20 @@ public class HearingAidHelperTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isHearingAidSupported_bluetoothOff_returnFalse() {
|
public void isHearingAidSupported_hapSupported_returnTrue() {
|
||||||
|
mShadowBluetoothAdapter.clearSupportedProfiles();
|
||||||
|
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HAP_CLIENT);
|
||||||
|
|
||||||
|
assertThat(mHelper.isHearingAidSupported()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isHearingAidSupported_unsupported_returnFalse() {
|
||||||
mShadowBluetoothAdapter.clearSupportedProfiles();
|
mShadowBluetoothAdapter.clearSupportedProfiles();
|
||||||
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);
|
|
||||||
mBluetoothAdapter.disable();
|
|
||||||
|
|
||||||
assertThat(mHelper.isHearingAidSupported()).isFalse();
|
assertThat(mHelper.isHearingAidSupported()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void isAllHearingAidRelatedProfilesReady_allReady_returnTrue() {
|
public void isAllHearingAidRelatedProfilesReady_allReady_returnTrue() {
|
||||||
when(mHearingAidProfile.isProfileReady()).thenReturn(true);
|
when(mHearingAidProfile.isProfileReady()).thenReturn(true);
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
|
|||||||
import com.android.settings.utils.ActivityControllerWrapper;
|
import com.android.settings.utils.ActivityControllerWrapper;
|
||||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||||
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
|
||||||
|
import com.android.settingslib.bluetooth.CsipSetCoordinatorProfile;
|
||||||
import com.android.settingslib.bluetooth.HearingAidInfo;
|
import com.android.settingslib.bluetooth.HearingAidInfo;
|
||||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||||
|
import com.android.settingslib.bluetooth.LocalBluetoothProfile;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@@ -52,6 +54,9 @@ import org.robolectric.RobolectricTestRunner;
|
|||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
import org.robolectric.shadow.api.Shadow;
|
import org.robolectric.shadow.api.Shadow;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/** Tests for {@link HearingAidUtils}. */
|
/** Tests for {@link HearingAidUtils}. */
|
||||||
@RunWith(RobolectricTestRunner.class)
|
@RunWith(RobolectricTestRunner.class)
|
||||||
@Config(shadows = {ShadowAlertDialogCompat.class, ShadowBluetoothAdapter.class,
|
@Config(shadows = {ShadowAlertDialogCompat.class, ShadowBluetoothAdapter.class,
|
||||||
@@ -72,6 +77,8 @@ public class HearingAidUtilsTest {
|
|||||||
private LocalBluetoothManager mLocalBluetoothManager;
|
private LocalBluetoothManager mLocalBluetoothManager;
|
||||||
@Mock
|
@Mock
|
||||||
private CachedBluetoothDeviceManager mCachedDeviceManager;
|
private CachedBluetoothDeviceManager mCachedDeviceManager;
|
||||||
|
@Mock
|
||||||
|
private CsipSetCoordinatorProfile mCsipSetCoordinatorProfile;
|
||||||
private BluetoothDevice mBluetoothDevice;
|
private BluetoothDevice mBluetoothDevice;
|
||||||
private BluetoothAdapter mBluetoothAdapter;
|
private BluetoothAdapter mBluetoothAdapter;
|
||||||
private ShadowBluetoothAdapter mShadowBluetoothAdapter;
|
private ShadowBluetoothAdapter mShadowBluetoothAdapter;
|
||||||
@@ -136,6 +143,38 @@ public class HearingAidUtilsTest {
|
|||||||
assertThat(dialog).isNull();
|
assertThat(dialog).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void launchHearingAidPairingDialog_deviceSupportsCsip_csipEnabled_noDialog() {
|
||||||
|
when(mCachedBluetoothDevice.isConnectedAshaHearingAidDevice()).thenReturn(true);
|
||||||
|
when(mCachedBluetoothDevice.getDeviceMode()).thenReturn(
|
||||||
|
HearingAidInfo.DeviceMode.MODE_BINAURAL);
|
||||||
|
when(mCachedBluetoothDevice.getDeviceSide()).thenReturn(
|
||||||
|
HearingAidInfo.DeviceSide.SIDE_LEFT);
|
||||||
|
makeDeviceSupportCsip();
|
||||||
|
makeDeviceEnableCsip(true);
|
||||||
|
|
||||||
|
HearingAidUtils.launchHearingAidPairingDialog(mFragmentManager, mCachedBluetoothDevice);
|
||||||
|
|
||||||
|
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
||||||
|
assertThat(dialog).isNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void launchHearingAidPairingDialog_deviceSupportsCsip_csipDisabled_dialogShown() {
|
||||||
|
when(mCachedBluetoothDevice.isConnectedAshaHearingAidDevice()).thenReturn(true);
|
||||||
|
when(mCachedBluetoothDevice.getDeviceMode()).thenReturn(
|
||||||
|
HearingAidInfo.DeviceMode.MODE_BINAURAL);
|
||||||
|
when(mCachedBluetoothDevice.getDeviceSide()).thenReturn(
|
||||||
|
HearingAidInfo.DeviceSide.SIDE_LEFT);
|
||||||
|
makeDeviceSupportCsip();
|
||||||
|
makeDeviceEnableCsip(false);
|
||||||
|
|
||||||
|
HearingAidUtils.launchHearingAidPairingDialog(mFragmentManager, mCachedBluetoothDevice);
|
||||||
|
|
||||||
|
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
|
||||||
|
assertThat(dialog.isShowing()).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void launchHearingAidPairingDialog_dialogShown() {
|
public void launchHearingAidPairingDialog_dialogShown() {
|
||||||
when(mCachedBluetoothDevice.isConnectedAshaHearingAidDevice()).thenReturn(true);
|
when(mCachedBluetoothDevice.isConnectedAshaHearingAidDevice()).thenReturn(true);
|
||||||
@@ -150,6 +189,17 @@ public class HearingAidUtilsTest {
|
|||||||
assertThat(dialog.isShowing()).isTrue();
|
assertThat(dialog.isShowing()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void makeDeviceSupportCsip() {
|
||||||
|
List<LocalBluetoothProfile> uuids = new ArrayList<>();
|
||||||
|
uuids.add(mCsipSetCoordinatorProfile);
|
||||||
|
when(mCachedBluetoothDevice.getProfiles()).thenReturn(uuids);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void makeDeviceEnableCsip(boolean enabled) {
|
||||||
|
when(mCsipSetCoordinatorProfile.isEnabled(mCachedBluetoothDevice.getDevice()))
|
||||||
|
.thenReturn(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
private void setupEnvironment() {
|
private void setupEnvironment() {
|
||||||
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalBluetoothManager;
|
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalBluetoothManager;
|
||||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -27,7 +28,9 @@ import android.content.Context;
|
|||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
|
import android.widget.Switch;
|
||||||
|
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
|
|
||||||
import com.android.settingslib.widget.MainSwitchPreference;
|
import com.android.settingslib.widget.MainSwitchPreference;
|
||||||
@@ -57,6 +60,10 @@ public class WorkModePreferenceControllerTest {
|
|||||||
private UserHandle mManagedUser;
|
private UserHandle mManagedUser;
|
||||||
@Mock
|
@Mock
|
||||||
private UserInfo mUserInfo;
|
private UserInfo mUserInfo;
|
||||||
|
@Mock
|
||||||
|
private PreferenceScreen mScreen;
|
||||||
|
@Mock
|
||||||
|
Switch mSwitch;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -69,7 +76,9 @@ public class WorkModePreferenceControllerTest {
|
|||||||
when(mUserManager.getProcessUserId()).thenReturn(0);
|
when(mUserManager.getProcessUserId()).thenReturn(0);
|
||||||
when(mUserManager.getUserProfiles()).thenReturn(Collections.singletonList(mManagedUser));
|
when(mUserManager.getUserProfiles()).thenReturn(Collections.singletonList(mManagedUser));
|
||||||
when(mManagedUser.getIdentifier()).thenReturn(MANAGED_USER_ID);
|
when(mManagedUser.getIdentifier()).thenReturn(MANAGED_USER_ID);
|
||||||
|
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
|
||||||
mController = new WorkModePreferenceController(mContext, PREF_KEY);
|
mController = new WorkModePreferenceController(mContext, PREF_KEY);
|
||||||
|
mController.displayPreference(mScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -106,13 +115,11 @@ public class WorkModePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_shouldRequestQuietModeEnabled() {
|
public void onPreferenceChange_shouldRequestQuietModeEnabled() {
|
||||||
mController.setPreference(mPreference);
|
mController.onSwitchChanged(mSwitch, true);
|
||||||
|
|
||||||
mController.onPreferenceChange(mPreference, true);
|
|
||||||
|
|
||||||
verify(mUserManager).requestQuietModeEnabled(false, mManagedUser);
|
verify(mUserManager).requestQuietModeEnabled(false, mManagedUser);
|
||||||
|
|
||||||
mController.onPreferenceChange(mPreference, false);
|
mController.onSwitchChanged(mSwitch, false);
|
||||||
|
|
||||||
verify(mUserManager).requestQuietModeEnabled(true, mManagedUser);
|
verify(mUserManager).requestQuietModeEnabled(true, mManagedUser);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 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.development;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class ShowKeyPressesPreferenceControllerTest {
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private PreferenceScreen mScreen;
|
||||||
|
@Mock
|
||||||
|
private SwitchPreference mPreference;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
private ShowKeyPressesPreferenceController mController;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
MockitoAnnotations.initMocks(this);
|
||||||
|
mContext = RuntimeEnvironment.application;
|
||||||
|
mController = new ShowKeyPressesPreferenceController(mContext);
|
||||||
|
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
|
||||||
|
mController.displayPreference(mScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateState_showKeyPressesEnabled_shouldCheckedPreference() {
|
||||||
|
Settings.System.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.System.SHOW_KEY_PRESSES, ShowTapsPreferenceController.SETTING_VALUE_ON);
|
||||||
|
|
||||||
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
|
verify(mPreference).setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateState_showKeyPressesDisabled_shouldUncheckedPreference() {
|
||||||
|
Settings.System.putInt(mContext.getContentResolver(),
|
||||||
|
Settings.System.SHOW_KEY_PRESSES, ShowTapsPreferenceController.SETTING_VALUE_OFF);
|
||||||
|
|
||||||
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
|
verify(mPreference).setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onPreferenceChange_preferenceChecked_shouldEnableShowKeyPresses() {
|
||||||
|
mController.onPreferenceChange(mPreference, true /* new value */);
|
||||||
|
|
||||||
|
final int showKeyPresses = Settings.System.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.System.SHOW_KEY_PRESSES, -1 /* default */);
|
||||||
|
|
||||||
|
assertThat(showKeyPresses).isEqualTo(ShowTapsPreferenceController.SETTING_VALUE_ON);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onPreferenceChange_preferenceUnchecked_shouldDisableShowKeyPresses() {
|
||||||
|
mController.onPreferenceChange(mPreference, false /* new value */);
|
||||||
|
|
||||||
|
final int showTapsMode = Settings.System.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.System.SHOW_KEY_PRESSES, -1 /* default */);
|
||||||
|
|
||||||
|
assertThat(showTapsMode).isEqualTo(ShowTapsPreferenceController.SETTING_VALUE_OFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onDeveloperOptionsSwitchDisabled_preferenceShouldBeEnabled() {
|
||||||
|
mController.onDeveloperOptionsSwitchDisabled();
|
||||||
|
|
||||||
|
final int showTapsMode = Settings.System.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.System.SHOW_KEY_PRESSES, -1 /* default */);
|
||||||
|
|
||||||
|
assertThat(showTapsMode).isEqualTo(ShowTapsPreferenceController.SETTING_VALUE_OFF);
|
||||||
|
verify(mPreference).setEnabled(false);
|
||||||
|
verify(mPreference).setChecked(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,6 +45,7 @@ import android.hardware.usb.UsbManager;
|
|||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.TetheringManager;
|
import android.net.TetheringManager;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.util.FeatureFlagUtils;
|
import android.util.FeatureFlagUtils;
|
||||||
@@ -54,6 +55,7 @@ import androidx.preference.Preference;
|
|||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreference;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.RestrictedSettingsFragment;
|
||||||
import com.android.settings.core.FeatureFlags;
|
import com.android.settings.core.FeatureFlags;
|
||||||
import com.android.settings.wifi.tether.WifiTetherPreferenceController;
|
import com.android.settings.wifi.tether.WifiTetherPreferenceController;
|
||||||
import com.android.settingslib.RestrictedSwitchPreference;
|
import com.android.settingslib.RestrictedSwitchPreference;
|
||||||
@@ -66,6 +68,9 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.RuntimeEnvironment;
|
import org.robolectric.RuntimeEnvironment;
|
||||||
|
import org.robolectric.annotation.Config;
|
||||||
|
import org.robolectric.annotation.Implementation;
|
||||||
|
import org.robolectric.annotation.Implements;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -92,7 +97,7 @@ public class TetherSettingsTest {
|
|||||||
@Mock
|
@Mock
|
||||||
private Preference mDataSaverFooter;
|
private Preference mDataSaverFooter;
|
||||||
|
|
||||||
TetherSettings mTetherSettings;
|
private MockTetherSettings mTetherSettings;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
@@ -114,7 +119,7 @@ public class TetherSettingsTest {
|
|||||||
when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
|
when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
|
||||||
when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
|
when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
|
||||||
|
|
||||||
mTetherSettings = spy(new TetherSettings());
|
mTetherSettings = spy(new MockTetherSettings());
|
||||||
mTetherSettings.mContext = mContext;
|
mTetherSettings.mContext = mContext;
|
||||||
mTetherSettings.mWifiTetherPreferenceController = mWifiTetherPreferenceController;
|
mTetherSettings.mWifiTetherPreferenceController = mWifiTetherPreferenceController;
|
||||||
mTetherSettings.mUsbTether = mUsbTether;
|
mTetherSettings.mUsbTether = mUsbTether;
|
||||||
@@ -123,6 +128,16 @@ public class TetherSettingsTest {
|
|||||||
mTetherSettings.mDataSaverFooter = mDataSaverFooter;
|
mTetherSettings.mDataSaverFooter = mDataSaverFooter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Config(shadows = ShadowRestrictedSettingsFragment.class)
|
||||||
|
public void onCreate_isUiRestricted_doNotSetupViewModel() {
|
||||||
|
when(mTetherSettings.isUiRestricted()).thenReturn(true);
|
||||||
|
|
||||||
|
mTetherSettings.onCreate(null);
|
||||||
|
|
||||||
|
verify(mTetherSettings, never()).setupViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTetherNonIndexableKeys_tetherAvailable_keysNotReturned() {
|
public void testTetherNonIndexableKeys_tetherAvailable_keysNotReturned() {
|
||||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
|
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
|
||||||
@@ -431,4 +446,19 @@ public class TetherSettingsTest {
|
|||||||
mTetherSettings.registerReceiver();
|
mTetherSettings.registerReceiver();
|
||||||
updateOnlyBluetoothState(mTetherSettings);
|
updateOnlyBluetoothState(mTetherSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class MockTetherSettings extends TetherSettings {
|
||||||
|
@Override
|
||||||
|
public boolean isUiRestricted() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Implements(RestrictedSettingsFragment.class)
|
||||||
|
public static final class ShadowRestrictedSettingsFragment {
|
||||||
|
@Implementation
|
||||||
|
public void onCreate(Bundle icicle) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user