blob: a083b7f20388c58e5c2097a29e52453e177fd11a [file] [log] [blame]
Santos Cordon7d4ddf62013-07-10 11:58:08 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.phone;
18
19import android.app.ActionBar;
20import android.app.Activity;
Evan Charlton1c696832014-04-15 14:24:23 -070021import android.app.ActivityOptions;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070022import android.app.AlertDialog;
23import android.app.Dialog;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070024import android.content.ContentResolver;
25import android.content.Context;
26import android.content.DialogInterface;
27import android.content.Intent;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070028import android.os.Bundle;
Jonathan Basseric31f1f32015-05-12 10:13:03 -070029import android.os.PersistableBundle;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070030import android.os.UserHandle;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070031import android.preference.CheckBoxPreference;
32import android.preference.ListPreference;
33import android.preference.Preference;
34import android.preference.PreferenceActivity;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070035import android.preference.PreferenceScreen;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070036import android.provider.Settings;
Tyler Gunn4d45d1c2014-09-12 22:17:53 -070037import android.telecom.PhoneAccountHandle;
38import android.telecom.TelecomManager;
Jonathan Basseri4b40ff42015-04-30 21:54:10 -070039import android.telephony.CarrierConfigManager;
Andrew Lee93c345f2014-10-27 15:25:07 -070040import android.telephony.TelephonyManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070041import android.text.TextUtils;
42import android.util.Log;
43import android.view.MenuItem;
Jay Shraunerc2684732014-11-12 12:10:37 -080044import android.widget.Toast;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070045
Andrew Leeeffef9c2015-02-19 16:02:37 -080046import com.android.ims.ImsConfig;
Andrew Lee312e8172014-10-23 17:01:36 -070047import com.android.ims.ImsManager;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070048import com.android.internal.telephony.CallForwardInfo;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070049import com.android.internal.telephony.Phone;
50import com.android.internal.telephony.PhoneConstants;
Andrew Lee2170a972014-08-13 18:13:01 -070051import com.android.phone.common.util.SettingsUtil;
Andrew Leedb2fe562014-09-03 15:40:43 -070052import com.android.phone.settings.AccountSelectionPreference;
Andrew Leebf07f762015-04-07 19:05:50 -070053import com.android.phone.settings.VoicemailSettingsActivity;
Andrew Lee5ed870c2014-10-29 11:47:49 -070054import com.android.phone.settings.fdn.FdnSetting;
Sailesh Nepal788959e2014-07-08 23:36:40 -070055import com.android.services.telephony.sip.SipUtil;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070056
Andrew Lee2170a972014-08-13 18:13:01 -070057import java.lang.String;
Andrew Leef1776d82014-11-04 14:45:02 -080058import java.util.ArrayList;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070059import java.util.List;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070060
61/**
62 * Top level "Call settings" UI; see res/xml/call_feature_setting.xml
63 *
Andrew Leece8ae2a2014-09-10 10:41:48 -070064 * This preference screen is the root of the "Call settings" hierarchy available from the Phone
65 * app; the settings here let you control various features related to phone calls (including
66 * voicemail settings, the "Respond via SMS" feature, and others.) It's used only on
67 * voice-capable phone devices.
Santos Cordon7d4ddf62013-07-10 11:58:08 -070068 *
69 * Note that this activity is part of the package com.android.phone, even
70 * though you reach it from the "Phone" app (i.e. DialtactsActivity) which
71 * is from the package com.android.contacts.
72 *
73 * For the "Mobile network settings" screen under the main Settings app,
74 * See {@link MobileNetworkSettings}.
75 *
76 * @see com.android.phone.MobileNetworkSettings
77 */
78public class CallFeaturesSetting extends PreferenceActivity
Andrew Leebf07f762015-04-07 19:05:50 -070079 implements Preference.OnPreferenceChangeListener {
Santos Cordon7d4ddf62013-07-10 11:58:08 -070080 private static final String LOG_TAG = "CallFeaturesSetting";
81 private static final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
Andrew Lee77527ac2014-10-21 16:57:39 -070082 // STOPSHIP if true. Flag to override behavior default behavior to hide VT setting.
Etan Cohenfd9760e2015-04-29 16:26:14 -070083 private static final boolean ENABLE_VT_FLAG = true;
Santos Cordon7d4ddf62013-07-10 11:58:08 -070084
Santos Cordon7d4ddf62013-07-10 11:58:08 -070085 // String keys for preference lookup
86 // TODO: Naming these "BUTTON_*" is confusing since they're not actually buttons(!)
Andrew Lee8d66d812014-11-24 14:54:02 -080087 // TODO: Consider moving these strings to strings.xml, so that they are not duplicated here and
88 // in the layout files. These strings need to be treated carefully; if the setting is
89 // persistent, they are used as the key to store shared preferences and the name should not be
90 // changed unless the settings are also migrated.
Andrew Lee97708a42014-09-25 12:39:07 -070091 private static final String VOICEMAIL_SETTING_SCREEN_PREF_KEY = "button_voicemail_category_key";
Santos Cordon7d4ddf62013-07-10 11:58:08 -070092 private static final String BUTTON_FDN_KEY = "button_fdn_key";
Santos Cordon7d4ddf62013-07-10 11:58:08 -070093 private static final String BUTTON_RETRY_KEY = "button_auto_retry_key";
Santos Cordon7d4ddf62013-07-10 11:58:08 -070094 private static final String BUTTON_GSM_UMTS_OPTIONS = "button_gsm_more_expand_key";
95 private static final String BUTTON_CDMA_OPTIONS = "button_cdma_more_expand_key";
96
Andrew Leece8ae2a2014-09-10 10:41:48 -070097 private static final String PHONE_ACCOUNT_SETTINGS_KEY =
98 "phone_account_settings_preference_screen";
Andrew Leedb2fe562014-09-03 15:40:43 -070099
Andrew Leedf14ead2014-10-17 14:22:52 -0700100 private static final String ENABLE_VIDEO_CALLING_KEY = "button_enable_video_calling";
101
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700102 private Phone mPhone;
Andrew Lee5ed870c2014-10-29 11:47:49 -0700103 private SubscriptionInfoHelper mSubscriptionInfoHelper;
104
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700105 private CheckBoxPreference mButtonAutoRetry;
Andrew Lee97708a42014-09-25 12:39:07 -0700106 private PreferenceScreen mVoicemailSettingsScreen;
Andrew Leedf14ead2014-10-17 14:22:52 -0700107 private CheckBoxPreference mEnableVideoCalling;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700108
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700109 /*
110 * Click Listeners, handle click based on objects attached to UI.
111 */
112
113 // Click listener for all toggle events
114 @Override
115 public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
Andrew Leebf07f762015-04-07 19:05:50 -0700116 if (preference == mButtonAutoRetry) {
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700117 android.provider.Settings.Global.putInt(mPhone.getContext().getContentResolver(),
118 android.provider.Settings.Global.CALL_AUTO_RETRY,
119 mButtonAutoRetry.isChecked() ? 1 : 0);
120 return true;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700121 }
122 return false;
123 }
124
125 /**
126 * Implemented to support onPreferenceChangeListener to look for preference
127 * changes.
128 *
129 * @param preference is the preference to be changed
130 * @param objValue should be the value of the selection, NOT its localized
131 * display value.
132 */
133 @Override
134 public boolean onPreferenceChange(Preference preference, Object objValue) {
Andrew Lee4ddb9bb2014-11-05 15:03:20 -0800135 if (DBG) log("onPreferenceChange: \"" + preference + "\" changed to \"" + objValue + "\"");
Andrew Lee2170a972014-08-13 18:13:01 -0700136
Andrew Leebf07f762015-04-07 19:05:50 -0700137 if (preference == mEnableVideoCalling) {
Andrew Lee312e8172014-10-23 17:01:36 -0700138 if (ImsManager.isEnhanced4gLteModeSettingEnabledByUser(mPhone.getContext())) {
139 PhoneGlobals.getInstance().phoneMgr.enableVideoCalling((boolean) objValue);
140 } else {
141 AlertDialog.Builder builder = new AlertDialog.Builder(this);
142 DialogInterface.OnClickListener networkSettingsClickListener =
143 new Dialog.OnClickListener() {
144 @Override
145 public void onClick(DialogInterface dialog, int which) {
146 startActivity(new Intent(mPhone.getContext(),
147 com.android.phone.MobileNetworkSettings.class));
148 }
149 };
150 builder.setMessage(getResources().getString(
151 R.string.enable_video_calling_dialog_msg))
152 .setNeutralButton(getResources().getString(
153 R.string.enable_video_calling_dialog_settings),
154 networkSettingsClickListener)
155 .setPositiveButton(android.R.string.ok, null)
156 .show();
157 return false;
158 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700159 }
Andrew Lee4ddb9bb2014-11-05 15:03:20 -0800160
161 // Always let the preference setting proceed.
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700162 return true;
163 }
164
165 @Override
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700166 protected void onCreate(Bundle icicle) {
167 super.onCreate(icicle);
Andrew Lee4ddb9bb2014-11-05 15:03:20 -0800168 if (DBG) log("onCreate: Intent is " + getIntent());
169
Jay Shraunerc2684732014-11-12 12:10:37 -0800170 // Make sure we are running as the primary user.
171 if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
172 Toast.makeText(this, R.string.call_settings_primary_user_only,
173 Toast.LENGTH_SHORT).show();
174 finish();
175 return;
176 }
177
Andrew Leedd4f6df2014-12-09 19:13:51 -0800178 mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
Andrew Lee5ed870c2014-10-29 11:47:49 -0700179 mSubscriptionInfoHelper.setActionBarTitle(
180 getActionBar(), getResources(), R.string.call_settings_with_label);
Andrew Lee1479dd12014-11-06 23:06:32 -0800181 mPhone = mSubscriptionInfoHelper.getPhone();
Tyler Gunnbaee2952014-09-10 16:01:02 -0700182 }
183
Tyler Gunnbaee2952014-09-10 16:01:02 -0700184 @Override
185 protected void onResume() {
186 super.onResume();
Tyler Gunnbaee2952014-09-10 16:01:02 -0700187
188 PreferenceScreen preferenceScreen = getPreferenceScreen();
189 if (preferenceScreen != null) {
190 preferenceScreen.removeAll();
191 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700192
193 addPreferencesFromResource(R.xml.call_feature_setting);
Andrew Lee5ed870c2014-10-29 11:47:49 -0700194
Andrew Lee6fee2cb2014-12-09 16:42:18 -0800195 TelecomManager telecomManager = TelecomManager.from(this);
196 TelephonyManager telephonyManager =
197 (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
198
199 Preference phoneAccountSettingsPreference = findPreference(PHONE_ACCOUNT_SETTINGS_KEY);
200 if (telephonyManager.isMultiSimEnabled() || (telecomManager.getSimCallManagers().isEmpty()
201 && !SipUtil.isVoipSupported(mPhone.getContext()))) {
202 getPreferenceScreen().removePreference(phoneAccountSettingsPreference);
203 }
Andrew Leedb2fe562014-09-03 15:40:43 -0700204
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700205 PreferenceScreen prefSet = getPreferenceScreen();
Andrew Lee2c027892014-10-29 11:29:54 -0700206 mVoicemailSettingsScreen =
207 (PreferenceScreen) findPreference(VOICEMAIL_SETTING_SCREEN_PREF_KEY);
Andrew Leebf07f762015-04-07 19:05:50 -0700208 mVoicemailSettingsScreen.setIntent(mSubscriptionInfoHelper.getIntent(
209 VoicemailSettingsActivity.class));
Andrew Lee8d66d812014-11-24 14:54:02 -0800210
Andrew Leebf07f762015-04-07 19:05:50 -0700211 mButtonAutoRetry = (CheckBoxPreference) findPreference(BUTTON_RETRY_KEY);
Andrew Lee64e5c9d2014-11-26 12:00:10 -0800212
213 mEnableVideoCalling = (CheckBoxPreference) findPreference(ENABLE_VIDEO_CALLING_KEY);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700214
Jonathan Basseric31f1f32015-05-12 10:13:03 -0700215 PersistableBundle carrierConfig =
216 PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
Jonathan Basseri4b40ff42015-04-30 21:54:10 -0700217
Jonathan Basseri9504c6b2015-06-04 14:23:32 -0700218 if (carrierConfig.getBoolean(CarrierConfigManager.KEY_AUTO_RETRY_ENABLED_BOOL)) {
Andrew Lee64a7d792014-10-15 17:38:38 -0700219 mButtonAutoRetry.setOnPreferenceChangeListener(this);
220 int autoretry = Settings.Global.getInt(
221 getContentResolver(), Settings.Global.CALL_AUTO_RETRY, 0);
222 mButtonAutoRetry.setChecked(autoretry != 0);
223 } else {
224 prefSet.removePreference(mButtonAutoRetry);
225 mButtonAutoRetry = null;
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700226 }
227
Sanket Padawee09a6f62015-03-05 11:59:39 -0800228 Preference cdmaOptions = prefSet.findPreference(BUTTON_CDMA_OPTIONS);
229 Preference gsmOptions = prefSet.findPreference(BUTTON_GSM_UMTS_OPTIONS);
Jonathan Basseri9504c6b2015-06-04 14:23:32 -0700230 if (carrierConfig.getBoolean(CarrierConfigManager.KEY_WORLD_PHONE_BOOL)) {
Sanket Padawee09a6f62015-03-05 11:59:39 -0800231 cdmaOptions.setIntent(mSubscriptionInfoHelper.getIntent(CdmaCallOptions.class));
232 gsmOptions.setIntent(mSubscriptionInfoHelper.getIntent(GsmUmtsCallOptions.class));
233 } else {
Andrew Lee2b36ba22014-11-05 17:08:49 -0800234 prefSet.removePreference(cdmaOptions);
Andrew Lee2b36ba22014-11-05 17:08:49 -0800235 prefSet.removePreference(gsmOptions);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700236
237 int phoneType = mPhone.getPhoneType();
Andrew Lee5ed870c2014-10-29 11:47:49 -0700238 Preference fdnButton = prefSet.findPreference(BUTTON_FDN_KEY);
Junda Liua9ba9d42015-06-01 01:26:52 -0700239 if (carrierConfig.getBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)) {
Andrew Lee5ed870c2014-10-29 11:47:49 -0700240 prefSet.removePreference(fdnButton);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700241 } else {
Junda Liua09d6962014-11-12 13:39:02 -0800242 if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
243 prefSet.removePreference(fdnButton);
244
Jonathan Basseri9504c6b2015-06-04 14:23:32 -0700245 if (!carrierConfig.getBoolean(
Jonathan Basseri38c58552015-06-09 15:14:06 -0700246 CarrierConfigManager.KEY_VOICE_PRIVACY_DISABLE_UI_BOOL)) {
Junda Liua09d6962014-11-12 13:39:02 -0800247 addPreferencesFromResource(R.xml.cdma_call_privacy);
248 }
249 } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
Andrew Leedd4f6df2014-12-09 19:13:51 -0800250 fdnButton.setIntent(mSubscriptionInfoHelper.getIntent(FdnSetting.class));
Junda Liua09d6962014-11-12 13:39:02 -0800251
Jonathan Basseri9504c6b2015-06-04 14:23:32 -0700252 if (carrierConfig.getBoolean(
253 CarrierConfigManager.KEY_ADDITIONAL_CALL_SETTING_BOOL)) {
Junda Liua09d6962014-11-12 13:39:02 -0800254 addPreferencesFromResource(R.xml.gsm_umts_call_options);
Sanket Padawee09a6f62015-03-05 11:59:39 -0800255 GsmUmtsCallOptions.init(prefSet, mSubscriptionInfoHelper);
Junda Liua09d6962014-11-12 13:39:02 -0800256 }
257 } else {
258 throw new IllegalStateException("Unexpected phone type: " + phoneType);
259 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700260 }
261 }
262
Andrew Lee312e8172014-10-23 17:01:36 -0700263 if (ImsManager.isVtEnabledByPlatform(mPhone.getContext()) && ENABLE_VT_FLAG) {
264 boolean currentValue =
265 ImsManager.isEnhanced4gLteModeSettingEnabledByUser(mPhone.getContext())
Svet Ganovb320e182015-04-16 12:30:10 -0700266 ? PhoneGlobals.getInstance().phoneMgr.isVideoCallingEnabled(
267 getOpPackageName()) : false;
Andrew Lee312e8172014-10-23 17:01:36 -0700268 mEnableVideoCalling.setChecked(currentValue);
Andrew Lee77527ac2014-10-21 16:57:39 -0700269 mEnableVideoCalling.setOnPreferenceChangeListener(this);
270 } else {
271 prefSet.removePreference(mEnableVideoCalling);
272 }
Etan Cohena51d4ef2014-12-15 10:44:42 -0800273
274 if (ImsManager.isVolteEnabledByPlatform(this) &&
275 !mPhone.getContext().getResources().getBoolean(
276 com.android.internal.R.bool.config_carrier_volte_tty_supported)) {
277 TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
Vinit Deshpande84cccac2015-03-16 00:08:19 -0700278 /* tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); */
Etan Cohena51d4ef2014-12-15 10:44:42 -0800279 }
Andrew Leeb97fad82015-01-27 15:31:39 -0800280
Andrew Leeeffef9c2015-02-19 16:02:37 -0800281 Preference wifiCallingSettings = findPreference(
282 getResources().getString(R.string.wifi_calling_settings_key));
Andrew Leeb97fad82015-01-27 15:31:39 -0800283 if (!ImsManager.isWfcEnabledByPlatform(mPhone.getContext())) {
Andrew Leeb97fad82015-01-27 15:31:39 -0800284 prefSet.removePreference(wifiCallingSettings);
Andrew Leeeffef9c2015-02-19 16:02:37 -0800285 } else {
Pavel Zhamaitsiakecae65a2015-03-23 14:45:34 -0700286 int resId = com.android.internal.R.string.wifi_calling_off_summary;
Andrew Leeeffef9c2015-02-19 16:02:37 -0800287 if (ImsManager.isWfcEnabledByUser(mPhone.getContext())) {
288 int wfcMode = ImsManager.getWfcMode(mPhone.getContext());
289 switch (wfcMode) {
290 case ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY:
Pavel Zhamaitsiakecae65a2015-03-23 14:45:34 -0700291 resId = com.android.internal.R.string.wfc_mode_wifi_only_summary;
Andrew Leeeffef9c2015-02-19 16:02:37 -0800292 break;
293 case ImsConfig.WfcModeFeatureValueConstants.CELLULAR_PREFERRED:
Pavel Zhamaitsiakecae65a2015-03-23 14:45:34 -0700294 resId = com.android.internal.R.string.wfc_mode_cellular_preferred_summary;
Andrew Leeeffef9c2015-02-19 16:02:37 -0800295 break;
296 case ImsConfig.WfcModeFeatureValueConstants.WIFI_PREFERRED:
Pavel Zhamaitsiakecae65a2015-03-23 14:45:34 -0700297 resId = com.android.internal.R.string.wfc_mode_wifi_preferred_summary;
Andrew Leeeffef9c2015-02-19 16:02:37 -0800298 break;
299 default:
300 if (DBG) log("Unexpected WFC mode value: " + wfcMode);
301 }
302 }
303 wifiCallingSettings.setSummary(resId);
Andrew Leeb97fad82015-01-27 15:31:39 -0800304 }
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700305 }
306
Andrew Lee785ca2a2014-12-18 12:46:41 -0800307 @Override
308 protected void onNewIntent(Intent newIntent) {
309 setIntent(newIntent);
310
311 mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
312 mSubscriptionInfoHelper.setActionBarTitle(
313 getActionBar(), getResources(), R.string.call_settings_with_label);
314 mPhone = mSubscriptionInfoHelper.getPhone();
315 }
316
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700317 private static void log(String msg) {
318 Log.d(LOG_TAG, msg);
319 }
320
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700321 @Override
322 public boolean onOptionsItemSelected(MenuItem item) {
323 final int itemId = item.getItemId();
324 if (itemId == android.R.id.home) { // See ActionBar#setDisplayHomeAsUpEnabled()
Yorke Leef2d0cac2013-09-09 19:42:56 -0700325 onBackPressed();
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700326 return true;
327 }
328 return super.onOptionsItemSelected(item);
329 }
Andrew Lee8d66d812014-11-24 14:54:02 -0800330
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700331 /**
332 * Finish current Activity and go up to the top level Settings ({@link CallFeaturesSetting}).
333 * This is useful for implementing "HomeAsUp" capability for second-level Settings.
334 */
Andrew Lee5efb1122014-12-05 04:20:42 -0800335 public static void goUpToTopLevelSetting(
Andrew Leedd4f6df2014-12-09 19:13:51 -0800336 Activity activity, SubscriptionInfoHelper subscriptionInfoHelper) {
337 Intent intent = subscriptionInfoHelper.getIntent(CallFeaturesSetting.class);
Santos Cordon7d4ddf62013-07-10 11:58:08 -0700338 intent.setAction(Intent.ACTION_MAIN);
339 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
340 activity.startActivity(intent);
341 activity.finish();
342 }
343}