1d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd/*
2d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * Copyright (C) 2015 The Android Open Source Project
3d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd *
4d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * Licensed under the Apache License, Version 2.0 (the "License");
5d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * you may not use this file except in compliance with the License.
6d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * You may obtain a copy of the License at
7d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd *
8d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd *      http://www.apache.org/licenses/LICENSE-2.0
9d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd *
10d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * Unless required by applicable law or agreed to in writing, software
11d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * distributed under the License is distributed on an "AS IS" BASIS,
12d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * See the License for the specific language governing permissions and
14d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * limitations under the License.
15d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd */
16d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
17d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddpackage com.android.messaging.datamodel.data;
18d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
19d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport android.app.LoaderManager;
20d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport android.content.Context;
21d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport android.content.Loader;
22d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport android.database.Cursor;
23d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport android.os.Bundle;
24d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport android.text.TextUtils;
25d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
26d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.R;
27d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.datamodel.BoundCursorLoader;
28d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.datamodel.DatabaseHelper.ParticipantColumns;
29d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.datamodel.MessagingContentProvider;
30d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.datamodel.binding.BindableData;
31d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.datamodel.binding.BindingBase;
32d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.util.Assert;
33d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.util.LogUtil;
34d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport com.android.messaging.util.OsUtil;
35d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
36d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport java.util.ArrayList;
37d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddimport java.util.List;
38d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
39d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd/**
40d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * Services SettingsFragment's data needs for loading active self participants to display
41d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd * the list of active subscriptions.
42d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd */
43d3b009ae55651f1e60950342468e3c37fdeb0796Mike Doddpublic class SettingsData extends BindableData implements
44d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        LoaderManager.LoaderCallbacks<Cursor> {
45d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    public interface SettingsDataListener {
46d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        void onSelfParticipantDataLoaded(SettingsData data);
47d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
48d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
49d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    public static class SettingsItem {
50d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public static final int TYPE_GENERAL_SETTINGS = 1;
51d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public static final int TYPE_PER_SUBSCRIPTION_SETTINGS = 2;
52d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
53d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        private final String mDisplayName;
54d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        private final String mDisplayDetail;
55d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        private final String mActivityTitle;
56d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        private final int mType;
57d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        private final int mSubId;
58d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
59d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        private SettingsItem(final String displayName, final String displayDetail,
60d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                final String activityTitle, final int type, final int subId) {
61d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mDisplayName = displayName;
62d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mDisplayDetail = displayDetail;
63d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mActivityTitle = activityTitle;
64d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mType = type;
65d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mSubId = subId;
66d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
67d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
68d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public String getDisplayName() {
69d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            return mDisplayName;
70d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
71d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
72d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public String getDisplayDetail() {
73d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            return mDisplayDetail;
74d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
75d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
76d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public int getType() {
77d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            return mType;
78d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
79d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
80d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public int getSubId() {
81d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            return mSubId;
82d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
83d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
84d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public String getActivityTitle() {
85d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            return mActivityTitle;
86d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
87d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
88d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public static SettingsItem fromSelfParticipant(final Context context,
89d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                final ParticipantData self) {
90d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            Assert.isTrue(self.isSelf());
91d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            Assert.isTrue(self.isActiveSubscription());
92d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            final String displayDetail = TextUtils.isEmpty(self.getDisplayDestination()) ?
93d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    context.getString(R.string.sim_settings_unknown_number) :
94d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                        self.getDisplayDestination();
95d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            final String displayName = context.getString(R.string.sim_specific_settings,
96d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    self.getSubscriptionName());
97d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            return new SettingsItem(displayName, displayDetail, displayName,
98d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    TYPE_PER_SUBSCRIPTION_SETTINGS, self.getSubId());
99d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
100d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
101d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public static SettingsItem createGeneralSettingsItem(final Context context) {
102d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            return new SettingsItem(context.getString(R.string.general_settings),
103d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    null, context.getString(R.string.general_settings_activity_title),
104d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    TYPE_GENERAL_SETTINGS, -1);
105d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
106d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
107d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        public static SettingsItem createDefaultMmsSettingsItem(final Context context,
108d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                final int subId) {
109d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            return new SettingsItem(context.getString(R.string.advanced_settings),
110d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    null, context.getString(R.string.advanced_settings_activity_title),
111d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    TYPE_PER_SUBSCRIPTION_SETTINGS, subId);
112d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
113d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
114d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
115d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    private static final String BINDING_ID = "bindingId";
116d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    private final Context mContext;
117d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    private final SelfParticipantsData mSelfParticipantsData;
118d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    private LoaderManager mLoaderManager;
119d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    private SettingsDataListener mListener;
120d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
121d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    public SettingsData(final Context context,
122d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            final SettingsDataListener listener) {
123d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        mListener = listener;
124d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        mContext = context;
125d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        mSelfParticipantsData = new SelfParticipantsData();
126d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
127d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
128d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    private static final int SELF_PARTICIPANT_LOADER = 1;
129d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
130d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    @Override
131d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
132d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        Assert.equals(SELF_PARTICIPANT_LOADER, id);
133d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        Loader<Cursor> loader = null;
134d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
135d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        final String bindingId = args.getString(BINDING_ID);
136d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        // Check if data still bound to the requesting ui element
137d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        if (isBound(bindingId)) {
138d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            loader = new BoundCursorLoader(bindingId, mContext,
139d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    MessagingContentProvider.PARTICIPANTS_URI,
140d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    ParticipantData.ParticipantsQuery.PROJECTION,
141d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    ParticipantColumns.SUB_ID + " <> ?",
142d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    new String[] { String.valueOf(ParticipantData.OTHER_THAN_SELF_SUB_ID) },
143d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    null);
144d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        } else {
145d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            LogUtil.w(LogUtil.BUGLE_TAG, "Creating self loader after unbinding");
146d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
147d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        return loader;
148d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
149d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
150d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    @Override
151d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    public void onLoadFinished(final Loader<Cursor> generic, final Cursor data) {
152d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        final BoundCursorLoader loader = (BoundCursorLoader) generic;
153d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
154d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        // Check if data still bound to the requesting ui element
155d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        if (isBound(loader.getBindingId())) {
156d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mSelfParticipantsData.bind(data);
157d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mListener.onSelfParticipantDataLoaded(this);
158d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        } else {
159d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            LogUtil.w(LogUtil.BUGLE_TAG, "Self loader finished after unbinding");
160d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
161d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
162d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
163d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    @Override
164d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    public void onLoaderReset(final Loader<Cursor> generic) {
165d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        final BoundCursorLoader loader = (BoundCursorLoader) generic;
166d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
167d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        // Check if data still bound to the requesting ui element
168d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        if (isBound(loader.getBindingId())) {
169d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mSelfParticipantsData.bind(null);
170d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        } else {
171d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            LogUtil.w(LogUtil.BUGLE_TAG, "Self loader reset after unbinding");
172d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
173d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
174d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
175d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    public void init(final LoaderManager loaderManager,
176d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            final BindingBase<SettingsData> binding) {
177d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        final Bundle args = new Bundle();
178d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        args.putString(BINDING_ID, binding.getBindingId());
179d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        mLoaderManager = loaderManager;
180d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        mLoaderManager.initLoader(SELF_PARTICIPANT_LOADER, args, this);
181d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
182d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
183d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    @Override
184d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    protected void unregisterListeners() {
185d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        mListener = null;
186d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
187d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        // This could be null if we bind but the caller doesn't init the BindableData
188d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        if (mLoaderManager != null) {
189d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mLoaderManager.destroyLoader(SELF_PARTICIPANT_LOADER);
190d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            mLoaderManager = null;
191d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
192d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
193d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd
194d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    public List<SettingsItem> getSettingsItems() {
195d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        final List<ParticipantData> selfs = mSelfParticipantsData.getSelfParticipants(true);
196d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        final List<SettingsItem> settingsItems = new ArrayList<SettingsItem>();
197d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        // First goes the general settings, followed by per-subscription settings.
198d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        settingsItems.add(SettingsItem.createGeneralSettingsItem(mContext));
199d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        // For per-subscription settings, show the actual SIM name with phone number if the
200d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        // platorm is at least L-MR1 and there are multiple active SIMs.
201d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        final int activeSubCountExcludingDefault =
202d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                mSelfParticipantsData.getSelfParticipantsCountExcludingDefault(true);
203d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        if (OsUtil.isAtLeastL_MR1() && activeSubCountExcludingDefault > 0) {
204d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            for (ParticipantData self : selfs) {
205d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                if (!self.isDefaultSelf()) {
206d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    if (activeSubCountExcludingDefault > 1) {
207d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                        settingsItems.add(SettingsItem.fromSelfParticipant(mContext, self));
208d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    } else {
209d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                        // This is the only active non-default SIM.
210d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                        settingsItems.add(SettingsItem.createDefaultMmsSettingsItem(mContext,
211d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                                self.getSubId()));
212d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                        break;
213d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    }
214d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                }
215d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            }
216d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        } else {
217d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            // Either pre-L-MR1, or there's no active SIM, so show the default MMS settings.
218d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd            settingsItems.add(SettingsItem.createDefaultMmsSettingsItem(mContext,
219d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd                    ParticipantData.DEFAULT_SELF_SUB_ID));
220d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        }
221d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd        return settingsItems;
222d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd    }
223d3b009ae55651f1e60950342468e3c37fdeb0796Mike Dodd}
224