Merge "Dynamic advanced button for about phone v2"
This commit is contained in:
committed by
Android (Google) Code Review
commit
12108840a0
@@ -22,8 +22,11 @@ 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 com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -62,6 +65,11 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
|
||||
|
||||
private static final String KEY_LEGAL_CONTAINER = "legal_container";
|
||||
|
||||
@VisibleForTesting
|
||||
static final int SIM_PREFERENCES_COUNT = 3;
|
||||
@VisibleForTesting
|
||||
static final int NON_SIM_PREFERENCES_COUNT = 2;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.DEVICEINFO;
|
||||
@@ -72,6 +80,21 @@ public class DeviceInfoSettings extends DashboardFragment implements Indexable {
|
||||
return R.string.help_uri_about;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
if (FeatureFlagUtils.isEnabled(getContext(), DEVICE_INFO_V2)) {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
final BuildNumberPreferenceController buildNumberPreferenceController =
|
||||
|
Reference in New Issue
Block a user