Add device name to About Phone page.

The device name is reflected in three places: A Settings.Global flag
which can be read by third party apps, the Bluetooth device name, and
the Wi-Fi tethering hotspot name.

The Bluetooth and Wi-Fi names can be changed independently of the device
name, but if the user sets the device name, they are all changed in
parallel.

Due to the naming restrictions of Bluetooth devices and SSIDs, the SSID
naming restrictions apply to the device name.

Bug: 63819909
Test: Robotest
Change-Id: I3a81535fc07d183557a6fa5d54baef3c7868499c
This commit is contained in:
Daniel Nishi
2018-01-17 18:05:13 -08:00
parent eb4dceea7f
commit a633b39cfa
10 changed files with 356 additions and 9 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings.deviceinfo.aboutphone;
import static com.android.settings.bluetooth.Utils.getLocalBtManager;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
@@ -54,6 +56,7 @@ import com.android.settings.search.Indexable;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settings.deviceinfo.DeviceNamePreferenceController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -102,6 +105,10 @@ public class MyDeviceInfoFragment extends DashboardFragment {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new PhoneNumberPreferenceController(context));
controllers.add(new BrandedAccountPreferenceController(context));
DeviceNamePreferenceController deviceNamePreferenceController =
new DeviceNamePreferenceController(context);
deviceNamePreferenceController.setLocalBluetoothManager(getLocalBtManager(context));
controllers.add(deviceNamePreferenceController);
controllers.add(new SimStatusPreferenceController(context, fragment));
controllers.add(new DeviceModelPreferenceController(context, fragment));
controllers.add(new ImeiInfoPreferenceController(context, fragment));
@@ -117,7 +124,6 @@ public class MyDeviceInfoFragment extends DashboardFragment {
controllers.add(new FccEquipmentIdPreferenceController(context));
controllers.add(
new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
// TODO: Add preference controller for getting the device name.
return controllers;
}