Delete about phone v1 code

Bug: 36458278
Test: make RunSettingsRoboTests -j40
Change-Id: Ib8f420a86caa1da0165aa5c161eb584a009ed2b9
This commit is contained in:
jeffreyhuang
2017-11-29 16:41:48 -08:00
parent b8eb89579c
commit 7ef47a9c5d
25 changed files with 34 additions and 1786 deletions

View File

@@ -16,36 +16,29 @@
package com.android.settings;
import static com.android.settings.core.FeatureFlags.DEVICE_INFO_V2;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.telephony.TelephonyManager;
import android.util.FeatureFlagUtils;
import android.support.annotation.VisibleForTesting;
import android.telephony.TelephonyManager;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.deviceinfo.BasebandVersionPreferenceController;
import com.android.settings.deviceinfo.BluetoothAddressPreferenceController;
import com.android.settings.deviceinfo.BuildNumberPreferenceController;
import com.android.settings.deviceinfo.DeviceModelPreferenceController;
import com.android.settings.deviceinfo.FccEquipmentIdPreferenceController;
import com.android.settings.deviceinfo.FeedbackPreferenceController;
import com.android.settings.deviceinfo.FirmwareVersionPreferenceController;
import com.android.settings.deviceinfo.ImsStatusPreferenceController;
import com.android.settings.deviceinfo.IpAddressPreferenceController;
import com.android.settings.deviceinfo.KernelVersionPreferenceController;
import com.android.settings.deviceinfo.ManualPreferenceController;
import com.android.settings.deviceinfo.PhoneNumberPreferenceController;
import com.android.settings.deviceinfo.RegulatoryInfoPreferenceController;
import com.android.settings.deviceinfo.SafetyInfoPreferenceController;
import com.android.settings.deviceinfo.SecurityPatchPreferenceController;
import com.android.settings.deviceinfo.WifiMacAddressPreferenceController;
import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceControllerV2;
import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceControllerV2;
@@ -84,21 +77,19 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
final Bundle arguments = getArguments();
if (FeatureFlagUtils.isEnabled(getContext(), DEVICE_INFO_V2)) {
// Do not override initial expand children count if we come from
// search (EXTRA_FRAGMENT_ARG_KEY is set) - we need to display every if entry point
// is search.
if (arguments == null
|| !arguments.containsKey(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY)) {
// Do not override initial expand children count if we come from
// search (EXTRA_FRAGMENT_ARG_KEY is set) - we need to display every if entry point
// is search.
if (arguments == null
|| !arguments.containsKey(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY)) {
// Increase the number of children when the device contains more than 1 sim.
final TelephonyManager telephonyManager = (TelephonyManager) getSystemService(
Context.TELEPHONY_SERVICE);
final int numberOfChildren = Math.max(SIM_PREFERENCES_COUNT,
SIM_PREFERENCES_COUNT * telephonyManager.getPhoneCount())
+ NON_SIM_PREFERENCES_COUNT;
getPreferenceScreen().setInitialExpandedChildrenCount(numberOfChildren);
}
// Increase the number of children when the device contains more than 1 sim.
final TelephonyManager telephonyManager = (TelephonyManager) getSystemService(
Context.TELEPHONY_SERVICE);
final int numberOfChildren = Math.max(SIM_PREFERENCES_COUNT,
SIM_PREFERENCES_COUNT * telephonyManager.getPhoneCount())
+ NON_SIM_PREFERENCES_COUNT;
getPreferenceScreen().setInitialExpandedChildrenCount(numberOfChildren);
}
}
@@ -119,8 +110,7 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
@Override
protected int getPreferenceScreenResId() {
return FeatureFlagUtils.isEnabled(getContext(), DEVICE_INFO_V2)
? R.xml.device_info_settings_v2 : R.xml.device_info_settings;
return R.xml.device_info_settings_v2;
}
@Override
@@ -156,57 +146,23 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Activity activity, Fragment fragment, Lifecycle lifecycle) {
if (FeatureFlagUtils.isEnabled(context, DEVICE_INFO_V2)) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
// Device name
controllers.add(new PhoneNumberPreferenceController(context));
controllers.add(new SimStatusPreferenceControllerV2(context, fragment));
controllers.add(new DeviceModelPreferenceController(context, fragment));
controllers.add(new ImeiInfoPreferenceControllerV2(context, fragment));
controllers.add(new FirmwareVersionPreferenceControllerV2(context, fragment));
controllers.add(new ImsStatusPreferenceController(context, lifecycle));
controllers.add(new IpAddressPreferenceController(context, lifecycle));
controllers.add(new WifiMacAddressPreferenceController(context, lifecycle));
controllers.add(new BluetoothAddressPreferenceController(context, lifecycle));
controllers.add(new RegulatoryInfoPreferenceController(context));
controllers.add(new SafetyInfoPreferenceController(context));
controllers.add(new ManualPreferenceController(context));
controllers.add(new FeedbackPreferenceController(fragment, context));
controllers.add(new FccEquipmentIdPreferenceController(context));
controllers.add(
new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
return controllers;
}
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(
new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
controllers.add(new PhoneNumberPreferenceController(context));
controllers.add(new SimStatusPreferenceControllerV2(context, fragment));
controllers.add(new DeviceModelPreferenceController(context, fragment));
controllers.add(new ImeiInfoPreferenceControllerV2(context, fragment));
controllers.add(new FirmwareVersionPreferenceControllerV2(context, fragment));
controllers.add(new ImsStatusPreferenceController(context, lifecycle));
controllers.add(new IpAddressPreferenceController(context, lifecycle));
controllers.add(new WifiMacAddressPreferenceController(context, lifecycle));
controllers.add(new BluetoothAddressPreferenceController(context, lifecycle));
controllers.add(new RegulatoryInfoPreferenceController(context));
controllers.add(new SafetyInfoPreferenceController(context));
controllers.add(new ManualPreferenceController(context));
controllers.add(new FeedbackPreferenceController(fragment, context));
controllers.add(new KernelVersionPreferenceController(context));
controllers.add(new BasebandVersionPreferenceController(context));
controllers.add(new FirmwareVersionPreferenceController(context, lifecycle));
controllers.add(new RegulatoryInfoPreferenceController(context));
controllers.add(new DeviceModelPreferenceController(context, fragment));
controllers.add(new SecurityPatchPreferenceController(context));
controllers.add(new FccEquipmentIdPreferenceController(context));
controllers.add(new SafetyInfoPreferenceController(context));
controllers.add(
new BuildNumberPreferenceController(context, activity, fragment, lifecycle));
return controllers;
}
@@ -220,8 +176,7 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) {
final SearchIndexableResource sir = new SearchIndexableResource(context);
sir.xmlResId = FeatureFlagUtils.isEnabled(context, DEVICE_INFO_V2)
? R.xml.device_info_settings_v2 : R.xml.device_info_settings;
sir.xmlResId = R.xml.device_info_settings_v2;
return Arrays.asList(sir);
}

