Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5ccde31 authored by Bonian Chen's avatar Bonian Chen
Browse files

[Settings] Support getSystemService(Class<T>)

Add getSystemService(Class<T>) to align the capability with framework
part.

This is a back port from aosp/1639943, aosp/1645152 and aosp/1648047

Bug: 179640862
Test: local
Change-Id: I035db55a71f94000ca35f8d71f03c19208423c73
parent d8c9a539
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public class DeviceNamePreferenceController extends BasePreferenceController
    public DeviceNamePreferenceController(Context context, String key) {
        super(context, key);

        mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
        mWifiManager = context.getSystemService(WifiManager.class);
        mWifiDeviceNameTextValidator = new WifiDeviceNameTextValidator();
        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
        try {
            moveId = getPackageManager().movePrimaryStorage(mVolume);
        } catch (IllegalArgumentException e) {
            StorageManager sm = (StorageManager) getSystemService(STORAGE_SERVICE);
            StorageManager sm = getSystemService(StorageManager.class);

            if (Objects.equals(mVolume.getFsUuid(), sm.getPrimaryStorageVolume().getUuid())) {
                final Intent intent = new Intent(this, StorageWizardReady.class);
+2 −2
Original line number Diff line number Diff line
@@ -146,8 +146,8 @@ public class MyDeviceInfoFragment extends DashboardFragment
        // TODO: There may be an avatar setting action we can use here.
        final int iconId = bundle.getInt("icon_id", 0);
        if (iconId == 0) {
            final UserManager userManager = (UserManager) getActivity().getSystemService(
                    Context.USER_SERVICE);
            final UserManager userManager = getActivity().getSystemService(
                    UserManager.class);
            final UserInfo info = Utils.getExistingUser(userManager,
                    android.os.Process.myUserHandle());
            controller.setLabel(info.name);
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public class FirmwareVersionDetailPreferenceController extends BasePreferenceCon

    public FirmwareVersionDetailPreferenceController(Context context, String key) {
        super(context, key);
        mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
        mUserManager = mContext.getSystemService(UserManager.class);
        initializeAdminPermissions();
    }

+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public class ImeiInfoPreferenceController extends BasePreferenceController {

    public ImeiInfoPreferenceController(Context context, String key) {
        super(context, key);
        mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        mTelephonyManager = context.getSystemService(TelephonyManager.class);
        mIsMultiSim = mTelephonyManager.getPhoneCount() > 1;
    }

Loading