Snap for 11959661 from 076b7ee22a to 24Q3-release

Change-Id: I751144b8ab0d9d594a74d699eb004fa4c8435ea3
This commit is contained in:
Android Build Coastguard Worker
2024-06-12 23:23:03 +00:00
31 changed files with 134 additions and 103 deletions

View File

@@ -4458,15 +4458,15 @@
<string name="trackpad_pointer_speed">Pointer speed</string>
<!-- Title text for mouse pointer fill style. [CHAR LIMIT=35] -->
<string name="pointer_fill_style">Pointer fill style</string>
<!-- Content description for black pointer fill style. [CHAR LIMIT=35] -->
<!-- Content description for black pointer fill style. [CHAR LIMIT=60] -->
<string name="pointer_fill_style_black_button">Change pointer fill style to black</string>
<!-- Content description for green pointer fill style. [CHAR LIMIT=35] -->
<!-- Content description for green pointer fill style. [CHAR LIMIT=60] -->
<string name="pointer_fill_style_green_button">Change pointer fill style to green</string>
<!-- Content description for yellow pointer fill style. [CHAR LIMIT=35] -->
<!-- Content description for yellow pointer fill style. [CHAR LIMIT=60] -->
<string name="pointer_fill_style_yellow_button">Change pointer fill style to yellow</string>
<!-- Content description for pink pointer fill style. [CHAR LIMIT=35] -->
<!-- Content description for pink pointer fill style. [CHAR LIMIT=60] -->
<string name="pointer_fill_style_pink_button">Change pointer fill style to pink</string>
<!-- Content description for blue pointer fill style. [CHAR LIMIT=35] -->
<!-- Content description for blue pointer fill style. [CHAR LIMIT=60] -->
<string name="pointer_fill_style_blue_button">Change pointer fill style to blue</string>
<!-- Title for the button to trigger the 'touch gesture' education. [CHAR LIMIT=35] -->
<string name="trackpad_touch_gesture">Learn touchpad gestures</string>
@@ -8732,9 +8732,9 @@
<string name="notif_listener_more_settings_desc">More settings are available inside this app</string>
<!-- Title for Polite Notifications setting [CHAR LIMIT=45]-->
<string name="notification_polite_title">Cooldown</string>
<string name="notification_polite_main_control_title">Use Cooldown</string>
<string name="notification_polite_description">When you get many notifications within a short time span, your device will minimize sound interruptions and pop-ups on the screen. Calls, alarms, and priority conversations will still alert as notmal, and all delivered notifications are easy to find in the Shade.</string>
<string name="notification_polite_title">Adaptive Notifications</string>
<string name="notification_polite_main_control_title">Use adaptive notifications</string>
<string name="notification_polite_description">When you get many notifications within a short time, your phone will lower volume and minimize pop-ups on screen for up to two minutes. Calls, alarms, and priority conversations still vibrate, make a sound, or show up on the screen, and all notifications are easy to find when you pull down from the top of the screen.</string>
<string name="notification_polite_work">Apply to work profiles</string>
<string name="notification_polite_work_summary">Apply to work profile apps</string>

View File