View File

@@ -148,9 +148,6 @@ public class Settings extends SettingsActivity {
public static class ApnEditorActivity extends SettingsActivity { /* empty */ }
public static class ChooseAccountActivity extends SettingsActivity { /* empty */ }
public static class IccLockSettingsActivity extends SettingsActivity { /* empty */ }
public static class ImeiInformationActivity extends SettingsActivity { /* empty */ }
public static class SimStatusActivity extends SettingsActivity { /* empty */ }
public static class StatusActivity extends SettingsActivity { /* empty */ }
public static class TestingSettingsActivity extends SettingsActivity { /* empty */ }
public static class WifiAPITestActivity extends SettingsActivity { /* empty */ }
public static class WifiInfoActivity extends SettingsActivity { /* empty */ }

View File

@@ -20,7 +20,6 @@ package com.android.settings.core;
* This class keeps track of all feature flags in Settings.
*/
public class FeatureFlags {
public static final String DEVICE_INFO_V2 = "device_info_v2";
public static final String SEARCH_V2 = "settings_search_v2";
public static final String SUGGESTIONS_V2 = "new_settings_suggestion";
public static final String APP_INFO_V2 = "settings_app_info_v2";

View File

@@ -65,12 +65,9 @@ import com.android.settings.datausage.DataUsageList;
import com.android.settings.datausage.DataUsageSummary;
import com.android.settings.deletionhelper.AutomaticStorageManagerSettings;
import com.android.settings.development.DevelopmentSettingsDashboardFragment;
import com.android.settings.deviceinfo.ImeiInformation;
import com.android.settings.deviceinfo.PrivateVolumeForget;
import com.android.settings.deviceinfo.PrivateVolumeSettings;
import com.android.settings.deviceinfo.PublicVolumeSettings;
import com.android.settings.deviceinfo.SimStatus;
import com.android.settings.deviceinfo.Status;
import com.android.settings.deviceinfo.StorageDashboardFragment;
import com.android.settings.deviceinfo.StorageSettings;
import com.android.settings.display.NightDisplaySettings;
@@ -235,9 +232,6 @@ public class SettingsGateway {
ManagedProfileSettings.class.getName(),
ChooseAccountActivity.class.getName(),
IccLockSettings.class.getName(),
ImeiInformation.class.getName(),
SimStatus.class.getName(),
Status.class.getName(),
TestingSettings.class.getName(),
WifiAPITest.class.getName(),
WifiInfo.class.getName(),

View File

@@ -1,58 +0,0 @@
/*
* Copyright (C) 2017 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.os.SystemProperties;
import android.support.v7.preference.Preference;
import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.firmwareversion.BasebandVersionDialogController;
import com.android.settingslib.Utils;
import com.android.settingslib.core.AbstractPreferenceController;
/**
* deprecated in favor of {@link BasebandVersionDialogController}
*/
@Deprecated
public class BasebandVersionPreferenceController extends AbstractPreferenceController implements
PreferenceControllerMixin {
private static final String BASEBAND_PROPERTY = "gsm.version.baseband";
private static final String KEY_BASEBAND_VERSION = "baseband_version";
public BasebandVersionPreferenceController(Context context) {
super(context);
}
@Override
public boolean isAvailable() {
return !Utils.isWifiOnly(mContext);
}
@Override
public String getPreferenceKey() {
return KEY_BASEBAND_VERSION;
}
@Override
public void updateState(Preference preference) {
super.updateState(preference);
preference.setSummary(SystemProperties.get(BASEBAND_PROPERTY,
mContext.getResources().getString(R.string.device_info_default)));
}
}

View File

@@ -1,110 +0,0 @@
/*
* Copyright (C) 2017 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.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import com.android.settings.Utils;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnStart;
import com.android.settingslib.core.lifecycle.events.OnStop;
/**
* Deprecated in About Phone V2
* Information in this preference is available in {@link PowerUsageSummary}
*/
@Deprecated
public class BatteryInfoPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin, LifecycleObserver, OnStart, OnStop {
@VisibleForTesting
static final IntentFilter BATTERY_INFO_RECEIVER_INTENT_FILTER =
new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
@VisibleForTesting
static final String KEY_BATTERY_STATUS = "battery_status";
@VisibleForTesting
static final String KEY_BATTERY_LEVEL = "battery_level";
@VisibleForTesting
BroadcastReceiver mBatteryInfoReceiver;
private Preference mBatteryStatus;
private Preference mBatteryLevel;
public BatteryInfoPreferenceController(Context context, Lifecycle lifecycle) {
super(context);
mBatteryInfoReceiver = new BatteryInfoReceiver(context);
if (lifecycle != null) {
lifecycle.addObserver(this);
}
}
@Override
public boolean isAvailable() {
return true;
}
@Override
public String getPreferenceKey() {
return null;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mBatteryLevel = screen.findPreference(KEY_BATTERY_LEVEL);
mBatteryStatus = screen.findPreference(KEY_BATTERY_STATUS);
}
@Override
public void onStart() {
mContext.registerReceiver(mBatteryInfoReceiver, BATTERY_INFO_RECEIVER_INTENT_FILTER);
}
@Override
public void onStop() {
mContext.unregisterReceiver(mBatteryInfoReceiver);
}
private class BatteryInfoReceiver extends BroadcastReceiver {
private final Context mContext;
public BatteryInfoReceiver(Context context) {
mContext = context;
}
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
mBatteryLevel.setSummary(Utils.getBatteryPercentage(intent));
mBatteryStatus.setSummary(Utils.getBatteryStatus(mContext.getResources(), intent));
}
}
}
}

View File

@@ -21,10 +21,8 @@ import android.os.Build;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.DeviceInfoUtils;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -51,12 +49,8 @@ public class DeviceModelPreferenceController extends AbstractPreferenceControlle
super.displayPreference(screen);
final Preference pref = screen.findPreference(KEY_DEVICE_MODEL);
if (pref != null) {
if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.DEVICE_INFO_V2)) {
pref.setSummary(mContext.getResources().getString(R.string.model_summary,
getDeviceModel()));
} else {
pref.setSummary(getDeviceModel());
}
pref.setSummary(mContext.getResources().getString(R.string.model_summary,
getDeviceModel()));
}
}

