Create RestrictedDashboardFragment.
RestrictedDashboardFragment has all the same logic coming from RestrcitedSettingsFragment but extends from DashboardFragment. As a result, we could use preferenceController in child class of RestrictedDashboardFragment. This cl also make DeviceListPreferenceFragment as child of RestrictedDashboardFragment, which enfluences the bluetooth page. Bug: 38041586 Test: Build Change-Id: I01395d506176c5cc584948478f7ca16c1c7c7045
This commit is contained in:
@@ -29,16 +29,20 @@ import android.view.MenuItem;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.PreferenceController;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
|
||||
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* BluetoothSettings is the Settings screen for Bluetooth configuration and
|
||||
* connection management.
|
||||
*/
|
||||
public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
private static final int MENU_ID_REFRESH = Menu.FIRST;
|
||||
private static final String TAG = "DevicePickerFragment";
|
||||
|
||||
public DevicePickerFragment() {
|
||||
super(null /* Not tied to any user restrictions. */);
|
||||
@@ -51,8 +55,6 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
|
||||
@Override
|
||||
void addPreferencesForActivity() {
|
||||
addPreferencesFromResource(R.xml.device_picker);
|
||||
|
||||
Intent intent = getActivity().getIntent();
|
||||
mNeedAuth = intent.getBooleanExtra(BluetoothDevicePicker.EXTRA_NEED_AUTH, false);
|
||||
setFilter(intent.getIntExtra(BluetoothDevicePicker.EXTRA_FILTER_TYPE,
|
||||
@@ -150,6 +152,21 @@ public final class DevicePickerFragment extends DeviceListPreferenceFragment {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.device_picker;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PreferenceController> getPreferenceControllers(Context context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void sendDevicePickedIntent(BluetoothDevice device) {
|
||||
Intent intent = new Intent(BluetoothDevicePicker.ACTION_DEVICE_SELECTED);
|
||||
intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
|
||||
|
Reference in New Issue
Block a user