diff --git a/res/xml/my_device_info.xml b/res/xml/my_device_info.xml index d993c00df71..9dc39c0f1c7 100644 --- a/res/xml/my_device_info.xml +++ b/res/xml/my_device_info.xml @@ -96,7 +96,8 @@ + android:order="6" + settings:controller="com.android.settings.deviceinfo.RadioInfoPreferenceController"> diff --git a/src/com/android/settings/deviceinfo/RadioInfoPreferenceController.java b/src/com/android/settings/deviceinfo/RadioInfoPreferenceController.java new file mode 100644 index 00000000000..35523025cf3 --- /dev/null +++ b/src/com/android/settings/deviceinfo/RadioInfoPreferenceController.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 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.deviceinfo; + +import android.content.Context; +import android.telephony.TelephonyManager; + +import androidx.preference.PreferenceScreen; + +import com.android.settings.R; +import com.android.settings.core.BasePreferenceController; + +public class RadioInfoPreferenceController extends BasePreferenceController { + + private TelephonyManager mTelephonyManager; + + public RadioInfoPreferenceController(Context context, String key) { + super(context, key); + mTelephonyManager = mContext.getSystemService(TelephonyManager.class); + } + + @Override + public void displayPreference(PreferenceScreen screen) { + super.displayPreference(screen); + } + + @Override + public int getAvailabilityStatus() { + return mTelephonyManager.isVoiceCapable() + ? AVAILABLE + : UNSUPPORTED_ON_DEVICE; + } +}