View File

@@ -1,118 +0,0 @@
/*
* Copyright (C) 2017 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.content.Intent;
import android.os.Build;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.Log;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionPreferenceControllerV2;
import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnResume;
/**
* deprecated in favor of {@link FirmwareVersionPreferenceControllerV2}
*/
@Deprecated
public class FirmwareVersionPreferenceController extends AbstractPreferenceController implements
PreferenceControllerMixin, LifecycleObserver, OnResume {
private static final String TAG = "FirmwareVersionPref";
private static final String KEY_FIRMWARE_VERSION = "firmware_version";
private final UserManager mUserManager;
private RestrictedLockUtils.EnforcedAdmin mFunDisallowedAdmin;
private boolean mFunDisallowedBySystem;
private long[] mHits = new long[3];
public FirmwareVersionPreferenceController(Context context, Lifecycle lifecycle) {
super(context);
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
if (lifecycle != null) {
lifecycle.addObserver(this);
}
}
@Override
public boolean isAvailable() {
return true;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final Preference pref = screen.findPreference(KEY_FIRMWARE_VERSION);
if (pref != null) {
pref.setSummary(Build.VERSION.RELEASE);
}
}
@Override
public String getPreferenceKey() {
return KEY_FIRMWARE_VERSION;
}
@Override
public void onResume() {
mFunDisallowedAdmin = RestrictedLockUtils.checkIfRestrictionEnforced(
mContext, UserManager.DISALLOW_FUN, UserHandle.myUserId());
mFunDisallowedBySystem = RestrictedLockUtils.hasBaseUserRestriction(
mContext, UserManager.DISALLOW_FUN, UserHandle.myUserId());
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (!TextUtils.equals(preference.getKey(), KEY_FIRMWARE_VERSION)) {
return false;
}
System.arraycopy(mHits, 1, mHits, 0, mHits.length - 1);
mHits[mHits.length - 1] = SystemClock.uptimeMillis();
if (mHits[0] >= (SystemClock.uptimeMillis() - 500)) {
if (mUserManager.hasUserRestriction(UserManager.DISALLOW_FUN)) {
if (mFunDisallowedAdmin != null && !mFunDisallowedBySystem) {
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(mContext,
mFunDisallowedAdmin);
}
Log.d(TAG, "Sorry, no fun for you!");
return false;
}
final Intent intent = new Intent(Intent.ACTION_MAIN)
.setClassName(
"android", com.android.internal.app.PlatLogoActivity.class.getName());
try {
mContext.startActivity(intent);
return true;
} catch (Exception e) {
Log.e(TAG, "Unable to start activity " + intent.toString());
}
}
return false;
}
}