@@ -116,9 +116,19 @@
<PreferenceCategory
android:key="advanced_section_header"
android:title="@string/advanced_section_header">
<!--Adaptive Notifications-->
<Preference
android:fragment="com.android.settings.notification.PoliteNotificationsPreferenceFragment"
android:key="polite_notifications_preference"
android:order="17"
android:persistent="false"
android:title="@string/notification_polite_title"
settings:controller="com.android.settings.notification.PoliteNotificationsPreferenceController" />
<com.android.settingslib.RestrictedPreference
android:key="zen_mode_notifications"
android:order="17"
android:order="18"
android:title="@string/zen_mode_settings_title"
settings:useAdminDisabledSummary="true"
android:fragment="com.android.settings.notification.zen.ZenModeSettings"
@@ -127,7 +137,7 @@
<SwitchPreferenceCompat
android:key="lock_screen_show_only_unseen_notifs"
android:order="18"
android:order="19"
android:title="@string/unseen_notifs_lock_screen"
android:summary="@string/unseen_notifs_lock_screen_summary"
settings:controller="com.android.settings.notification.ShowOnlyUnseenNotificationsOnLockscreenPreferenceController"
@@ -136,7 +146,7 @@
<Preference
android:fragment="com.android.settings.accessibility.FlashNotificationsPreferenceFragment"
android:key="flash_notifications_preference"
android:order="19"
android:order="20"
android:persistent="false"
android:title="@string/flash_notifications_title"
settings:searchable="false"
@@ -144,7 +154,7 @@
<com.android.settingslib.RestrictedPreference
android:key="app_and_notif_cell_broadcast_settings"
android:order="20"
android:order="21"
android:title="@string/cell_broadcast_settings"
settings:useAdminDisabledSummary="true">
<intent
@@ -155,43 +165,36 @@
<SwitchPreferenceCompat
android:key="silent_icons"
android:order="21"
android:order="22"
android:title="@string/silent_notifications_status_bar"
settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController"/>
<SwitchPreferenceCompat
android:key="show_snooze_options"
android:order="22"
android:order="23"
android:title="@string/snooze_options_title"
settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />
<!-- Notification badging -->
<SwitchPreferenceCompat
android:key="notification_badging"
android:order="23"
android:order="24"
android:title="@string/notification_badging_title"
settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>
<!-- Pulse notification light, on devices that support it -->
<SwitchPreferenceCompat
android:key="notification_pulse"
android:order="24"
android:order="25"
android:title="@string/notification_pulse_title"
settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>
<SwitchPreferenceCompat
android:key="notification_assistant"
android:order="25"
android:order="26"
android:title="@string/notification_assistant_title"
android:summary="@string/notification_assistant_summary"
settings:controller="com.android.settings.notification.NotificationAssistantPreferenceController"/>
<Preference
android:fragment="com.android.settings.notification.PoliteNotificationsPreferenceFragment"
android:key="polite_notifications_preference"
android:order="26"
android:persistent="false"
android:title="@string/notification_polite_title"
settings:controller="com.android.settings.notification.PoliteNotificationsPreferenceController" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -270,6 +270,7 @@ public class ResetNetworkRequest {
if ((mResetOptions & RESET_IMS_STACK) != 0) {
builder.resetIms(mSubscriptionIdToResetIms);
}
// Reset phone process and RILD may impact above components, keep them at the end
if ((mResetOptions & RESET_PHONE_PROCESS) != 0) {
builder.restartPhoneProcess();
}

View File

@@ -148,7 +148,7 @@ public class AccessibilityHearingAidPreferenceController extends BasePreferenceC
// Check if another side of LE audio hearing aid is connected as a pair
final Set<CachedBluetoothDevice> memberDevices = device.getMemberDevice();
if (memberDevices.stream().anyMatch(m -> m.isConnected())) {
if (memberDevices.stream().anyMatch(m -> m.getDevice().isConnected())) {
return mContext.getString(
R.string.accessibility_hearingaid_left_and_right_side_device_summary,
name);
@@ -156,7 +156,7 @@ public class AccessibilityHearingAidPreferenceController extends BasePreferenceC
// Check if another side of ASHA hearing aid is connected as a pair
final CachedBluetoothDevice subDevice = device.getSubDevice();
if (subDevice != null && subDevice.isConnected()) {
if (subDevice != null && subDevice.getDevice().isConnected()) {
return mContext.getString(
R.string.accessibility_hearingaid_left_and_right_side_device_summary, name);
}

View File

@@ -28,9 +28,10 @@ import com.android.settingslib.development.AbstractEnableAdbPreferenceController
public class AdbPreferenceController extends AbstractEnableAdbPreferenceController implements
PreferenceControllerMixin {
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
public AdbPreferenceController(Context context, DevelopmentSettingsDashboardFragment fragment) {
public AdbPreferenceController(Context context,
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
}

View File

@@ -40,7 +40,7 @@ public class BackAnimationPreferenceController extends DeveloperOptionsPreferenc
private static final int SETTING_VALUE_OFF = 0;
private static final int SETTING_VALUE_ON = 1;
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
@VisibleForTesting
BackAnimationPreferenceController(Context context) {

View File

@@ -21,6 +21,7 @@ import static com.android.settings.development.BluetoothLeAudioHwOffloadPreferen
import android.content.Context;
import android.os.SystemProperties;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -32,7 +33,7 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
private static final String PREFERENCE_KEY = "bluetooth_disable_a2dp_hw_offload";
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
static final String A2DP_OFFLOAD_DISABLED_PROPERTY = "persist.bluetooth.a2dp_offload.disabled";
static final String A2DP_OFFLOAD_SUPPORTED_PROPERTY = "ro.bluetooth.a2dp_offload.supported";
@@ -41,7 +42,7 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
boolean mChanged = false;
public BluetoothA2dpHwOffloadPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
}

View File

@@ -49,12 +49,8 @@ public class BluetoothLeAudioAllowListPreferenceController
BluetoothAdapter mBluetoothAdapter;
@VisibleForTesting boolean mLeAudioConnectionByDefault;
private final DevelopmentSettingsDashboardFragment mFragment;
public BluetoothLeAudioAllowListPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
public BluetoothLeAudioAllowListPreferenceController(Context context) {
super(context);
mFragment = fragment;
mBluetoothAdapter = context.getSystemService(BluetoothManager.class).getAdapter();
mLeAudioConnectionByDefault =
SystemProperties.getBoolean(LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY, true);

View File

@@ -24,6 +24,7 @@ import android.bluetooth.BluetoothStatusCodes;
import android.content.Context;
import android.os.SystemProperties;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -39,7 +40,7 @@ public class BluetoothLeAudioHwOffloadPreferenceController
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
private static final String PREFERENCE_KEY = "bluetooth_disable_le_audio_hw_offload";
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
static final String LE_AUDIO_OFFLOAD_DISABLED_PROPERTY =
"persist.bluetooth.leaudio_offload.disabled";
@@ -53,7 +54,7 @@ public class BluetoothLeAudioHwOffloadPreferenceController
boolean mChanged = false;
public BluetoothLeAudioHwOffloadPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
mBluetoothAdapter = context.getSystemService(BluetoothManager.class).getAdapter();

View File

@@ -23,6 +23,7 @@ import android.content.Context;
import android.os.SystemProperties;
import android.sysprop.BluetoothProperties;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -45,7 +46,7 @@ public class BluetoothLeAudioPreferenceController
static final String LE_AUDIO_SWITCHER_DISABLED_PROPERTY =
"persist.bluetooth.leaudio_switcher.disabled";
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
@VisibleForTesting
BluetoothAdapter mBluetoothAdapter;
@@ -54,7 +55,7 @@ public class BluetoothLeAudioPreferenceController
boolean mChanged = false;
public BluetoothLeAudioPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
mBluetoothAdapter = context.getSystemService(BluetoothManager.class).getAdapter();

View File

@@ -22,6 +22,7 @@ import android.os.SystemProperties;
import android.provider.Settings;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
@@ -42,10 +43,10 @@ public class BluetoothSnoopLogPreferenceController extends DeveloperOptionsPrefe
private final String[] mListValues;
private final String[] mListEntries;
private DevelopmentSettingsDashboardFragment mFragment;
@Nullable private DevelopmentSettingsDashboardFragment mFragment;
public BluetoothSnoopLogPreferenceController(
Context context, DevelopmentSettingsDashboardFragment fragment) {
Context context, @Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mListValues = context.getResources()
.getStringArray(com.android.settingslib.R.array.bt_hci_snoop_log_values);

View File

@@ -25,6 +25,7 @@ import android.sysprop.AdbProperties;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
@@ -40,10 +41,10 @@ public class ClearAdbKeysPreferenceController extends DeveloperOptionsPreference
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
private final IAdbManager mAdbManager;
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
public ClearAdbKeysPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;

View File

@@ -22,6 +22,7 @@ import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -41,10 +42,10 @@ public class DesktopModePreferenceController extends DeveloperOptionsPreferenceC
@VisibleForTesting
static final int SETTING_VALUE_ON = 1;
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
public DesktopModePreferenceController(
Context context, DevelopmentSettingsDashboardFragment fragment) {
Context context, @Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
}

View File

@@ -26,8 +26,7 @@ public class DevelopmentMemtagPagePreferenceController extends DeveloperOptionsP
implements PreferenceControllerMixin {
private static final String KEY_DEVELOPMENT_MEMTAG_PAGE = "development_memtag_page";
public DevelopmentMemtagPagePreferenceController(
Context context, DevelopmentSettingsDashboardFragment fragment) {
public DevelopmentMemtagPagePreferenceController(Context context) {
super(context);
}

View File

@@ -655,7 +655,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
controllers.add(new BugReportPreferenceController(context));
controllers.add(new BugReportHandlerPreferenceController(context));
controllers.add(new SystemServerHeapDumpPreferenceController(context));
controllers.add(new DevelopmentMemtagPagePreferenceController(context, fragment));
controllers.add(new DevelopmentMemtagPagePreferenceController(context));
controllers.add(new LocalBackupPasswordPreferenceController(context));
controllers.add(new StayAwakePreferenceController(context, lifecycle));
controllers.add(new HdcpCheckingPreferenceController(context));
@@ -706,7 +706,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
controllers.add(new BluetoothLeAudioPreferenceController(context, fragment));
controllers.add(new BluetoothLeAudioModePreferenceController(context, fragment));
controllers.add(new BluetoothLeAudioDeviceDetailsPreferenceController(context));
controllers.add(new BluetoothLeAudioAllowListPreferenceController(context, fragment));
controllers.add(new BluetoothLeAudioAllowListPreferenceController(context));
controllers.add(new BluetoothA2dpHwOffloadPreferenceController(context, fragment));
controllers.add(new BluetoothLeAudioHwOffloadPreferenceController(context, fragment));
controllers.add(new BluetoothMaxConnectedAudioDevicesPreferenceController(context));

View File

@@ -34,6 +34,7 @@ import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
@@ -86,7 +87,7 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
private static final int OFFSET_TO_FILE_NAME = 30;
public static final String EXPERIMENTAL_UPDATE_TITLE = "Android 16K Kernel Experimental Update";
private @NonNull DevelopmentSettingsDashboardFragment mFragment;
private @Nullable DevelopmentSettingsDashboardFragment mFragment;
private boolean mEnable16k;
private final ListeningExecutorService mExecutorService =
@@ -95,7 +96,7 @@ public class Enable16kPagesPreferenceController extends DeveloperOptionsPreferen
private AlertDialog mProgressDialog;
public Enable16kPagesPreferenceController(
@NonNull Context context, @NonNull DevelopmentSettingsDashboardFragment fragment) {
@NonNull Context context, @Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
this.mFragment = fragment;
mEnable16k = Enable16kUtils.isUsing16kbPages();

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -39,10 +40,10 @@ public class FreeformWindowsPreferenceController extends DeveloperOptionsPrefere
@VisibleForTesting
static final int SETTING_VALUE_ON = 1;
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
public FreeformWindowsPreferenceController(
Context context, DevelopmentSettingsDashboardFragment fragment) {
Context context, @Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
}

View File

@@ -28,10 +28,10 @@ import com.android.settingslib.development.AbstractLogpersistPreferenceControlle
public class LogPersistPreferenceController extends AbstractLogpersistPreferenceController
implements PreferenceControllerMixin {
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
public LogPersistPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment, Lifecycle lifecycle) {
@Nullable DevelopmentSettingsDashboardFragment fragment, Lifecycle lifecycle) {
super(context, lifecycle);
mFragment = fragment;

View File

@@ -30,6 +30,7 @@ import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -45,12 +46,12 @@ public class MockLocationAppPreferenceController extends DeveloperOptionsPrefere
private static final String MOCK_LOCATION_APP_KEY = "mock_location_app";
private static final int[] MOCK_LOCATION_APP_OPS = new int[]{AppOpsManager.OP_MOCK_LOCATION};
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
private final AppOpsManager mAppsOpsManager;
private final PackageManager mPackageManager;
public MockLocationAppPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.os.SystemProperties;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -45,10 +46,10 @@ public class NfcSnoopLogPreferenceController extends
@VisibleForTesting
boolean mChanged = false;
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
public NfcSnoopLogPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
}

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.os.SystemProperties;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -45,10 +46,10 @@ public class NfcVerboseVendorLogPreferenceController
@VisibleForTesting
boolean mChanged = false;
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
public NfcVerboseVendorLogPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
}

View File

@@ -31,6 +31,7 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
@@ -54,11 +55,11 @@ public class OemUnlockPreferenceController extends DeveloperOptionsPreferenceCon
private final UserManager mUserManager;
private final TelephonyManager mTelephonyManager;
private final Activity mActivity;
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
private RestrictedSwitchPreference mPreference;
public OemUnlockPreferenceController(Context context, Activity activity,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
if (!TextUtils.equals(SystemProperties.get(OEM_UNLOCK_SUPPORTED_KEY, UNSUPPORTED),

View File

@@ -28,6 +28,7 @@ import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -40,11 +41,11 @@ public class SelectDebugAppPreferenceController extends DeveloperOptionsPreferen
private static final String DEBUG_APP_KEY = "debug_app";
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
private final PackageManager mPackageManager;
public SelectDebugAppPreferenceController(Context context,
DevelopmentSettingsDashboardFragment fragment) {
@Nullable DevelopmentSettingsDashboardFragment fragment) {
super(context);
mFragment = fragment;
mPackageManager = mContext.getPackageManager();

View File

@@ -22,6 +22,7 @@ import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.PreferenceScreen;
@@ -41,11 +42,11 @@ public class BluetoothCodecDialogPreferenceController extends
private static final String KEY = "bluetooth_audio_codec_settings";
private static final String TAG = "BtCodecCtr";
private final Callback mCallback;
@Nullable private final Callback mCallback;
public BluetoothCodecDialogPreferenceController(Context context, Lifecycle lifecycle,
BluetoothA2dpConfigStore store,
Callback callback) {
@Nullable Callback callback) {
super(context, lifecycle, store);
mCallback = callback;
}

View File

@@ -21,6 +21,7 @@ import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -36,11 +37,11 @@ public class BluetoothHDAudioPreferenceController extends AbstractBluetoothPrefe
private static final String KEY = "bluetooth_hd_audio_settings";
private static final String TAG = "BtHDAudioCtr";
private final Callback mCallback;
@Nullable private final Callback mCallback;
public BluetoothHDAudioPreferenceController(Context context, Lifecycle lifecycle,
BluetoothA2dpConfigStore store,
Callback callback) {
@Nullable Callback callback) {
super(context, lifecycle, store);
mCallback = callback;
}

View File

@@ -23,6 +23,7 @@ import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.TwoStatePreference;
@@ -45,7 +46,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
private static final String ENABLE_ANELE_AS_SYSTEM_DRIVER_KEY = "enable_angle_as_system_driver";
private final DevelopmentSettingsDashboardFragment mFragment;
@Nullable private final DevelopmentSettingsDashboardFragment mFragment;
private final GraphicsDriverSystemPropertiesWrapper mSystemProperties;
@@ -83,7 +84,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
}
public GraphicsDriverEnableAngleAsSystemDriverController(
Context context, DevelopmentSettingsDashboardFragment fragment) {
Context context, @Nullable DevelopmentSettingsDashboardFragment fragment) {
this(context, fragment, new Injector());
}
@@ -96,7 +97,7 @@ public class GraphicsDriverEnableAngleAsSystemDriverController
@VisibleForTesting
GraphicsDriverEnableAngleAsSystemDriverController(
Context context, DevelopmentSettingsDashboardFragment fragment, Injector injector) {
Context context, @Nullable DevelopmentSettingsDashboardFragment fragment, Injector injector) {
super(context);
mFragment = fragment;
mSystemProperties = injector.createSystemPropertiesWrapper();

View File

@@ -256,16 +256,19 @@ public class ResetNetworkOperationBuilder {
* @return this
*/
public ResetNetworkOperationBuilder restartPhoneProcess() {
try {
mContext.getContentResolver().call(
getResetTelephonyContentProviderAuthority(),
METHOD_RESTART_PHONE_PROCESS,
/* arg= */ null,
/* extras= */ null);
Log.i(TAG, "Phone process was restarted.");
} catch (IllegalArgumentException iae) {
Log.w(TAG, "Fail to restart phone process: " + iae);
}
Runnable runnable = () -> {
try {
mContext.getContentResolver().call(
getResetTelephonyContentProviderAuthority(),
METHOD_RESTART_PHONE_PROCESS,
/* arg= */ null,
/* extras= */ null);
Log.i(TAG, "Phone process was restarted.");
} catch (IllegalArgumentException iae) {
Log.w(TAG, "Fail to restart phone process: " + iae);
}
};
mResetSequence.add(runnable);
return this;
}
@@ -275,16 +278,19 @@ public class ResetNetworkOperationBuilder {
* @return this
*/
public ResetNetworkOperationBuilder restartRild() {
try {
mContext.getContentResolver().call(
getResetTelephonyContentProviderAuthority(),
METHOD_RESTART_RILD,
/* arg= */ null,
/* extras= */ null);
Log.i(TAG, "RILD was restarted.");
} catch (IllegalArgumentException iae) {
Log.w(TAG, "Fail to restart RILD: " + iae);
}
Runnable runnable = () -> {
try {
mContext.getContentResolver().call(
getResetTelephonyContentProviderAuthority(),
METHOD_RESTART_RILD,
/* arg= */ null,
/* extras= */ null);
Log.i(TAG, "RILD was restarted.");
} catch (IllegalArgumentException iae) {
Log.w(TAG, "Fail to restart RILD: " + iae);
}
};
mResetSequence.add(runnable);
return this;
}

View File

@@ -33,7 +33,7 @@ android_test {
],
platform_apis: true,
certificate: "platform",
test_suites: ["general-tests"],
test_suites: ["device-tests"],
libs: [
"android.test.runner",
"android.test.base",
@@ -57,6 +57,6 @@ java_test_host {
data: [
":test_16kb_app",
],
test_suites: ["general-tests"],
test_suites: ["device-tests"],
test_config: "AndroidTest.xml",
}

View File

@@ -75,6 +75,7 @@ android_robolectric_test {
//"src/com/android/settings/homepage/**/*.java",
"src/com/android/settings/inputmethod/**/*.java",
"src/com/android/settings/network/ShadowServiceManagerExtend.java",
"src/com/android/settings/notification/modes/**/*.java",
"src/com/android/settings/password/**/*.java",
"src/com/android/settings/search/DatabaseIndexingUtils.java",
"src/com/android/settings/testutils/**/*.java",

View File

@@ -19,6 +19,7 @@ package com.android.settings.accessibility;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import static org.robolectric.Shadows.shadowOf;
@@ -82,6 +83,8 @@ public class AccessibilityHearingAidPreferenceControllerTest {
private BluetoothAdapter mBluetoothAdapter;
private ShadowBluetoothAdapter mShadowBluetoothAdapter;
private BluetoothDevice mBluetoothDevice;
private BluetoothDevice mSubBluetoothDevice;
private final Context mContext = ApplicationProvider.getApplicationContext();
private Preference mHearingAidPreference;
@@ -143,8 +146,8 @@ public class AccessibilityHearingAidPreferenceControllerTest {
public void getSummary_connectedAshaHearingAidBothSide_connectedBothSideSummary() {
when(mCachedBluetoothDevice.getDeviceSide()).thenReturn(
HearingAidInfo.DeviceSide.SIDE_LEFT);
when(mCachedSubBluetoothDevice.isConnected()).thenReturn(true);
when(mCachedBluetoothDevice.getSubDevice()).thenReturn(mCachedSubBluetoothDevice);
when(mSubBluetoothDevice.isConnected()).thenReturn(true);
when(mHearingAidProfile.getConnectedDevices()).thenReturn(generateHearingAidDeviceList());
mPreferenceController.onStart();
@@ -211,8 +214,8 @@ public class AccessibilityHearingAidPreferenceControllerTest {
@Test
public void getSummary_connectedLeAudioHearingAidBothSide_connectedBothSideSummary() {
when(mCachedBluetoothDevice.getMemberDevice()).thenReturn(generateMemberDevices());
when(mCachedSubBluetoothDevice.isConnected()).thenReturn(true);
when(mHapClientProfile.getConnectedDevices()).thenReturn(generateHearingAidDeviceList());
when(mSubBluetoothDevice.isConnected()).thenReturn(true);
mPreferenceController.onStart();
Intent intent = new Intent(BluetoothHapClient.ACTION_HAP_CONNECTION_STATE_CHANGED);
@@ -288,7 +291,8 @@ public class AccessibilityHearingAidPreferenceControllerTest {
mShadowBluetoothAdapter = Shadow.extract(mBluetoothAdapter);
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);
mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HAP_CLIENT);
mBluetoothDevice = mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS);
mBluetoothDevice = spy(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS));
mSubBluetoothDevice = spy(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS_2));
mBluetoothAdapter.enable();
doReturn(mEventManager).when(mLocalBluetoothManager).getEventManager();
@@ -299,8 +303,12 @@ public class AccessibilityHearingAidPreferenceControllerTest {
when(mHearingAidProfile.isProfileReady()).thenReturn(true);
when(mHapClientProfile.isProfileReady()).thenReturn(true);
when(mCachedDeviceManager.findDevice(mBluetoothDevice)).thenReturn(mCachedBluetoothDevice);
when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice);
when(mCachedBluetoothDevice.getAddress()).thenReturn(TEST_DEVICE_ADDRESS);
when(mCachedBluetoothDevice.getName()).thenReturn(TEST_DEVICE_NAME);
when(mCachedDeviceManager.findDevice(mSubBluetoothDevice)).thenReturn(
mCachedSubBluetoothDevice);
when(mCachedSubBluetoothDevice.getDevice()).thenReturn(mSubBluetoothDevice);
}
private void sendIntent(Intent intent) {
@@ -319,7 +327,7 @@ public class AccessibilityHearingAidPreferenceControllerTest {
// Generates different Bluetooth devices for testing multiple devices
final List<BluetoothDevice> deviceList = new ArrayList<>(2);
deviceList.add(mBluetoothDevice);
deviceList.add(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS_2));
deviceList.add(mSubBluetoothDevice);
return deviceList;
}

View File

@@ -188,7 +188,7 @@ public class ResetNetworkOperationBuilderTest {
doThrow(new IllegalArgumentException()).when(mContentProvider).call(
anyString(), anyString(), anyString(), any());
mBuilder.restartPhoneProcess();
mBuilder.restartPhoneProcess().build().run();
}
@Test
@@ -196,12 +196,12 @@ public class ResetNetworkOperationBuilderTest {
doThrow(new IllegalArgumentException()).when(mContentProvider).call(
anyString(), anyString(), anyString(), any());
mBuilder.restartRild();
mBuilder.restartRild().build().run();
}
@Test
public void restartPhoneProcess_withTelephonyContentProvider_shouldCallRestartPhoneProcess() {
mBuilder.restartPhoneProcess();
mBuilder.restartPhoneProcess().build().run();
verify(mContentProvider).call(
eq(mBuilder.getResetTelephonyContentProviderAuthority()),
@@ -212,7 +212,7 @@ public class ResetNetworkOperationBuilderTest {
@Test
public void restartRild_withTelephonyContentProvider_shouldCallRestartRild() {
mBuilder.restartRild();
mBuilder.restartRild().build().run();
verify(mContentProvider).call(
eq(mBuilder.getResetTelephonyContentProviderAuthority()),