View File

@@ -23,14 +23,12 @@ import android.os.Bundle;
import android.os.SystemProperties;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.FeatureFlagUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.R;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
public class HardwareInfoDialogFragment extends InstrumentedDialogFragment {
@@ -59,12 +57,7 @@ public class HardwareInfoDialogFragment extends InstrumentedDialogFragment {
DeviceModelPreferenceController.getDeviceModel());
// Serial number
if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.DEVICE_INFO_V2)) {
setText(content, R.id.serial_number_label, R.id.serial_number_value, getSerialNumber());
} else {
content.findViewById(R.id.serial_number_label).setVisibility(View.GONE);
content.findViewById(R.id.serial_number_value).setVisibility(View.GONE);
}
setText(content, R.id.serial_number_label, R.id.serial_number_value, getSerialNumber());
// Hardware rev
setText(content, R.id.hardware_rev_label, R.id.hardware_rev_value,

View File

@@ -1,42 +0,0 @@
/*
* Copyright (C) 2017 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 com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceControllerV2;
import com.android.settingslib.deviceinfo.AbstractSimStatusImeiInfoPreferenceController;
/**
* deprecated in favour of {@link ImeiInfoPreferenceControllerV2}
*/
@Deprecated
public class ImeiInfoPreferenceController extends AbstractSimStatusImeiInfoPreferenceController
implements PreferenceControllerMixin {
private static final String KEY_IMEI_INFO = "imei_info";
public ImeiInfoPreferenceController(Context context) {
super(context);
}
@Override
public String getPreferenceKey() {
return KEY_IMEI_INFO;
}
}

View File

@@ -1,180 +0,0 @@
/*
* Copyright (C) 2014 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.os.Bundle;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.TtsSpan;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.deviceinfo.imei.ImeiInfoPreferenceControllerV2;
/**
* deprecated in favor of {@link ImeiInfoPreferenceControllerV2}
*/
@Deprecated
public class ImeiInformation extends SettingsPreferenceFragment {
private static final String KEY_PRL_VERSION = "prl_version";
private static final String KEY_MIN_NUMBER = "min_number";
private static final String KEY_MEID_NUMBER = "meid_number";
private static final String KEY_ICC_ID = "icc_id";
private static final String KEY_IMEI = "imei";
private static final String KEY_IMEI_SV = "imei_sv";
private SubscriptionManager mSubscriptionManager;
private boolean isMultiSIM = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSubscriptionManager = SubscriptionManager.from(getContext());
final TelephonyManager telephonyManager =
(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
initPreferenceScreen(telephonyManager.getSimCount());
}
// Since there are multiple phone for dsds, therefore need to show information for different
// phones.
private void initPreferenceScreen(int slotCount) {
isMultiSIM = (slotCount > 1);
for (int slotId = 0; slotId < slotCount; slotId ++) {
addPreferencesFromResource(R.xml.device_info_phone_status);
setPreferenceValue(slotId);
setNewKey(slotId);
}
}
private void setPreferenceValue(int phoneId) {
final Phone phone = PhoneFactory.getPhone(phoneId);
if (phone != null) {
if (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
setSummaryText(KEY_MEID_NUMBER, phone.getMeid());
setSummaryText(KEY_MIN_NUMBER, phone.getCdmaMin());
if (getResources().getBoolean(R.bool.config_msid_enable)) {
findPreference(KEY_MIN_NUMBER).setTitle(R.string.status_msid_number);
}
setSummaryText(KEY_PRL_VERSION, phone.getCdmaPrlVersion());
if (phone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
// Show ICC ID and IMEI for LTE device
setSummaryText(KEY_ICC_ID, phone.getIccSerialNumber());
setSummaryTextAsDigit(KEY_IMEI, phone.getImei());
setSummaryTextAsDigit(KEY_IMEI_SV, phone.getDeviceSvn());
} else {
// device is not GSM/UMTS, do not display GSM/UMTS features
// check Null in case no specified preference in overlay xml
removePreferenceFromScreen(KEY_IMEI_SV);
removePreferenceFromScreen(KEY_IMEI);
removePreferenceFromScreen(KEY_ICC_ID);
}
} else {
setSummaryTextAsDigit(KEY_IMEI, phone.getImei());
setSummaryTextAsDigit(KEY_IMEI_SV, phone.getDeviceSvn());
// device is not CDMA, do not display CDMA features
// check Null in case no specified preference in overlay xml
removePreferenceFromScreen(KEY_PRL_VERSION);
removePreferenceFromScreen(KEY_MEID_NUMBER);
removePreferenceFromScreen(KEY_MIN_NUMBER);
removePreferenceFromScreen(KEY_ICC_ID);
}
}
}
// Modify the preference key with prefix "_", so new added information preference can be set
// related phone information.
private void setNewKey(int slotId) {
final PreferenceScreen prefScreen = getPreferenceScreen();
final int count = prefScreen.getPreferenceCount();
for (int i = 0; i < count; i++) {
Preference pref = prefScreen.getPreference(i);
String key = pref.getKey();
if (!key.startsWith("_")){
key = "_" + key + String.valueOf(slotId);
pref.setKey(key);
updateTitle(pref, slotId);
}
}
}
private void updateTitle(Preference pref, int slotId) {
if (pref != null) {
String title = pref.getTitle().toString();
if (isMultiSIM) {
// Slot starts from 1, slotId starts from 0 so plus 1
title += " " + getResources().getString(R.string.slot_number, slotId + 1);
}
pref.setTitle(title);
}
}
private void setSummaryText(String key, String text) {
setSummaryText(key, text, false /* forceDigit */);
}
private void setSummaryTextAsDigit(String key, String text) {
setSummaryText(key, text, true /* forceDigit */);
}
private void setSummaryText(String key, CharSequence text, boolean forceDigit) {
final Preference preference = findPreference(key);
if (TextUtils.isEmpty(text)) {
text = getResources().getString(R.string.device_info_default);
} else if (forceDigit && TextUtils.isDigitsOnly(text)) {
final Spannable spannable = new SpannableStringBuilder(text);
final TtsSpan span = new TtsSpan.DigitsBuilder(text.toString()).build();
spannable.setSpan(span, 0, spannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
text = spannable;
}
if (preference != null) {
preference.setSummary(text);
}
}
/**
* Removes the specified preference, if it exists.
* @param key the key for the Preference item
*/
private void removePreferenceFromScreen(String key) {
final Preference preference = findPreference(key);
if (preference != null) {
getPreferenceScreen().removePreference(preference);
}
}
@Override
public int getMetricsCategory() {
return MetricsEvent.DEVICEINFO_IMEI_INFORMATION;
}
}

View File

@@ -1,81 +0,0 @@
/*
* Copyright (C) 2017 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.content.pm.PackageManager;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.Log;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.firmwareversion.SecurityPatchLevelDialogController;
import com.android.settingslib.DeviceInfoUtils;
import com.android.settingslib.core.AbstractPreferenceController;
/**
* deprecated in favor of {@link SecurityPatchLevelDialogController}
*/
@Deprecated
public class SecurityPatchPreferenceController extends AbstractPreferenceController implements
PreferenceControllerMixin {
private static final String KEY_SECURITY_PATCH = "security_patch";
private static final String TAG = "SecurityPatchPref";
private final String mPatch;
private final PackageManager mPackageManager;
public SecurityPatchPreferenceController(Context context) {
super(context);
mPackageManager = mContext.getPackageManager();
mPatch = DeviceInfoUtils.getSecurityPatch();
}
@Override
public boolean isAvailable() {
return !TextUtils.isEmpty(mPatch);
}
@Override
public String getPreferenceKey() {
return KEY_SECURITY_PATCH;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final Preference pref = screen.findPreference(KEY_SECURITY_PATCH);
if (pref != null) {
pref.setSummary(mPatch);
}
}
@Override
public boolean handlePreferenceTreeClick(Preference preference) {
if (!TextUtils.equals(preference.getKey(), KEY_SECURITY_PATCH)) {
return false;
}
if (mPackageManager.queryIntentActivities(preference.getIntent(), 0).isEmpty()) {
// Don't send out the intent to stop crash
Log.w(TAG, "Stop click action on " + KEY_SECURITY_PATCH + ": "
+ "queryIntentActivities() returns empty");
return true;
}
return false;
}
}

View File

@@ -1,39 +0,0 @@
/*
* Copyright (C) 2016 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.os.Build;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.deviceinfo.AbstractSerialNumberPreferenceController;
/**
* Preference controller for displaying device serial number. Wraps {@link Build#getSerial()}.
*
* deprecated because this preference is no longer used in About Phone V2
*/
@Deprecated
public class SerialNumberPreferenceController extends
AbstractSerialNumberPreferenceController implements
PreferenceControllerMixin {
public SerialNumberPreferenceController(Context context) {
super(context);
}
// This space intentionally left blank
}

View File

@@ -1,487 +0,0 @@
/*
* Copyright (C) 2014 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 static android.content.Context.CARRIER_CONFIG_SERVICE;
import static android.content.Context.TELEPHONY_SERVICE;
import android.Manifest;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.support.v7.preference.Preference;
import android.telephony.CarrierConfigManager;
import android.telephony.CellBroadcastMessage;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;
import android.widget.TabHost.TabContentFactory;
import android.widget.TabHost.TabSpec;
import android.widget.TabWidget;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstantConversions;
import com.android.internal.telephony.PhoneFactory;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.android.settingslib.DeviceInfoUtils;
import java.util.List;
/**
* Display the following information
* # Phone Number
* # Network
* # Roaming
* # Device Id (IMEI in GSM and MEID in CDMA)
* # Network type
* # Operator info (area update info cell broadcast)
* # Signal Strength
*
* deprecated in favor of {@link com.android.settings.deviceinfo.simstatus.SimStatusDialogFragment}
*/
@Deprecated
public class SimStatus extends SettingsPreferenceFragment {
private static final String TAG = "SimStatus";
private static final String KEY_DATA_STATE = "data_state";
private static final String KEY_SERVICE_STATE = "service_state";
private static final String KEY_OPERATOR_NAME = "operator_name";
private static final String KEY_ROAMING_STATE = "roaming_state";
private static final String KEY_NETWORK_TYPE = "network_type";
private static final String KEY_LATEST_AREA_INFO = "latest_area_info";
private static final String KEY_PHONE_NUMBER = "number";
private static final String KEY_SIGNAL_STRENGTH = "signal_strength";
private static final String KEY_IMEI = "imei";
private static final String KEY_IMEI_SV = "imei_sv";
private static final String KEY_ICCID = "iccid";
static private final String CB_AREA_INFO_RECEIVED_ACTION =
"com.android.cellbroadcastreceiver.CB_AREA_INFO_RECEIVED";
static private final String GET_LATEST_CB_AREA_INFO_ACTION =
"com.android.cellbroadcastreceiver.GET_LATEST_CB_AREA_INFO";
static private final String CELL_BROADCAST_RECEIVER_APP = "com.android.cellbroadcastreceiver";
private TelephonyManager mTelephonyManager;
private CarrierConfigManager mCarrierConfigManager;
private Phone mPhone = null;
private Resources mRes;
private Preference mSignalStrength;
private SubscriptionInfo mSir;
private boolean mShowLatestAreaInfo;
private boolean mShowICCID;
// Default summary for items
private String mDefaultText;
private TabHost mTabHost;
private TabWidget mTabWidget;
private ListView mListView;
private List<SubscriptionInfo> mSelectableSubInfos;
private PhoneStateListener mPhoneStateListener;
// Once the cell broadcast configuration is moved into telephony framework,
private final BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (CB_AREA_INFO_RECEIVED_ACTION.equals(action)) {
Bundle extras = intent.getExtras();
if (extras == null) {
return;
}
CellBroadcastMessage cbMessage = (CellBroadcastMessage) extras.get("message");
if (cbMessage != null && mSir.getSubscriptionId() == cbMessage.getSubId()) {
String latestAreaInfo = cbMessage.getMessageBody();
updateAreaInfo(latestAreaInfo);
}
}
}
};
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mTelephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
mCarrierConfigManager = (CarrierConfigManager) getSystemService(CARRIER_CONFIG_SERVICE);
mSelectableSubInfos = SubscriptionManager.from(getContext())
.getActiveSubscriptionInfoList();
addPreferencesFromResource(R.xml.device_info_sim_status);
mRes = getResources();
mDefaultText = mRes.getString(R.string.device_info_default);
// Note - missing in zaku build, be careful later...
mSignalStrength = findPreference(KEY_SIGNAL_STRENGTH);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (mSelectableSubInfos == null) {
mSir = null;
} else {
mSir = mSelectableSubInfos.size() > 0 ? mSelectableSubInfos.get(0) : null;
if (mSelectableSubInfos.size() > 1) {
View view = inflater.inflate(R.layout.icc_lock_tabs, container, false);
final ViewGroup prefs_container = (ViewGroup) view.findViewById(
R.id.prefs_container);
Utils.prepareCustomPreferencesList(container, view, prefs_container, false);
View prefs = super.onCreateView(inflater, prefs_container, savedInstanceState);
prefs_container.addView(prefs);
mTabHost = (TabHost) view.findViewById(android.R.id.tabhost);
mTabWidget = (TabWidget) view.findViewById(android.R.id.tabs);
mListView = (ListView) view.findViewById(android.R.id.list);
mTabHost.setup();
mTabHost.setOnTabChangedListener(mTabListener);
mTabHost.clearAllTabs();
for (int i = 0; i < mSelectableSubInfos.size(); i++) {
mTabHost.addTab(buildTabSpec(String.valueOf(i),
String.valueOf(mSelectableSubInfos.get(i).getDisplayName())));
}
return view;
}
}
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
updatePhoneInfos();
}
@Override
public int getMetricsCategory() {
return MetricsEvent.DEVICEINFO_SIM_STATUS;
}
@Override
public void onResume() {
super.onResume();
if (mPhone != null) {
updatePreference();
updateSignalStrength(mPhone.getSignalStrength());
updateServiceState(mPhone.getServiceState());
updateDataState();
mTelephonyManager.listen(mPhoneStateListener,
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
| PhoneStateListener.LISTEN_SERVICE_STATE);
if (mShowLatestAreaInfo) {
getContext().registerReceiver(mAreaInfoReceiver,
new IntentFilter(CB_AREA_INFO_RECEIVED_ACTION),
Manifest.permission.RECEIVE_EMERGENCY_BROADCAST, null);
// Ask CellBroadcastReceiver to broadcast the latest area info received
Intent getLatestIntent = new Intent(GET_LATEST_CB_AREA_INFO_ACTION);
getLatestIntent.setPackage(CELL_BROADCAST_RECEIVER_APP);
getContext().sendBroadcastAsUser(getLatestIntent, UserHandle.ALL,
Manifest.permission.RECEIVE_EMERGENCY_BROADCAST);
}
}
}
@Override
public void onPause() {
super.onPause();
if (mPhone != null) {
mTelephonyManager.listen(mPhoneStateListener,
PhoneStateListener.LISTEN_NONE);
}
if (mShowLatestAreaInfo) {
getContext().unregisterReceiver(mAreaInfoReceiver);
}
}
/**
* Removes the specified preference, if it exists.
* @param key the key for the Preference item
*/
private void removePreferenceFromScreen(String key) {
Preference pref = findPreference(key);
if (pref != null) {
getPreferenceScreen().removePreference(pref);
}
}
private void setSummaryText(String key, String text) {
if (TextUtils.isEmpty(text)) {
text = mDefaultText;
}
// some preferences may be missing
final Preference preference = findPreference(key);
if (preference != null) {
preference.setSummary(text);
}
}
private void updateNetworkType() {
// Whether EDGE, UMTS, etc...
String networktype = null;
final int subId = mSir.getSubscriptionId();
final int actualDataNetworkType = mTelephonyManager.getDataNetworkType(
mSir.getSubscriptionId());
final int actualVoiceNetworkType = mTelephonyManager.getVoiceNetworkType(
mSir.getSubscriptionId());
if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualDataNetworkType) {
networktype = mTelephonyManager.getNetworkTypeName(actualDataNetworkType);
} else if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualVoiceNetworkType) {
networktype = mTelephonyManager.getNetworkTypeName(actualVoiceNetworkType);
}
boolean show4GForLTE = false;
try {
Context con = getActivity().createPackageContext("com.android.systemui", 0);
int id = con.getResources().getIdentifier("config_show4GForLTE",
"bool", "com.android.systemui");
show4GForLTE = con.getResources().getBoolean(id);
} catch (NameNotFoundException e) {
Log.e(TAG, "NameNotFoundException for show4GFotLTE");
}
if (networktype != null && networktype.equals("LTE") && show4GForLTE) {
networktype = "4G";
}
setSummaryText(KEY_NETWORK_TYPE, networktype);
}
private void updateDataState() {
final int state =
PhoneConstantConversions.convertDataState(mPhone.getDataConnectionState());
String display = mRes.getString(R.string.radioInfo_unknown);
switch (state) {
case TelephonyManager.DATA_CONNECTED:
display = mRes.getString(R.string.radioInfo_data_connected);
break;
case TelephonyManager.DATA_SUSPENDED:
display = mRes.getString(R.string.radioInfo_data_suspended);
break;
case TelephonyManager.DATA_CONNECTING:
display = mRes.getString(R.string.radioInfo_data_connecting);
break;
case TelephonyManager.DATA_DISCONNECTED:
display = mRes.getString(R.string.radioInfo_data_disconnected);
break;
}
setSummaryText(KEY_DATA_STATE, display);
}
private void updateServiceState(ServiceState serviceState) {
final int state = serviceState.getState();
String display = mRes.getString(R.string.radioInfo_unknown);
switch (state) {
case ServiceState.STATE_IN_SERVICE:
display = mRes.getString(R.string.radioInfo_service_in);
break;
case ServiceState.STATE_OUT_OF_SERVICE:
// Set signal strength to 0 when service state is STATE_OUT_OF_SERVICE
mSignalStrength.setSummary("0");
case ServiceState.STATE_EMERGENCY_ONLY:
// Set summary string of service state to radioInfo_service_out when
// service state is both STATE_OUT_OF_SERVICE & STATE_EMERGENCY_ONLY
display = mRes.getString(R.string.radioInfo_service_out);
break;
case ServiceState.STATE_POWER_OFF:
display = mRes.getString(R.string.radioInfo_service_off);
// Also set signal strength to 0
mSignalStrength.setSummary("0");
break;
}
setSummaryText(KEY_SERVICE_STATE, display);
if (serviceState.getRoaming()) {
setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in));
} else {
setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_not));
}
setSummaryText(KEY_OPERATOR_NAME, serviceState.getOperatorAlphaLong());
}
private void updateAreaInfo(String areaInfo) {
if (areaInfo != null) {
setSummaryText(KEY_LATEST_AREA_INFO, areaInfo);
}
}
void updateSignalStrength(SignalStrength signalStrength) {
if (mSignalStrength != null) {
final int state = mPhone.getServiceState().getState();
if ((ServiceState.STATE_OUT_OF_SERVICE == state) ||
(ServiceState.STATE_POWER_OFF == state)) {
mSignalStrength.setSummary("0");
return;
}
int signalDbm = signalStrength.getDbm();
int signalAsu = signalStrength.getAsuLevel();
if (-1 == signalDbm) {
signalDbm = 0;
}
if (-1 == signalAsu) {
signalAsu = 0;
}
mSignalStrength.setSummary(mRes.getString(R.string.sim_signal_strength,
signalDbm, signalAsu));
}
}
private void updatePreference() {
if (mPhone.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
mShowLatestAreaInfo = Resources.getSystem().getBoolean(
com.android.internal.R.bool.config_showAreaUpdateInfoSettings);
}
PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(
mSir.getSubscriptionId());
mShowICCID = carrierConfig.getBoolean(
CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL);
// If formattedNumber is null or empty, it'll display as "Unknown".
setSummaryText(KEY_PHONE_NUMBER,
DeviceInfoUtils.getFormattedPhoneNumber(getContext(), mSir));
setSummaryText(KEY_IMEI, mPhone.getImei());
setSummaryText(KEY_IMEI_SV, mPhone.getDeviceSvn());
if (!mShowICCID) {
removePreferenceFromScreen(KEY_ICCID);
} else {
// Get ICCID, which is SIM serial number
String iccid = mTelephonyManager.getSimSerialNumber(mSir.getSubscriptionId());
setSummaryText(KEY_ICCID, iccid);
}
if (!mShowLatestAreaInfo) {
removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
}
boolean hideSignalStrength = carrierConfig.getBoolean(
CarrierConfigManager.KEY_HIDE_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL);
if (hideSignalStrength) {
removePreferenceFromScreen(KEY_SIGNAL_STRENGTH);
}
}
private void updatePhoneInfos() {
if (mSir != null) {
// TODO: http://b/23763013
final Phone phone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(
mSir.getSubscriptionId()));
if (UserManager.get(getContext()).isAdminUser()
&& SubscriptionManager.isValidSubscriptionId(mSir.getSubscriptionId())) {
if (phone == null) {
Log.e(TAG, "Unable to locate a phone object for the given Subscription ID.");
return;
}
mPhone = phone;
// To avoid register multiple listeners when user changes the tab.
if (mPhoneStateListener != null && mTelephonyManager != null) {
mTelephonyManager.listen(mPhoneStateListener,
PhoneStateListener.LISTEN_NONE);
mPhoneStateListener = null;
}
mPhoneStateListener = new PhoneStateListener(mSir.getSubscriptionId()) {
@Override
public void onDataConnectionStateChanged(int state) {
updateDataState();
updateNetworkType();
}
@Override
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
updateSignalStrength(signalStrength);
}
@Override
public void onServiceStateChanged(ServiceState serviceState) {
updateServiceState(serviceState);
}
};
}
}
}
private OnTabChangeListener mTabListener = new OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
final int slotId = Integer.parseInt(tabId);
mSir = mSelectableSubInfos.get(slotId);
// The User has changed tab; update the SIM information.
updatePhoneInfos();
mTelephonyManager.listen(mPhoneStateListener,
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
| PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
| PhoneStateListener.LISTEN_SERVICE_STATE);
updateDataState();
updateNetworkType();
updatePreference();
}
};
private TabContentFactory mEmptyTabContent = new TabContentFactory() {
@Override
public View createTabContent(String tag) {
return new View(mTabHost.getContext());
}
};
private TabSpec buildTabSpec(String tag, String title) {
return mTabHost.newTabSpec(tag).setIndicator(title).setContent(
mEmptyTabContent);
}
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright (C) 2017 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 com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.simstatus.SimStatusPreferenceControllerV2;
import com.android.settingslib.deviceinfo.AbstractSimStatusImeiInfoPreferenceController;
/**
* deprecated in favor of {@link SimStatusPreferenceControllerV2}
*/
@Deprecated
public class SimStatusPreferenceController extends AbstractSimStatusImeiInfoPreferenceController
implements PreferenceControllerMixin {
private static final String KEY_SIM_STATUS = "sim_status";
public SimStatusPreferenceController(Context context) {
super(context);
}
@Override
public String getPreferenceKey() {
return KEY_SIM_STATUS;
}
}

View File

@@ -1,99 +0,0 @@
/*
* Copyright (C) 2008 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.provider.SearchIndexableResource;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.DeviceInfoSettings;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Fragment for showing device hardware info, such as MAC addresses and serial numbers
* Deprecated in About Phone V2
* Information on this page is available in {@link DeviceInfoSettings}
*/
@Deprecated
public class Status extends DashboardFragment {
private static final String TAG = "DeviceStatus";
@Override
public int getMetricsCategory() {
return MetricsEvent.DEVICEINFO_STATUS;
}
@Override
protected String getLogTag() {
return TAG;
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.device_info_status;
}
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
return buildPreferenceControllers(context, getLifecycle());
}
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Lifecycle lifecycle) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new SerialNumberPreferenceController(context));
controllers.add(new UptimePreferenceController(context, lifecycle));
controllers.add(new BluetoothAddressPreferenceController(context, lifecycle));
controllers.add(new IpAddressPreferenceController(context, lifecycle));
controllers.add(new WifiMacAddressPreferenceController(context, lifecycle));
controllers.add(new ImsStatusPreferenceController(context, lifecycle));
controllers.add(new SimStatusPreferenceController(context));
controllers.add(new ImeiInfoPreferenceController(context));
controllers.add(new BatteryInfoPreferenceController(context, lifecycle));
return controllers;
}
/**
* For Search.
*/
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override
public List<SearchIndexableResource> getXmlResourcesToIndex(
Context context, boolean enabled) {
final SearchIndexableResource sir = new SearchIndexableResource(context);
sir.xmlResId = R.xml.device_info_status;
return Arrays.asList(sir);
}
@Override
public List<AbstractPreferenceController> getPreferenceControllers(Context
context) {
return buildPreferenceControllers(context, null /* lifecycle */);
}
};
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright (C) 2017 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 com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.deviceinfo.AbstractUptimePreferenceController;
/**
* Concrete subclass of uptime preference controller
*
* Deprecated in About Phone V2
* Information in this preference is available in {@link PowerUsageSummary}
*/
@Deprecated
public class UptimePreferenceController extends AbstractUptimePreferenceController
implements PreferenceControllerMixin {
public UptimePreferenceController(Context context, Lifecycle lifecycle) {
super(context, lifecycle);
}
// This space intentionally left blank
}